Search in sources :

Example 1 with ObjectTypes

use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.

the class OrgMemberPanel method initSearch.

@Override
protected void initSearch(Form form) {
    /// TODO: move to utils class??
    List<ObjectTypes> objectTypes = Arrays.asList(ObjectTypes.values());
    Collections.sort(objectTypes, new Comparator<ObjectTypes>() {

        @Override
        public int compare(ObjectTypes o1, ObjectTypes o2) {
            Validate.notNull(o1);
            Validate.notNull(o2);
            String type1 = o1.getValue();
            String type2 = o2.getValue();
            return String.CASE_INSENSITIVE_ORDER.compare(type1, type2);
        }
    });
    DropDownChoice<ObjectTypes> objectType = new DropDownChoice<ObjectTypes>(ID_SEARCH_BY_TYPE, Model.of(OBJECT_TYPES_DEFAULT), objectTypes, new EnumChoiceRenderer<ObjectTypes>());
    objectType.add(new OnChangeAjaxBehavior() {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            refreshTable(target);
        }
    });
    objectType.setOutputMarkupId(true);
    form.add(objectType);
    DropDownChoice<String> seachScrope = new DropDownChoice<String>(ID_SEARCH_SCOPE, Model.of(SEARCH_SCOPE_SUBTREE), SEARCH_SCOPE_VALUES, new StringResourceChoiceRenderer("TreeTablePanel.search.scope"));
    seachScrope.add(new OnChangeAjaxBehavior() {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            refreshTable(target);
        }
    });
    seachScrope.setOutputMarkupId(true);
    form.add(seachScrope);
}
Also used : StringResourceChoiceRenderer(com.evolveum.midpoint.web.util.StringResourceChoiceRenderer) ObjectTypes(com.evolveum.midpoint.schema.constants.ObjectTypes) OnChangeAjaxBehavior(org.apache.wicket.ajax.form.OnChangeAjaxBehavior) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice)

Example 2 with ObjectTypes

use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.

the class ActionsExecutedObjectsTableLineDto method getObjectTypeLocalizationKey.

public String getObjectTypeLocalizationKey() {
    ObjectTypes type = ObjectTypes.getObjectTypeFromTypeQName(entry.getObjectType());
    ObjectTypeGuiDescriptor descriptor = ObjectTypeGuiDescriptor.getDescriptor(type);
    if (descriptor != null) {
        return descriptor.getLocalizationKey();
    } else {
        return null;
    }
}
Also used : ObjectTypeGuiDescriptor(com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor) ObjectTypes(com.evolveum.midpoint.schema.constants.ObjectTypes)

Example 3 with ObjectTypes

use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.

the class PageDebugList method listObjectsPerformed.

private void listObjectsPerformed(ObjectQuery query, AjaxRequestTarget target) {
    DebugSearchDto dto = searchModel.getObject();
    ObjectTypes selected = dto.getType();
    RepositoryObjectDataProvider provider = getTableDataProvider();
    provider.setQuery(createQuery(query));
    if (selected != null) {
        provider.setType(selected.getClassDefinition());
        addOrReplaceTable(provider);
    }
    // save object type category to session storage, used by back button
    ConfigurationStorage storage = getSessionStorage().getConfiguration();
    storage.setDebugSearchDto(dto);
    Table table = getListTable();
    target.add((Component) table);
}
Also used : RepositoryObjectDataProvider(com.evolveum.midpoint.web.component.data.RepositoryObjectDataProvider) DataTable(org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable) Table(com.evolveum.midpoint.web.component.data.Table) ConfigurationStorage(com.evolveum.midpoint.web.session.ConfigurationStorage) DebugSearchDto(com.evolveum.midpoint.web.page.admin.configuration.dto.DebugSearchDto) ObjectTypes(com.evolveum.midpoint.schema.constants.ObjectTypes)

Example 4 with ObjectTypes

use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.

the class PageDebugList method setupSearchDto.

private void setupSearchDto(DebugSearchDto dto) {
    ObjectTypes type = dto.getType();
    Search search = SearchFactory.createSearch(type.getClassDefinition(), this);
    dto.setSearch(search);
}
Also used : Search(com.evolveum.midpoint.web.component.search.Search) ObjectTypes(com.evolveum.midpoint.schema.constants.ObjectTypes)

Example 5 with ObjectTypes

use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.

the class AbstractSearchExpressionEvaluator method transformSingleValue.

@Override
protected List<V> transformSingleValue(ExpressionVariables variables, PlusMinusZero valueDestination, boolean useNew, ExpressionEvaluationContext context, String contextDescription, Task task, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException {
    //		if (LOGGER.isTraceEnabled()) {
    //			LOGGER.trace("transformSingleValue in {}\nvariables:\n{}\nvalueDestination: {}\nuseNew: {}",
    //					new Object[]{contextDescription, variables.debugDump(1), valueDestination, useNew});
    //		}
    QName targetTypeQName = getExpressionEvaluatorType().getTargetType();
    if (targetTypeQName == null) {
        targetTypeQName = getDefaultTargetType();
    }
    if (targetTypeQName != null && QNameUtil.isUnqualified(targetTypeQName)) {
        targetTypeQName = getPrismContext().getSchemaRegistry().resolveUnqualifiedTypeName(targetTypeQName);
    }
    ObjectTypes targetType = ObjectTypes.getObjectTypeFromTypeQName(targetTypeQName);
    if (targetType == null) {
        throw new SchemaException("Unknown target type " + targetTypeQName + " in " + shortDebugDump());
    }
    Class<? extends ObjectType> targetTypeClass = targetType.getClassDefinition();
    List<V> resultValues = null;
    ObjectQuery query = null;
    List<ItemDelta<V, D>> additionalAttributeDeltas = null;
    PopulateType populateAssignmentType = getExpressionEvaluatorType().getPopulate();
    if (populateAssignmentType != null) {
        additionalAttributeDeltas = collectAdditionalAttributes(populateAssignmentType, outputDefinition, variables, context, contextDescription, task, result);
    }
    if (getExpressionEvaluatorType().getOid() != null) {
        resultValues = new ArrayList<>(1);
        resultValues.add(createPrismValue(getExpressionEvaluatorType().getOid(), targetTypeQName, additionalAttributeDeltas, context));
    } else {
        SearchFilterType filterType = getExpressionEvaluatorType().getFilter();
        if (filterType == null) {
            throw new SchemaException("No filter in " + shortDebugDump());
        }
        query = QueryJaxbConvertor.createObjectQuery(targetTypeClass, filterType, prismContext);
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("XML query converted to: {}", query.debugDump());
        }
        query = ExpressionUtil.evaluateQueryExpressions(query, variables, context.getExpressionFactory(), prismContext, context.getContextDescription(), task, result);
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("Expression in query evaluated to: {}", query.debugDump());
        }
        query = extendQuery(query, context);
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("Query after extension: {}", query.debugDump());
        }
        resultValues = executeSearchUsingCache(targetTypeClass, targetTypeQName, query, additionalAttributeDeltas, context, contextDescription, task, context.getResult());
        if (resultValues.isEmpty()) {
            ObjectReferenceType defaultTargetRef = getExpressionEvaluatorType().getDefaultTargetRef();
            if (defaultTargetRef != null) {
                resultValues.add(createPrismValue(defaultTargetRef.getOid(), targetTypeQName, additionalAttributeDeltas, context));
            }
        }
    }
    if (resultValues.isEmpty() && getExpressionEvaluatorType().isCreateOnDemand() == Boolean.TRUE && (valueDestination == PlusMinusZero.PLUS || valueDestination == PlusMinusZero.ZERO || useNew)) {
        String createdObjectOid = createOnDemand(targetTypeClass, variables, context, context.getContextDescription(), task, context.getResult());
        resultValues.add(createPrismValue(createdObjectOid, targetTypeQName, additionalAttributeDeltas, context));
    }
    LOGGER.trace("Search expression got {} results for query {}", resultValues == null ? "null" : resultValues.size(), query);
    return (List<V>) resultValues;
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) SearchFilterType(com.evolveum.prism.xml.ns._public.query_3.SearchFilterType) QName(javax.xml.namespace.QName) ObjectTypes(com.evolveum.midpoint.schema.constants.ObjectTypes) ItemDelta(com.evolveum.midpoint.prism.delta.ItemDelta) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) List(java.util.List) ArrayList(java.util.ArrayList) PopulateType(com.evolveum.midpoint.xml.ns._public.common.common_3.PopulateType)

Aggregations

ObjectTypes (com.evolveum.midpoint.schema.constants.ObjectTypes)46 QName (javax.xml.namespace.QName)16 ArrayList (java.util.ArrayList)11 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)11 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)8 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)8 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)7 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)7 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)6 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)6 List (java.util.List)6 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)5 ITab (org.apache.wicket.extensions.markup.html.tabs.ITab)5 AssignmentPopup (com.evolveum.midpoint.gui.api.component.AssignmentPopup)4 OnChangeAjaxBehavior (org.apache.wicket.ajax.form.OnChangeAjaxBehavior)4 DropDownChoice (org.apache.wicket.markup.html.form.DropDownChoice)4 CountablePanelTab (com.evolveum.midpoint.gui.api.component.tabs.CountablePanelTab)3 PanelTab (com.evolveum.midpoint.gui.api.component.tabs.PanelTab)3 PrismContainerWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper)3 AssignmentObjectRelation (com.evolveum.midpoint.model.api.AssignmentObjectRelation)3