pathTokens.add(schema.getName()); for (PathNode node : path) { String name = node.getField().getName().getLocalName(); pathTokens.add(name);
@Override public String toString() { if (listItem) { return field.getName().getPrefixedName(); } else { return field.getName().getPrefixedName() + "[" + index + "]"; } }
protected String getName(Property property) { QName name = property.getField().getName(); return prefixed ? name.getPrefixedName() : name.getLocalName(); }
field = fields.get(xpath); if (field == null) { QName qname = QName.valueOf(xpath); String prefix = qname.getPrefix(); Schema schema = getSchemaFromPrefix(prefix); if (schema == null) { field = schema.getField(qname.getLocalName()); if (field != null) {
/** * Create a schema from a ComplexType * * @since 5.7 * @param complexType * @param name * @param ns */ public SchemaImpl(ComplexType complexType, String name, Namespace ns, boolean isVersionWritabe) { super(null, SchemaNames.SCHEMAS, name, ns); this.isVersionWritabe = isVersionWritabe; if (complexType != null) { for (Field field : complexType.getFields()) { QName fieldname = QName.valueOf(field.getName().getLocalName(), ns.prefix); Type type = field.getType(); String defaultValue = type.encode(field.getDefaultValue()); Set<Constraint> constraint = field.getConstraints(); FieldImpl newField = new FieldImpl(fieldname, this, type, defaultValue, 0, constraint); newField.setConstant(field.isConstant()); addField(newField); } } }
private void addFieldFragment(Field field, String fragmentName) { String fieldName = field.getName().toString(); fieldFragment.put(fieldName, fragmentName); }
/** * Parses the given name and create the corresponding QName. * <p> * If the given name is not prefixed then the given prefix will be used. * * @param name * @param prefix * @return */ public static QName valueOf(String name, String prefix) { int p = name.indexOf(':'); if (p > -1) { return new QName(name.substring(p + 1), name.substring(0, p)); } else { return new QName(name, prefix); } }
protected void addField(Field field) { QName name = field.getName(); fields.put(name, field); fieldsByName.put(name.getLocalName(), field); fieldsByName.put(name.getPrefixedName(), field); }
prop = PropertyFactory.createProperty(part, t.getField(), Property.NONE); log.debug(String.format("Writing %s for field %s resolved to %s", fieldName, field.getName().toString(), prop.getName())); prop.setValue(bucket.getKey());
@Override public String getName() { return field.getName().getPrefixedName(); }
/** * Validates sub fields for given complex field. * * @since 7.1 */ @SuppressWarnings("unchecked") private List<ConstraintViolation> validateComplexTypeField(Schema schema, List<PathNode> path, Field field, Object value) { assert field.getType().isComplexType(); List<ConstraintViolation> violations = new ArrayList<>(); ComplexType complexType = (ComplexType) field.getType(); // this code does not support other type than Map as value if (!(value instanceof Map)) { return violations; } Map<String, Object> map = (Map<String, Object>) value; for (Field child : complexType.getFields()) { Object item = map.get(child.getName().getLocalName()); List<PathNode> subPath = new ArrayList<>(path); subPath.add(new PathNode(child)); violations.addAll(validateAnyTypeField(schema, subPath, child, item, true)); } return violations; }
for (Field field : schema.getFields()) { QName fieldName = field.getName(); String key = fieldName.getLocalName(); Serializable value = result.getPropertyValue(fieldName.getPrefixedName()); if (label.equals(key)) { if (localize && !dbl10n) {
@Override public String getName() { return field.getName().getPrefixedName(); }
int index = Integer.parseInt(xpathToken); path.add(new PathNode(field, index)); } else if (xpathToken.equals(itemField.getName().getLocalName())) {
protected void writeUserProfile(JsonGenerator jg, DocumentModel up) throws IOException { Writer<Property> propertyWriter = registry.getWriter(ctx, Property.class, APPLICATION_JSON_TYPE); Schema schema = schemaManager.getSchema(USER_PROFILE_SCHEMA); // provides the user profile document to the property marshaller try (Closeable resource = ctx.wrap().with(ENTITY_TYPE, up).open()) { for (Field field : schema.getFields()) { jg.writeFieldName(field.getName().getLocalName()); Property property = up.getProperty(field.getName().getPrefixedName()); OutputStream out = new OutputStreamWithJsonWriter(jg); propertyWriter.write(property, Property.class, Property.class, APPLICATION_JSON_TYPE, out); } } } }
@Override public String getName() { return field.getName().getPrefixedName(); }
public static DataModel cloneDataModel(Schema schema, DataModel data) { DataModel dm = new DataModelImpl(schema.getName()); for (Field field : schema.getFields()) { String key = field.getName().getLocalName(); Object value; try { value = data.getData(key); } catch (PropertyException e1) { continue; } if (value == null) { continue; } Object clone = cloneField(field, key, value); dm.setData(key, clone); } return dm; }
String propertyName = field.getName().getPrefixedName(); complexChildren.put(propertyName, fieldType.getName()); initComplexTypeModel((ComplexType) fieldType); } else { String propertyName = field.getName().getPrefixedName(); FieldDescriptor fieldDescriptor = null; for (FieldDescriptor fd : repositoryDescriptor.schemaFields) { String fragmentKey = field.getName().getLocalName(); addPropertyInfo(complexType, propertyName, propertyType, fragmentName, fragmentKey, false, null, columnType); String fragmentKey = field.getName().getLocalName(); PropertyType propertyType = PropertyType.fromFieldType(fieldType, false); ColumnType type = ColumnType.fromField(field);
public final Property getNonPhantomChild(Field field) { String name = field.getName().getPrefixedName(); Property property = children.get(name); if (property == null) { property = internalGetChild(field); if (property == null) { return null; } children.put(name, property); } return property; }
@Override public String getFieldName() { return field.getName().getLocalName(); }