public ActivationType disableTimestamp(XMLGregorianCalendar value) { setDisableTimestamp(value); return this; }
public static void copyToJAXB(RActivation repo, ActivationType jaxb, PrismContext prismContext) { Validate.notNull(jaxb, "JAXB object must not be null."); Validate.notNull(repo, "Repo object must not be null."); if (repo.getAdministrativeStatus() != null) { jaxb.setAdministrativeStatus(repo.getAdministrativeStatus().getSchemaValue()); } if (repo.getEffectiveStatus() != null) { jaxb.setEffectiveStatus(repo.getEffectiveStatus().getSchemaValue()); } if (repo.getValidityStatus() != null) { jaxb.setValidityStatus(repo.getValidityStatus().getSchemaValue()); } jaxb.setValidFrom(repo.getValidFrom()); jaxb.setValidTo(repo.getValidTo()); jaxb.setDisableReason(repo.getDisableReason()); jaxb.setArchiveTimestamp(repo.getArchiveTimestamp()); jaxb.setDisableTimestamp(repo.getDisableTimestamp()); jaxb.setEnableTimestamp(repo.getEnableTimestamp()); jaxb.setValidityChangeTimestamp(repo.getValidityChangeTimestamp()); }
@Test public void testNoReferenceTime() throws Exception { final String TEST_NAME = "testNoReferenceTime"; System.out.println("===[ "+TEST_NAME+"]==="); // GIVEN PrismObject<UserType> userOld = evaluator.getUserOld(); userOld.asObjectable().getActivation().setDisableTimestamp(null); MappingImpl.Builder<PrismPropertyValue<Boolean>,PrismPropertyDefinition<Boolean>> builder = evaluator.createMappingBuilder( MAPPING_TIME_ACTIVATION, TEST_NAME, "title", null, userOld); builder.setNow(TIME_PAST); PrismPropertyDefinition<Boolean> existenceDef = evaluator.getPrismContext().definitionFactory().createPropertyDefinition( ExpressionConstants.OUTPUT_ELEMENT_NAME, DOMUtil.XSD_BOOLEAN); builder.setDefaultTargetDefinition(existenceDef); MappingImpl<PrismPropertyValue<Boolean>,PrismPropertyDefinition<Boolean>> mapping = builder.build(); OperationResult opResult = new OperationResult(TEST_NAME); // WHEN mapping.evaluate(null, opResult); // THEN PrismValueDeltaSetTriple<PrismPropertyValue<Boolean>> outputTriple = mapping.getOutputTriple(); assertNullTriple(outputTriple); assertNextRecompute(mapping, null); }
@Test public void testSetReferenceTimeBefore() throws Exception { final String TEST_NAME = "testSetReferenceTimeBefore"; System.out.println("===[ "+TEST_NAME+"]==="); // GIVEN PrismObject<UserType> userOld = evaluator.getUserOld(); XMLGregorianCalendar disableTimestamp = userOld.asObjectable().getActivation().getDisableTimestamp(); userOld.asObjectable().getActivation().setDisableTimestamp(null); ObjectDelta<UserType> delta = evaluator.getPrismContext().deltaFactory().object() .createModificationReplaceProperty(UserType.class, evaluator.USER_OLD_OID, ItemPath.create(UserType.F_ACTIVATION, ActivationType.F_DISABLE_TIMESTAMP), disableTimestamp); MappingImpl.Builder<PrismPropertyValue<Boolean>,PrismPropertyDefinition<Boolean>> builder = evaluator.createMappingBuilder( MAPPING_TIME_ACTIVATION, TEST_NAME, "title", delta, userOld); builder.setNow(TIME_PAST); PrismPropertyDefinition<Boolean> existenceDef = evaluator.getPrismContext().definitionFactory().createPropertyDefinition( ExpressionConstants.OUTPUT_ELEMENT_NAME, DOMUtil.XSD_BOOLEAN); builder.setDefaultTargetDefinition(existenceDef); MappingImpl<PrismPropertyValue<Boolean>,PrismPropertyDefinition<Boolean>> mapping = builder.build(); OperationResult opResult = new OperationResult(TEST_NAME); // WHEN mapping.evaluate(null, opResult); // THEN PrismValueDeltaSetTriple<PrismPropertyValue<Boolean>> outputTriple = mapping.getOutputTriple(); assertNullTriple(outputTriple); assertNextRecompute(mapping, TIME_MAPPING_DISABLED_PLUS_1M); }
userOld.asObjectable().getActivation().setDisableTimestamp(null);
resultActivationType.setDisableTimestamp(repoActivation.getDisableTimestamp()); resultActivationType.setArchiveTimestamp(repoActivation.getArchiveTimestamp()); resultActivationType.setValidityChangeTimestamp(repoActivation.getValidityChangeTimestamp());