org.nuxeo.ecm.core.api.Lock.getCreated()方法的使用及代码示例

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

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

Lock.getCreated介绍

[英]The creation time of the lock.
[中]锁的创建时间。

代码示例

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

protected String stringFromLock(Lock lock) {
  if (lock == null) {
    throw new NullPointerException("null lock");
  }
  return lock.getOwner() + ":" + lock.getCreated().getTimeInMillis();
}

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

@Override
public Map<String, Serializable> getLockDetails(DocumentModel document) {
  if (lockDetails == null || !StringUtils.equals(documentId, document.getId())) {
    lockDetails = new HashMap<String, Serializable>();
    documentId = document.getId();
    Lock lock = documentManager.getLockInfo(document.getRef());
    if (lock == null) {
      return lockDetails;
    }
    lockDetails.put(LOCKER, lock.getOwner());
    lockDetails.put(LOCK_CREATED, lock.getCreated());
  }
  return lockDetails;
}

代码示例来源:origin: opentoutatice-ecm.elasticsearch-customizer/opentoutatice-addon-elasticsearch-customizer-ecm

/**
 * Write lock informations of document.
 * 
 * @param jg
 * @param doc
 * @throws JsonGenerationException
 * @throws IOException
 */
// FIXME: create a lock index?
protected void writeLockInfos(JsonGenerator jg, DocumentModel doc) throws JsonGenerationException, IOException {
  Lock lock = doc.getLockInfo();
  if (lock != null) {
    jg.writeStringField("ttc:lockOwner", lock.getOwner());
    jg.writeStringField("ttc:lockCreated", ISODateTimeFormat.dateTime().print(new DateTime(lock.getCreated())));
  }
}

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

@GET
public Object doGet() {
  try {
    DocumentModel doc = getTarget().getAdapter(DocumentModel.class);
    Lock lock = ctx.getCoreSession().getLockInfo(doc.getRef());
    return lock.getOwner() + '/' + ISODateTimeFormat.dateTime().print(new DateTime(lock.getCreated()));
  } catch (NuxeoException e) {
    e.addInfo("Failed to get lock on document");
    throw e;
  }
}

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

@Override
public void updateExport(DocumentModel docModel, ExportedDocumentImpl result) throws Exception {
  if (docModel.isLocked()) {
    Element lockElement = result.getDocument().getRootElement().addElement("lockInfo");
    Lock lock = docModel.getLockInfo();
    Long created = lock.getCreated().getTimeInMillis();
    String owner = lock.getOwner();
    lockElement.addElement("created").setText(created.toString());
    ;
    lockElement.addElement("owner").setText(owner.toString());
    ;
  }
}

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

@Override
public Lock setLock(final Serializable id, final Lock lock) {
  if (log.isDebugEnabled()) {
    log.debug("setLock " + id + " owner=" + lock.getOwner());
  }
  Lock oldLock = getLock(id);
  if (oldLock == null) {
    Row row = new Row(Model.LOCK_TABLE_NAME, id);
    row.put(Model.LOCK_OWNER_KEY, lock.getOwner());
    row.put(Model.LOCK_CREATED_KEY, lock.getCreated());
    insertSimpleRows(Model.LOCK_TABLE_NAME, Collections.singletonList(row));
  }
  return oldLock;
}

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

@Override
public synchronized Lock setLock(String id, Lock lock) {
  State state = states.get(id);
  if (state == null) {
    // document not found
    throw new DocumentNotFoundException(id);
  }
  String owner = (String) state.get(KEY_LOCK_OWNER);
  if (owner != null) {
    // return old lock
    Calendar created = (Calendar) state.get(KEY_LOCK_CREATED);
    return new Lock(owner, created);
  }
  state.put(KEY_LOCK_OWNER, lock.getOwner());
  state.put(KEY_LOCK_CREATED, lock.getCreated());
  return null;
}

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

if (lock != null) {
  jg.writeStringField("lockOwner", lock.getOwner());
  jg.writeStringField("lockCreated", ISODateTimeFormat.dateTime().print(new DateTime(lock.getCreated())));

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

Updates.set(KEY_LOCK_CREATED, converter.serializableToBson(lock.getCreated())) //
);
if (log.isTraceEnabled()) {

相关文章

微信公众号

最新文章

更多