Search in sources :

Example 66 with FaultMessage

use of com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage in project midpoint by Evolveum.

the class AbstractTestForExchangeConnector method getObjectNoFetch.

protected <T extends ObjectType> T getObjectNoFetch(Class<T> clazz, String oid) throws SAXException, IOException, FaultMessage {
    SelectorQualifiedGetOptionsType options = new SelectorQualifiedGetOptionsType();
    SelectorQualifiedGetOptionType option = new SelectorQualifiedGetOptionType();
    GetOperationOptionsType getOptions = new GetOperationOptionsType();
    getOptions.setNoFetch(true);
    option.setOptions(getOptions);
    options.getOption().add(option);
    return getObject(clazz, oid, options);
}
Also used : GetOperationOptionsType(com.evolveum.midpoint.xml.ns._public.common.common_3.GetOperationOptionsType) SelectorQualifiedGetOptionType(com.evolveum.midpoint.xml.ns._public.common.common_3.SelectorQualifiedGetOptionType) SelectorQualifiedGetOptionsType(com.evolveum.midpoint.xml.ns._public.common.common_3.SelectorQualifiedGetOptionsType)

Example 67 with FaultMessage

use of com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage in project midpoint by Evolveum.

the class AbstractTestForExchangeConnector method deleteObject.

protected void deleteObject(Class objectClass, String oid, boolean ignoreFailures, ModelExecuteOptionsType executeOptionsType) throws FaultMessage {
    System.out.println("Deleting " + objectClass.getSimpleName() + " " + oid);
    ObjectDeltaType deltaType = new ObjectDeltaType();
    deltaType.setObjectType(ModelClientUtil.getTypeQName(objectClass));
    deltaType.setChangeType(ChangeTypeType.DELETE);
    deltaType.setOid(oid);
    ObjectDeltaListType deltaListType = new ObjectDeltaListType();
    deltaListType.getDelta().add(deltaType);
    if (!ignoreFailures) {
        modelPort.executeChanges(deltaListType, executeOptionsType);
    } else {
        try {
            modelPort.executeChanges(deltaListType, executeOptionsType);
        } catch (Exception e) {
            System.err.println("Cannot remove " + oid + ": " + e.getMessage());
        }
    }
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType) JAXBException(javax.xml.bind.JAXBException) FileNotFoundException(java.io.FileNotFoundException) SAXException(org.xml.sax.SAXException) IOException(java.io.IOException)

Example 68 with FaultMessage

use of com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage in project midpoint by Evolveum.

the class AbstractTestForExchangeConnector method createAddressBookPolicy.

protected String createAddressBookPolicy(String name, Collection<String> addressLists, String gal, String oab, String rooms) throws FaultMessage {
    Document doc = ModelClientUtil.getDocumnent();
    ShadowType shadow = new ShadowType();
    shadow.setName(ModelClientUtil.createPolyStringType(name, doc));
    shadow.setResourceRef(createObjectReferenceType(ResourceType.class, getResourceOid()));
    shadow.setObjectClass(OC_ADDRESS_BOOK_POLICY);
    shadow.setKind(ShadowKindType.GENERIC);
    shadow.setIntent("address-book-policy");
    ShadowAttributesType attributes = new ShadowAttributesType();
    attributes.getAny().add(ModelClientUtil.createTextElement(new QName(NS_ICFS, "name"), name, doc));
    for (String addressList : addressLists) {
        attributes.getAny().add(ModelClientUtil.createTextElement(new QName(NS_RI, "AddressLists"), addressList, doc));
    }
    attributes.getAny().add(ModelClientUtil.createTextElement(new QName(NS_RI, "GlobalAddressList"), gal, doc));
    attributes.getAny().add(ModelClientUtil.createTextElement(new QName(NS_RI, "OfflineAddressBook"), oab, doc));
    attributes.getAny().add(ModelClientUtil.createTextElement(new QName(NS_RI, "RoomList"), rooms, doc));
    shadow.setAttributes(attributes);
    return createShadow(shadow);
}
Also used : ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) QName(javax.xml.namespace.QName) ShadowAttributesType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowAttributesType) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) Document(org.w3c.dom.Document)

Example 69 with FaultMessage

use of com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage in project midpoint by Evolveum.

the class AbstractTestForExchangeConnector method createUser.

protected String createUser(UserType userType) throws FaultMessage {
    ObjectDeltaType deltaType = new ObjectDeltaType();
    deltaType.setObjectType(ModelClientUtil.getTypeQName(UserType.class));
    deltaType.setChangeType(ChangeTypeType.ADD);
    deltaType.setObjectToAdd(userType);
    ObjectDeltaListType deltaListType = new ObjectDeltaListType();
    deltaListType.getDelta().add(deltaType);
    ObjectDeltaOperationListType operationListType = modelPort.executeChanges(deltaListType, null);
    String oid = ModelClientUtil.getOidFromDeltaOperationList(operationListType, deltaType);
    return oid;
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) ObjectDeltaOperationListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)

Example 70 with FaultMessage

use of com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage in project midpoint by Evolveum.

the class AbstractTestForExchangeConnector method changeUserGivenName.

protected void changeUserGivenName(String oid, String newValue) throws FaultMessage {
    Document doc = ModelClientUtil.getDocumnent();
    ObjectDeltaType userDelta = new ObjectDeltaType();
    userDelta.setOid(oid);
    userDelta.setObjectType(ModelClientUtil.getTypeQName(UserType.class));
    userDelta.setChangeType(ChangeTypeType.MODIFY);
    ItemDeltaType itemDelta = new ItemDeltaType();
    itemDelta.setModificationType(ModificationTypeType.REPLACE);
    itemDelta.setPath(ModelClientUtil.createItemPathType("givenName"));
    itemDelta.getValue().add(ModelClientUtil.createPolyStringType(newValue, doc));
    userDelta.getItemDelta().add(itemDelta);
    ObjectDeltaListType deltaList = new ObjectDeltaListType();
    deltaList.getDelta().add(userDelta);
    modelPort.executeChanges(deltaList, null);
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) Document(org.w3c.dom.Document) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType) ItemDeltaType(com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType)

Aggregations

OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)46 ObjectDeltaType (com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType)36 ObjectDeltaListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)33 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)32 Holder (javax.xml.ws.Holder)32 SelectorQualifiedGetOptionsType (com.evolveum.midpoint.xml.ns._public.common.common_3.SelectorQualifiedGetOptionsType)25 ObjectDeltaOperationListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType)22 FaultMessage (com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage)22 Test (org.testng.annotations.Test)22 ObjectListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectListType)21 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)17 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)16 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)16 QName (javax.xml.namespace.QName)15 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)13 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)13 Document (org.w3c.dom.Document)13 ModelExecuteOptionsType (com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType)10 QueryType (com.evolveum.prism.xml.ns._public.query_3.QueryType)10 ItemDeltaType (com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType)10