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

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

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

Property.remove介绍

[英]Removes this property from the tree.

This method marks the property as dirty and sets its value to null.
[中]从树中删除此属性。
此方法将属性标记为dirty,并将其值设置为null。

代码示例

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

@Override
public void remove() {
  if (property == null) {
    throw new IllegalStateException("Cannot call remove on a non initialized iterator");
  }
  property.remove();
}

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

child.remove();
child.remove();

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

List<Property> temp = new ArrayList<Property>(children);
for (Property p : temp) { // remove all children
  p.remove();

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

@DELETE
public Response doDelete() {
  try {
    doc.getProperty(xpath).remove();
  } catch (PropertyNotFoundException e) {
    throw new NuxeoException("Failed to delete attached file into property: " + xpath, e, SC_BAD_REQUEST);
  }
  CoreSession session = ctx.getCoreSession();
  session.saveDocument(doc);
  session.save();
  return Response.noContent().build();
}

代码示例来源:origin: toutatice-services.carto-nat/toutatice-carto-nat-ecm

@OperationMethod
public DocumentModel run(DocumentModel input) throws Exception {
  
  if(input.isProxy()){
    input = session.getWorkingCopy(input.getRef());
  }
  Property ppt = input.getProperty(xpath);
  Collection<Property> childrenPpt = ppt.getChildren();
  if (!childrenPpt.isEmpty()) {
    for (Property child : childrenPpt) {
      Serializable pptyval = child.getValue(criterion);
      if (pptyval != null && (pptyval.toString()).equals(filterValue)) {					
        child.remove();
        break;
      }
    }
  }
  if (save) {
    input = session.saveDocument(input);
  }
  return input;
}

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

static void fillDocumentProperty(Property p, String key, Object[] ar) throws PropertyException {
  if (ar == null || ar.length == 0) {
    p.remove();
  } else if (p.isScalar()) {
    p.setValue(ar[0]);

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

/**
 * Removes a property from a document given the xpath. If the xpath points to a list property the list will be
 * cleared. If the path points to a blob in a list the property is removed from the list. Otherwise the xpath should
 * point to a non list property that will be removed.
 */
public static void removeProperty(DocumentModel doc, String xpath) {
  Property p = doc.getProperty(xpath);
  if (p instanceof ListProperty) {
    ((ListProperty) p).clear();
  } else {
    Property pp = p.getParent();
    if (pp != null && pp.isList()) { // remove list entry
      ((ListProperty) pp).remove(p);
    } else {
      p.remove();
    }
  }
}

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

@DELETE
public Response doDelete() {
  DocumentModel doc = getTarget().getAdapter(DocumentModel.class);
  FormData form = ctx.getForm();
  String xpath = form.getString(FormData.PROPERTY);
  if (xpath == null) {
    if (doc.hasSchema("file")) {
      xpath = "file:content";
    } else {
      throw new IllegalArgumentException("Missing request parameter named 'property' that specifies "
          + "the blob property xpath to fetch");
    }
  }
  try {
    doc.getProperty(xpath).remove();
    CoreSession session = ctx.getCoreSession();
    session.saveDocument(doc);
    session.save();
  } catch (NuxeoException e) {
    e.addInfo("Failed to delete attached file");
    throw e;
  }
  return redirect(getTarget().getPath());
}

相关文章