public static void cleanupShadowActivation(ShadowType repoShadowType) { // cleanup activation - we don't want to store these data in repo shadow (MID-2585) if (repoShadowType.getActivation() != null) { cleanupShadowActivation(repoShadowType.getActivation()); } }
public static boolean hasValidTo(ShadowType objectType) { ActivationType activation = objectType.getActivation(); return activation != null && activation.getValidTo() != null; }
public static boolean hasAdministrativeActivation(ShadowType objectType) { ActivationType activation = objectType.getActivation(); return activation != null && activation.getAdministrativeStatus() != null; }
public static boolean hasValidFrom(ShadowType objectType) { ActivationType activation = objectType.getActivation(); return activation != null && activation.getValidFrom() != null; }
public static boolean hasLockoutStatus(ShadowType objectType) { ActivationType activation = objectType.getActivation(); return activation != null && activation.getLockoutStatus() != null; }
public static boolean isLockedOut(ShadowType objectType) { return isLockedOut(objectType.getActivation()); }
public static boolean isAdministrativeEnabled(ShadowType objectType) { return isAdministrativeEnabled(objectType.getActivation()); }
public static ActivationType getOrCreateActivation(ShadowType shadowType) { ActivationType activation = shadowType.getActivation(); if (activation == null) { activation = new ActivationType(); shadowType.setActivation(activation); } return activation; }
private ActivationType getActivation() { return getObject().asObjectable().getActivation(); }
protected ActivationType getActivation(PrismObject<? extends ObjectType> obj) { ObjectType objectType = obj.asObjectable(); ActivationType activation; if (objectType instanceof ShadowType) { activation = ((ShadowType)objectType).getActivation(); } else if (objectType instanceof UserType) { activation = ((UserType)objectType).getActivation(); } else { throw new IllegalArgumentException("Cannot get activation from "+obj); } assertNotNull("No activation in " + obj, activation); return activation; }
protected void assertDisableTimestampShadow(PrismObject<? extends ShadowType> shadow, XMLGregorianCalendar startTime, XMLGregorianCalendar endTime) { XMLGregorianCalendar userDisableTimestamp = shadow.asObjectable().getActivation().getDisableTimestamp(); TestUtil.assertBetween("Wrong shadow disableTimestamp in "+shadow, startTime, endTime, userDisableTimestamp); }
protected void assertDisableReasonShadow(PrismObject<? extends ShadowType> shadow, String expectedReason) { String disableReason = shadow.asObjectable().getActivation().getDisableReason(); assertEquals("Wrong shadow disableReason in " + shadow, expectedReason, disableReason); }
protected void assertActivationAdministrativeStatus(PrismObject<ShadowType> shadow, ActivationStatusType expectedStatus) { ActivationType activationType = shadow.asObjectable().getActivation(); if (activationType == null) { if (expectedStatus == null) { return; } else { AssertJUnit.fail("Expected activation administrative status of "+shadow+" to be "+expectedStatus+", but there was no activation administrative status"); } } else { assertEquals("Wrong activation administrative status of "+shadow, expectedStatus, activationType.getAdministrativeStatus()); } }
protected void assertEnableTimestampShadow(PrismObject<? extends ShadowType> shadow, XMLGregorianCalendar startTime, XMLGregorianCalendar endTime) { ActivationType activationType = shadow.asObjectable().getActivation(); assertNotNull("No activation in "+shadow, activationType); XMLGregorianCalendar userDisableTimestamp = activationType.getEnableTimestamp(); TestUtil.assertBetween("Wrong shadow enableTimestamp in "+shadow, startTime, endTime, userDisableTimestamp); }
protected void assertShadowLockout(PrismObject<ShadowType> shadow, LockoutStatusType expectedStatus) { ActivationType activationType = shadow.asObjectable().getActivation(); if (activationType == null) { if (expectedStatus == null) { return; } else { AssertJUnit.fail("Expected lockout status of "+shadow+" to be "+expectedStatus+", but there was no lockout status"); } } else { assertEquals("Wrong lockout status of "+shadow, expectedStatus, activationType.getLockoutStatus()); } }
protected void assertActivationAdministrativeStatus(PrismObject<ShadowType> shadow, ActivationStatusType expectedStatus) { ActivationType activationType = shadow.asObjectable().getActivation(); if (activationType == null) { if (expectedStatus == null) { return; } else { AssertJUnit.fail("Expected activation administrative status of "+shadow+" to be "+expectedStatus+", but there was no activation administrative status"); } } else { assertEquals("Wrong activation administrative status of "+shadow, expectedStatus, activationType.getAdministrativeStatus()); } }
protected void assertShadowLockout(PrismObject<ShadowType> shadow, LockoutStatusType expectedStatus) { ActivationType activationType = shadow.asObjectable().getActivation(); if (activationType == null) { if (expectedStatus == null) { return; } else { AssertJUnit.fail("Expected lockout status of "+shadow+" to be "+expectedStatus+", but there was no lockout status"); } } else { assertEquals("Wrong lockout status of "+shadow, expectedStatus, activationType.getLockoutStatus()); } }
protected void assertRepoShadowCacheActivation(PrismObject<ShadowType> shadowRepo, ActivationStatusType expectedAdministrativeStatus) { ActivationType activationType = shadowRepo.asObjectable().getActivation(); if (activationType == null) { return; } ActivationStatusType administrativeStatus = activationType.getAdministrativeStatus(); assertNull("Unexpected activation administrativeStatus in repo shadow "+shadowRepo+": "+administrativeStatus, administrativeStatus); }
@Override protected void assertRepoShadowCacheActivation(PrismObject<ShadowType> shadowRepo, ActivationStatusType expectedAdministrativeStatus) { ActivationType activationType = shadowRepo.asObjectable().getActivation(); assertNotNull("No activation in repo shadow "+shadowRepo, activationType); ActivationStatusType administrativeStatus = activationType.getAdministrativeStatus(); assertEquals("Wrong activation administrativeStatus in repo shadow "+shadowRepo, expectedAdministrativeStatus, administrativeStatus); }
private void assertJaxb(ShadowType shadow, boolean isObject) throws SchemaException { if (isObject) { assertEquals("88519fca-3f4a-44ca-91c8-dc9be5bf3d03", shadow.getOid()); } assertEquals("Wrong name", PrismTestUtil.createPolyStringType("hbarbossa"), shadow.getName()); ActivationType activation = shadow.getActivation(); assertNotNull("No activation", activation); assertEquals("User not enabled", ActivationStatusType.ENABLED, activation.getAdministrativeStatus()); ObjectReferenceType resourceRef = shadow.getResourceRef(); assertNotNull("No resourceRef", resourceRef); assertEquals("Wrong resourceRef oid (jaxb)", "10000000-0000-0000-0000-000000000003", resourceRef.getOid()); assertEquals("Wrong resourceRef type (jaxb)", ResourceType.COMPLEX_TYPE, resourceRef.getType()); }