Search in sources :

Example 96 with ObjectReferenceType

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

the class DistributedReportExportActivitySupport method fetchGlobalReportDataRef.

@NotNull
private ObjectReferenceType fetchGlobalReportDataRef(OperationResult result) throws SchemaException, ObjectNotFoundException, ActivityRunException {
    ActivityState activityState = ActivityState.getActivityStateUpwards(activity.getPath().allExceptLast(), runningTask, ReportExportWorkStateType.COMPLEX_TYPE, beans, result);
    ObjectReferenceType globalReportDataRef = activityState.getWorkStateReferenceRealValue(F_REPORT_DATA_REF);
    if (globalReportDataRef == null) {
        throw new ActivityRunException("No global report data reference in " + activityState, FATAL_ERROR, PERMANENT_ERROR);
    }
    return globalReportDataRef;
}
Also used : ActivityState(com.evolveum.midpoint.repo.common.activity.run.state.ActivityState) ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) ActivityRunException(com.evolveum.midpoint.repo.common.activity.run.ActivityRunException) NotNull(org.jetbrains.annotations.NotNull)

Example 97 with ObjectReferenceType

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

the class AbstractPopupTabPanel method initObjectListPanel.

protected Component initObjectListPanel() {
    PopupObjectListPanel<O> listPanel = new PopupObjectListPanel<>(ID_OBJECT_LIST_PANEL, getObjectType().getClassDefinition(), true) {

        private static final long serialVersionUID = 1L;

        @Override
        protected List<IColumn<SelectableBean<O>, String>> createDefaultColumns() {
            if (AbstractRoleType.class.isAssignableFrom(getType())) {
                return new ArrayList<>((Collection) ColumnUtils.getDefaultAbstractRoleColumns(false));
            } else {
                return super.createDefaultColumns();
            }
        }

        @Override
        protected void onUpdateCheckbox(AjaxRequestTarget target, IModel<SelectableBean<O>> rowModel) {
            onSelectionPerformed(target, rowModel);
        }

        @Override
        protected List<O> getPreselectedObjectList() {
            return getPreselectedObjects();
        }

        @Override
        protected IModel<Boolean> getCheckBoxEnableModel(IModel<SelectableBean<O>> rowModel) {
            return getObjectSelectCheckBoxEnableModel(rowModel);
        }

        @Override
        protected ObjectQuery getCustomizeContentQuery() {
            ObjectQuery customQuery = AbstractPopupTabPanel.this.addFilterToContentQuery();
            if (customQuery == null) {
                customQuery = AbstractPopupTabPanel.this.getPageBase().getPrismContext().queryFactory().createQuery();
            }
            List<ObjectReferenceType> archetypeRefList = getArchetypeRefList();
            if (!CollectionUtils.isEmpty(archetypeRefList)) {
                List<ObjectFilter> archetypeRefFilterList = new ArrayList<>();
                for (ObjectReferenceType archetypeRef : archetypeRefList) {
                    ObjectFilter filter = AbstractPopupTabPanel.this.getPageBase().getPrismContext().queryFor(AssignmentHolderType.class).item(AssignmentHolderType.F_ARCHETYPE_REF).ref(archetypeRef.getOid()).buildFilter();
                    ((RefFilter) filter).setTargetTypeNullAsAny(true);
                    archetypeRefFilterList.add(filter);
                }
                if (!CollectionUtils.isEmpty(archetypeRefFilterList)) {
                    OrFilter archetypeRefOrFilter = AbstractPopupTabPanel.this.getPageBase().getPrismContext().queryFactory().createOr(archetypeRefFilterList);
                    customQuery.addFilter(archetypeRefOrFilter);
                }
            }
            ObjectFilter subTypeFilter = getSubtypeFilter();
            if (subTypeFilter != null) {
                customQuery.addFilter(subTypeFilter);
            }
            return customQuery;
        }
    };
    listPanel.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        public boolean isVisible() {
            return isObjectListPanelVisible();
        }
    });
    listPanel.setOutputMarkupId(true);
    return listPanel;
}
Also used : RefFilter(com.evolveum.midpoint.prism.query.RefFilter) IModel(org.apache.wicket.model.IModel) ArrayList(java.util.ArrayList) ObjectFilter(com.evolveum.midpoint.prism.query.ObjectFilter) OrFilter(com.evolveum.midpoint.prism.query.OrFilter) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AssignmentHolderType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentHolderType)

Example 98 with ObjectReferenceType

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

the class ReferenceConverter method convertToObject.

@Override
public ObjectReferenceType convertToObject(String value, Locale locale) throws ConversionException {
    Class<ObjectType> type = getReferenceTargetObjectType();
    ObjectQuery query = pageBase.getPrismContext().queryFor(type).item(ObjectType.F_NAME).eq(value).matchingNorm().build();
    List<PrismObject<ObjectType>> objectsList = WebModelServiceUtils.searchObjects(type, query, new OperationResult("searchObjects"), pageBase);
    if (CollectionUtils.isNotEmpty(objectsList)) {
        if (objectsList.size() == 1) {
            return ObjectTypeUtil.createObjectRefWithFullObject(objectsList.get(0), pageBase.getPrismContext());
        }
        pageBase.error("Couldn't specify one object by name '" + value + "' and type " + type.getSimpleName() + ". Please will try specific type of object.");
    }
    ObjectReferenceType ref = null;
    if (isAllowedNotFoundObjectRef()) {
        ref = new ObjectReferenceType();
        ref.setTargetName(new PolyStringType(value));
        if (baseComponent != null && baseComponent.getModelObject() instanceof ObjectReferenceType) {
            if (((ObjectReferenceType) baseComponent.getModelObject()).getRelation() == null) {
                ref.setRelation(pageBase.getPrismContext().getDefaultRelation());
            } else {
                ref.setRelation(((ObjectReferenceType) baseComponent.getModelObject()).getRelation());
            }
            ref.setType(WebComponentUtil.classToQName(PrismContext.get(), type));
        }
    }
    return ref;
}
Also used : PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) PrismObject(com.evolveum.midpoint.prism.PrismObject) ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery)

Example 99 with ObjectReferenceType

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

the class MultiTypesMemberPopupTabPanel method prepareDelta.

@Override
protected ObjectDelta prepareDelta() {
    Class classType = WebComponentUtil.qnameToClass(getPageBase().getPrismContext(), getObjectType().getTypeQName());
    ObjectReferenceType ref = ObjectTypeUtil.createObjectRef(getAbstractRoleTypeObject(), getRelationValue());
    return getPageBase().getPrismContext().deltaFactory().object().createModificationAddReference(classType, "fakeOid", ObjectType.F_PARENT_ORG_REF, ref.asReferenceValue());
}
Also used : ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)

Example 100 with ObjectReferenceType

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

the class FocusPersonasTabPanel method getPersonasOidsList.

private List<String> getPersonasOidsList() {
    List<ObjectReferenceType> personasRefList = getObjectWrapper().getObject().asObjectable().getPersonaRef();
    List<String> oidsList = new ArrayList<>();
    if (personasRefList != null) {
        for (ObjectReferenceType ref : personasRefList) {
            oidsList.add(ref.getOid());
        }
    }
    return oidsList;
}
Also used : ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) ArrayList(java.util.ArrayList)

Aggregations

ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)278 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)104 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)61 Test (org.testng.annotations.Test)61 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)56 Task (com.evolveum.midpoint.task.api.Task)53 QName (javax.xml.namespace.QName)46 ArrayList (java.util.ArrayList)44 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)42 PrismAsserts.assertEqualsPolyString (com.evolveum.midpoint.prism.util.PrismAsserts.assertEqualsPolyString)37 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)33 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)32 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)32 ObjectDeltaType (com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType)31 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)30 ChangeRecordEntry (org.opends.server.util.ChangeRecordEntry)30 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)26 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)26 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)23 List (java.util.List)23