Skip to content

Commit

Permalink
removed relation drop down from assignments tab panel
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Sep 6, 2018
1 parent fd04655 commit 6813a1d
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 105 deletions.
Expand Up @@ -20,11 +20,7 @@
<div wicket:id="assignments">
</div>
<wicket:fragment wicket:id="searchFragment">
<div wicket:id="relationContainer" class="col-xs-6">
<label class="col-xs-2 prism-property" ><wicket:message key="AbstractRoleAssignmentPanel.relationLabel" /></label>
<div class="col-xs-3" wicket:id="relation" />
</div>
<div class="col-xs-3 pull-right">
<div class="col-xs-3 pull-right">
<div class="btn btn-default pull-right" wicket:id="showAllAssignmentsButton" />
</div>
</wicket:fragment>
Expand Down
Expand Up @@ -17,59 +17,44 @@
package com.evolveum.midpoint.web.component.assignment;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import javax.xml.namespace.QName;

import com.evolveum.midpoint.gui.api.component.AssignmentPopup;
import com.evolveum.midpoint.prism.*;
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.web.component.prism.*;
import com.evolveum.midpoint.web.component.search.SearchFactory;
import com.evolveum.midpoint.web.component.search.SearchItem;
import com.evolveum.midpoint.web.component.search.SearchItemDefinition;
import com.evolveum.midpoint.web.page.admin.PageAdminFocus;
import com.evolveum.midpoint.web.page.admin.users.component.AssignmentInfoDto;
import com.evolveum.midpoint.web.page.admin.users.component.AllAssignmentsPreviewDialog;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import org.apache.commons.lang.StringUtils;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Fragment;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

import com.evolveum.midpoint.gui.api.component.TypedAssignablePanel;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils;
import com.evolveum.midpoint.gui.impl.component.MultivalueContainerListPanelWithDetailsPanel;
import com.evolveum.midpoint.gui.impl.model.PropertyWrapperFromContainerValueWrapperModel;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.prism.query.ObjectPaging;
import com.evolveum.midpoint.prism.query.ObjectQuery;
import com.evolveum.midpoint.prism.query.builder.QueryBuilder;
import com.evolveum.midpoint.schema.util.ObjectTypeUtil;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.AjaxButton;
import com.evolveum.midpoint.web.component.form.Form;
import com.evolveum.midpoint.web.component.input.DropDownChoicePanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.session.UserProfileStorage;
import com.evolveum.midpoint.web.session.UserProfileStorage.TableId;
Expand All @@ -83,71 +68,18 @@ public class AbstractRoleAssignmentPanel extends AssignmentPanel {

private static final Trace LOGGER = TraceManager.getTrace(AssignmentPanel.class);

private static final String ID_RELATION = "relation";
private static final String ID_RELATION_CONTAINER = "relationContainer";
private static final String ID_SHOW_ALL_ASSIGNMENTS_BUTTON = "showAllAssignmentsButton";

protected static final String DOT_CLASS = AbstractRoleAssignmentPanel.class.getName() + ".";
private static final String OPERATION_LOAD_TARGET_REF_OBJECT = DOT_CLASS + "loadAssignmentTargetRefObject";

private RelationTypes relationValue = null;

public AbstractRoleAssignmentPanel(String id, IModel<ContainerWrapper<AssignmentType>> assignmentContainerWrapperModel){
super(id, assignmentContainerWrapperModel);
}

protected Fragment getCustomSearchPanel(String contentAreaId){
Fragment searchContainer = new Fragment(contentAreaId, AssignmentPanel.ID_SEARCH_FRAGMENT, this);

WebMarkupContainer relationContainer = new WebMarkupContainer(ID_RELATION_CONTAINER);

relationContainer.setOutputMarkupId(true);
relationContainer.add(new VisibleEnableBehaviour() {

private static final long serialVersionUID = 1L;

@Override
public boolean isVisible() {
return AbstractRoleAssignmentPanel.this.isRelationVisible();
}

});
searchContainer.addOrReplace(relationContainer);

DropDownChoicePanel<RelationTypes> relation = WebComponentUtil.createEnumPanel(RelationTypes.class, ID_RELATION,
WebComponentUtil.createReadonlyModelFromEnum(RelationTypes.class),
new IModel<RelationTypes>() {

private static final long serialVersionUID = 1L;

@Override
public RelationTypes getObject() {
return relationValue;
}

@Override
public void setObject(RelationTypes relationTypes) {
relationValue = relationTypes;
}

@Override
public void detach() {

}
}, this, true,
createStringResource("RelationTypes.ANY").getString());
relation.getBaseFormComponent().add(new AjaxFormComponentUpdatingBehavior("change") {
private static final long serialVersionUID = 1L;

@Override
protected void onUpdate(AjaxRequestTarget target) {
getMultivalueContainerListPanel().refreshTable(target);
}
});
relation.setOutputMarkupId(true);
relation.setOutputMarkupPlaceholderTag(true);
relationContainer.addOrReplace(relation);

AjaxButton showAllAssignmentsButton = new AjaxButton(ID_SHOW_ALL_ASSIGNMENTS_BUTTON,
createStringResource("AssignmentTablePanel.menu.showAllAssignments")) {

Expand All @@ -171,11 +103,6 @@ public boolean isVisible(){
return searchContainer;
}

private DropDownChoicePanel<RelationTypes> getRelationPanel() {
return (DropDownChoicePanel<RelationTypes>) getAssignmentContainer().get(ID_RELATION_CONTAINER).get(ID_RELATION);
}


protected void showAllAssignments(AjaxRequestTarget target) {
PageBase pageBase = getPageBase();
List<AssignmentInfoDto> previewAssignmentsList;
Expand Down Expand Up @@ -332,8 +259,6 @@ protected int getItemsPerPage() {
}

protected ObjectQuery createObjectQuery() {
QName relation = getRelation();
if (PrismConstants.Q_ANY.equals(relation)){
return QueryBuilder.queryFor(AssignmentType.class, getParentPage().getPrismContext())
.block()
.not()
Expand All @@ -346,21 +271,11 @@ protected ObjectQuery createObjectQuery() {
.item(new ItemPath(AssignmentType.F_TARGET_REF))
.ref(SchemaConstants.ORG_DEPUTY)
.endBlock()
.and()
.and()
.not()
.exists(AssignmentType.F_POLICY_RULE)
.build();
} else {
return QueryBuilder.queryFor(AssignmentType.class, getParentPage().getPrismContext())
.item(new ItemPath(AssignmentType.F_TARGET_REF))
.ref(relation)
.build();
}
}

private QName getRelation() {
return relationValue == null ? PrismConstants.Q_ANY : relationValue.getRelation();
}

private IModel<String> getTenantLabelModel(ContainerValueWrapper<AssignmentType> assignmentContainer){
if (assignmentContainer == null || assignmentContainer.getContainerValue() == null){
Expand Down Expand Up @@ -403,10 +318,6 @@ private <O extends ObjectType> IModel<String> getIdentifierLabelModel(ContainerV
return Model.of("");
}

protected boolean isRelationVisible() {
return true;
}

protected List<ObjectTypes> getObjectTypesList(){
return WebComponentUtil.createAssignableTypesList();
}
Expand Down
Expand Up @@ -95,11 +95,6 @@ public Boolean getObject() {
return columns;
}

@Override
protected boolean isRelationVisible() {
return false;
}

// @Override
// protected <T extends ObjectType> void addSelectedAssignmentsPerformed(AjaxRequestTarget target, List<T> assignmentsList,
// QName relation, ShadowKindType kind, String intent) {
Expand Down
Expand Up @@ -151,11 +151,6 @@ private ConstructionAssociationPanel getConstructionAssociationPanel(ContainerVa
return constructionDetailsPanel;
}

@Override
protected boolean isRelationVisible() {
return false;
}

protected List<ObjectTypes> getObjectTypesList(){
return Arrays.asList(ObjectTypes.RESOURCE);
}
Expand Down

0 comments on commit 6813a1d

Please sign in to comment.