public void adopt(PrismContext prismContext) throws SchemaException { for (ObjectDelta<O> thisWave: this.waves) { if (thisWave != null) { prismContext.adopt(thisWave); } } }
public void adopt(PrismContext prismContext) throws SchemaException { if (objectNew != null) { prismContext.adopt(objectNew); } if (objectOld != null) { prismContext.adopt(objectOld); } if (objectCurrent != null) { prismContext.adopt(objectCurrent); } if (primaryDelta != null) { prismContext.adopt(primaryDelta); } // TODO: object definition? }
private <T> void adopt(T object, Class<T> type) throws SchemaException { if (object instanceof Objectable) { getPrismContext().adopt(((Objectable)object)); } }
public PrismContainerImpl(QName name, Class<C> compileTimeClass, PrismContext prismContext) { this(name, compileTimeClass); this.prismContext = prismContext; if (prismContext != null) { try { prismContext.adopt(this); } catch (SchemaException e) { throw new SystemException("Schema exception when adopting freshly created PrismContainer: " + this); } } }
public static <O extends Objectable, C extends Containerable> Collection<PrismContainerValue<C>> toPrismContainerValues( Class<O> type, ItemPath path, PrismContext prismContext, C... containerValues) throws SchemaException { Collection<PrismContainerValue<C>> pvalues = new ArrayList<>(containerValues.length); for (C val: containerValues) { prismContext.adopt(val, type, path); PrismUtil.recomputeRealValue(val, prismContext); PrismContainerValue<C> pval = val.asPrismContainerValue(); pvalues.add(pval); } return pvalues; } }
private void adopt(Object object) throws SchemaException { if (object instanceof JAXBElement) { adopt(((JAXBElement)object).getValue()); } else if (object instanceof Objectable) { getPrismContext().adopt(((Objectable)(object))); } }
protected void loginSuperUser(MidPointPrincipal principal) throws SchemaException { AuthorizationType superAutzType = new AuthorizationType(); prismContext.adopt(superAutzType, RoleType.class, RoleType.F_AUTHORIZATION); superAutzType.getAction().add(AuthorizationConstants.AUTZ_ALL_URL); Authorization superAutz = new Authorization(superAutzType); Collection<Authorization> authorities = principal.getAuthorities(); authorities.add(superAutz); SecurityContext securityContext = SecurityContextHolder.getContext(); Authentication authentication = new UsernamePasswordAuthenticationToken(principal, null); securityContext.setAuthentication(authentication); }
public static <T extends Containerable,O extends Objectable> ContainerDeltaImpl<T> createModificationAdd( ItemPath containerPath, Class<O> type, PrismContext prismContext, PrismContainerValue<T> cValue) throws SchemaException { ContainerDeltaImpl<T> delta = createDelta(containerPath, type, prismContext); prismContext.adopt(cValue, type, containerPath); delta.addValuesToAdd(cValue); return delta; }
public static <T extends Containerable,O extends Objectable> ContainerDeltaImpl<T> createModificationDelete( ItemPath containerPath, Class<O> type, PrismContext prismContext, PrismContainerValue<T> cValue) throws SchemaException { ContainerDeltaImpl<T> delta = createDelta(containerPath, type, prismContext); prismContext.adopt(cValue, type, containerPath); delta.addValuesToDelete(cValue); return delta; }
public static <T extends Objectable> void revive(Objectable object, PrismContext prismContext) throws DtoTranslationException { try { prismContext.adopt(object); } catch (SchemaException ex) { throw new DtoTranslationException(ex.getMessage(), ex); } }
public static <T extends Containerable,O extends Objectable> ContainerDeltaImpl<T> createModificationReplace( ItemPath containerPath, Class<O> type, PrismContext prismContext, PrismContainerValue<T> cValue) throws SchemaException { ContainerDeltaImpl<T> delta = createDelta(containerPath, type, prismContext); prismContext.adopt(cValue, type, containerPath); delta.setValuesToReplace(cValue); return delta; }
@SafeVarargs static <O extends Objectable, C extends Containerable> void fillInModificationAddContainer( ObjectDelta<O> objectDelta, ItemPath propertyPath, PrismContext prismContext, C... containerables) throws SchemaException { ContainerDelta<C> containerDelta = objectDelta.createContainerModification(propertyPath); if (containerables != null) { for (C containerable: containerables) { prismContext.adopt(containerable, objectDelta.getObjectTypeClass(), propertyPath); PrismContainerValue<C> prismContainerValue = containerable.asPrismContainerValue(); containerDelta.addValueToAdd(prismContainerValue); } } }
@SafeVarargs static <O extends Objectable, C extends Containerable> void fillInModificationDeleteContainer( ObjectDelta<O> objectDelta, ItemPath propertyPath, PrismContext prismContext, C... containerables) throws SchemaException { ContainerDelta<C> containerDelta = objectDelta.createContainerModification(propertyPath); if (containerables != null) { for (C containerable: containerables) { prismContext.adopt(containerable, objectDelta.getObjectTypeClass(), propertyPath); PrismContainerValue<C> prismContainerValue = containerable.asPrismContainerValue(); containerDelta.addValueToDelete(prismContainerValue); } } }
public static void adopt(ObjectDeltaType delta, PrismContext prismContext) throws SchemaException { if (delta == null) { return; } if (delta.getObjectToAdd() != null) { prismContext.adopt(delta.getObjectToAdd().asPrismObject()); } for (ItemDeltaType itemDelta : delta.getItemDelta()) { adopt(itemDelta, prismContext); } }
private void writeObject(ObjectType obj, Writer writer) throws IOException, SchemaException { PrismObject prism = obj.asPrismObject(); prismContext.adopt(prism); writer.write(prismContext.serializerFor(PrismContext.LANG_XML).serialize(prism)); writer.write('\n'); }
private <T extends ObjectType> void executeChange(PrismObject<T> focalObject, Task coordinatorTask, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ObjectAlreadyExistsException, ConfigurationException, PolicyViolationException, SecurityViolationException { LOGGER.trace("Executing change on object {}", focalObject); ObjectDelta<T> delta = createDeltaFromTask(coordinatorTask); if (delta == null) { throw new IllegalStateException("No delta in the task"); } delta.setOid(focalObject.getOid()); if (focalObject.getCompileTimeClass() != null) { delta.setObjectTypeClass(focalObject.getCompileTimeClass()); } prismContext.adopt(delta); model.executeChanges(Collections.singletonList(delta), getExecuteOptionsFromTask(task), task, result); LOGGER.trace("Execute changes {} for object {}: {}", delta, focalObject, result.getStatus()); }
@Test public void testSerializeExecuteCredentialResetResponseType() throws Exception { System.out.println("===[ testSerializeExecuteCredentialResetResponseType ]==="); PrismContext prismContext = getPrismContext(); SingleLocalizableMessage localizableMessage = new SingleLocalizableMessage("execute.reset.credential.bad.request", null, "Failed to execute reset password. Bad request."); LocalizableMessageType localizableMessageBean = LocalizationUtil.createLocalizableMessageType(localizableMessage); ExecuteCredentialResetResponseType response = new ExecuteCredentialResetResponseType(); response.setMessage(localizableMessageBean); QName fakeQName = new QName(PrismConstants.NS_TYPES, "object"); prismContext.adopt(response); String xml = prismContext.xmlSerializer().serializeAnyData(response, fakeQName); System.out.println(xml); }
private OrgType createOrgType(String name, ObjectReferenceType parentRef) throws Exception { OrgType orgType = new OrgType(); orgType.setOid(UUID.randomUUID().toString()); orgType.setName(new PolyStringType(name)); orgType.setIdentifier(UUID.randomUUID().toString()); orgType.setDisplayName(new PolyStringType(name)); if (parentRef != null) { orgType.setCostCenter(parentRef.getOid().substring(4)); orgType.getParentOrgRef().add(parentRef); } prismContext.adopt(orgType); return orgType; } }
private ObjectDeltaOperation createObjectDeltaOperation(int i) throws Exception { ObjectDeltaOperation delta = new ObjectDeltaOperation(); delta.setExecutionResult(new OperationResult("asdf")); UserType user = new UserType(); prismContext.adopt(user); PolyStringType name = new PolyStringType(); name.setOrig("a" + i); name.setNorm("a" + i); user.setName(name); delta.setObjectDelta(DeltaFactory.Object.createAddDelta(user.asPrismObject())); return delta; } }