@Override public String toString() { if (listItem) { return field.getName().getPrefixedName(); } else { return field.getName().getPrefixedName() + "[" + index + "]"; } }
@Override public String getName() { return field.getName().getPrefixedName(); }
@Override public String getName() { return field.getName().getPrefixedName(); }
@Override public String getName() { return field.getName().getPrefixedName(); }
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; }
protected String getName(Property property) { QName name = property.getField().getName(); return prefixed ? name.getPrefixedName() : name.getLocalName(); }
/** * Finds strings from the document for a given set of included and excluded paths. * <p> * Paths must be specified with a schema prefix in all cases (normalized). * * @param document the document * @param includedPaths the paths to include, or {@code null} for all paths * @param excludedPaths the paths to exclude, or {@code null} for none * @return a list of strings (each string is never {@code null}) */ public List<String> findStrings(DocumentModel document, Set<String> includedPaths, Set<String> excludedPaths) { this.document = document; this.includedPaths = includedPaths; this.excludedPaths = excludedPaths; strings = new ArrayList<>(); for (String schema : document.getSchemas()) { for (Property property : document.getPropertyObjects(schema)) { String path = property.getField().getName().getPrefixedName(); if (!path.contains(":")) { // add schema name as prefix if the schema doesn't have a prefix path = property.getSchema().getName() + ":" + path; } findStrings(property, path); } } return strings; }
@Override public DocumentValidationReport validate(DocumentModel document, boolean dirtyOnly) { List<ConstraintViolation> violations = new ArrayList<>(); DocumentType docType = document.getDocumentType(); if (dirtyOnly) { for (DataModel dataModel : document.getDataModels().values()) { Schema schemaDef = getSchemaManager().getSchema(dataModel.getSchema()); for (String fieldName : dataModel.getDirtyFields()) { Field field = schemaDef.getField(fieldName); Property property = document.getProperty(field.getName().getPrefixedName()); List<PathNode> path = singletonList(new PathNode(property.getField())); violations.addAll(validateAnyTypeProperty(property.getSchema(), path, property, true, true)); } } } else { for (Schema schema : docType.getSchemas()) { for (Field field : schema.getFields()) { Property property = document.getProperty(field.getName().getPrefixedName()); List<PathNode> path = singletonList(new PathNode(property.getField())); violations.addAll(validateAnyTypeProperty(property.getSchema(), path, property, false, true)); } } } return new DocumentValidationReport(violations); }
String pp = p.getField().getName().getPrefixedName(); findStrings(p, path + '/' + pp);
@Override public Field getField(QName name) { // TODO can this be unified with super behavior? return fieldsByName.get(name.getPrefixedName()); }
protected void findBlobPaths(ComplexType complexType, String path, Schema schema, List<String> paths) { for (Field field : complexType.getFields()) { String fieldPath = field.getName().getPrefixedName(); if (path == null) {
protected void addField(Field field) { QName name = field.getName(); fields.put(name, field); fieldsByName.put(name.getLocalName(), field); fieldsByName.put(name.getPrefixedName(), field); }
protected String getPrefixedIdField() { Field idField = directory.getSchemaFieldMap().get(getIdField()); if (idField == null) { return null; } return idField.getName().getPrefixedName(); }
protected void addField(Document bson, String key, Object value) { String keyFieldName = key; Field field = directory.getSchemaFieldMap().get(key); if (field != null) { keyFieldName = field.getName().getPrefixedName(); } bson.put(keyFieldName, value); }
protected String getPrefixedPasswordField() { Field passwordField = directory.getSchemaFieldMap().get(getPasswordField()); if (passwordField == null) { return null; } return passwordField.getName().getPrefixedName(); }
@Override public DocumentModel getEntryFromSource(String id, boolean fetchReferences) { String idFieldName = directory.getSchemaFieldMap().get(getIdField()).getName().getPrefixedName(); DocumentModelList result = query(Collections.singletonMap(idFieldName, id), Collections.emptySet(), Collections.emptyMap(), true); return result.isEmpty() ? null : result.get(0); }
protected Object getValueComplex(T state, ComplexType complexType) throws PropertyException { if (TypeConstants.isContentType(complexType)) { return getValueBlob(state); } Map<String, Object> map = new HashMap<>(); for (Field field : complexType.getFields()) { String name = field.getName().getPrefixedName(); Object value = getValueField(state, field); map.put(name, value); } return map; }
protected void walkComplexType(ComplexType complexType, String path, String addPrefix) { for (Field field : complexType.getFields()) { String name = field.getName().getPrefixedName(); String fieldPath = path == null ? name : path + '/' + name; walkType(field.getType(), fieldPath, addPrefix); } }
@Override protected FieldInfo walkReference(String name) { Field field = directory.getSchemaFieldMap().get(name); if (field == null) { throw new QueryParseException("No column: " + name + " for directory: " + getDirectory().getName()); } String key = field.getName().getPrefixedName(); String queryField = stripElemMatchPrefix(key); return new FieldInfo(name, queryField, key, field.getType(), false); }
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); } } } }