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

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

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

Property.isPhantom介绍

[英]Tests if the property is a phantom. This means it doesn't exists yet in the storage and it is not a new property. This is a placeholder for a property that is defined by the schema but was not yet set.
[中]测试属性是否为幻影。这意味着它在存储中还不存在,也不是新的属性。这是由架构定义但尚未设置的属性的占位符。

代码示例

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

@Override
public void clearDirtyFlags() {
  // even makes child properties not dirty
  super.clearDirtyFlags();
  for (Property child : children.values()) {
    if (!child.isRemoved() && !child.isPhantom()) {
      child.clearDirtyFlags();
    }
  }
}

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

boolean allChildrenPhantom = true;
for (Property child : prop.getChildren()) {
  if (!child.isPhantom()) {
    allChildrenPhantom = false;
    break;
if (prop.isPhantom() || value == null || allChildrenPhantom) {
  if (!field.isNillable()) {
    addNotNullViolation(violations, schema, path);

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

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

List<ConstraintViolation> violations = new ArrayList<>();
Serializable value = prop.getValue();
if (prop.isPhantom() || value == null) {
  if (!field.isNillable()) {
    addNotNullViolation(violations, schema, path);

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

for (Entry<String, Object> entry : map.entrySet()) {
  Property property = get(entry.getKey());
  if (property.isPhantom() && this.isNew()) {

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

public void visitChildren(PropertyVisitor visitor, Object arg) throws PropertyException {
  boolean includePhantoms = visitor.acceptPhantoms();
  if (includePhantoms) {
    for (Property property : getChildren()) {
      property.accept(visitor, arg);
    }
  } else {
    for (Field field : getType().getFields()) {
      Property property = getNonPhantomChild(field);
      if (property == null) {
        continue; // a phantom property not yet initialized
      } else if (property.isPhantom()) {
        continue; // a phantom property
      } else {
        property.accept(visitor, arg);
      }
    }
  }
}

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

protected void writeProperty(JsonGenerator jg, Property prop) throws IOException {
  if (prop.isScalar()) {
    writeScalarProperty(jg, prop);
  } else if (prop.isList()) {
    writeListProperty(jg, prop);
  } else if (prop instanceof BlobProperty) { // a blob
    writeBlobProperty(jg, (BlobProperty) prop);
  } else if (prop.isComplex()) {
    writeComplexProperty(jg, prop);
  } else if (prop.isPhantom()) {
    jg.writeNull();
  }
}

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

/**
 * Converts the value of the given core property to JSON.
 *
 * @param fieldNameWriter the field name writer is used to write the field name depending on writer configuration,
 *            this parameter also allows us to handle different cases: field with prefix, field under complex
 *            property, or nothing for arrays and lists
 */
protected void writeProperty(JsonGenerator jg, Property prop, PropertyConsumer fieldNameWriter)
    throws PropertyException, IOException {
  if (prop.isScalar()) {
    writeScalarProperty(jg, prop, fieldNameWriter);
  } else if (prop.isList()) {
    writeListProperty(jg, prop, fieldNameWriter);
  } else {
    if (prop.isPhantom()) {
      if (writeNull) {
        fieldNameWriter.accept(jg, prop);
        jg.writeNull();
      }
    } else if (prop instanceof BlobProperty) { // a blob
      writeBlobProperty(jg, prop, fieldNameWriter);
    } else { // a complex property
      writeMapProperty(jg, (ComplexProperty) prop, fieldNameWriter);
    }
  }
}

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

|| (property.isPhantom() && property.getField().getDefaultValue() != null)) {

相关文章