protected void processFacet(XSDFacet facet, Node node, String propertyName, int propertyType) throws RepositoryException { if (facet == null) { return; } String lexicalValue = facet.getLexicalValue(); if (lexicalValue != null) { int actualPropertyType = determineJCRPropertyTypeForFacet(lexicalValue, propertyType); Value value = context.valueFactory().createValue(facet.getLexicalValue(), actualPropertyType); node.setProperty(propertyName, value); } else if (facet instanceof XSDRepeatableFacet) { Set<String> values = getRepeatableFacetValues((XSDRepeatableFacet) facet); if (!values.isEmpty()) { node.setProperty(propertyName, values.toArray(new String[values.size()])); } } }
protected <Facet extends XSDFacet> void processFacetsList( List<Facet> facets, Node node, String propertyName) throws RepositoryException { if (facets == null) { return; } Set<String> values = new HashSet<String>(); for (XSDFacet facet : facets) { String lexicalValue = facet.getLexicalValue(); if (lexicalValue != null) { values.add(facet.getLexicalValue()); } else if (facet instanceof XSDRepeatableFacet) { values.addAll(getRepeatableFacetValues((XSDRepeatableFacet) facet)); } } if (!values.isEmpty()) { node.setProperty(propertyName, values.toArray(new String[values.size()])); } }