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()); }
IResource iResource = (IResource) resource; InstantDt existing = ResourceMetadataKeyEnum.UPDATED.get(iResource); if (existing == null || existing.isEmpty()) { InstantDt lmValue = new InstantDt(headerDateValue); iResource.getResourceMetadata().put(ResourceMetadataKeyEnum.UPDATED, lmValue);
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()); }
IResource iResource = (IResource) resource; InstantDt existing = ResourceMetadataKeyEnum.UPDATED.get(iResource); if (existing == null || existing.isEmpty()) { InstantDt lmValue = new InstantDt(headerDateValue); iResource.getResourceMetadata().put(ResourceMetadataKeyEnum.UPDATED, lmValue);
@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); } }