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

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

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

Property.size介绍

[英]Get the count of the children properties. This includes phantom properties. So the returned size will be equal to the one returned by the property ComplexType#getFieldsCount().
[中]获取子属性的计数。这包括幻影属性。因此,返回的大小将等于属性ComplexType#GetFieldScont()返回的大小。

代码示例

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

@Override
public int size() throws TemplateModelException {
  return property.size();
}

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

@Override
public boolean isEmpty() throws TemplateModelException {
  return property.size() == 0;
}

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

@Override
public String getViewXPath(String viewName) {
  Property views = doc.getProperty(VIEWS_PROPERTY);
  for (int i = 0; i < views.size(); i++) {
    if (views.get(i).getValue(TITLE_PROPERTY).equals(viewName)) {
      return getViewXPathFor(i);
    }
  }
  return null;
}

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

@Override
public void doRotate(int angle) {
  int size = doc.getProperty(VIEWS_PROPERTY).size();
  for (int i = 0; i < size; i++) {
    String xpath = "picture:views/view[" + i + "]/";
    BlobHolder blob = new SimpleBlobHolder(doc.getProperty(xpath + "content").getValue(Blob.class));
    String type = blob.getBlob().getMimeType();
    if (!"image/png".equals(type)) {
      Map<String, Serializable> options = new HashMap<>();
      options.put(ImagingConvertConstants.OPTION_ROTATE_ANGLE, angle);
      blob = getConversionService().convert(ImagingConvertConstants.OPERATION_ROTATE, blob, options);
      doc.getProperty(xpath + "content").setValue(blob.getBlob());
      Long height = (Long) doc.getProperty(xpath + "height").getValue();
      Long width = (Long) doc.getProperty(xpath + "width").getValue();
      doc.getProperty(xpath + "height").setValue(width);
      doc.getProperty(xpath + "width").setValue(height);
    }
  }
}

相关文章