org.nuxeo.ecm.core.schema.types.Field.getName()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中org.nuxeo.ecm.core.schema.types.Field.getName()方法的一些代码示例,展示了Field.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Field.getName()方法的具体详情如下:
包路径:org.nuxeo.ecm.core.schema.types.Field
类名称:Field
方法名:getName

Field.getName介绍

[英]Gets the field name.
[中]获取字段名。

代码示例

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api

@Override
public String toString() {
  if (listItem) {
    return field.getName().getPrefixedName();
  } else {
    return field.getName().getPrefixedName() + "[" + index + "]";
  }
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api

@Override
public String getName() {
  return field.getName().getPrefixedName();
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api

@Override
public String getName() {
  return field.getName().getPrefixedName();
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api

@Override
public String getName() {
  return field.getName().getPrefixedName();
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api

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;
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api

protected String getName(Property property) {
  QName name = property.getField().getName();
  return prefixed ? name.getPrefixedName() : name.getLocalName();
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api

pathTokens.add(schema.getName());
for (PathNode node : path) {
  String name = node.getField().getName().getLocalName();
  pathTokens.add(name);

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api

/**
 * 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;
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api

int index = Integer.parseInt(xpathToken);
  path.add(new PathNode(field, index));
} else if (xpathToken.equals(itemField.getName().getLocalName())) {

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api

/**
 * 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;
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api

@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);
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api

String pp = p.getField().getName().getPrefixedName();
findStrings(p, path + '/' + pp);

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api

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;
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api

protected boolean compatibleTypes(Type targetType, Type sourceType) {
    if (!sourceType.getName().equals(targetType.getName())) {
      return false;
    }
    if (sourceType.isComplexType()) {
      for (Field field : ((ComplexType) sourceType).getFields()) {
        Field targetField = ((ComplexType) targetType).getField(field.getName());
        if (targetField == null || !field.getType().equals(targetField.getType())) {
          return false;
        }
      }
    }
    if (sourceType.isListType()) {
      if (!((ListType) sourceType).getFieldType().equals(((ListType) targetType).getFieldType())) {
        return false;
      }
      if (((ListType) sourceType).getFieldType().isComplexType()) {
        return compatibleTypes(((ListType) targetType).getFieldType(), ((ListType) sourceType).getFieldType());
      }
    }
    return true;
  }
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api

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) {

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-schema

protected void addField(Field field) {
  QName name = field.getName();
  fields.put(name, field);
  fieldsByName.put(name.getLocalName(), field);
  fieldsByName.put(name.getPrefixedName(), field);
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-directory-mongodb

protected String getPrefixedIdField() {
  Field idField = directory.getSchemaFieldMap().get(getIdField());
  if (idField == null) {
    return null;
  }
  return idField.getName().getPrefixedName();
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-directory-api

@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);
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-storage

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);
  }
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-directory-mongodb

@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);
}

相关文章

微信公众号

最新文章

更多