Search in sources :

Example 66 with AssignmentType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType in project midpoint by Evolveum.

the class PerfTestPrismObjectSize method replaceDelta.

@Test(dataProvider = "combinations")
public void replaceDelta(ContainerTestParams config) throws SchemaException {
    for (int maxOps : DELTA_OP_COUNT) {
        int opCount = Math.min(config.count, maxOps);
        measureDelta(config, monitorName("replace", config.monitorId(), Integer.toString(opCount)), assignments -> {
            DeltaBuilder<UserType> delta = new DeltaBuilder<>(UserType.class, getPrismContext());
            for (int i = assignments.size() - opCount; i < assignments.size(); i++) {
                AssignmentType assignment = assignments.get(i).clone();
                assignment.description("Modified");
                delta = (DeltaBuilder<UserType>) delta.item(UserType.F_ASSIGNMENT).replace(assignment.asPrismContainerValue());
            }
            return delta.asObjectDelta("");
        });
    }
}
Also used : DeltaBuilder(com.evolveum.midpoint.prism.impl.delta.builder.DeltaBuilder) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Example 67 with AssignmentType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType in project midpoint by Evolveum.

the class TestDeltaPerfComparison method randomAssigment.

private AssignmentType randomAssigment() {
    AssignmentType assigment = new AssignmentType();
    ObjectReferenceType target = new ObjectReferenceType();
    target.setOid(newUuid());
    target.setRelation(new QName("default"));
    assigment.setTargetRef(target);
    return assigment;
}
Also used : ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) QName(javax.xml.namespace.QName) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)

Example 68 with AssignmentType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType in project midpoint by Evolveum.

the class AssignmentListProvider method postProcessWrapper.

@Override
protected void postProcessWrapper(PrismContainerValueWrapper<AssignmentType> valueWrapper) {
    AssignmentType assignmentType = valueWrapper.getRealValue();
    if (assignmentType == null) {
        return;
    }
    ObjectReferenceType targetRef = assignmentType.getTargetRef();
    if (targetRef == null || targetRef.getOid() == null || targetRef.getObject() != null) {
        return;
    }
    PrismObject<? extends ObjectType> object = WebModelServiceUtils.loadObject(targetRef, getPageBase());
    targetRef.asReferenceValue().setObject(object);
}
Also used : ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)

Example 69 with AssignmentType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType in project midpoint by Evolveum.

the class PageAdminAbstractRole method loadInducements.

// TODO unify with loadAssignments
private List<AssignmentEditorDto> loadInducements() {
    List<AssignmentEditorDto> list = new ArrayList<AssignmentEditorDto>();
    ObjectWrapper focusWrapper = getObjectWrapper();
    PrismObject<T> focus = focusWrapper.getObject();
    List<AssignmentType> inducements = focus.asObjectable().getInducement();
    for (AssignmentType inducement : inducements) {
        list.add(new AssignmentEditorDto(UserDtoStatus.MODIFY, inducement, this));
    }
    Collections.sort(list);
    return list;
}
Also used : AssignmentEditorDto(com.evolveum.midpoint.web.component.assignment.AssignmentEditorDto) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) ArrayList(java.util.ArrayList) ObjectWrapper(com.evolveum.midpoint.web.component.prism.ObjectWrapper)

Example 70 with AssignmentType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType in project midpoint by Evolveum.

the class AbstractRoleMemberPanel method initObjectForAdd.

// TODO: merge this with TreeTablePanel.initObjectForAdd, also see MID-3233
private void initObjectForAdd(ObjectReferenceType parentOrgRef, QName type, QName relation, AjaxRequestTarget target) throws SchemaException {
    getPageBase().hideMainPopup(target);
    PrismContext prismContext = getPageBase().getPrismContext();
    PrismObjectDefinition def = prismContext.getSchemaRegistry().findObjectDefinitionByType(type);
    PrismObject obj = def.instantiate();
    if (parentOrgRef == null) {
        parentOrgRef = createReference(relation);
    }
    ObjectType objType = (ObjectType) obj.asObjectable();
    if (FocusType.class.isAssignableFrom(obj.getCompileTimeClass())) {
        AssignmentType assignment = new AssignmentType();
        assignment.setTargetRef(parentOrgRef);
        ((FocusType) objType).getAssignment().add(assignment);
    }
    // TODO: fix MID-3234
    if (parentOrgRef.getType() != null && OrgType.COMPLEX_TYPE.equals(parentOrgRef.getType())) {
        objType.getParentOrgRef().add(parentOrgRef.clone());
    }
    WebComponentUtil.dispatchToObjectDetailsPage(obj, this);
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) PrismContext(com.evolveum.midpoint.prism.PrismContext) PrismObjectDefinition(com.evolveum.midpoint.prism.PrismObjectDefinition) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)

Aggregations

AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)121 Test (org.testng.annotations.Test)61 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)55 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)42 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)41 Task (com.evolveum.midpoint.task.api.Task)39 PrismContainerValue (com.evolveum.midpoint.prism.PrismContainerValue)33 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)25 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)24 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)21 QName (javax.xml.namespace.QName)20 PrismObject (com.evolveum.midpoint.prism.PrismObject)19 PrismContainerDefinition (com.evolveum.midpoint.prism.PrismContainerDefinition)17 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)17 com.evolveum.midpoint.xml.ns._public.common.common_3 (com.evolveum.midpoint.xml.ns._public.common.common_3)17 RoleType (com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType)17 PolyStringType (com.evolveum.prism.xml.ns._public.types_3.PolyStringType)17 ArrayList (java.util.ArrayList)17 SchemaConstants (com.evolveum.midpoint.schema.constants.SchemaConstants)15 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)14