Search in sources :

Example 1 with NotPersistent

use of javax.jdo.annotations.NotPersistent 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)

Example 2 with NotPersistent

use of javax.jdo.annotations.NotPersistent in project motech by motech.

the class Entity method advancedSettingsDto.

@NotPersistent
public AdvancedSettingsDto advancedSettingsDto() {
    AdvancedSettingsDto advancedSettingsDto = new AdvancedSettingsDto();
    RestOptionsDto restDto;
    if (null == restOptions) {
        restDto = new RestOptions(this).toDto();
    } else {
        restDto = restOptions.toDto();
    }
    List<LookupDto> indexes = new ArrayList<>();
    for (Lookup lookup : getLookups()) {
        indexes.add(lookup.toDto());
    }
    Tracking trackingMapping = getTracking();
    TrackingDto trackingDto = (trackingMapping == null) ? new TrackingDto() : trackingMapping.toDto();
    advancedSettingsDto.setIndexes(indexes);
    advancedSettingsDto.setEntityId(getId());
    advancedSettingsDto.setBrowsing(getBrowsingSettings().toDto());
    advancedSettingsDto.setRestOptions(restDto);
    advancedSettingsDto.setTracking(trackingDto);
    return advancedSettingsDto;
}
Also used : LookupDto(org.motechproject.mds.dto.LookupDto) ArrayList(java.util.ArrayList) AdvancedSettingsDto(org.motechproject.mds.dto.AdvancedSettingsDto) RestOptionsDto(org.motechproject.mds.dto.RestOptionsDto) TrackingDto(org.motechproject.mds.dto.TrackingDto) NotPersistent(javax.jdo.annotations.NotPersistent)

Aggregations

NotPersistent (javax.jdo.annotations.NotPersistent)2 ArrayList (java.util.ArrayList)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 AdvancedSettingsDto (org.motechproject.mds.dto.AdvancedSettingsDto)1 LookupDto (org.motechproject.mds.dto.LookupDto)1 RestOptionsDto (org.motechproject.mds.dto.RestOptionsDto)1 TrackingDto (org.motechproject.mds.dto.TrackingDto)1