@Override public InstantDt getPublished() { if (myPublished != null) { return new InstantDt(myPublished); } else { return null; } }
public void setUpdated(InstantDt theUpdated) { myUpdated = theUpdated.getValue(); }
/** * Create a new unmodifiable empty resource list with the current time as the publish date. */ public static IBundleProvider newEmptyList() { final InstantDt published = InstantDt.withCurrentTime(); return new IBundleProvider() { @Override public List<IBaseResource> getResources(int theFromIndex, int theToIndex) { return Collections.emptyList(); } @Override public Integer size() { return 0; } @Override public InstantDt getPublished() { return published; } @Override public Integer preferredPageSize() { return null; } @Override public String getUuid() { return null; } }; }
@Override protected String doEncode(Date theString) { return new InstantDt(theString).getValueAsString(); }
@Override protected Calendar doParse(String theString) { return new InstantDt(theString).getValueAsCalendar(); }
private static InstantDt getInstantFromMetadataOrNullIfNone(Map<ResourceMetadataKeyEnum<?>, Object> theResourceMetadata, ResourceMetadataKeyEnum<InstantDt> theKey) { Object retValObj = theResourceMetadata.get(theKey); if (retValObj == null) { return null; } else if (retValObj instanceof Date) { return new InstantDt((Date) retValObj); } else if (retValObj instanceof InstantDt) { if (((InstantDt) retValObj).isEmpty()) { return null; } return (InstantDt) retValObj; } throw new InternalErrorException("Found an object of type '" + retValObj.getClass().getCanonicalName() + "' in resource metadata for key " + theKey.name() + " - Expected " + InstantDt.class.getCanonicalName()); }
public static void datatypes() { // START SNIPPET: datatypes Observation obs = new Observation(); // These are all equivalent obs.setIssued(new InstantDt(new Date())); obs.setIssued(new Date(), TemporalPrecisionEnum.MILLI); obs.setIssuedWithMillisPrecision(new Date()); // The InstantDt also lets you work with the instant as a Java Date // object or as a FHIR String. Date date = obs.getIssuedElement().getValue(); // A date object String dateString = obs.getIssuedElement().getValueAsString(); // "2014-03-08T12:59:58.068-05:00" // END SNIPPET: datatypes System.out.println(date); System.out.println(dateString); }
writeOptionalTagWithValue(theEventWriter, "versionId", versionIdPart); if (updated != null) { writeOptionalTagWithValue(theEventWriter, "lastUpdated", updated.getValueAsString());
@Override public void addRootPropertiesToBundle(String theAuthor, String theServerBase, String theCompleteUrl, Integer theTotalResults, BundleTypeEnum theBundleType, IPrimitiveType<Date> theLastUpdated) { if (myBundle.getAuthorName().isEmpty()) { myBundle.getAuthorName().setValue(theAuthor); } if (theLastUpdated != null && myBundle.getUpdated().isEmpty() && isNotBlank(theLastUpdated.getValueAsString())) { myBundle.getUpdated().setValueAsString(theLastUpdated.getValueAsString()); } if (myBundle.getBundleId().isEmpty()) { myBundle.getBundleId().setValue(UUID.randomUUID().toString()); } if (myBundle.getLinkBase().isEmpty()) { myBundle.getLinkBase().setValue(theServerBase); } if (myBundle.getLinkSelf().isEmpty()) { myBundle.getLinkSelf().setValue(theCompleteUrl); } if (theBundleType != null && myBundle.getType().isEmpty()) { myBundle.getType().setValueAsString(theBundleType.getCode()); } if (myBundle.getTotalResults().isEmpty() && theTotalResults != null) { myBundle.getTotalResults().setValue(theTotalResults); } }
@Override protected String doEncode(Calendar theString) { return new InstantDt(theString).getValueAsString(); }
@Override public Map<String, String> getDetail() { if(myResource == null) return null; Map<String, String> details = new HashMap<String, String>(); details.put("dateIssued", myResource.getIssued().getValueAsString()); details.put("version", myResource.getId().getVersionIdPart()); details.put("subject", myResource.getSubject().getReference().getValue()); return details; }
/** * Sets the value for <b>lastUpdated</b> () * * <p> * <b>Definition:</b> * When the resource last changed - e.g. when the version changed * </p> */ public MetaDt setLastUpdatedWithMillisPrecision( Date theDate) { myLastUpdated = new InstantDt(theDate); return this; }
public void setPublished(InstantDt thePublished) { myPublished = thePublished.getValue(); }
res = (IResource) myContext.getResourceDefinition(theResourceType).newInstance(); retVal = (R) res; ResourceMetadataKeyEnum.DELETED_AT.put(res, new InstantDt(theEntity.getDeleted())); if (theForHistoryOperation) { ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.put(res, BundleEntryTransactionMethodEnum.DELETE); Date published = theEntity.getPublished().getValue(); Date updated = theEntity.getUpdated().getValue(); if (published.equals(updated)) { ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.put(res, BundleEntryTransactionMethodEnum.POST);
@Override protected String doEncode(Date theString) { return new InstantDt(theString).getValueAsString(); }
private static InstantDt getInstantFromMetadataOrNullIfNone(Map<ResourceMetadataKeyEnum<?>, Object> theResourceMetadata, ResourceMetadataKeyEnum<InstantDt> theKey) { Object retValObj = theResourceMetadata.get(theKey); if (retValObj == null) { return null; } else if (retValObj instanceof Date) { return new InstantDt((Date) retValObj); } else if (retValObj instanceof InstantDt) { if (((InstantDt) retValObj).isEmpty()) { return null; } return (InstantDt) retValObj; } throw new InternalErrorException("Found an object of type '" + retValObj.getClass().getCanonicalName() + "' in resource metadata for key " + theKey.name() + " - Expected " + InstantDt.class.getCanonicalName()); }
final InstantDt searchTime = InstantDt.withCurrentTime();