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

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

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

Property.getChildren介绍

[英]Get a collection over the children properties. This includes all children including phantom ones (those who are not yet set by the user).

The returned collection is ordered for list properties, and unordered for complex properties

Be aware that this method is creating phantom child properties for all schema fields that are not yet set.
[中]收集孩子们的财产。这包括所有子项,包括幻象子项(用户尚未设置的子项)。
对于列表属性,返回的集合是有序的,对于复杂属性,返回的集合是无序的
请注意,此方法正在为所有尚未设置的架构字段创建幻像子属性。

代码示例

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

protected void findBlobsProperties(Property property, List<String> split, List<Property> properties) {
  if (split.isEmpty()) {
    if (property.getValue() != null) {
      properties.add(property);
    }
  } else {
    for (Property childProperty : property.getChildren()) {
      Property childSubProp = childProperty.get(split.get(0));
      List<String> subPath = split.subList(1, split.size());
      findBlobsProperties(childSubProp, subPath, properties);
    }
  }
}

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

List<ConstraintViolation> violations = new ArrayList<>();
boolean allChildrenPhantom = true;
for (Property child : prop.getChildren()) {
  if (!child.isPhantom()) {
    allChildrenPhantom = false;
      for (Property child : prop.getChildren()) {
        List<PathNode> subPath = new ArrayList<>(path);
        subPath.add(new PathNode(child.getField()));

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

Collection<Property> children = prop.getChildren();
if (!field.isNillable() && children.isEmpty()) {
  addNotNullViolation(violations, schema, path);

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

protected void writeComplexProperty(JsonGenerator jg, Property prop) throws IOException {
  jg.writeStartObject();
  for (Property p : prop.getChildren()) {
    jg.writeFieldName(p.getName());
    writeProperty(jg, p);
  }
  jg.writeEndObject();
}

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

@Override
public List<Blob> getBlobs() {
  List<Blob> blobList = new ArrayList<>();
  Blob mainBlob = getBlob();
  if (mainBlob != null) {
    blobList.add(getBlob());
  }
  Collection<Property> views = doc.getProperty("picture:views").getChildren();
  for (Property property : views) {
    blobList.add((Blob) property.getValue("content"));
  }
  return blobList;
}

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

@Override
public TemplateCollectionModel keys() throws TemplateModelException {
  List<String> list = new ArrayList<String>(property.size());
  for (Property p : property.getChildren()) {
    list.add(p.getName());
  }
  return new CollectionAndSequence(new SimpleSequence(list, wrapper));
}

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

@Override
protected List<Node> updateList(Node node, String name, Property property) throws PropertyException {
  Collection<Property> properties = property.getChildren();
  List<Node> childNodes = getChildAsList(node, name);
  int oldSize = childNodes.size();
  int newSize = properties.size();
  // remove extra list elements
  if (oldSize > newSize) {
    for (int i = oldSize - 1; i >= newSize; i--) {
      session.removeProperty(childNodes.remove(i));
    }
  }
  // add new list elements
  if (oldSize < newSize) {
    String typeName = ((ListType) property.getType()).getFieldType().getName();
    for (int i = oldSize; i < newSize; i++) {
      Node childNode = session.addChildProperty(node, name, Long.valueOf(i), typeName);
      childNodes.add(childNode);
    }
  }
  return childNodes;
}

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

protected void writeListProperty(JsonGenerator jg, Property prop, PropertyConsumer fieldNameWriter)
    throws PropertyException, IOException {
  // test if array/list is empty - don't write empty case
  if (!writeEmpty && (prop == null || (prop instanceof ArrayProperty && prop.getValue() == null)
      || (prop instanceof ListProperty && prop.getChildren().isEmpty()))) {
    return;
  }
  fieldNameWriter.accept(jg, prop);
  jg.writeStartArray();
  if (prop instanceof ArrayProperty) {
    Object[] ar = (Object[]) prop.getValue();
    if (ar == null) {
      jg.writeEndArray();
      return;
    }
    Type type = ((ListType) prop.getType()).getFieldType();
    for (Object o : ar) {
      jg.writeString(type.encode(o));
    }
  } else {
    for (Property p : prop.getChildren()) {
      // it's a list of complex object, don't write field names
      writeProperty(jg, p, PropertyConsumer.nothing());
    }
  }
  jg.writeEndArray();
}

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

@Override
public TemplateCollectionModel values() throws TemplateModelException {
  try {
    List<Object> list = new ArrayList<Object>(property.size());
    for (Property p : property.getChildren()) {
      Object value = p.getValue();
      list.add(value == null ? "" : value);
    }
    return new CollectionAndSequence(new SimpleSequence(list, wrapper));
  } catch (PropertyException e) {
    throw new TemplateModelException("Failed to adapt complex property values", e);
  }
}

代码示例来源:origin: toutatice-services.carto-nat/toutatice-carto-nat-ecm

@OperationMethod
public DocumentModel run(DocumentModel input) throws Exception {
  String value = null;
  Property ppt = input.getProperty(xpath);
  Collection<Property> childrenPpt = ppt.getChildren();
  if (childrenPpt.isEmpty()) {
    value = ppt.getValue(String.class);
  } else {
    if (index != null) {
      Property child = (Property) childrenPpt.toArray()[index];
      value = child.getValue(String.class, pptyId);
    } else {
      for (Property child : childrenPpt) {
        Serializable pptyval = child.getValue(criterion);
        
        if (pptyval!=null && (pptyval.toString()).equals(filterValue)) {
          value = child.getValue(String.class, pptyId);
          break;
        }
      }
    }
  }
  ctx.put(key, value);
  return input;
}

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

@Override
public Blob getPictureFromTitle(String title) throws PropertyException {
  if (title == null) {
    return null;
  }
  Collection<Property> views = doc.getProperty(VIEWS_PROPERTY).getChildren();
  for (Property property : views) {
    if (title.equals(property.getValue(TITLE_PROPERTY))) {
      Blob blob = (Blob) property.getValue("content");
      if (blob != null) {
        blob.setFilename((String) property.getValue(FILENAME_PROPERTY));
      }
      return blob;
    }
  }
  return null;
}

代码示例来源:origin: toutatice-services.carto-nat/toutatice-carto-nat-ecm

@OperationMethod
public DocumentModel run(DocumentModel input) throws Exception {
  
  if(input.isProxy()){
    input = session.getWorkingCopy(input.getRef());
  }
  Property ppt = input.getProperty(xpath);
  Collection<Property> childrenPpt = ppt.getChildren();
  if (!childrenPpt.isEmpty()) {
    for (Property child : childrenPpt) {
      Serializable pptyval = child.getValue(criterion);
      if (pptyval != null && (pptyval.toString()).equals(filterValue)) {					
        child.remove();
        break;
      }
    }
  }
  if (save) {
    input = session.saveDocument(input);
  }
  return input;
}

代码示例来源:origin: toutatice-services.carto-nat/toutatice-carto-nat-ecm

if (unumPart != null) {
  Collection<Property> referentsProps = unumPart.get(DenormalizationConstants.REF_REFERENTS).getChildren();
      Collection<Property> childrenProps = prop.getChildren();
      if (CollectionUtils.isNotEmpty(childrenProps)) {
        jg.writeStartObject();

代码示例来源:origin: toutatice-services.carto-nat/toutatice-carto-nat-ecm

@OperationMethod(collector=DocumentModelCollector.class)
public DocumentModel run(DocumentModel doc) throws Exception {
  
  Property propertyRoot =  doc.getProperty(xpathRoot);
  Collection<Property> childrenProperties = propertyRoot.getChildren();
  boolean add=true;
  if(key != null){
          
    for (Property property : childrenProperties) {
      if(property.getValue(key).equals(properties.get(key))){
        for (String pptyKey : properties.keySet()) {
          property.setValue(pptyKey, properties.get(pptyKey));
        }
        add=false;
        break;
      }
    }
  }
  if(key==null || add){
    propertyRoot.addValue(properties);
  }
  
  if (save) {
    doc = session.saveDocument(doc);
  }
  return doc;
}

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

for (Property childProperty : property.getChildren()) {
  T childState = childStates.get(i);
  String xpi = xp + '/' + i;

相关文章