public static boolean hasValidFrom(ShadowType objectType) { ActivationType activation = objectType.getActivation(); return activation != null && activation.getValidFrom() != null; }
public ActivationAsserter<RA> assertNoValidFrom() { assertNull("Unexpected validFrom in " + desc() + ": " + getActivation().getValidFrom(), getActivation().getValidFrom()); return this; }
protected void assertValidFrom(PrismObject<? extends ObjectType> obj, Date expectedDate) { assertEquals("Wrong validFrom in "+obj, XmlTypeConverter.createXMLGregorianCalendar(expectedDate), getActivation(obj).getValidFrom()); }
public ActivationAsserter<RA> assertValidFrom(XMLGregorianCalendar expected) { assertEquals("Wrong validFrom in " + desc(), expected, getActivation().getValidFrom()); return this; }
public TimeIntervalStatusType getValidityStatus(ActivationType activationType, XMLGregorianCalendar referenceTime) { if (activationType == null || referenceTime == null) { return null; } XMLGregorianCalendar validFrom = activationType.getValidFrom(); XMLGregorianCalendar validTo = activationType.getValidTo(); if (validFrom == null && validTo == null) { return null; } TimeIntervalStatusType status = TimeIntervalStatusType.IN; if (validFrom != null && (referenceTime == null || referenceTime.compare(validFrom) == DatatypeConstants.LESSER)) { status = TimeIntervalStatusType.BEFORE; } if (validTo != null && referenceTime.compare(validTo) == DatatypeConstants.GREATER) { status = TimeIntervalStatusType.AFTER; } return status; }
public ActivationAsserter<RA> assertValidFrom(Date expected) { assertEquals("Wrong validFrom in " + desc(), XmlTypeConverter.createXMLGregorianCalendar(expected), getActivation().getValidFrom()); return this; }
private void checkAssignmentValidity(UserType jack, XMLGregorianCalendar validFrom, XMLGregorianCalendar validTo) { assertEquals("jack's assignments", 1, jack.getAssignment().size()); AssignmentType assignmentType = jack.getAssignment().get(0); assertEquals("wrong validFrom", validFrom, assignmentType.getActivation().getValidFrom()); assertEquals("wrong validTo", validTo, assignmentType.getActivation().getValidTo()); }
protected void checkNoAssignmentValidity(UserType jack) { assertEquals("jack's assignments", 1, jack.getAssignment().size()); AssignmentType assignmentType = jack.getAssignment().get(0); if (assignmentType.getActivation() != null) { assertNull("validFrom already set", assignmentType.getActivation().getValidFrom()); assertNull("validTo already set", assignmentType.getActivation().getValidTo()); } }
public static void fromJaxb(ActivationType jaxb, RActivation repo, RepositoryContext repositoryContext) throws DtoTranslationException { Validate.notNull(jaxb, "JAXB object must not be null."); Validate.notNull(repo, "Repo object must not be null."); repo.setAdministrativeStatus(RUtil.getRepoEnumValue(jaxb.getAdministrativeStatus(), RActivationStatus.class)); repo.setEffectiveStatus(RUtil.getRepoEnumValue(jaxb.getEffectiveStatus(), RActivationStatus.class)); repo.setValidityStatus(RUtil.getRepoEnumValue(jaxb.getValidityStatus(), RTimeIntervalStatus.class)); repo.setValidFrom(jaxb.getValidFrom()); repo.setValidTo(jaxb.getValidTo()); repo.setDisableReason(jaxb.getDisableReason()); repo.setArchiveTimestamp(jaxb.getArchiveTimestamp()); repo.setDisableTimestamp(jaxb.getDisableTimestamp()); repo.setEnableTimestamp(jaxb.getEnableTimestamp()); repo.setValidityChangeTimestamp(jaxb.getValidityChangeTimestamp()); }
public static void checkShadowActivationConsistency(PrismObject<ShadowType> shadow) { if (shadow == null) { // just for sure return; } ActivationType activation = shadow.asObjectable().getActivation(); if (activation == null) { return; } FailedOperationTypeType failedOperation = shadow.asObjectable().getFailedOperationType(); if (failedOperation == FailedOperationTypeType.ADD) { return; // in this case it's ok to have activation present } if (activation.getAdministrativeStatus() != null || activation.getEffectiveStatus() != null || activation.getValidFrom() != null || activation.getValidTo() != null || activation.getValidityStatus() != null || activation.getLockoutStatus() != null || activation.getLockoutExpirationTimestamp() != null || activation.getValidityChangeTimestamp() != null) { String m = "Unexpected content in shadow.activation for " + ObjectTypeUtil.toShortString(shadow) + ": " + activation; LOGGER.warn("{}", m); //throw new IllegalStateException(m); // use only for testing } }
attributes.add(AttributeBuilder.build(OperationalAttributes.ENABLE_DATE_NAME, XmlTypeConverter.toMillis(shadowType.getActivation().getValidFrom())));
i = i.item(ShadowType.F_ACTIVATION, ActivationType.F_EFFECTIVE_STATUS).replace(); if (activation.getValidFrom() != null) { i = i.item(ShadowType.F_ACTIVATION, ActivationType.F_VALID_FROM).replace();