List of usage examples for javax.xml.datatype DatatypeConstants GREATER
int GREATER
To view the source code for javax.xml.datatype DatatypeConstants GREATER.
Click Source Link
Comparison result.
From source file:DatatypeAPIUsage.java
public static void main(String[] args) { try {//from w w w . j a va 2s.c o m DatatypeFactory df = DatatypeFactory.newInstance(); // my work number in milliseconds: Duration myPhone = df.newDuration(9054133519l); Duration myLife = df.newDuration(true, 29, 2, 15, 13, 45, 0); int compareVal = myPhone.compare(myLife); switch (compareVal) { case DatatypeConstants.LESSER: System.out.println("There are fewer milliseconds in my phone number than my lifespan."); break; case DatatypeConstants.EQUAL: System.out.println("The same number of milliseconds are in my phone number and my lifespan."); break; case DatatypeConstants.GREATER: System.out.println("There are more milliseconds in my phone number than my lifespan."); break; case DatatypeConstants.INDETERMINATE: System.out.println("The comparison could not be carried out."); } // create a yearMonthDuration Duration ymDuration = df.newDurationYearMonth("P12Y10M"); System.out.println("P12Y10M is of type: " + ymDuration.getXMLSchemaType()); // create a dayTimeDuration (really this time) Duration dtDuration = df.newDurationDayTime("P10DT10H12M0S"); System.out.println("P10DT10H12M0S is of type: " + dtDuration.getXMLSchemaType()); // try to fool the factory! try { ymDuration = df.newDurationYearMonth("P12Y10M1D"); } catch (IllegalArgumentException e) { System.out.println("'duration': P12Y10M1D is not 'yearMonthDuration'!!!"); } XMLGregorianCalendar xgc = df.newXMLGregorianCalendar(); xgc.setYear(1975); xgc.setMonth(DatatypeConstants.AUGUST); xgc.setDay(11); xgc.setHour(6); xgc.setMinute(44); xgc.setSecond(0); xgc.setMillisecond(0); xgc.setTimezone(5); xgc.add(myPhone); System.out.println("The approximate end of the number of milliseconds in my phone number was " + xgc); // adding a duration to XMLGregorianCalendar xgc.add(myLife); System.out.println("Adding the duration myLife to the above calendar:" + xgc); // create a new XMLGregorianCalendar using the string format of xgc. XMLGregorianCalendar xgcCopy = df.newXMLGregorianCalendar(xgc.toXMLFormat()); // should be equal-if not what happened!! if (xgcCopy.compare(xgc) != DatatypeConstants.EQUAL) { System.out.println("oooops!"); } else { System.out.println("Very good: " + xgc + " is equal to " + xgcCopy); } } catch (DatatypeConfigurationException dce) { System.err.println("error: Datatype error occurred - " + dce.getMessage()); dce.printStackTrace(System.err); } }
From source file:Main.java
/** * Validate that the current time falls between the two boundaries * * @param now/*from w w w . ja va 2 s.c om*/ * @param notbefore * @param notOnOrAfter * * @return */ public static boolean isValid(XMLGregorianCalendar now, XMLGregorianCalendar notbefore, XMLGregorianCalendar notOnOrAfter) { int val = 0; if (notbefore != null) { val = notbefore.compare(now); if (val == DatatypeConstants.INDETERMINATE || val == DatatypeConstants.GREATER) return false; } if (notOnOrAfter != null) { val = notOnOrAfter.compare(now); if (val != DatatypeConstants.GREATER) return false; } return true; }
From source file:com.evolveum.midpoint.schema.statistics.ActionsExecutedInformation.java
private static void addToEntry(ObjectActionsExecutedEntryType sum, ObjectActionsExecutedEntryType delta) { sum.setTotalSuccessCount(sum.getTotalSuccessCount() + delta.getTotalSuccessCount()); if (delta.getLastSuccessTimestamp() != null && (sum.getLastSuccessTimestamp() == null || delta .getLastSuccessTimestamp().compare(sum.getLastSuccessTimestamp()) == DatatypeConstants.GREATER)) { sum.setLastSuccessObjectName(delta.getLastSuccessObjectName()); sum.setLastSuccessObjectDisplayName(delta.getLastSuccessObjectDisplayName()); sum.setLastSuccessObjectOid(delta.getLastSuccessObjectOid()); sum.setLastSuccessTimestamp(delta.getLastSuccessTimestamp()); }/*from w ww . jav a 2 s. com*/ sum.setTotalFailureCount(sum.getTotalFailureCount() + delta.getTotalFailureCount()); if (delta.getLastFailureTimestamp() != null && (sum.getLastFailureTimestamp() == null || delta .getLastFailureTimestamp().compare(sum.getLastFailureTimestamp()) == DatatypeConstants.GREATER)) { sum.setLastFailureObjectName(delta.getLastFailureObjectName()); sum.setLastFailureObjectDisplayName(delta.getLastFailureObjectDisplayName()); sum.setLastFailureObjectOid(delta.getLastFailureObjectOid()); sum.setLastFailureTimestamp(delta.getLastFailureTimestamp()); sum.setLastFailureExceptionMessage(delta.getLastFailureExceptionMessage()); } }
From source file:com.evolveum.midpoint.schema.statistics.IterativeTaskInformation.java
public static void addTo(IterativeTaskInformationType sum, IterativeTaskInformationType delta, boolean overrideCurrent) { if (sum.getLastSuccessEndTimestamp() == null || (delta.getLastSuccessEndTimestamp() != null && delta.getLastSuccessEndTimestamp() .compare(sum.getLastSuccessEndTimestamp()) == DatatypeConstants.GREATER)) { sum.setLastSuccessObjectName(delta.getLastSuccessObjectName()); sum.setLastSuccessObjectDisplayName(delta.getLastSuccessObjectDisplayName()); sum.setLastSuccessObjectType(delta.getLastSuccessObjectType()); sum.setLastSuccessObjectOid(delta.getLastSuccessObjectOid()); sum.setLastSuccessEndTimestamp(delta.getLastSuccessEndTimestamp()); sum.setLastSuccessDuration(delta.getLastSuccessDuration()); }// ww w .jav a 2s . co m sum.setTotalSuccessDuration(sum.getTotalSuccessDuration() + delta.getTotalSuccessDuration()); sum.setTotalSuccessCount(sum.getTotalSuccessCount() + delta.getTotalSuccessCount()); if (sum.getLastFailureEndTimestamp() == null || (delta.getLastFailureEndTimestamp() != null && delta.getLastFailureEndTimestamp() .compare(sum.getLastFailureEndTimestamp()) == DatatypeConstants.GREATER)) { sum.setLastFailureObjectName(delta.getLastFailureObjectName()); sum.setLastFailureObjectDisplayName(delta.getLastFailureObjectDisplayName()); sum.setLastFailureObjectType(delta.getLastFailureObjectType()); sum.setLastFailureObjectOid(delta.getLastFailureObjectOid()); sum.setLastFailureEndTimestamp(delta.getLastFailureEndTimestamp()); sum.setLastFailureDuration(delta.getLastFailureDuration()); sum.setLastFailureExceptionMessage(delta.getLastFailureExceptionMessage()); } sum.setTotalFailureDuration(sum.getTotalFailureDuration() + delta.getTotalFailureDuration()); sum.setTotalFailureCount(sum.getTotalFailureCount() + delta.getTotalFailureCount()); if (overrideCurrent || sum.getCurrentObjectStartTimestamp() == null || (delta.getCurrentObjectStartTimestamp() != null && delta.getCurrentObjectStartTimestamp() .compare(sum.getCurrentObjectStartTimestamp()) == DatatypeConstants.GREATER)) { sum.setCurrentObjectName(delta.getCurrentObjectName()); sum.setCurrentObjectDisplayName(delta.getCurrentObjectDisplayName()); sum.setCurrentObjectType(delta.getCurrentObjectType()); sum.setCurrentObjectOid(delta.getCurrentObjectOid()); sum.setCurrentObjectStartTimestamp(delta.getCurrentObjectStartTimestamp()); } }
From source file:com.evolveum.midpoint.model.common.stringpolicy.ObjectValuePolicyEvaluator.java
private void validateMinAge(List<LocalizableMessage> messages, OperationResult result) { if (oldCredentialType == null) { return;//from ww w .j a v a2 s . c om } Duration minAge = getMinAge(); if (minAge == null) { return; } MetadataType currentCredentialMetadata = oldCredentialType.getMetadata(); if (currentCredentialMetadata == null) { return; } XMLGregorianCalendar lastChangeTimestamp = currentCredentialMetadata.getModifyTimestamp(); if (lastChangeTimestamp == null) { lastChangeTimestamp = currentCredentialMetadata.getCreateTimestamp(); } if (lastChangeTimestamp == null) { return; } XMLGregorianCalendar changeAllowedTimestamp = XmlTypeConverter.addDuration(lastChangeTimestamp, minAge); if (changeAllowedTimestamp.compare(now) == DatatypeConstants.GREATER) { LOGGER.trace("Password minAge violated. lastChange={}, minAge={}, now={}", lastChangeTimestamp, minAge, now); LocalizableMessage msg = LocalizableMessageBuilder.buildKey("ValuePolicy.minAgeNotReached"); result.addSubresult( new OperationResult("Password minimal age", OperationResultStatus.FATAL_ERROR, msg)); messages.add(msg); } }
From source file:com.evolveum.midpoint.util.MiscUtil.java
public static boolean isBetween(XMLGregorianCalendar date, XMLGregorianCalendar start, XMLGregorianCalendar end) { return (date.compare(start) == DatatypeConstants.GREATER || date.compare(start) == DatatypeConstants.EQUAL) && (date.compare(end) == DatatypeConstants.LESSER || date.compare(end) == DatatypeConstants.EQUAL); }
From source file:com.evolveum.midpoint.model.impl.lens.projector.MappingEvaluationHelper.java
/** * strongMappingWasUsed: Returns true here if the value was (at least partly) determined by a strong mapping. * Used to know whether (when doing reconciliation) this value should be forcibly put onto the resource, even * if it was not changed (i.e. if it's only in the zero set). *///from w w w .j av a 2s .co m // public <V extends PrismValue, F extends FocusType, O extends ObjectType> void evaluateMappingSetProjection( // Collection<MappingType> mappingTypes, String mappingDesc, // XMLGregorianCalendar now, MappingInitializer<V> initializer, MappingOutputProcessor<V> processor, // Item<V> aPrioriValue, ItemDelta<V> aPrioriDelta, PrismObject<? extends ObjectType> aPrioriObject, // Boolean evaluateCurrent, MutableBoolean strongMappingWasUsed, // LensContext<F> context, LensElementContext<O> targetContext, // Task task, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException { public <V extends PrismValue, T extends ObjectType, F extends FocusType> void evaluateMappingSetProjection( MappingEvaluatorHelperParams<V, T, F> params, Task task, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException { String mappingDesc = params.getMappingDesc(); LensElementContext<T> targetContext = params.getTargetContext(); PrismObjectDefinition<T> targetObjectDefinition = targetContext.getObjectDefinition(); ItemPath defaultTargetItemPath = params.getDefaultTargetItemPath(); Map<ItemPath, MappingOutputStruct<V>> outputTripleMap = new HashMap<>(); XMLGregorianCalendar nextRecomputeTime = null; Collection<MappingType> mappingTypes = params.getMappingTypes(); Collection<Mapping<V>> mappings = new ArrayList<Mapping<V>>(mappingTypes.size()); for (MappingType mappingType : mappingTypes) { Mapping<V> mapping = mappingFactory.createMapping(mappingType, mappingDesc); if (!mapping.isApplicableToChannel(params.getContext().getChannel())) { continue; } mapping.setNow(params.getNow()); if (defaultTargetItemPath != null && targetObjectDefinition != null) { ItemDefinition defaultTargetItemDef = targetObjectDefinition .findItemDefinition(defaultTargetItemPath); mapping.setDefaultTargetDefinition(defaultTargetItemDef); mapping.setDefaultTargetPath(defaultTargetItemPath); } else { mapping.setDefaultTargetDefinition(params.getTargetItemDefinition()); mapping.setDefaultTargetPath(defaultTargetItemPath); } mapping.setTargetContext(targetObjectDefinition); // Initialize mapping (using Inversion of Control) params.getInitializer().initialize(mapping); Boolean timeConstraintValid = mapping.evaluateTimeConstraintValid(result); if (params.getEvaluateCurrent() != null) { if (params.getEvaluateCurrent() && !timeConstraintValid) { continue; } if (!params.getEvaluateCurrent() && timeConstraintValid) { continue; } } mappings.add(mapping); } for (Mapping<V> mapping : mappings) { if (mapping.getStrength() == MappingStrengthType.WEAK) { // Evaluate weak mappings in a second run. continue; } ItemPath mappingOutputPath = mapping.getOutputPath(); if (params.isFixTarget() && mappingOutputPath != null && defaultTargetItemPath != null && !mappingOutputPath.equivalent(defaultTargetItemPath)) { throw new ExpressionEvaluationException("Target cannot be overridden in " + mappingDesc); } if (params.getAPrioriTargetDelta() != null && mappingOutputPath != null) { ItemDelta<PrismValue> aPrioriItemDelta = params.getAPrioriTargetDelta() .findItemDelta(mappingOutputPath); if (mapping.getStrength() != MappingStrengthType.STRONG) { if (aPrioriItemDelta != null && !aPrioriItemDelta.isEmpty()) { continue; } } } LensUtil.evaluateMapping(mapping, params.getContext(), task, result); PrismValueDeltaSetTriple<V> mappingOutputTriple = mapping.getOutputTriple(); if (mappingOutputTriple != null) { MappingOutputStruct<V> mappingOutputStruct = outputTripleMap.get(mappingOutputPath); if (mappingOutputStruct == null) { mappingOutputStruct = new MappingOutputStruct<>(); outputTripleMap.put(mappingOutputPath, mappingOutputStruct); } if (mapping.getStrength() == MappingStrengthType.STRONG) { mappingOutputStruct.setStrongMappingWasUsed(true); } PrismValueDeltaSetTriple<V> outputTriple = mappingOutputStruct.getOutputTriple(); if (outputTriple == null) { mappingOutputStruct.setOutputTriple(mappingOutputTriple); } else { outputTriple.merge(mappingOutputTriple); } } } // Second pass, evaluate only weak mappings for (Mapping<V> mapping : mappings) { ItemPath mappingOutputPath = mapping.getOutputPath(); if (params.isFixTarget() && mappingOutputPath != null && defaultTargetItemPath != null && !mappingOutputPath.equivalent(defaultTargetItemPath)) { throw new ExpressionEvaluationException("Target cannot be overridden in " + mappingDesc); } MappingOutputStruct<V> mappingOutputStruct = outputTripleMap.get(mappingOutputPath); if (mappingOutputStruct == null) { mappingOutputStruct = new MappingOutputStruct<>(); outputTripleMap.put(mappingOutputPath, mappingOutputStruct); } PrismValueDeltaSetTriple<V> outputTriple = mappingOutputStruct.getOutputTriple(); Item<?> aPrioriTargetItem = null; PrismObject<T> aPrioriTargetObject = params.getAPrioriTargetObject(); if (aPrioriTargetObject != null && mappingOutputPath != null) { aPrioriTargetItem = aPrioriTargetObject.findItem(mappingOutputPath); } if ((aPrioriTargetItem == null || aPrioriTargetItem.isEmpty()) && outputTriple == null) { if (mapping.getStrength() != MappingStrengthType.WEAK) { continue; } LensUtil.evaluateMapping(mapping, params.getContext(), task, result); PrismValueDeltaSetTriple<V> mappingOutputTriple = mapping.getOutputTriple(); if (mappingOutputTriple != null) { if (outputTriple == null) { mappingOutputStruct.setOutputTriple(mappingOutputTriple); } else { outputTriple.merge(mappingOutputTriple); } } } } MappingOutputProcessor<V> processor = params.getProcessor(); for (Entry<ItemPath, MappingOutputStruct<V>> outputTripleMapEntry : outputTripleMap.entrySet()) { ItemPath mappingOutputPath = outputTripleMapEntry.getKey(); MappingOutputStruct<V> mappingOutputStruct = outputTripleMapEntry.getValue(); PrismValueDeltaSetTriple<V> outputTriple = mappingOutputStruct.getOutputTriple(); if (processor != null) { processor.process(mappingOutputPath, outputTriple); } else { if (outputTriple == null) { LOGGER.trace("{} expression resulted in null triple for {}, skipping", mappingDesc, targetContext); continue; } ItemDefinition targetItemDefinition = null; if (mappingOutputPath != null) { targetItemDefinition = targetObjectDefinition.findItemDefinition(mappingOutputPath); if (targetItemDefinition == null) { throw new SchemaException( "No definition for item " + mappingOutputPath + " in " + targetObjectDefinition); } } else { targetItemDefinition = params.getTargetItemDefinition(); } ItemDelta<V> targetItemDelta = targetItemDefinition.createEmptyDelta(mappingOutputPath); Item<V> aPrioriTargetItem = null; PrismObject<T> aPrioriTargetObject = params.getAPrioriTargetObject(); if (aPrioriTargetObject != null) { aPrioriTargetItem = (Item<V>) aPrioriTargetObject.findItem(mappingOutputPath); } if (targetContext.isAdd()) { Collection<V> nonNegativeValues = outputTriple.getNonNegativeValues(); if (nonNegativeValues == null || nonNegativeValues.isEmpty()) { LOGGER.trace("{} resulted in null or empty value for {}, skipping", mappingDesc, targetContext); continue; } targetItemDelta.setValuesToReplace(PrismValue.cloneCollection(nonNegativeValues)); } else { // if we have fresh information (full shadow) AND the mapping used to derive the information was strong, // we will consider all values (zero & plus sets) -- otherwise, we take only the "plus" (i.e. changed) set // the first case is necessary, because in some situations (e.g. when mapping is changed) // the evaluator sees no differences w.r.t. real state, even if there is a difference // - and we must have a way to push new information onto the resource Collection<V> valuesToReplace; if (params.hasFullTargetObject() && mappingOutputStruct.isStrongMappingWasUsed()) { valuesToReplace = outputTriple.getNonNegativeValues(); } else { valuesToReplace = outputTriple.getPlusSet(); } if (valuesToReplace != null && !valuesToReplace.isEmpty()) { // if what we want to set is the same as is already in the shadow, we skip that // (we insist on having full shadow, to be sure we work with current data) if (params.hasFullTargetObject() && targetContext.isFresh() && aPrioriTargetItem != null) { Collection<V> valuesPresent = aPrioriTargetItem.getValues(); if (PrismValue.equalsRealValues(valuesPresent, valuesToReplace)) { LOGGER.trace("{} resulted in existing values for {}, skipping creation of a delta", mappingDesc, targetContext); continue; } } targetItemDelta.setValuesToReplace(PrismValue.cloneCollection(valuesToReplace)); } } if (targetItemDelta.isEmpty()) { continue; } LOGGER.trace("{} adding new delta for {}: {}", new Object[] { mappingDesc, targetContext, targetItemDelta }); targetContext.swallowToSecondaryDelta(targetItemDelta); } } // Figure out recompute time for (Mapping<V> mapping : mappings) { XMLGregorianCalendar mappingNextRecomputeTime = mapping.getNextRecomputeTime(); if (mappingNextRecomputeTime != null) { if (nextRecomputeTime == null || nextRecomputeTime.compare(mappingNextRecomputeTime) == DatatypeConstants.GREATER) { nextRecomputeTime = mappingNextRecomputeTime; } } } if (nextRecomputeTime != null) { boolean alreadyHasTrigger = false; if (params.getAPrioriTargetObject() != null) { for (TriggerType trigger : params.getAPrioriTargetObject().asObjectable().getTrigger()) { if (RecomputeTriggerHandler.HANDLER_URI.equals(trigger.getHandlerUri()) && nextRecomputeTime.equals(trigger.getTimestamp())) { alreadyHasTrigger = true; break; } } } if (!alreadyHasTrigger) { PrismContainerDefinition<TriggerType> triggerContDef = targetObjectDefinition .findContainerDefinition(ObjectType.F_TRIGGER); ContainerDelta<TriggerType> triggerDelta = triggerContDef .createEmptyDelta(new ItemPath(ObjectType.F_TRIGGER)); PrismContainerValue<TriggerType> triggerCVal = triggerContDef.createValue(); triggerDelta.addValueToAdd(triggerCVal); TriggerType triggerType = triggerCVal.asContainerable(); triggerType.setTimestamp(nextRecomputeTime); triggerType.setHandlerUri(RecomputeTriggerHandler.HANDLER_URI); targetContext.swallowToSecondaryDelta(triggerDelta); } } }
From source file:com.evolveum.midpoint.model.impl.lens.projector.ObjectTemplateProcessor.java
private <F extends FocusType> XMLGregorianCalendar collectTripleFromTemplate(LensContext<F> context, ObjectTemplateType objectTemplateType, ObjectTemplateMappingEvaluationPhaseType phase, ObjectDeltaObject<F> focusOdo, Map<ItemPath, DeltaSetTriple<? extends ItemValueWithOrigin<?, ?>>> outputTripleMap, int iteration, String iterationToken, XMLGregorianCalendar now, String contextDesc, Task task, OperationResult result) throws SchemaException, ExpressionEvaluationException, ObjectNotFoundException, PolicyViolationException {/*from w w w . ja v a2 s . c o m*/ XMLGregorianCalendar nextRecomputeTime = null; // Process includes for (ObjectReferenceType includeRef : objectTemplateType.getIncludeRef()) { PrismObject<ObjectTemplateType> includeObject = includeRef.asReferenceValue().getObject(); if (includeObject == null) { ObjectTemplateType includeObjectType = modelObjectResolver.resolve(includeRef, ObjectTemplateType.class, null, "include reference in " + objectTemplateType + " in " + contextDesc, task, result); includeObject = includeObjectType.asPrismObject(); // Store resolved object for future use (e.g. next waves). includeRef.asReferenceValue().setObject(includeObject); } LOGGER.trace("Including template {}", includeObject); ObjectTemplateType includeObjectType = includeObject.asObjectable(); XMLGregorianCalendar includeNextRecomputeTime = collectTripleFromTemplate(context, includeObjectType, phase, focusOdo, outputTripleMap, iteration, iterationToken, now, "include " + includeObject + " in " + objectTemplateType + " in " + contextDesc, task, result); if (includeNextRecomputeTime != null) { if (nextRecomputeTime == null || nextRecomputeTime.compare(includeNextRecomputeTime) == DatatypeConstants.GREATER) { nextRecomputeTime = includeNextRecomputeTime; } } } // Process own mappings List<ObjectTemplateMappingType> mappings = collectMappings(objectTemplateType); List<ObjectTemplateMappingType> sortedMappings = sortMappingsByDependencies(mappings); XMLGregorianCalendar templateNextRecomputeTime = collectTripleFromMappings(sortedMappings, phase, context, objectTemplateType, focusOdo, outputTripleMap, iteration, iterationToken, now, contextDesc, task, result); if (templateNextRecomputeTime != null) { if (nextRecomputeTime == null || nextRecomputeTime.compare(templateNextRecomputeTime) == DatatypeConstants.GREATER) { nextRecomputeTime = templateNextRecomputeTime; } } return nextRecomputeTime; }
From source file:com.evolveum.midpoint.test.util.TestUtil.java
public static void assertBetween(String message, XMLGregorianCalendar start, XMLGregorianCalendar end, XMLGregorianCalendar actual) { assertNotNull(message + " is null", actual); if (start != null) { assertTrue(message + ": expected time to be after " + start + " but it was " + actual, actual.compare(start) == DatatypeConstants.GREATER || actual.compare(start) == DatatypeConstants.EQUAL); }//from ww w .j a v a2 s .c om if (end != null) { assertTrue(message + ": expected time to be before " + end + " but it was " + actual, actual.compare(end) == DatatypeConstants.LESSER || actual.compare(end) == DatatypeConstants.EQUAL); } }
From source file:com.evolveum.midpoint.model.common.mapping.Mapping.java
private void parseTimeConstraints(Task task, OperationResult result) throws SchemaException, ObjectNotFoundException { MappingTimeDeclarationType timeFromType = mappingType.getTimeFrom(); MappingTimeDeclarationType timeToType = mappingType.getTimeTo(); if (timeFromType == null && timeToType == null) { timeConstraintValid = true;//w ww .j a v a 2 s . c o m return; } XMLGregorianCalendar timeFrom = parseTime(timeFromType, task, result); if (timeFrom == null && timeFromType != null) { // Time is specified but there is no value for it. // This means that event that should start validity haven't happened yet // therefore the mapping is not yet valid. timeConstraintValid = false; return; } XMLGregorianCalendar timeTo = parseTime(timeToType, task, result); if (timeFrom != null && timeFrom.compare(now) == DatatypeConstants.GREATER) { // before timeFrom nextRecomputeTime = timeFrom; timeConstraintValid = false; return; } if (timeTo == null && timeToType != null) { // Time is specified but there is no value for it. // This means that event that should stop validity haven't happened yet // therefore the mapping is still valid. timeConstraintValid = true; return; } if (timeTo != null && timeTo.compare(now) == DatatypeConstants.GREATER) { // between timeFrom and timeTo (also no timeFrom and before timeTo) nextRecomputeTime = timeTo; timeConstraintValid = true; return; } if (timeTo == null) { // after timeFrom and no timeTo // no nextRecomputeTime set, there is nothing to recompute in the future timeConstraintValid = true; return; } else { // after timeTo // no nextRecomputeTime set, there is nothing to recompute in the future timeConstraintValid = false; return; } }