/** * Get the date when the document has been created. return The date when the document has been created. */ public Date getCreationDate() { return this.doc.getCreationDate(); }
/** * {@inheritDoc} * * @see com.xpn.xwiki.doc.XWikiDocument#getCreationDate() */ @Override public Date getCreationDate() { return getDocument().getCreationDate(); }
@Override public PatientData<String> load(Patient patient) { try { XWikiDocument doc = patient.getXDocument(); Map<String, String> result = new LinkedHashMap<>(); DateTimeFormatter dateFormatter = ISODateTimeFormat.dateTime().withZone(DateTimeZone.UTC); result.put(DOCUMENT_NAME, doc.getDocumentReference().getName()); result.put(CREATION_DATE, dateFormatter.print(new DateTime(doc.getCreationDate()))); result.put(AUTHOR, (doc.getAuthorReference() != null) ? doc.getAuthorReference().getName() : UNKNOWN_USER); result.put(DATE, dateFormatter.print(new DateTime(doc.getDate()))); return new DictionaryPatientData<>(getName(), result); } catch (Exception e) { this.logger.error(ERROR_MESSAGE_LOAD_FAILED, e.getMessage()); } return null; }
@Override public PatientData<String> load(Patient patient) { try { XWikiDocument doc = (XWikiDocument) this.documentAccessBridge.getDocument(patient.getDocument()); Map<String, String> result = new LinkedHashMap<>(); DateTimeFormatter dateFormatter = ISODateTimeFormat.dateTime().withZone(DateTimeZone.UTC); result.put(DOCUMENT_NAME, doc.getDocumentReference().getName()); result.put(CREATION_DATE, dateFormatter.print(new DateTime(doc.getCreationDate()))); result.put(AUTHOR, (doc.getAuthorReference() != null) ? doc.getAuthorReference().getName() : UNKNOWN_USER); result.put(DATE, dateFormatter.print(new DateTime(doc.getDate()))); return new DictionaryPatientData<>(getName(), result); } catch (Exception e) { this.logger.error("Could not find requested document or some unforeseen" + " error has occurred during controller loading ", e.getMessage()); } return null; }
private void setBasicPatientData(XWikiDocument patientDoc) { try { this.phenotipsId = patientDoc.getDocumentReference().getName(); this.owner = R71498PhenoTips2155DataMigration.this.familyMigrations.getOwner(patientDoc); this.creationDate = patientDoc.getCreationDate(); BaseObject data = patientDoc.getXObject(Patient.CLASS_REFERENCE); if (data != null) { this.gender = data.getStringValue(PATIENT_DOCUMENT_GENDER_FIELD).toUpperCase(); this.externalId = data.getStringValue(PATIENT_DOCUMENT_EXTERNALID_FIELD); } } catch (Exception ex) { this.phenotipsId = "ERROR"; R71498PhenoTips2155DataMigration.this.logger.error("Failed to get data from patient [{}] document: {}", patientDoc.getDocumentReference(), ex.getMessage()); } }
private void setBasicPatientData(XWikiDocument patientDoc) { try { this.phenotipsId = patientDoc.getDocumentReference().getName(); this.owner = familyMigrations.getOwner(patientDoc); this.creationDate = patientDoc.getCreationDate(); BaseObject data = patientDoc.getXObject(Patient.CLASS_REFERENCE); if (data != null) { this.gender = data.getStringValue(PATIENT_DOCUMENT_GENDER_FIELD).toUpperCase(); this.externalId = data.getStringValue(PATIENT_DOCUMENT_EXTERNALID_FIELD); } } catch (Exception ex) { this.phenotipsId = "ERROR"; logger.error("Failed to get data from patient [{}] document: {}", patientDoc.getDocumentReference(), ex.getMessage()); } }
Date creationDate = patientDoc.getCreationDate(); DataCell cell = new DataCell(format.format(creationDate), x, 0); bodySection.addCell(cell);
Date creationDate = patientDoc.getCreationDate(); DataCell cell = new DataCell(format.format(creationDate), x, 0); bodySection.addCell(cell);
public DocumentData(final XWikiDocument doc, final XWikiContext context, final boolean deleted) { super(LucenePlugin.DOCTYPE_WIKIPAGE, doc, context, deleted); setAuthor(doc.getAuthor()); setCreator(doc.getCreator()); setModificationDate(doc.getDate()); setCreationDate(doc.getCreationDate()); }
@Override public void init(XWikiDavResource parent, String name, String relativePath) throws DavException { super.init(parent, name, relativePath); if (!(name.equals(WIKI_TXT) || name.equals(WIKI_XML))) { throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR); } this.parentDoc = ((DavPage) parent).getDocument(); String timeStamp = DavConstants.creationDateFormat.format(parentDoc.getCreationDate()); getProperties().add(new DefaultDavProperty(DavPropertyName.CREATIONDATE, timeStamp)); timeStamp = DavConstants.modificationDateFormat.format(parentDoc.getContentUpdateDate()); getProperties().add(new DefaultDavProperty(DavPropertyName.GETLASTMODIFIED, timeStamp)); getProperties().add(new DefaultDavProperty(DavPropertyName.GETETAG, timeStamp)); getProperties().add( new DefaultDavProperty(DavPropertyName.GETCONTENTLANGUAGE, parentDoc.getLanguage())); String contentType = this.name.equals(WIKI_TXT) ? "text/plain" : "text/xml"; getProperties().add(new DefaultDavProperty(DavPropertyName.GETCONTENTTYPE, contentType)); int contentLength = this.name.equals(WIKI_TXT) ? parentDoc.getContent().length() : getContext().toXML( parentDoc).length(); getProperties().add( new DefaultDavProperty(DavPropertyName.GETCONTENTLENGTH, contentLength)); }
if (getCreationDate().getTime() != doc.getCreationDate().getTime()) { return false;
@Override public void init(XWikiDavResource parent, String name, String relativePath) throws DavException { super.init(parent, name, relativePath); int dot = name.lastIndexOf('.'); if (dot != -1) { this.spaceName = name.substring(0, dot); } else { throw new DavException(DavServletResponse.SC_BAD_REQUEST); } this.doc = getContext().getDocument(this.name); String timeStamp = DavConstants.creationDateFormat.format(doc.getCreationDate()); getProperties().add(new DefaultDavProperty(DavPropertyName.CREATIONDATE, timeStamp)); timeStamp = DavConstants.modificationDateFormat.format(doc.getContentUpdateDate()); getProperties().add(new DefaultDavProperty(DavPropertyName.GETLASTMODIFIED, timeStamp)); getProperties().add(new DefaultDavProperty(DavPropertyName.GETETAG, timeStamp)); getProperties().add(new DefaultDavProperty(DavPropertyName.GETCONTENTTYPE, "text/directory")); getProperties().add(new DefaultDavProperty(DavPropertyName.GETCONTENTLANGUAGE, doc.getLanguage())); getProperties().add(new DefaultDavProperty(DavPropertyName.GETCONTENTLENGTH, 0)); }
@Override public PatientSummary createPatientSummary(Patient patient, UriInfo uriInfo) { if (patient == null) { return null; } User currentUser = this.users.getCurrentUser(); if (!this.access.hasAccess(currentUser, Right.VIEW, patient.getDocumentReference())) { return null; } PatientSummary result = new PatientSummary(); XWikiDocument doc = patient.getXDocument(); result.withId(patient.getId()).withEid(patient.getExternalId()); result.withCreatedBy(String.valueOf(patient.getReporter())).withLastModifiedBy( String.valueOf(doc.getAuthorReference())); result.withVersion(doc.getVersion()); result.withCreatedOn(new DateTime(doc.getCreationDate()).withZone(DateTimeZone.UTC)); result.withLastModifiedOn(new DateTime(doc.getDate()).withZone(DateTimeZone.UTC)); result.withLinks(this.autolinker.get().forSecondaryResource(PatientResource.class, uriInfo) .withExtraParameters("entity-id", patient.getId()) .withExtraParameters("entity-type", "patients") .build()); return result; }
localeParameters.put(WikiDocumentFilter.PARAMETER_CREATION_DATE, document.getCreationDate()); localeParameters.put(WikiDocumentFilter.PARAMETER_LASTREVISION, document.getVersion());
doc.setCreationDate(new Date(doc.getCreationDate().getTime())); doc.setContentUpdateDate(new Date(doc.getContentUpdateDate().getTime())); } catch (ObjectNotFoundException e) { // No document
solrDocument.setField(FieldUtils.CREATIONDATE, translatedDocument.getCreationDate()); solrDocument.setField(FieldUtils.DATE, translatedDocument.getContentUpdateDate());
doc.setContentUpdateDate(xdoc.getContentUpdateDate().getTime()); doc.setDate(xdoc.getDate().getTime()); doc.setCreationDate(xdoc.getCreationDate().getTime()); doc.setMostRecent(xdoc.isMostRecent()); doc.setNew(xdoc.isNew());
doc.setContent(getContent()); doc.setContentDirty(isContentDirty()); doc.setCreationDate(getCreationDate()); doc.setDate(getDate()); doc.setCustomClass(getCustomClass());
wr.write(el); long d = getCreationDate().getTime(); el = new DOMElement("creationDate"); el.addText("" + d);
setContent(document.getContent()); setContentDirty(document.isContentDirty()); setCreationDate(document.getCreationDate()); setDate(document.getDate()); setCustomClass(document.getCustomClass());