org.nuxeo.ecm.core.api.model.Property.getSchema()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(105)

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

Property.getSchema介绍

[英]Gets the document schema defining the property tree from which the property belongs.
[中]获取定义属性所属的属性树的文档架构。

代码示例

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

/**
 * Gets the full xpath for a property, including schema prefix in all cases.
 *
 * @since 9.3
 */
protected String getFullXPath(Property property) {
  String xpath = property.getXPath();
  if (xpath.indexOf(':') < 0) {
    // add schema name as prefix
    xpath = property.getSchema().getName() + ':' + xpath;
  }
  return xpath;
}

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

@Override
public DocumentValidationReport validate(Property property, boolean validateSubProperties) {
  List<PathNode> path = new ArrayList<>();
  Property inspect = property;
  while (inspect != null && !(inspect instanceof DocumentPart)) {
    path.add(0, new PathNode(inspect.getField()));
    inspect = inspect.getParent();
  }
  return new DocumentValidationReport(
      validateAnyTypeProperty(property.getSchema(), path, property, false, validateSubProperties));
}

代码示例来源: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.automation/nuxeo-automation-core

/**
 * Gets the full URL of where a blob can be downloaded.
 *
 * @since 5.9.3
 */
private static String getBlobUrl(Property prop, String filesBaseUrl) throws PropertyException {
  StringBuilder blobUrlBuilder = new StringBuilder(filesBaseUrl);
  String xpath = prop.getXPath();
  if (!xpath.contains(":")) {
    // if no prefix, use schema name as prefix:
    xpath = prop.getSchema().getName() + ":" + xpath;
  }
  blobUrlBuilder.append(xpath);
  blobUrlBuilder.append("/");
  String filename = ((Blob) prop.getValue()).getFilename();
  if (filename != null) {
    blobUrlBuilder.append(URIUtils.quoteURIPathComponent(filename, true));
  }
  return blobUrlBuilder.toString();
}

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

/**
 * Gets the full URL of where a blob can be downloaded.
 *
 * @since 7.2
 */
private String getBlobUrl(Property prop) {
  DocumentModel doc = ctx.getParameter(ENTITY_TYPE);
  if (doc == null) {
    return "";
  }
  DownloadService downloadService = Framework.getService(DownloadService.class);
  String xpath = prop.getXPath();
  // if no prefix, use schema name as prefix:
  if (!xpath.contains(":")) {
    xpath = prop.getSchema().getName() + ":" + xpath;
  }
  String filename = ((Blob) prop.getValue()).getFilename();
  return ctx.getBaseUrl() + downloadService.getDownloadUrl(doc, xpath, filename);
}

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

for (Property prop : searchDocumentModel.getPropertyObjects(schema)) {
  if (prop.getValue() != null
      && !SKIPPED_SCHEMAS_FOR_SEARCHFIELD.contains(prop.getSchema().getNamespace().prefix)) {
    if (prop.isList()) {
      if (ArrayUtils.isNotEmpty(prop.getValue(Object[].class))) {

代码示例来源:origin: org.nuxeo.ecm.webengine/nuxeo-webengine-base

Property p = doc.getProperty(xpath);
if (p.isList()) { // add the file to the list
  if ("files".equals(p.getSchema().getName())) { // treat the

相关文章