public ObjectDeltaListType delta(ObjectDeltaType value) { getDelta().add(value); return this; }
public static Collection<ObjectDelta> createObjectDeltas(ObjectDeltaListType deltaList, PrismContext prismContext) throws SchemaException { List<ObjectDelta> retval = new ArrayList<>(); for (ObjectDeltaType deltaType : deltaList.getDelta()) { retval.add(createObjectDelta(deltaType, prismContext)); } return retval; } }
/** * Creates a new {@code ObjectDeltaListType} instance by deeply copying a given {@code ObjectDeltaListType} instance. * * * @param o * The instance to copy. * @throws NullPointerException * if {@code o} is {@code null}. */ public ObjectDeltaListType(final ObjectDeltaListType o) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 super(); if (o == null) { throw new NullPointerException("Cannot create a copy of 'ObjectDeltaListType' from 'null'."); } // 'Delta' collection. if (o.delta!= null) { copyDelta(o.getDelta(), this.getDelta()); } }
public static ObjectDeltaListType createDeltaList(ObjectDeltaType... deltas) { ObjectDeltaListType list = new ObjectDeltaListType(); for (ObjectDeltaType delta: deltas) { list.getDelta().add(delta); } return list; }
/** * Creates and returns a deep copy of this object. * * * @return * A deep copy of this object. */ @Override public ObjectDeltaListType clone() { try { { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 final ObjectDeltaListType clone = ((ObjectDeltaListType) super.clone()); // 'Delta' collection. if (this.delta!= null) { clone.delta = null; copyDelta(this.getDelta(), clone.getDelta()); } return clone; } } catch (CloneNotSupportedException e) { // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ throw new AssertionError(e); } }
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) { int currentHashCode = 1; { List<ObjectDeltaType> theDelta; theDelta = (((this.delta!= null)&&(!this.delta.isEmpty()))?this.getDelta():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "delta", theDelta), currentHashCode, theDelta); } return currentHashCode; }
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { if (!(object instanceof ObjectDeltaListType)) { return false; } if (this == object) { return true; } final ObjectDeltaListType that = ((ObjectDeltaListType) object); { List<ObjectDeltaType> lhsDelta; lhsDelta = (((this.delta!= null)&&(!this.delta.isEmpty()))?this.getDelta():null); List<ObjectDeltaType> rhsDelta; rhsDelta = (((that.delta!= null)&&(!that.delta.isEmpty()))?that.getDelta():null); if (!strategy.equals(LocatorUtils.property(thisLocator, "delta", lhsDelta), LocatorUtils.property(thatLocator, "delta", rhsDelta), lhsDelta, rhsDelta)) { return false; } } return true; }
public static <O extends ObjectType> ObjectDeltaListType createModificationDeltaList(Class<O> type, String oid, String path, ModificationTypeType modType, Object... values) { ObjectDeltaListType deltaList = new ObjectDeltaListType(); ObjectDeltaType delta = new ObjectDeltaType(); delta.setObjectType(getTypeQName(type)); delta.setChangeType(ChangeTypeType.MODIFY); delta.setOid(oid); ItemDeltaType itemDelta = new ItemDeltaType(); itemDelta.setPath(ModelClientUtil.createItemPathType(path)); itemDelta.setModificationType(modType); itemDelta.getValue().addAll(Arrays.asList(values)); delta.getItemDelta().add(itemDelta); deltaList.getDelta().add(delta); return deltaList; }
@Test public void test200ModifyAccountWrongExplicitType() throws Exception { final String TEST_NAME = "test200ModifyAccountWrongExplicitType"; TestUtil.displayTestTitle(this, TEST_NAME); // GIVEN Task task = taskManager.createTaskInstance(TestModelWebServiceNegative.class.getName() + "." + TEST_NAME); ObjectDeltaType objectChange = createShadowReplaceChange(ACCOUNT_SHADOW_GUYBRUSH_OID, "attributes/"+DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME, "42", DOMUtil.XSD_INT); ObjectDeltaListType deltaList = new ObjectDeltaListType(); deltaList.getDelta().add(objectChange); // WHEN, THEN //assertExecuteChangesFailure(deltaList, null, SchemaViolationFaultType.class, "The value of type", "cannot be applied to attribute"); assertExecuteChangesFailure(deltaList, null, SchemaViolationFaultType.class, "Expected", "but got class"); }
private OperationResultType modifyObjectViaModelWS(ObjectDeltaType objectChange) throws FaultMessage { ObjectDeltaListType deltaList = new ObjectDeltaListType(); deltaList.getDelta().add(objectChange); ObjectDeltaOperationListType list = modelWeb.executeChanges(deltaList, null); return getOdoFromDeltaOperationList(list, objectChange).getExecutionResult(); }
/** * First tests are positive, to make sure that this method works. */ @Test public void test100ModifyAccountExplicitType() throws Exception { final String TEST_NAME = "test100ModifyUserAddAccount"; TestUtil.displayTestTitle(this, TEST_NAME); // GIVEN Task task = taskManager.createTaskInstance(TestModelWebServiceNegative.class.getName() + "." + TEST_NAME); ObjectDeltaType objectChange = createShadowReplaceChange(ACCOUNT_SHADOW_GUYBRUSH_OID, "attributes/"+DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME, "foo", DOMUtil.XSD_STRING); ObjectDeltaListType deltaList = new ObjectDeltaListType(); deltaList.getDelta().add(objectChange); // WHEN modelWeb.executeChanges(deltaList, null); // THEN // Check account in dummy resource assertDefaultDummyAccount(ACCOUNT_GUYBRUSH_DUMMY_USERNAME, ACCOUNT_GUYBRUSH_DUMMY_FULLNAME, true); assertDummyAccountAttribute(null, ACCOUNT_GUYBRUSH_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME, "foo"); }
/** * First tests are positive, to make sure that this method works. */ @Test public void test110ModifyAccountImplicitType() throws Exception { final String TEST_NAME = "test110ModifyAccountImplicitType"; TestUtil.displayTestTitle(this, TEST_NAME); // GIVEN Task task = taskManager.createTaskInstance(TestModelWebServiceNegative.class.getName() + "." + TEST_NAME); ObjectDeltaType objectChange = createShadowReplaceChange(ACCOUNT_SHADOW_GUYBRUSH_OID, "attributes/"+DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME, "bar", null); ObjectDeltaListType deltaList = new ObjectDeltaListType(); deltaList.getDelta().add(objectChange); // WHEN modelWeb.executeChanges(deltaList, null); // THEN // Check account in dummy resource assertDefaultDummyAccount(ACCOUNT_GUYBRUSH_DUMMY_USERNAME, ACCOUNT_GUYBRUSH_DUMMY_FULLNAME, true); assertDummyAccountAttribute(null, ACCOUNT_GUYBRUSH_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME, "bar"); }
deltaListType.getDelta().add(objectDeltaType);
private OperationResultType deleteObjectViaModelWS(QName typeQName, String oid) throws FaultMessage { ObjectDeltaListType deltaList = new ObjectDeltaListType(); ObjectDeltaType objectDelta = new ObjectDeltaType(); objectDelta.setOid(oid); objectDelta.setObjectType(typeQName); objectDelta.setChangeType(ChangeTypeType.DELETE); deltaList.getDelta().add(objectDelta); ObjectDeltaOperationListType list = modelWeb.executeChanges(deltaList, null); return getOdoFromDeltaOperationList(list, objectDelta).getExecutionResult(); }
private void addObjectViaModelWS(ObjectType objectType, ModelExecuteOptionsType options, Holder<String> oidHolder, Holder<OperationResultType> resultHolder) throws FaultMessage { ObjectDeltaListType deltaList = new ObjectDeltaListType(); ObjectDeltaType objectDelta = new ObjectDeltaType(); objectDelta.setObjectToAdd(objectType); QName type = objectType.asPrismObject().getDefinition().getTypeName(); objectDelta.setObjectType(type); objectDelta.setChangeType(ChangeTypeType.ADD); deltaList.getDelta().add(objectDelta); ObjectDeltaOperationListType objectDeltaOperationListType = modelWeb.executeChanges(deltaList, options); ObjectDeltaOperationType objectDeltaOperationType = getOdoFromDeltaOperationList(objectDeltaOperationListType, objectDelta); resultHolder.value = objectDeltaOperationType.getExecutionResult(); oidHolder.value = ((ObjectType) objectDeltaOperationType.getObjectDelta().getObjectToAdd()).getOid(); }