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
KaterynaHonchar committed Nov 2, 2015
2 parents 982c5ec + d11f6dd commit ace3812
Show file tree
Hide file tree
Showing 23 changed files with 425 additions and 185 deletions.
Expand Up @@ -518,26 +518,26 @@ public void onClick(AjaxRequestTarget target) {

private List<InlineMenuItem> createOrgMenu() {
List<InlineMenuItem> items = new ArrayList<InlineMenuItem>();
InlineMenuItem item = new InlineMenuItem(createStringResource("pageAdminFocus.button.addToOrg"),
new InlineMenuItemAction() {

@Override
public void onClick(AjaxRequestTarget target) {
showModalWindow(MODAL_ID_ADD_ORG, target);
}
});
items.add(item);
items.add(new InlineMenuItem());
item = new InlineMenuItem(createStringResource("pageAdminFocus.button.unlink"),
new InlineMenuItemAction() {

@Override
public void onClick(AjaxRequestTarget target) {
unlinkProjectionPerformed(target, orgModel, getSelectedProjections(orgModel), ID_ORGS);
}
});
items.add(item);
items.add(new InlineMenuItem());
// InlineMenuItem item = new InlineMenuItem(createStringResource("pageAdminFocus.button.addToOrg"),
// new InlineMenuItemAction() {
//
// @Override
// public void onClick(AjaxRequestTarget target) {
// showModalWindow(MODAL_ID_ADD_ORG, target);
// }
// });
// items.add(item);
// items.add(new InlineMenuItem());
// item = new InlineMenuItem(createStringResource("pageAdminFocus.button.unlink"),
// new InlineMenuItemAction() {
//
// @Override
// public void onClick(AjaxRequestTarget target) {
// unlinkProjectionPerformed(target, orgModel, getSelectedProjections(orgModel), ID_ORGS);
// }
// });
// items.add(item);
// items.add(new InlineMenuItem());


return items;
Expand Down
Expand Up @@ -131,9 +131,8 @@ protected AssignmentSearchDto load() {
@Override
protected void initLayout() {

Panel panel = createPopupContent();
add(panel);

createPopupContent();

AjaxButton addButton = new AjaxButton(ID_ADD, createStringResource(context.getSubmitKey())) {

@Override
Expand Down
Expand Up @@ -25,6 +25,7 @@

<p align="center">
<a class="btn btn-success" wicket:id="add" />
<a class="btn btn-success" wicket:id="assignRoot" />
</p>
</div>
</wicket:panel>
Expand Down
Expand Up @@ -9,17 +9,20 @@
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.AjaxButton;
import com.evolveum.midpoint.web.component.AjaxTabbedPanel;
import com.evolveum.midpoint.web.component.org.OrgTreeTablePanel;
import com.evolveum.midpoint.web.component.util.LoadableModel;
import com.evolveum.midpoint.web.page.PageBase;
import com.evolveum.midpoint.web.page.admin.users.PageUsers;
import com.evolveum.midpoint.web.page.admin.users.dto.OrgTableDto;
import com.evolveum.midpoint.web.page.admin.users.dto.OrgTreeDto;
import com.evolveum.midpoint.web.util.WebMiscUtil;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType;
import org.apache.commons.lang.Validate;
import org.apache.wicket.RestartResponseException;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
import org.apache.wicket.extensions.markup.html.tabs.ITab;
import org.apache.wicket.markup.html.WebMarkupContainer;
Expand All @@ -39,6 +42,7 @@ public class AssignableOrgSelectionPanel <T extends ObjectType> extends Abstract
private static final String OPERATION_LOAD_ORG_UNITS = DOT_CLASS + "loadOrgUnits";

private final static String ID_TABS = "tabs";
private final static String ID_ASSIGN_ROOT = "assignRoot";

public AssignableOrgSelectionPanel(String id, Context context) {
super(id, context);
Expand Down Expand Up @@ -80,7 +84,16 @@ protected CharSequence computeTreeHeight() {

AjaxTabbedPanel tabbedPanel = new AjaxTabbedPanel(ID_TABS, tabModel.getObject(), new Model<>(0));
tabbedPanel.setOutputMarkupId(true);
addOrReplace(tabbedPanel);

AjaxButton assignRootButton = new AjaxButton(ID_ASSIGN_ROOT, createStringResource("AssignableOrgSelectionPanel.button.assignRoot")) {

@Override
public void onClick(AjaxRequestTarget target) {
addPerformed(target, getSelectedRoot());
}
};
add(assignRootButton);
return tabbedPanel;
}

Expand Down Expand Up @@ -137,14 +150,28 @@ public List<ObjectType> getSelectedObjects(){
}
return selected;
}

public List<ObjectType> getSelectedRoot(){
List<ObjectType> selected = new ArrayList<>();
AjaxTabbedPanel orgPanel = (AjaxTabbedPanel) getTablePanel();
// int selectedTab = orgPanel.getSelectedTab();
// OrgTreeTablePanel orgPanels = (OrgTreeTablePanel) orgPanel.get(selectedTab);
OrgTreeTablePanel orgPanels = (OrgTreeTablePanel) orgPanel.get("panel");
OrgTreeDto org = orgPanels.getRootFromProvider();
selected.add(org.getObject());
return selected;
}



public void setType(Class<T> type){
Validate.notNull(type, "Class must not be null.");
this.type = type;

AjaxTabbedPanel table = (AjaxTabbedPanel) getTablePanel();
if (table != null) {
replace(createPopupContent());
createPopupContent();
// replace(createPopupContent());
}
}
}
Expand Up @@ -180,7 +180,9 @@ protected void onUpdate(AjaxRequestTarget target) {
});
add(typeSearch);

return createTable();
TablePanel table = createTable();
add(table);
return table;
}

private List<? extends DisplayableValue<String>> getLookupDisplayableList(){
Expand Down Expand Up @@ -331,7 +333,7 @@ public void setType(Class type){
provider.setType(type);

//replace table with table with proper columns
replace(createTable());
addOrReplace(createTable());
}
}

Expand Down
Expand Up @@ -132,7 +132,7 @@ private OrgTreeDto createDto(OrgTreeDto parent, PrismObject<OrgType> unit) {
String identifier = unit.getPropertyRealValue(OrgType.F_IDENTIFIER, String.class);

//todo relation [lazyman]
return new OrgTreeDto(parent, unit.getOid(), null, name, description, displayName, identifier);
return new OrgTreeDto(parent, unit);
}

@Override
Expand Down
Expand Up @@ -810,6 +810,9 @@ private PrismObject<OrgType> addChildOrgUnitPerformed(AjaxRequestTarget target,
// ref.setType(OrgType.COMPLEX_TYPE);
// ref.setTargetName(WebMiscUtil.createPolyFromOrigString(selected.getObject().getName()));
org.getParentOrgRef().add(ref);
AssignmentType newOrgAssignment = new AssignmentType();
newOrgAssignment.setTargetRef(ref);
org.getAssignment().add(newOrgAssignment);

PrismContext context = page.getPrismContext();
context.adopt(org);
Expand Down
Expand Up @@ -16,6 +16,8 @@

package com.evolveum.midpoint.web.page.admin.users.dto;

import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.web.util.WebMiscUtil;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType;

Expand All @@ -35,17 +37,31 @@ public class OrgTreeDto implements Serializable, Comparable<OrgTreeDto>, OrgDto
private String displayName;
private String identifier;
private QName relation;

public OrgTreeDto(OrgTreeDto parent, String oid, QName relation, String name, String description,
String displayName, String identifier) {
this.parent = parent;
this.oid = oid;
this.relation = relation;
this.name = name;
this.description = description;
this.displayName = displayName;
this.identifier = identifier;
}

private ObjectType object;

// public OrgTreeDto(OrgTreeDto parent, String oid, QName relation, String name, String description,
// String displayName, String identifier) {
// this.parent = parent;
// this.oid = oid;
// this.relation = relation;
// this.name = name;
// this.description = description;
// this.displayName = displayName;
// this.identifier = identifier;
// }

public OrgTreeDto(OrgTreeDto parent, PrismObject<OrgType> object) {
OrgType org = object.asObjectable();
this.object = org;
this.parent = parent;
this.oid = org.getOid();
//this.relation = relation;
this.name = WebMiscUtil.getOrigStringFromPoly(org.getName());
this.description = org.getDescription();
this.displayName = WebMiscUtil.getOrigStringFromPoly(org.getDisplayName());
this.identifier = org.getIdentifier();
}

public OrgTreeDto getParent() {
return parent;
Expand Down Expand Up @@ -81,6 +97,14 @@ public QName getRelation() {
public void setRelation(QName relation) {
this.relation = relation;
}

public ObjectType getObject() {
return object;
}

public void setObject(ObjectType object) {
this.object = object;
}

@Override
public Class<? extends ObjectType> getType() {
Expand Down
Expand Up @@ -50,6 +50,7 @@ AEPlevel.LEGALIZE=Relative
AEPlevel.MARK=Mark
AEPlevel.NONE=None
AEPlevel.POSITIVE=Positive
AssignableOrgSelectionPanel.button.assignRoot=Assign Root
assignablePopupContent.button.assign=Assign
assignablePopupContent.button.add=Add
assignablePopupContent.description=Description
Expand Down
Expand Up @@ -24,6 +24,18 @@

package com.evolveum.prism.xml.ns._public.types_3;

import com.evolveum.midpoint.prism.Raw;
import com.evolveum.midpoint.util.JAXBUtil;
import com.evolveum.midpoint.util.MiscUtil;
import org.w3c.dom.Element;

import javax.activation.MimeType;
import javax.activation.MimeTypeParseException;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.*;
import javax.xml.datatype.Duration;
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;
import java.io.File;
import java.io.Serializable;
import java.lang.reflect.Array;
Expand All @@ -34,33 +46,7 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Currency;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import java.util.UUID;

import javax.activation.MimeType;
import javax.activation.MimeTypeParseException;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.datatype.Duration;
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.prism.Raw;
import org.w3c.dom.Element;

import com.evolveum.midpoint.util.JAXBUtil;
import com.evolveum.midpoint.util.MiscUtil;
import java.util.*;


/**
Expand Down Expand Up @@ -323,7 +309,12 @@ public ItemDeltaType clone() {
ItemDeltaType clone = new ItemDeltaType();
clone.setModificationType(getModificationType());
clone.setPath(getPath()); //TODO clone path
clone.getValue().addAll(getValue());
// If not to clone inside iteration, then in clone object would be an origin raw objects and manipulations with
// clones wail take effect on origin objects. For example parsing while taking data from raw objects.
// In our case it have bad side effect - equals doesn't work.
for (RawType rawType : getValue()) {
clone.getValue().add(rawType.clone());
}
// delta.setValue(value != null ? value.clone() : null);
clone.getEstimatedOldValue().addAll(getEstimatedOldValue());
return clone;
Expand Down

0 comments on commit ace3812

Please sign in to comment.