Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Nov 14, 2018
2 parents 540a7b4 + 047b236 commit 5fae4c4
Show file tree
Hide file tree
Showing 39 changed files with 322 additions and 1,230 deletions.
Expand Up @@ -185,7 +185,7 @@ private static SpringApplicationBuilder configureApplication(SpringApplicationBu
System.setProperty(MIDPOINT_HOME_PROPERTY, mpHome);
}

System.setProperty("spring.config.location", MidPointSpringApplication.class.getResource("/") + ",${midpoint.home}/");
System.setProperty("spring.config.additional-location", "${midpoint.home}/");

application.bannerMode(Banner.Mode.LOG);

Expand Down

This file was deleted.

This file was deleted.

Expand Up @@ -96,12 +96,6 @@ public ExpressionValuePanel(String id, IModel<ExpressionType> model, Constructio
initLayout();
}

// @Override
// protected void onInitialize(){
// super.onInitialize();
// initLayout();
// }

private void initLayout(){
setOutputMarkupId(true);

Expand Down Expand Up @@ -396,7 +390,12 @@ public void onClick(AjaxRequestTarget target) {
}
};
}
});

@Override
public IModel<Boolean> getVisible() {
return Model.of(isAssociationExpression());
}
});
menuList.add(new InlineMenuItem(createStringResource("ExpressionValuePanel.addValueButtonTargetSearchTitle")) {
private static final long serialVersionUID = 1L;

Expand All @@ -417,6 +416,11 @@ public void onClick(AjaxRequestTarget target) {
}
};
}

@Override
public IModel<Boolean> getVisible() {
return Model.of(isAssociationExpression());
}
});
menuList.add(new InlineMenuItem(createStringResource("ExpressionValuePanel.addLiteralValueButton")) {
private static final long serialVersionUID = 1L;
Expand All @@ -437,6 +441,11 @@ public void onClick(AjaxRequestTarget target) {
}
};
}

@Override
public IModel<Boolean> getVisible() {
return Model.of(!isAssociationExpression());
}
});
return menuList;
}
Expand All @@ -461,4 +470,8 @@ private List<String> getLiteralValues(){
}
return literalValueList;
}

protected boolean isAssociationExpression(){
return false;
}
}

This file was deleted.

Expand Up @@ -104,7 +104,7 @@ public <C extends Containerable> ContainerWrapper createContainerWrapper( Object
return cWrapper;
}

public <C extends Containerable> AbstractAssociationWrapper createAssociationWrapper(ObjectWrapper objectWrapper, PrismObject<ResourceType> resource, ShadowKindType kind, String shadowIntent, PrismContainer<C> association, ContainerStatus objectStatus, ContainerStatus status, ItemPath path) throws SchemaException {
public <C extends Containerable> ShadowAssociationWrapper createAssociationWrapper(ObjectWrapper objectWrapper, PrismObject<ResourceType> resource, ShadowKindType kind, String shadowIntent, PrismContainer<C> association, ContainerStatus objectStatus, ContainerStatus status, ItemPath path) throws SchemaException {
if (association == null || association.getDefinition() == null
|| (!(association.getDefinition().getCompileTimeClass().equals(ShadowAssociationType.class))
&& !(association.getDefinition().getCompileTimeClass().equals(ResourceObjectAssociationType.class)))){
Expand Down Expand Up @@ -133,16 +133,14 @@ public <C extends Containerable> AbstractAssociationWrapper createAssociationWra
}

PrismContainer associationTransformed = associationDefinition.instantiate();
AbstractAssociationWrapper associationWrapper;
ShadowAssociationWrapper associationWrapper;
if (association.getDefinition().getCompileTimeClass().equals(ShadowAssociationType.class)) {
associationWrapper = new ShadowAssociationWrapper(objectWrapper, associationTransformed, objectStatus, status, path);
} else if (association.getDefinition().getCompileTimeClass().equals(ResourceObjectAssociationType.class)) {
associationWrapper = new ResourceAssociationWrapper(objectWrapper, associationTransformed, objectStatus, status, path);
} else {
return null;
}

ContainerValueWrapper<C> shadowValueWrapper = new ContainerValueWrapper<>(associationWrapper,
ContainerValueWrapper<ShadowAssociationType> shadowValueWrapper = new ContainerValueWrapper<ShadowAssociationType>(associationWrapper,
associationTransformed.createNewValue(), objectStatus,
ContainerStatus.ADDING == status ? ValueStatus.ADDED : ValueStatus.NOT_CHANGED, path);

Expand Down
Expand Up @@ -282,7 +282,14 @@ protected void populateItem(final ListItem<ValueWrapper> item) {
itemWrapper.getPath().containsName(MappingType.F_EXPRESSION)){
ExpressionWrapper expressionWrapper = (ExpressionWrapper)item.getModelObject().getItem();
panel = new ExpressionValuePanel("value", new PropertyModel(item.getModel(), "value.value"),
expressionWrapper.getConstruction(), pageBase);
expressionWrapper.getConstruction(), pageBase){
private static final long serialVersionUID = 1L;

@Override
protected boolean isAssociationExpression(){
return itemWrapper.getPath().containsName(ConstructionType.F_ASSOCIATION);
}
};
} else {
panel = new PrismValuePanel("value", item.getModel(), label, form, getValueCssClass(), getInputCssClass());
}
Expand Down
Expand Up @@ -619,13 +619,7 @@ public void setObject(String object) {
if (def.getValueEnumerationRef() != null) {
PrismReferenceValue valueEnumerationRef = def.getValueEnumerationRef();
String lookupTableUid = valueEnumerationRef.getOid();
Task task = getPageBase().createSimpleTask("loadLookupTable");
OperationResult result = task.getResult();

Collection<SelectorOptions<GetOperationOptions>> options = WebModelServiceUtils
.createLookupTableRetrieveOptions();
final PrismObject<LookupTableType> lookupTable = WebModelServiceUtils.loadObject(LookupTableType.class,
lookupTableUid, options, getPageBase(), task, result);
PrismObject<LookupTableType> lookupTable = getLookupTable(lookupTableUid);

if (lookupTable != null) {

Expand Down Expand Up @@ -899,28 +893,7 @@ public void checkInputValue(AutoCompleteTextField input, AjaxRequestTarget targe
} else if (def.getValueEnumerationRef() != null) {
PrismReferenceValue valueEnumerationRef = def.getValueEnumerationRef();
String lookupTableUid = valueEnumerationRef.getOid();

PrismObject<LookupTableType> lookupTable;
String operation = "loadLookupTable";
if(getPageBase() instanceof PageSelfRegistration) {
lookupTable = getPageBase().runPrivileged(
() -> {
Task task = getPageBase().createAnonymousTask(operation);
OperationResult result = task.getResult();
Collection<SelectorOptions<GetOperationOptions>> options = WebModelServiceUtils
.createLookupTableRetrieveOptions();
return WebModelServiceUtils.loadObject(LookupTableType.class,
lookupTableUid, options, getPageBase(), task, result);
});
} else {
Task task = getPageBase().createSimpleTask(operation);
OperationResult result = task.getResult();

Collection<SelectorOptions<GetOperationOptions>> options = WebModelServiceUtils
.createLookupTableRetrieveOptions();
lookupTable = WebModelServiceUtils.loadObject(LookupTableType.class,
lookupTableUid, options, getPageBase(), task, result);
}
PrismObject<LookupTableType> lookupTable = getLookupTable(lookupTableUid);

if (lookupTable != null) {

Expand Down Expand Up @@ -995,6 +968,32 @@ protected Class getDefaultType(List<QName> supportedTypes){

return panel;
}

private PrismObject<LookupTableType> getLookupTable(String lookupTableUid) {
PrismObject<LookupTableType> lookupTable;
String operation = "loadLookupTable";
if(getPageBase() instanceof PageSelfRegistration) {
lookupTable = getPageBase().runPrivileged(
() -> {
Task task = getPageBase().createAnonymousTask(operation);
OperationResult result = task.getResult();
Collection<SelectorOptions<GetOperationOptions>> options = WebModelServiceUtils
.createLookupTableRetrieveOptions();
return WebModelServiceUtils.loadObject(LookupTableType.class,
lookupTableUid, options, getPageBase(), task, result);
});
} else {
Task task = getPageBase().createSimpleTask(operation);
OperationResult result = task.getResult();

Collection<SelectorOptions<GetOperationOptions>> options = WebModelServiceUtils
.createLookupTableRetrieveOptions();
lookupTable = WebModelServiceUtils.loadObject(LookupTableType.class,
lookupTableUid, options, getPageBase(), task, result);
}

return lookupTable;
}

private List<String> prepareAutoCompleteList(String input, PrismObject<LookupTableType> lookupTable) {
List<String> values = new ArrayList<>();
Expand Down

0 comments on commit 5fae4c4

Please sign in to comment.