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

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

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

Property.addValue介绍

[英]Inserts at the given position a new value to the list. A new property will be created to store the given value and appended to the children list.

The created property will be marked as Property#isNew().
[中]在给定位置向列表中插入一个新值。将创建一个新属性来存储给定的值,并将其附加到子列表中。
创建的属性将被标记为属性#isNew()。

代码示例

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

private void fillListProperty(Property property, JsonNode jn) throws IOException {
  ListType listType = (ListType) property.getType();
  if (property instanceof ArrayProperty) {
    fillScalarProperty(property, jn);
  } else {
    JsonNode elNode;
    Iterator<JsonNode> it = jn.elements();
    while (it.hasNext()) {
      elNode = it.next();
      Property child = readProperty(property, listType.getField(), elNode);
      property.addValue(child.getValue());
    }
  }
}

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

/**
 * Given a document property, updates its value with the given blob. The property can be a blob list or a blob. If a
 * blob list the blob is appended to the list, if a blob then it will be set as the property value. Both blob list
 * formats are supported: the file list (blob holder list) and simple blob list.
 */
public static void addBlob(Property p, Blob blob) throws PropertyException {
  if (p.isList()) {
    // detect if a list of simple blobs or a list of files (blob
    // holder)
    Type ft = ((ListProperty) p).getType().getFieldType();
    if (ft.isComplexType() && ((ComplexType) ft).getFieldsCount() == 1) {
      p.addValue(createBlobHolderMap(blob));
    } else {
      p.addValue(blob);
    }
  } else {
    p.setValue(blob);
  }
}

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

@OperationMethod(collector = DocumentModelCollector.class)
public DocumentModel run(DocumentModel doc) throws OperationException, IOException {
  Property complexProperty = doc.getProperty(xpath);
  ListType listType = (ListType) complexProperty.getField().getType();
  if (!listType.getFieldType().isComplexType()) {
    throw new OperationException("Property type " + listType.getFieldType().getClass().getName()
        + " is not supported by this operation");
  }
  List<Object> newVals = ComplexTypeJSONDecoder.decodeList(listType, complexJsonProperties);
  for (Object newVal : newVals) {
    complexProperty.addValue(newVal);
  }
  doc = session.saveDocument(doc);
  if (save) {
    session.save();
  }
  return doc;
}

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

p.addValue(map);
} else {
  p.addValue(blob);

相关文章