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

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

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

Property.getValue介绍

[英]Gets the property normalized value.

Normalized values are of the java type that correspond to the field type.
[中]

代码示例

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

@Override
public Object fetch() {
  return resolver.fetch(property.getValue());
}

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

@Override
public <T> T getValue(Class<T> type, String path) throws PropertyException {
  return resolvePath(path).getValue(type);
}

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

@Override
public boolean validate(Object context) {
  return resolver.validate(property.getValue(), context);
}

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

@Override
public boolean validate() {
  return resolver.validate(property.getValue());
}

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

@Override
public <T> T fetch(Class<T> type) {
  return resolver.fetch(type, property.getValue());
}

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

@Override
public Serializable getPropertyValue(String xpath) throws PropertyException {
  return getProperty(xpath).getValue();
}

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

@Override
public Object fetch(Object context) {
  return resolver.fetch(property.getValue(), context);
}

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

/**
 * Gets the blobs of the document.
 *
 * @param doc the document
 * @return the list of blobs
 */
public List<Blob> getBlobs(DocumentModel doc) {
  List<Blob> blobs = new ArrayList<>();
  for (Property property : getBlobsProperties(doc)) {
    blobs.add((Blob) property.getValue());
  }
  return blobs;
}

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

@Override
public Serializable getValue(String path) throws PropertyException {
  return resolvePath(path).getValue();
}

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

@Override
public Serializable getPropertyValue(String xpath) throws PropertyException {
  return getProperty(xpath).getValue();
}

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

@Override
public Serializable internalGetValue() throws PropertyException {
  // noinspection CollectionDeclaredAsConcreteClass
  HashMap<String, Serializable> map = new HashMap<String, Serializable>();
  for (Property property : getChildren()) {
    map.put(property.getName(), property.getValue());
  }
  return map;
}

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

public Map<String, Serializable> getMapFromBlobWithUri(Blob blob) throws PropertyException {
  Map<String, Serializable> map = getMapFromBlob(blob);
  Property property = get(URI);
  Serializable uri = property.getValue();
  map.put(URI, uri);
  return map;
}

代码示例来源: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

@Override
public Serializable internalGetValue() throws PropertyException {
  StringBuilder msg = newRemovedMessage();
  if (fallback == null) {
    msg.append("Return null");
  } else {
    msg.append("Return value from '").append(fallback.getXPath()).append("'");
  }
  if (log.isTraceEnabled()) {
    log.error(msg, new NuxeoException());
  } else {
    log.error(msg);
  }
  if (fallback == null) {
    return null;
  }
  return fallback.getValue();
}

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

@Override
public Object setValue(String path, Object value) throws PropertyException {
  Property prop = dp.resolvePath(path);
  Object oldValue = prop.getValue();
  prop.setValue(value);
  return oldValue;
}

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

@Override
public void internalSetValue(Serializable value) throws PropertyException {
  ((BlobProperty) parent).setMemberValue(parent.getValue(), getName(), value);
}

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

@Override
public Blob getBlob() {
  String string = (String) doc.getProperty(xPath).getValue();
  if (string == null) {
    return null;
  }
  Blob blob = Blobs.createBlob(string, mt);
  String ext = ".txt";
  if ("text/html".equals(mt)) {
    ext = ".html";
  } else if ("text/xml".equals(mt)) {
    ext = ".xml";
  } else if ("text/x-web-markdown".equals(mt)) {
    ext = ".md";
  }
  String title = doc.getTitle();
  if (!title.endsWith(ext)) {
    title = title.concat(ext);
  }
  blob.setFilename(title);
  return blob;
}

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

@Override
  public Serializable internalGetValue() throws PropertyException {
    Object value = ((BlobProperty) parent).getMemberValue(parent.getValue(), getName());
    if (value != null && !(value instanceof Serializable)) {
      throw new PropertyException("Non serializable value: " + value);
    }
    return (Serializable) value;
  }
}

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

@Override
public void mapProperties(CoreSession session, DocumentModel sourceDoc, DocumentModel targetDoc, String mapping)
    {
  Map<String, String> properties = getMapping(mapping);
  for (String keyProp : properties.keySet()) {
    // verify that mapping can be done
    Property sourceProperty = sourceDoc.getProperty(keyProp);
    Property targetProperty = targetDoc.getProperty(properties.get(keyProp));
    Type sourceType = sourceProperty.getType();
    Type targetType = targetProperty.getType();
    if (!compatibleTypes(targetType, sourceType)) {
      throw new NuxeoException(
          String.format("Invalid mapping. Cannot map %s on type %s ", sourceType, targetType));
    }
    targetDoc.setPropertyValue(targetProperty.getXPath(), sourceProperty.getValue());
  }
  session.saveDocument(targetDoc);
}

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

/**
 * @since 7.1
 */
private List<ConstraintViolation> validateSimpleTypeProperty(Schema schema, List<PathNode> path, Property prop,
    boolean dirtyOnly) {
  Field field = prop.getField();
  assert field.getType().isSimpleType() || prop.isScalar();
  List<ConstraintViolation> violations = new ArrayList<>();
  Serializable value = prop.getValue();
  Object defaultValue = field.getDefaultValue();
  // check nullity constraint only if field doesn't have a default value (phantom case)
  if (prop.isPhantom() && defaultValue == null || value == null) {
    if (!field.isNillable()) {
      addNotNullViolation(violations, schema, path);
    }
  } else {
    violations.addAll(validateSimpleTypeField(schema, path, field, value));
  }
  return violations;
}

相关文章