@Test public void shouldSetCreationDate() { DocumentModel doc = session.createDocumentModel("/", "file", "File"); Calendar currentDate = Calendar.getInstance(); Map<String, Object> originalProperties = new HashMap<>(doc.getProperties("dublincore")); Set<String> expectedChangedProperties = Collections.singleton("dc:created"); storageService.setCreationDate(doc, currentDate); assertDocumentPropertiesChanges(doc, originalProperties, expectedChangedProperties); assertEquals(currentDate, doc.getPropertyValue("dc:created")); }
@Override public void setCreationDate(DocumentModel doc, Calendar creationDate) { Framework.doPrivileged(() -> doc.setPropertyValue(DUBLINCORE_CREATED_DATE_PROPERTY, creationDate)); }
DublinCoreStorageServiceImpl extends DefaultComponent implements DublinCoreStorageService { @Override public void setCreationDate(DocumentModel doc, Calendar creationDate) { Framework.doPrivileged(() -> doc.setPropertyValue(DUBLINCORE_CREATED_DATE_PROPERTY, creationDate)); } }
DublinCoreStorageServiceImpl extends DefaultComponent implements DublinCoreStorageService { @Override public void setCreationDate(DocumentModel doc, Calendar creationDate) { Framework.doPrivileged(() -> doc.setPropertyValue(DUBLINCORE_CREATED_DATE_PROPERTY, creationDate)); }  }
DublinCoreStorageServiceImpl extends DefaultComponent implements DublinCoreStorageService { @Override public void setCreationDate(DocumentModel doc, Calendar creationDate) { Framework.doPrivileged(() -> doc.setPropertyValue(DUBLINCORE_CREATED_DATE_PROPERTY, creationDate)); }  @Override void setCreationDate(DocumentModel doc, Calendar creationDate); @Override void setIssuedDate(DocumentModel doc, Calendar issuedDate); @Override void setModificationDate(DocumentModel doc, Calendar modificationDate); @Override void addContributor(DocumentModel doc, Event event); }
DublinCoreStorageServiceImpl extends DefaultComponent implements DublinCoreStorageService { @Override public void setCreationDate(DocumentModel doc, Calendar creationDate) { Framework.doPrivileged(() -> doc.setPropertyValue(DUBLINCORE_CREATED_DATE_PROPERTY, creationDate)); }  @Override void setCreationDate(DocumentModel doc, Calendar creationDate); @Override void setIssuedDate(DocumentModel doc, Calendar issuedDate); @Override void setModificationDate(DocumentModel doc, Calendar modificationDate); @Override void addContributor(DocumentModel doc, Event event);  }