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

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

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

Property.isDirty介绍

[英]Tests whether a property is dirty.

This tests whether or not a dirty flag is set on the property.
[中]测试属性是否脏。
这将测试是否在属性上设置了脏标志。

代码示例

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

@Override
public boolean hasNext() {
  if (next != null) {
    return true;
  }
  while (it.hasNext()) {
    next = it.next();
    if (next.isDirty()) {
      return true;
    }
  }
  next = null;
  return false;
}

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

@Override
public boolean isDirty(String name) throws PropertyNotFoundException {
  return dp.get(name).isDirty();
}

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

@Override
public Collection<String> getDirtyFields() {
  Collection<String> dirtyFields = new ArrayList<String>();
  for (Property prop : dp.getChildren()) {
    if (prop.isDirty()) {
      dirtyFields.add(prop.getName());
    }
  }
  return dirtyFields;
}

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

/**
 * @since 7.1
 */
private List<ConstraintViolation> validateAnyTypeProperty(Schema schema, List<PathNode> path, Property prop,
    boolean dirtyOnly, boolean validateSubProperties) {
  Field field = prop.getField();
  if (!dirtyOnly || prop.isDirty()) {
    if (field.getType().isSimpleType()) {
      return validateSimpleTypeProperty(schema, path, prop, dirtyOnly);
    } else if (field.getType().isComplexType()) {
      // ignore for now the case when the complex property is null with a null contraints because it's
      // currently impossible
      if (validateSubProperties) {
        return validateComplexTypeProperty(schema, path, prop, dirtyOnly);
      }
    } else if (field.getType().isListType()) {
      if (validateSubProperties) {
        return validateListTypeProperty(schema, path, prop, dirtyOnly);
      }
    }
  }
  // unrecognized type : ignored
  return Collections.emptyList();
}

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

protected boolean shouldProcess(DocumentModel doc, String eventName) {
  return doc.hasFacet(VIDEO_FACET) && !doc.isProxy()
      && (Boolean.TRUE.equals(doc.getContextData(CTX_FORCE_INFORMATIONS_GENERATION))
          || DOCUMENT_CREATED.equals(eventName) || doc.getProperty("file:content").isDirty());
}

代码示例来源:origin: org.nuxeo.binary.metadata/nuxeo-binary-metadata

/**
   * Maps inspector only.
   */
  protected boolean isDirtyMapping(MetadataMappingDescriptor mappingDescriptor, DocumentModel doc) {
    Map<String, String> mappingResult = new HashMap<>();
    for (MetadataMappingDescriptor.MetadataDescriptor metadataDescriptor : mappingDescriptor.getMetadataDescriptors()) {
      mappingResult.put(metadataDescriptor.getXpath(), metadataDescriptor.getName());
    }
    // Returning only dirty properties
    HashMap<String, Object> resultDirtyMapping = new HashMap<>();
    for (String metadata : mappingResult.keySet()) {
      Property property = doc.getProperty(metadata);
      if (property.isDirty()) {
        resultDirtyMapping.put(mappingResult.get(metadata), doc.getPropertyValue(metadata));
      }
    }
    return !resultDirtyMapping.isEmpty();
  }
}

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

for (String schema : collector.getSchemas()) {
  for (Property property : collector.getPropertyObjects(schema)) {
    if (!property.isDirty()) {
      continue;

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

@Override
public void handleEvent(Event event) {
  EventContext ctx = event.getContext();
  if (!(ctx instanceof DocumentEventContext)) {
    return;
  }
  DocumentEventContext docCtx = (DocumentEventContext) ctx;
  DocumentModel doc = docCtx.getSourceDocument();
  if (doc.hasFacet(PICTURE_FACET) && !doc.isProxy()) {
    Property fileProp = doc.getProperty("file:content");
    Property viewsProp = doc.getProperty(AbstractPictureAdapter.VIEWS_PROPERTY);
    boolean forceGeneration = Boolean.TRUE.equals(doc.getContextData(CTX_FORCE_VIEWS_GENERATION));
    boolean noPictureViews = !viewsProp.isDirty() || viewsProp.size() == 0;
    boolean fileChanged = ABOUT_TO_CREATE.equals(event.getName()) || fileProp.isDirty();
    if (forceGeneration || (noPictureViews  && fileChanged)) {
      preFillPictureViews(docCtx.getCoreSession(), doc);
    } else {
      docCtx.setProperty(PictureViewsGenerationListener.DISABLE_PICTURE_VIEWS_GENERATION_LISTENER, true);
    }
  }
}

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

if (prop == null || !prop.isDirty()
    || (fieldName.equals(passwordFieldName) && StringUtils.isEmpty((String) prop.getValue()))) {
  continue;

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

try {
  for (String fieldName : schemaFieldMap.keySet()) {
    if (!docModel.getPropertyObject(schemaName, fieldName).isDirty()) {
      continue;

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

if (!prop.isDirty()) {
  continue;

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

if (!(force || fileProperty.isDirty() || ABOUT_TO_CREATE.equals(event.getName()))) {
  return;

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

@Override
public void handleEvent(Event event) {
  EventContext ec = event.getContext();
  if (!(ec instanceof DocumentEventContext)) {
    return;
  }
  DocumentEventContext context = (DocumentEventContext) ec;
  DocumentModel doc = context.getSourceDocument();
  if (!doc.hasSchema("file")) {
    return;
  }
  Property content = doc.getProperty("file:content");
  // Only perform the thumbnail update at creation or modification if the content is marked as changed and the
  // thumbnail has not already been updated. This additional check is needed to avoid an infinite loop.
  if (DOCUMENT_CREATED.equals(event.getName())
      || content.isDirty() && !Boolean.TRUE.equals(ec.getProperty(THUMBNAIL_UPDATED))) {
    if (BEFORE_DOC_UPDATE.equals(event.getName()) && doc.hasFacet(ThumbnailConstants.THUMBNAIL_FACET)
        && content.getValue() == null) {
      doc.setPropertyValue(ThumbnailConstants.THUMBNAIL_PROPERTY_NAME, null);
    }
    if (content.getValue() != null) {
      doc.addFacet(ThumbnailConstants.THUMBNAIL_FACET);
      Framework.getService(EventService.class)
           .fireEvent(ThumbnailConstants.EventNames.scheduleThumbnailUpdate.name(), context);
    }
  }
}

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

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

代码示例来源:origin: org.nuxeo.binary.metadata/nuxeo-binary-metadata

@Override
public void handleUpdate(List<MetadataMappingDescriptor> mappingDescriptors, DocumentModel doc) {
  for (MetadataMappingDescriptor mappingDescriptor : mappingDescriptors) {
    Property fileProp = doc.getProperty(mappingDescriptor.getBlobXPath());
    Blob blob = fileProp.getValue(Blob.class);
    if (blob != null) {
      boolean isDirtyMapping = isDirtyMapping(mappingDescriptor, doc);
      if (isDirtyMapping) {
        BlobManager blobManager = Framework.getService(BlobManager.class);
        BlobProvider blobProvider = blobManager.getBlobProvider(blob);
        // do not write metadata in blobs backed by extended blob providers (ex: Google Drive) or blobs from
        // providers that prevent user updates
        if (blobProvider != null && (!blobProvider.supportsUserUpdate() || blobProvider.getBinaryManager() == null)) {
          return;
        }
        // if document metadata dirty, write metadata from doc to Blob
        Blob newBlob = writeMetadata(mappingDescriptor.getProcessor(), fileProp.getValue(Blob.class), mappingDescriptor.getId(), doc);
        fileProp.setValue(newBlob);
      } else if (fileProp.isDirty()) {
        // if Blob dirty and document metadata not dirty, write metadata from Blob to doc
        writeMetadata(doc);
      }
    }
  }
}

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

private void filterProperty(Property prop, DocumentModel docModel) {
  if (!prop.isDirty()) {
    return;

相关文章