Skip to content

Commit

Permalink
Fixing association editor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Jan 25, 2016
1 parent 6b83be3 commit daf35c9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Expand Up @@ -36,7 +36,7 @@
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.model.LookupPropertyModel;
import com.evolveum.midpoint.web.page.admin.users.component.AssociationValueChoosePanel;
import com.evolveum.midpoint.web.page.admin.users.component.AssociationValueChoicePanel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import org.apache.commons.lang.ClassUtils;
Expand Down Expand Up @@ -286,7 +286,7 @@ private boolean isRemoveButtonVisible() {
return false;
}
Component inputPanel = this.get(ID_VALUE_CONTAINER).get(ID_INPUT);
if (inputPanel instanceof ValueChoosePanel || inputPanel instanceof AssociationValueChoosePanel){
if (inputPanel instanceof ValueChoosePanel || inputPanel instanceof AssociationValueChoicePanel){
return true;
}

Expand Down Expand Up @@ -658,7 +658,7 @@ public void checkInputValue(AutoCompleteTextField input, AjaxRequestTarget targe
assocTarget.getTypeName(), assocTarget.getKind(), assocTarget.getIntent());

List values = item.getValues();
return new AssociationValueChoosePanel(id, model, values, false, ShadowType.class, query);
return new AssociationValueChoicePanel(id, model, values, false, ShadowType.class, query);
}
}

Expand Down Expand Up @@ -785,7 +785,7 @@ private void removeValue(AjaxRequestTarget target) {
error("Couldn't delete already deleted item: " + wrapper.toString());
target.add(((PageBase) getPage()).getFeedbackPanel());
case NOT_CHANGED:
if (inputPanel instanceof AssociationValueChoosePanel) {
if (inputPanel instanceof AssociationValueChoicePanel) {
((PropertyWrapper)propertyWrapper).setStatus(ValueStatus.DELETED);
}
wrapper.setStatus(ValueStatus.DELETED);
Expand All @@ -799,7 +799,7 @@ private void removeValue(AjaxRequestTarget target) {
if (count == 0 && !hasEmptyPlaceholder(propertyWrapper)) {
if (inputPanel instanceof ValueChoosePanel) {
values.add(new ValueWrapper(propertyWrapper, new PrismReferenceValue(null), ValueStatus.ADDED));
} else if (inputPanel instanceof AssociationValueChoosePanel) {
} else if (inputPanel instanceof AssociationValueChoicePanel) {
Item item = propertyWrapper.getItem();
ItemPath path = item.getPath();
if (path != null){
Expand Down
Expand Up @@ -64,9 +64,9 @@
// (for now ValueChoosePanel works only with PrismReferenceValue);
//in future some super class is to be created to union the common
// functionality of these 2 classes
public class AssociationValueChoosePanel <C extends ObjectType> extends BasePanel<PrismContainerValue<ShadowAssociationType>> {
public class AssociationValueChoicePanel <C extends ObjectType> extends BasePanel<PrismContainerValue<ShadowAssociationType>> {

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

private static final String ID_LABEL = "label";

Expand All @@ -82,7 +82,7 @@ public class AssociationValueChoosePanel <C extends ObjectType> extends BasePane
private IModel<ValueWrapper<PrismContainerValue<ShadowAssociationType>>> model;
private ObjectQuery query = null;

public AssociationValueChoosePanel(String id, IModel<ValueWrapper<PrismContainerValue<ShadowAssociationType>>> model, List<PrismPropertyValue> values, boolean required, Class<C> type,
public AssociationValueChoicePanel(String id, IModel<ValueWrapper<PrismContainerValue<ShadowAssociationType>>> model, List<PrismPropertyValue> values, boolean required, Class<C> type,
ObjectQuery query){
super(id, (IModel)new PropertyModel<>(model, "value"));
this.model = model;
Expand Down Expand Up @@ -166,8 +166,8 @@ private void initGenericDialog(final Class<C> type, final List<PrismPropertyValu
ObjectSelectionPanel.Context context = new ObjectSelectionPanel.Context(this) {

// See analogous discussion in ChooseTypePanel
public AssociationValueChoosePanel getRealParent() {
return WebMiscUtil.theSameForPage(AssociationValueChoosePanel.this, getCallingPageReference());
public AssociationValueChoicePanel getRealParent() {
return WebMiscUtil.theSameForPage(AssociationValueChoicePanel.this, getCallingPageReference());
}

@Override
Expand Down Expand Up @@ -208,8 +208,8 @@ private void initUserOrgDialog() {
ObjectSelectionPanel.Context context = new ObjectSelectionPanel.Context(this) {

// See analogous discussion in ChooseTypePanel
public AssociationValueChoosePanel getRealParent() {
return WebMiscUtil.theSameForPage(AssociationValueChoosePanel.this, getCallingPageReference());
public AssociationValueChoicePanel getRealParent() {
return WebMiscUtil.theSameForPage(AssociationValueChoicePanel.this, getCallingPageReference());
}

@Override
Expand Down Expand Up @@ -288,9 +288,9 @@ public String getObject() {
}
PrismReferenceValue shadowRef = cval.findReference(ShadowAssociationType.F_SHADOW_REF).getValue();
if (shadowRef.getObject() == null) {
ShadowIdentifiersType identifiers = cval.asContainerable().getIdentifiers();
Element e = (Element) identifiers.getAny().get(0);
return e.getTextContent();
PrismContainer<Containerable> identifiersContainer = cval.findContainer(ShadowAssociationType.F_IDENTIFIERS);
PrismProperty<String> identifierProp = (PrismProperty<String>) identifiersContainer.getValue().getItems().get(0);
return identifierProp.getRealValue();
} else {
return shadowRef.getObject().getName().toString();
}
Expand Down

0 comments on commit daf35c9

Please sign in to comment.