Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed Sep 10, 2018
2 parents 6f05257 + 0e8073d commit e875a21
Show file tree
Hide file tree
Showing 248 changed files with 2,465 additions and 1,361 deletions.
Expand Up @@ -163,8 +163,7 @@ private boolean isIdentifierVisible() {
// TODO: maybe move relation methods to subclass if we want this panel to be really reusable

private boolean isRelationVisible() {
QName relation = getRelation();
return relation != null && !QNameUtil.match(SchemaConstants.ORG_DEFAULT, relation);
return !WebComponentUtil.isDefaultRelation(getRelation());
}

private boolean isKindIntentVisible(IModel<String> kindIntentLabelModel) {
Expand Down
Expand Up @@ -18,24 +18,17 @@
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.prism.delta.ObjectDelta;
import com.evolveum.midpoint.schema.constants.ObjectTypes;
import com.evolveum.midpoint.schema.constants.RelationTypes;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.util.ObjectTypeUtil;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.logging.LoggingUtils;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.input.DropDownChoicePanel;
import com.evolveum.midpoint.web.component.input.RelationDropDownChoicePanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnChangeAjaxFormUpdatingBehavior;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.panel.Fragment;
import org.apache.wicket.model.Model;

import javax.xml.namespace.QName;
import java.util.ArrayList;
Expand Down Expand Up @@ -94,8 +87,7 @@ protected ObjectDelta prepareDelta(){
Class classType = WebComponentUtil.qnameToClass(pageBase.getPrismContext(), getObjectType().getTypeQName());
delta = ObjectDelta.createEmptyModifyDelta(classType, "fakeOid", pageBase.getPrismContext());
AssignmentType newAssignment = new AssignmentType();
ObjectReferenceType ref = ObjectTypeUtil.createObjectRef(getAbstractRoleTypeObject());
ref.setRelation(getRelationValue());
ObjectReferenceType ref = ObjectTypeUtil.createObjectRef(getAbstractRoleTypeObject(), getRelationValue());
newAssignment.setTargetRef(ref);

pageBase.getPrismContext().adopt(newAssignment);
Expand Down
Expand Up @@ -19,24 +19,16 @@
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.prism.delta.ObjectDelta;
import com.evolveum.midpoint.schema.constants.ObjectTypes;
import com.evolveum.midpoint.schema.constants.RelationTypes;
import com.evolveum.midpoint.schema.util.ObjectTypeUtil;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.task.api.TaskCategory;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.logging.LoggingUtils;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.page.admin.roles.AbstractRoleMemberPanel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.OnChangeAjaxBehavior;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.EnumChoiceRenderer;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

import javax.xml.namespace.QName;
import java.util.ArrayList;
Expand Down Expand Up @@ -93,8 +85,7 @@ protected void onUpdate(AjaxRequestTarget target) {
@Override
protected ObjectDelta prepareDelta(){
Class classType = WebComponentUtil.qnameToClass(getPageBase().getPrismContext(), getObjectType().getTypeQName());
ObjectReferenceType ref = ObjectTypeUtil.createObjectRef(getAbstractRoleTypeObject());
ref.setRelation(getRelationValue());
ObjectReferenceType ref = ObjectTypeUtil.createObjectRef(getAbstractRoleTypeObject(), getRelationValue());
return ObjectDelta.createModificationAddReference(classType, "fakeOid",
ObjectType.F_PARENT_ORG_REF, getPageBase().getPrismContext(),
ref.asReferenceValue());
Expand Down
Expand Up @@ -161,7 +161,9 @@ protected Map<String, AssignmentType> getSelectedAssignmentsMap(){
ShadowKindType kind = getKindValue();
String intent = getIntentValue();
selectedObjects.forEach(selectedObject -> {
assignmentList.put(selectedObject.getOid(), ObjectTypeUtil.createAssignmentWithConstruction(selectedObject.asPrismObject(), kind, intent));
assignmentList.put(selectedObject.getOid(),
ObjectTypeUtil.createAssignmentWithConstruction(
selectedObject.asPrismObject(), kind, intent, getPageBase().getPrismContext()));
});
return assignmentList;
}
Expand Down
Expand Up @@ -364,7 +364,7 @@ private QName getSelectedRelation(){
DropDownChoicePanel<RelationTypes> relationPanel = (DropDownChoicePanel<RelationTypes>) get(ID_RELATION_CONTAINER).get(ID_RELATION);
RelationTypes relation = relationPanel.getModel().getObject();
if (relation == null) {
return SchemaConstants.ORG_DEFAULT;
return WebComponentUtil.getDefaultRelationOrFail();
}
return relation.getRelation();
}
Expand Down
Expand Up @@ -47,6 +47,7 @@
import com.evolveum.midpoint.repo.common.expression.ExpressionFactory;
import com.evolveum.midpoint.repo.common.expression.ExpressionVariables;
import com.evolveum.midpoint.report.api.ReportManager;
import com.evolveum.midpoint.schema.RelationRegistry;
import com.evolveum.midpoint.schema.constants.ExpressionConstants;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.schema.internals.InternalsConfig;
Expand Down Expand Up @@ -164,9 +165,7 @@
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import javax.management.ObjectName;
import javax.xml.namespace.QName;

import java.io.Serializable;
import java.util.*;

/**
Expand Down Expand Up @@ -357,7 +356,7 @@ protected Integer load() {
Task task = createSimpleTask(OPERATION_LOAD_WORK_ITEM_COUNT);
S_FilterEntryOrEmpty q = QueryBuilder.queryFor(WorkItemType.class, getPrismContext());
ObjectQuery query = QueryUtils.filterForAssignees(q, getPrincipal(),
OtherPrivilegesLimitationType.F_APPROVAL_WORK_ITEMS).build();
OtherPrivilegesLimitationType.F_APPROVAL_WORK_ITEMS, getRelationRegistry()).build();
return getModelService().countContainers(WorkItemType.class, query, null, task, task.getResult());
} catch (SchemaException | SecurityViolationException | ExpressionEvaluationException | ObjectNotFoundException | CommunicationException | ConfigurationException e) {
LoggingUtils.logExceptionAsWarning(LOGGER, "Couldn't load work item count", e);
Expand Down Expand Up @@ -471,6 +470,10 @@ public PrismContext getPrismContext() {
return getMidpointApplication().getPrismContext();
}

public RelationRegistry getRelationRegistry() {
return getMidpointApplication().getRelationRegistry();
}

public ExpressionFactory getExpressionFactory() {
return getMidpointApplication().getExpressionFactory();
}
Expand Down

0 comments on commit e875a21

Please sign in to comment.