protected void copyValues(ObjectDeltaImpl<O> clone) { clone.oid = this.oid; for (ItemDelta<?,?> thisModification: this.modifications) { ((Collection)clone.modifications).add(thisModification.clone()); } if (this.objectToAdd == null) { clone.objectToAdd = null; } else { clone.objectToAdd = this.objectToAdd.clone(); } }
protected void copyValues(CloneStrategy strategy, PrismReferenceValueImpl clone) { super.copyValues(strategy, clone); clone.targetType = this.targetType; if (this.object != null && strategy == CloneStrategy.LITERAL) { clone.object = this.object.clone(); } clone.description = this.description; clone.filter = this.filter; clone.resolutionTime = this.resolutionTime; clone.relation = this.relation; clone.targetName = this.targetName; }
public PrismObject<O> createImmutableClone() { PrismObject<O> clone = ((PrismObject) this).clone(); clone.setImmutable(true); return clone; }
public static <T extends Objectable> ObjectDeltaObject<T> create(PrismObject<T> oldObject, ObjectDelta<T> delta) throws SchemaException { PrismObject<T> newObject = oldObject.clone(); delta.applyTo(newObject); return new ObjectDeltaObject<>(oldObject, delta, newObject); }
private <T extends ObjectType> void cacheObject(Cache cache, PrismObject<T> object, boolean readOnly) { if (cache != null) { PrismObject<ObjectType> objectToCache; if (readOnly) { object.setImmutable(true); objectToCache = (PrismObject<ObjectType>) object; } else { objectToCache = (PrismObject<ObjectType>) object.clone(); } cache.putObject(object.getOid(), objectToCache); } }
public ShadowType clone() { ShadowType object = new ShadowType(); PrismObject value = asPrismObject().clone(); object.setupContainer(value); return object; }
public AccessCertificationDefinitionForReportType clone() { AccessCertificationDefinitionForReportType object = new AccessCertificationDefinitionForReportType(); PrismObject value = asPrismObject().clone(); object.setupContainer(value); return object; }
public FunctionLibraryType clone() { FunctionLibraryType object = new FunctionLibraryType(); PrismObject value = asPrismObject().clone(); object.setupContainer(value); return object; }
public DashboardType clone() { DashboardType object = new DashboardType(); PrismObject value = asPrismObject().clone(); object.setupContainer(value); return object; }
public ServiceType clone() { ServiceType object = new ServiceType(); PrismObject value = asPrismObject().clone(); object.setupContainer(value); return object; }
public ObjectTemplateType clone() { ObjectTemplateType object = new ObjectTemplateType(); PrismObject value = asPrismObject().clone(); object.setupContainer(value); return object; }
public ReportType clone() { ReportType object = new ReportType(); PrismObject value = asPrismObject().clone(); object.setupContainer(value); return object; }
public ReportOutputType clone() { ReportOutputType object = new ReportOutputType(); PrismObject value = asPrismObject().clone(); object.setupContainer(value); return object; }
public SequenceType clone() { SequenceType object = new SequenceType(); PrismObject value = asPrismObject().clone(); object.setupContainer(value); return object; }
public UserType clone() { UserType object = new UserType(); PrismObject value = asPrismObject().clone(); object.setupContainer(value); return object; }
public AccessCertificationDefinitionType clone() { AccessCertificationDefinitionType object = new AccessCertificationDefinitionType(); PrismObject value = asPrismObject().clone(); object.setupContainer(value); return object; }
@Test public void test300Clone() throws Exception { System.out.println("===[ test300Clone ]==="); PrismObject<UserType> jack = getJack(); measure("jack.clone", () -> jack.clone()); }
@Test public void testDiffSameValues() throws Exception { PrismObject<ResourceType> before = PrismTestUtil.parseObject(new File(TEST_DIR, "resource-white-before.xml")); PrismObject<ResourceType> after = PrismTestUtil.parseObject(new File(TEST_DIR, "resource-white-after.xml")); Collection<? extends ItemDelta> differences = before.diffModifications(after, EquivalenceStrategy.LITERAL_IGNORE_METADATA); assertEquals(1, differences.size()); System.out.println(differences.iterator().next().debugDump()); PrismObject<ResourceType> differencesApplied = before.clone(); ItemDeltaCollectionsUtil.applyTo(differences, differencesApplied); System.out.println(differencesApplied.debugDump()); assertEquals("'after' is different from the object with differences applied", after, differencesApplied); }
private <T extends ObjectType> void assertReencryptDelta(String label, Collection<? extends ItemDelta<?, ?>> modifications, int expectedModificationsCount, PrismObject<T> oldObject, Protector protector) throws SchemaException, EncryptionException { System.out.println("Modifications for " + label + ":\n" + modifications); assertEquals("Delta has wrong # of modifications: " + label, expectedModificationsCount, modifications.size()); PrismObject<T> patchedObject = oldObject.clone(); ItemDeltaCollectionsUtil.applyTo(modifications, patchedObject); int fixes = CryptoUtil.reencryptValues(protector, patchedObject); assertEquals("Wrong # of re-encryption fixes on reencrypted object: " + label, 0, fixes); }
@Test public void testReplaceModelOperationContext() throws Exception { PrismObject prismObject = PrismTestUtil.parseObject(new File(TEST_DIR, "task-modelOperationContext-before.xml")); ObjectDelta delta = getPrismContext().deltaFactory().object().createEmptyModifyDelta(TaskType.class, prismObject.getOid() ); delta.addModificationReplaceContainer(TaskType.F_MODEL_OPERATION_CONTEXT); PrismObject changed = prismObject.clone(); ItemDeltaCollectionsUtil.applyTo(delta.getModifications(), changed); Collection<? extends ItemDelta> processedModifications = prismObject.diffModifications(changed, EquivalenceStrategy.LITERAL_IGNORE_METADATA); ItemDeltaCollectionsUtil.applyTo(processedModifications, prismObject); assertNull(prismObject.findContainer(TaskType.F_MODEL_OPERATION_CONTEXT)); }