public XWikiLock getLock(XWikiContext context) throws XWikiException { XWikiLock theLock = getStore(context).loadLock(getId(), context, true); if (theLock != null) { int timeout = context.getWiki().getXWikiPreferenceAsInt("lock_Timeout", 30 * 60, context); if (theLock.getDate().getTime() + timeout * 1000 < new Date().getTime()) { getStore(context).deleteLock(theLock, context, true); theLock = null; } } return theLock; }
public Date getLockingDate() { try { XWikiLock lock = this.doc.getLock(getXWikiContext()); if (lock != null && !getXWikiContext().getUser().equals(lock.getUserName())) { return lock.getDate(); } else { return null; } } catch (XWikiException e) { return null; } }
@Override public DocumentLock getLock(DocumentReference doc) { XWikiContext context = this.provider.get(); XWikiDocument xdoc; try { xdoc = context.getWiki().getDocument(doc, context); if (xdoc == null) { return null; } XWikiLock xlock = xdoc.getLock(context); User user = this.userManager.getUser(xlock.getUserName()); if (xlock != null && !user.getId().equals(this.userManager.getCurrentUser().getId())) { Set<String> actions = Collections.singleton("edit"); return new DocumentLock(user, xlock.getDate(), this.tm.translate("locks.documentInUse", user.getName()), actions, true); } } catch (XWikiException e) { this.logger.error("Failed to access the document lock: {}", e.getMessage(), e); } return null; } }
user = this.userManager.getUser(xlock.getUserName()); Set<String> actions = Collections.singleton("edit"); return new DocumentLock(user, xlock.getDate(), this.tm.translate("family.locks.familyMemberInUse"), actions, false);
@Override public DocumentLock getLock(DocumentReference doc) { XWikiContext context = this.provider.get(); XWikiDocument xdoc; try { xdoc = context.getWiki().getDocument(doc, context); if (xdoc == null) { return null; } String documentId = xdoc.getDocumentReference().getName(); Patient patient = this.patientRepository.getPatientById(documentId); if (patient == null) { return null; } XWikiLock xlock = xdoc.getLock(context); User user = this.userManager.getUser(xlock.getUserName()); if (xlock != null && !user.getId().equals(this.userManager.getCurrentUser().getId())) { Set<String> actions = Collections.singleton("edit"); return new DocumentLock(user, xlock.getDate(), this.tm.translate("patient.locks.patientInUse", user.getName()), actions, false); } } catch (XWikiException e) { this.logger.error("Failed to access the document lock: {}", e.getMessage(), e); } return null; } }
@Override public DocumentLock getLock(DocumentReference doc) { XWikiContext context = this.provider.get(); XWikiDocument xdoc; try { xdoc = context.getWiki().getDocument(doc, context); if (xdoc == null) { return null; } String documentId = xdoc.getDocumentReference().getName(); Family family = this.familyRepository.getFamilyById(documentId); if (family == null) { return null; } XWikiLock xlock = xdoc.getLock(context); User user = this.userManager.getUser(xlock.getUserName()); if (xlock != null && !user.getId().equals(this.userManager.getCurrentUser().getId())) { Set<String> actions = Collections.singleton("edit"); return new DocumentLock(user, xlock.getDate(), this.tm.translate("family.locks.familyInUse", user.getName()), actions, false); } } catch (XWikiException e) { this.logger.error("Failed to access the document lock: {}", e.getMessage(), e); } return null; } }
@Override public DocumentLock getLock(DocumentReference doc) { XWikiContext context = this.provider.get(); XWikiDocument xdoc; try { xdoc = context.getWiki().getDocument(doc, context); if (xdoc == null) { return null; } String documentId = xdoc.getDocumentReference().getName(); Patient patient = this.patientRepository.getPatientById(documentId); if (patient == null) { return null; } XWikiLock xlock = xdoc.getLock(context); User user = this.userManager.getUser(xlock.getUserName()); if (xlock != null && !user.getId().equals(this.userManager.getCurrentUser().getId())) { Set<String> actions = Collections.singleton("edit"); return new DocumentLock(user, xlock.getDate(), this.tm.translate("patient.locks.patientInUse", user.getName()), actions, false); } } catch (XWikiException e) { this.logger.error("Failed to access the document lock: {}", e.getMessage(), e); } return null; } }
if (xlock != null && !user.getId().equals(this.userManager.getCurrentUser().getId())) { Set<String> actions = Collections.singleton("edit"); return new DocumentLock(user, xlock.getDate(), this.tm.translate("family.locks.familyInUse", user.getName()), actions, false);
Set<String> actions = Collections.singleton("edit"); User user = this.userManager.getUser(xlock.getUserName()); return new DocumentLock(user, xlock.getDate(), this.tm.translate("family.locks.patientFamilyInUse", user.getName()), actions, false);
Set<String> actions = Collections.singleton("edit"); User user = this.userManager.getUser(xlock.getUserName()); return new DocumentLock(user, xlock.getDate(), this.tm.translate("family.locks.patientFamilyInUse", user.getName()), actions, false);