Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Sep 27, 2016
2 parents b7c8805 + ea1fbd5 commit d1e21fb
Show file tree
Hide file tree
Showing 120 changed files with 2,847 additions and 176 deletions.
@@ -0,0 +1,23 @@
<!--
~ Copyright (c) 2010-2016 Evolveum
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:wicket="http://wicket.apache.org">
<body>
<wicket:panel>
<div wicket:id="detailsPanel" />
</wicket:panel>
</body>
</html>
@@ -0,0 +1,54 @@
package com.evolveum.midpoint.web.component.assignment;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.web.component.dialog.Popupable;
import org.apache.wicket.Component;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.StringResourceModel;

/**
* Created by honchar
*/
public class AssignmentDetailsPanel extends BasePanel<AssignmentEditorDto> {
private static final String ID_DETAILS_PANEL = "detailsPanel";

public AssignmentDetailsPanel(String id) {
super(id);
}

public AssignmentDetailsPanel(String id, IModel<AssignmentEditorDto> model) {
super(id, model);
initLayout();
}

private void initLayout() {
setOutputMarkupId(true);

// AssignmentEditorDto aa = assignmentModel.getObject();
// if (aa == null){}
AssignmentEditorPanel assignmentDetailsPanel = new AssignmentEditorPanel(ID_DETAILS_PANEL, getModel()) {

};
assignmentDetailsPanel.setOutputMarkupId(true);
add(assignmentDetailsPanel);

}

public int getWidth() {
return 900;
}

public int getHeight() {
return 600;
}

public StringResourceModel getTitle() {
return createStringResource("MultiButtonPanel.assignmentDetailsPopupTitle");
}

public Component getComponent() {
return this;
}

}
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2010-2016 Evolveum
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:wicket="http://wicket.apache.org">
<body>
<wicket:panel>
<div class="col-md-4">
<div wicket:id="treePanel"/>
</div>
<div class="col-md-8">
<div wicket:id="assignmentsPanel"/>
</div>
</wicket:panel>
</body>
</html>
@@ -0,0 +1,155 @@
package com.evolveum.midpoint.web.component.assignment;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.query.*;
import com.evolveum.midpoint.schema.GetOperationOptions;
import com.evolveum.midpoint.schema.SelectorOptions;
import com.evolveum.midpoint.web.component.data.BaseSortableDataProvider;
import com.evolveum.midpoint.web.component.data.MultiButtonTable;
import com.evolveum.midpoint.web.component.data.ObjectDataProvider;
import com.evolveum.midpoint.web.component.data.SelectableBeanObjectDataProvider;
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem;
import com.evolveum.midpoint.web.component.search.Search;
import com.evolveum.midpoint.web.component.util.SelectableBean;
import com.evolveum.midpoint.web.page.admin.orgs.OrgTreePanel;
import com.evolveum.midpoint.web.page.admin.users.component.TreeTablePanel;
import com.evolveum.midpoint.web.page.admin.users.dto.UserDtoStatus;
import com.evolveum.midpoint.web.session.PageStorage;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.model.IModel;

import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.List;

/**
* Created by Kate on 20.09.2016.
*/
public class AssignmentShoppingCartPanel<F extends FocusType> extends BasePanel<String> {
private static String ID_TREE_PANEL = "treePanel";
private static String ID_ASSIGNMENTS_PANEL = "assignmentsPanel";

public AssignmentShoppingCartPanel(String id) {
super(id);
}

public AssignmentShoppingCartPanel(String id, IModel<String> rootOidModel) {
super(id, rootOidModel);
initLayout();
}

private void initLayout() {
setOutputMarkupId(true);
OrgTreePanel treePanel = new OrgTreePanel(ID_TREE_PANEL, getModel(), false) {
private static final long serialVersionUID = 1L;

@Override
protected void selectTreeItemPerformed(SelectableBean<OrgType> selected,
AjaxRequestTarget target) {
AssignmentShoppingCartPanel.this.selectTreeItemPerformed(selected, target);
}

protected List<InlineMenuItem> createTreeMenu() {
return new ArrayList<>();
}

@Override
protected List<InlineMenuItem> createTreeChildrenMenu() {
return new ArrayList<>();
}

};
treePanel.setOutputMarkupId(true);
add(treePanel);


WebMarkupContainer initAssignmentsPanel = new WebMarkupContainer(ID_ASSIGNMENTS_PANEL);
initAssignmentsPanel.setOutputMarkupId(true);
add(initAssignmentsPanel);

}

private void selectTreeItemPerformed(SelectableBean<OrgType> selected, AjaxRequestTarget target) {
final OrgType selectedOgr = selected.getValue();
final ObjectDataProvider<AssignmentEditorDto, FocusType> provider = initProvider(selectedOgr.getOid());
if (provider != null) {
long s = provider.size();
provider.internalIterator(0, s);
}
MultiButtonTable assignmentsTable = new MultiButtonTable(ID_ASSIGNMENTS_PANEL, 3, new IModel<List<AssignmentEditorDto>>() {
@Override
public List<AssignmentEditorDto> getObject() {
return provider.getAvailableData();
}

@Override
public void setObject(List<AssignmentEditorDto> assignmentTypeList) {

}

@Override
public void detach() {

}
});
assignmentsTable.setOutputMarkupId(true);
replace(assignmentsTable);
target.add(this);
}

protected ObjectDataProvider<AssignmentEditorDto, FocusType> initProvider(final String oid) {

ObjectDataProvider<AssignmentEditorDto, FocusType> provider = new ObjectDataProvider<AssignmentEditorDto, FocusType>(getPageBase(), FocusType.class) {
private static final long serialVersionUID = 1L;

@Override
public AssignmentEditorDto createDataObjectWrapper(PrismObject<FocusType> obj) {
return AssignmentEditorDto.createDtoFromObject(obj.asObjectable(), UserDtoStatus.MODIFY, getPageBase());
}

@Override
public void setQuery(ObjectQuery query) {
super.setQuery(query);
}

@Override
public ObjectQuery getQuery() {

return createContentQuery(oid);
}
};
provider.setQuery(createContentQuery(oid));

return provider;
}

protected ObjectQuery createContentQuery(String oid) {
// Search search = searchModel.getObject();
// ObjectQuery query = search.createObjectQuery(parentPage.getPrismContext());
// query = addFilterToContentQuery(query);
// return query;
return createMemberQuery(oid);
}

protected ObjectQuery createMemberQuery(String oid) {
ObjectQuery query = null;
ObjectFilter filter = OrgFilter.createOrg(oid, OrgFilter.Scope.ONE_LEVEL);
query = ObjectQuery.createObjectQuery(AndFilter.createAnd(filter));

// TypeFilter roleTypeFilter = TypeFilter.createType(RoleType.COMPLEX_TYPE, filter);
// TypeFilter orgTypeFilter = TypeFilter.createType(OrgType.COMPLEX_TYPE, filter);
// TypeFilter serviceTypeFilter = TypeFilter.createType(ServiceType.COMPLEX_TYPE, filter);
// query = ObjectQuery.createObjectQuery(OrFilter.createOr(roleTypeFilter, orgTypeFilter, serviceTypeFilter));
return ObjectQuery.createObjectQuery(TypeFilter.createType(RoleType.COMPLEX_TYPE, query.getFilter()));

}


}

@@ -0,0 +1,31 @@
<!--
~ Copyright (c) 2010-2016 Evolveum
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:wicket="http://wicket.apache.org">
<body>
<wicket:panel>
<div class="row" wicket:id="row">
<div wicket:id="cell">
<a wicket:id="assignmentButton" class="col-sm-3 btn btn-app">
<span wicket:id="plusIcon" class="badge bg-green" style="font-size: 24px;"></span>
<i wicket:id="typeIcon"></i>
<label wicket:id="buttonLabel"></label>
</a>
</div>
</div>
</wicket:panel>
</body>
</html>

0 comments on commit d1e21fb

Please sign in to comment.