Search in sources :

Example 1 with DocumentState

use of org.incode.module.document.dom.impl.docs.DocumentState in project estatio by estatio.

the class Paperclip method getDocumentDate.

/**
 * Either the {@link Document#getCreatedAt()} or {@link Document#getRenderedAt()}, depending upon the
 * {@link Document#getState()} of the {@link Document}.  Returns <tt>null</tt> for {@link DocumentTemplate}s.
 */
@NotPersistent
@Property(domainEvent = DocumentDateDomainEvent.class, editing = Editing.DISABLED)
public DateTime getDocumentDate() {
    final DocumentAbstract documentAbstract = getDocument();
    if (documentAbstract instanceof Document) {
        final Document document = (Document) documentAbstract;
        DocumentState state = document.getState();
        return state.dateOf(document);
    }
    return null;
}
Also used : DocumentAbstract(org.incode.module.document.dom.impl.docs.DocumentAbstract) DocumentState(org.incode.module.document.dom.impl.docs.DocumentState) Document(org.incode.module.document.dom.impl.docs.Document) NotPersistent(javax.jdo.annotations.NotPersistent) Property(org.apache.isis.applib.annotation.Property)

Aggregations

NotPersistent (javax.jdo.annotations.NotPersistent)1 Property (org.apache.isis.applib.annotation.Property)1 Document (org.incode.module.document.dom.impl.docs.Document)1 DocumentAbstract (org.incode.module.document.dom.impl.docs.DocumentAbstract)1 DocumentState (org.incode.module.document.dom.impl.docs.DocumentState)1