in src/main/java/org/apache/sling/jcr/contentloader/internal/DefaultContentCreator.java [369:423]
public void createProperty(String name, int propertyType, String[] values) throws RepositoryException {
appliedSet.add(name);
final Node node = this.parentNodeStack.peek();
// check if the property already exists and isPropertyOverwrite() is false,
// don't overwrite it in this case
if (node.hasProperty(name) && !this.configuration.isPropertyOverwrite() && !node.getProperty(name).isNew()) {
return;
}
if (propertyType == PropertyType.REFERENCE) {
String propPath = node.getPath() + "/" + name; // NOSONAR
boolean hasAll = true;
String[] uuids = new String[values.length];
String[] uuidOrPaths = new String[values.length];
for (int i = 0; i < values.length; i++) {
uuids[i] = getUUID(node.getSession(), propPath, getAbsPath(node, values[i]));
uuidOrPaths[i] = uuids[i] != null ? uuids[i] : getAbsPath(node, values[i]);
if (uuids[i] == null)
hasAll = false;
}
checkoutIfNecessary(node);
node.setProperty(name, uuids, propertyType);
if (this.importListener != null) {
this.importListener.onCreate(node.getProperty(name).getPath());
}
if (!hasAll) {
delayedMultipleReferences.put(propPath, uuidOrPaths);
}
} else if (propertyType == PropertyType.DATE) {
checkoutIfNecessary(node);
// This modification is to remove the colon in the JSON Timezone
ValueFactory valueFactory = node.getSession().getValueFactory();
Value[] jcrValues = new Value[values.length];
for (int i = 0; i < values.length; i++) {
jcrValues[i] = valueFactory.createValue(ISO8601.parse(values[i]));
}
node.setProperty(name, jcrValues, propertyType);
if (this.importListener != null) {
this.importListener.onCreate(node.getProperty(name).getPath());
}
} else {
checkoutIfNecessary(node);
if (propertyType == PropertyType.UNDEFINED) {
node.setProperty(name, values);
} else {
node.setProperty(name, values, propertyType);
}
if (this.importListener != null) {
this.importListener.onCreate(node.getProperty(name).getPath());
}
}
}