/** * Checks that at least either Valid Until or Cache Duration is present when Entities Descriptor is root element. * * @param entitiesDescriptor * @throws ValidationException */ protected void validateRoot(EntitiesDescriptor entitiesDescriptor) throws ValidationException { if (entitiesDescriptor.getParent() == null && entitiesDescriptor.getValidUntil() == null && entitiesDescriptor.getCacheDuration() == null) { throw new ValidationException("Must have either ValidUntil or CacheDuration when is root element."); } } }
if (entitiesDescriptor.getCacheDuration() != null) { log.debug("Writting cacheDuration attribute to EntitiesDescriptor DOM element"); String cacheDuration = XMLHelper.longToDuration(entitiesDescriptor.getCacheDuration()); domElement.setAttributeNS(null, CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME, cacheDuration);