* @throws ValueFormatException
*/
private ImportPropertyData endProperty() throws PathNotFoundException, RepositoryException, NoSuchNodeTypeException,
IllegalPathException, ValueFormatException
{
ImportPropertyData propertyData = null;
if (Constants.JCR_PRIMARYTYPE.equals(propertyInfo.getName()))
{
propertyData = endPrimaryType();
}
else if (Constants.JCR_MIXINTYPES.equals(propertyInfo.getName()))
{
propertyData = endMixinTypes();
}
else if (Constants.JCR_UUID.equals(propertyInfo.getName()))
{
propertyData = endUuid();
// skip verionable properties
}
else if (!getParent().getQPath().isDescendantOf(Constants.JCR_VERSION_STORAGE_PATH)
&& (Constants.JCR_VERSIONHISTORY.equals(propertyInfo.getName())
|| Constants.JCR_BASEVERSION.equals(propertyInfo.getName()) || Constants.JCR_PREDECESSORS
.equals(propertyInfo.getName())))
{
propertyData = null;
endVersionable((ImportNodeData)getParent(), parseValues());
}
else
{
ImportNodeData currentNodeInfo = (ImportNodeData)getParent();
List<ValueData> values = parseValues();
// determinating is property multivalue;
boolean isMultivalue = true;
PropertyDefinitionDatas defs =
nodeTypeDataManager.getPropertyDefinitions(propertyInfo.getName(), currentNodeInfo.getPrimaryTypeName(),
currentNodeInfo.getMixinTypeNames());
if (defs == null)
{
if (!((Boolean)context.get(ContentImporter.RESPECT_PROPERTY_DEFINITIONS_CONSTRAINTS)))
{
log.warn("Property definition not found for " + propertyInfo.getName());
return null;
}
else
throw new RepositoryException("Property definition not found for " + propertyInfo.getName());
}
if (values.size() == 1)
{
// there is single-value defeniton
if (defs.getDefinition(false) != null)
{
isMultivalue = false;
}
}
else
{
if ((defs.getDefinition(true) == null) && (defs.getDefinition(false) != null))
{
throw new ValueFormatException("Can not assign multiple-values " + "Value to a single-valued property "
+ propertyInfo.getName().getName());
}
}
log.debug("Import " + propertyInfo.getName().getName() + " size=" + propertyInfo.getValuesSize()
+ " isMultivalue=" + isMultivalue);
propertyData =
new ImportPropertyData(QPath.makeChildPath(currentNodeInfo.getQPath(), propertyInfo.getName()),
propertyInfo.getIndentifer(), -1, propertyInfo.getType(), currentNodeInfo.getIdentifier(), isMultivalue);
propertyData.setValues(values);
}
return propertyData;
}