code: public static Resource createResource(ResourceResolver resolver, String path,
                                            Map<String, JsonProperty> propertiesSet,
                                            ValueFactory factory, MappingRules mapping)
              throws RepositoryException {
          // determine the new nodes primary type from the properties
          JsonProperty primaryType = propertiesSet.get(PropertyUtil.PROP_PRIMARY_TYPE);
          Resource resource = ResourceUtil.getOrCreateResource(resolver, path,
                  primaryType != null ? (String) primaryType.value : null);
          if (resource != null) {
              JsonProperty mixinTypes = propertiesSet.get(PropertyUtil.PROP_MIXIN_TYPES);
              if (mixinTypes != null) {
                  // import mixin types property first(!)
                  if (!importJsonProperty(factory, resource, mixinTypes, mapping)) {
                      propertiesSet.remove(PropertyUtil.PROP_MIXIN_TYPES);
                  }
              }
              for (Map.Entry<String, JsonProperty> entry : propertiesSet.entrySet()) {
                  JsonProperty property = entry.getValue();
                  // import all the other properties - not the primary and mixin types
                  if (!PropertyUtil.PROP_PRIMARY_TYPE.equals(property.name)
                          && !PropertyUtil.PROP_MIXIN_TYPES.equals(property.name)) {
                      if (!importJsonProperty(factory, resource, property, mapping)) {
                          entry.setValue(null);
                      }
                  }
              }
          }
          return resource;
      }
docs: Creates the resource parsed from JSON.
  Uses the 'jcr:primaryType' property from the propertySet to determine
  the right primary type for the new node.
  Uses the 'jcr:mixinTypes' property to set up the mixin types of the node
  before the other properties are set (it's important that all main type settings
  are done before the properties are set to avoid constraint violations).
  
  @param resolver
  @param path
  @param propertiesSet
  @param factory
  @param mapping
  @return
  @throws RepositoryException