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 Jan 23, 2017
2 parents 95cd9f0 + 3c501e7 commit 1317bf0
Show file tree
Hide file tree
Showing 89 changed files with 2,523 additions and 804 deletions.
2 changes: 1 addition & 1 deletion build-system/pom.xml
Expand Up @@ -85,7 +85,7 @@
<jasper.version>6.1.1</jasper.version>
<derby.version>10.11.1.1</derby.version>
<wro4j.version>1.8.0</wro4j.version>
<jackson.version>2.8.3</jackson.version>
<jackson.version>2.8.6</jackson.version>
<snakeyaml.version>1.15</snakeyaml.version>
<surefire.version>2.19.1</surefire.version>
</properties>
Expand Down
Expand Up @@ -20,6 +20,7 @@

import javax.xml.bind.JAXBElement;

import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.commons.lang.StringUtils;
import org.apache.wicket.RestartResponseException;
import org.apache.wicket.markup.html.basic.Label;
Expand All @@ -37,11 +38,6 @@
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.form.Form;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AbstractFormItemType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.FormDefinitionType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.FormFieldGroupType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.FormItemDisplayType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import com.evolveum.prism.xml.ns._public.types_3.ItemPathType;

public class DynamicFieldGroupPanel<O extends ObjectType> extends BasePanel<ObjectWrapper<O>>{
Expand All @@ -66,7 +62,7 @@ public DynamicFieldGroupPanel(String id, IModel<ObjectWrapper<O>> objectWrapper,
if (formDefinition.getDisplay() != null) {
groupName = formDefinition.getDisplay().getLabel();
}
initLayout(groupName, getFormItems(formDefinition.getFormItem()), mainForm);
initLayout(groupName, getFormItems(formDefinition.getFormItems()), mainForm);
}

private void initLayout(String groupName, List<AbstractFormItemType> formItems, Form<?> mainForm) {
Expand All @@ -81,7 +77,7 @@ private void initLayout(String groupName, List<AbstractFormItemType> formItems,
for (AbstractFormItemType formItem : formItems) {

if (formItem instanceof FormFieldGroupType) {
DynamicFieldGroupPanel<O> dynamicFieldGroupPanel = new DynamicFieldGroupPanel<O>(itemView.newChildId(), formItem.getName(), getModel(), getFormItems(((FormFieldGroupType) formItem).getFormItem()), mainForm, getPageBase());
DynamicFieldGroupPanel<O> dynamicFieldGroupPanel = new DynamicFieldGroupPanel<O>(itemView.newChildId(), formItem.getName(), getModel(), getFormItems(((FormFieldGroupType) formItem).getFormItems()), mainForm, getPageBase());
dynamicFieldGroupPanel.setOutputMarkupId(true);
itemView.add(dynamicFieldGroupPanel);
continue;
Expand Down Expand Up @@ -164,11 +160,13 @@ private void applyFormDefinition(ItemWrapper itemWrapper, AbstractFormItemType f

}

private List<AbstractFormItemType> getFormItems(List<JAXBElement<? extends AbstractFormItemType>> formItems) {
private List<AbstractFormItemType> getFormItems(FormItemsType formItemsProperty) {
List<AbstractFormItemType> items = new ArrayList<>();
for (JAXBElement<? extends AbstractFormItemType> formItem : formItems) {
AbstractFormItemType item = formItem.getValue();
items.add(item);
if (formItemsProperty != null) {
for (JAXBElement<? extends AbstractFormItemType> formItem : formItemsProperty.getFormItem()) {
AbstractFormItemType item = formItem.getValue();
items.add(item);
}
}
return items;
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2013 Evolveum
* Copyright (c) 2010-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -627,7 +627,7 @@ private String formatItemInfo(ResourceItemDefinitionType item, ItemPathType ref,
if (outbound != null) {
sb.append(" | ").append(getString("SchemaHandlingStep.out")).append(": ");
boolean first = true;
for (MappingSourceDeclarationType source : outbound.getSource()) {
for (VariableBindingDefinitionType source : outbound.getSource()) {
if (source != null) {
if (first) first = false; else sb.append(", ");
sb.append(formatPath(source.getPath()));
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2014 Evolveum
* Copyright (c) 2010-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -117,7 +117,7 @@ private void prepareActivationObject(ResourceActivationDefinitionType activation
} else {
for(MappingType mapping: activation.getExistence().getInbound()){
if(mapping.equals(new MappingType())){
MappingSourceDeclarationType source = new MappingSourceDeclarationType();
VariableBindingDefinitionType source = new VariableBindingDefinitionType();
source.setPath(new ItemPathType(EXISTENCE_DEFAULT_SOURCE));
mapping.getSource().add(source);
}
Expand All @@ -129,23 +129,23 @@ private void prepareActivationObject(ResourceActivationDefinitionType activation
} else {
for(MappingType outbound: activation.getAdministrativeStatus().getOutbound()){
if(outbound.equals(new MappingType())){
MappingSourceDeclarationType source = new MappingSourceDeclarationType();
VariableBindingDefinitionType source = new VariableBindingDefinitionType();
source.setPath(new ItemPathType(ADM_STATUS_OUT_SOURCE_DEFAULT));
outbound.getSource().add(source);

MappingTargetDeclarationType target = new MappingTargetDeclarationType();
VariableBindingDefinitionType target = new VariableBindingDefinitionType();
target.setPath(new ItemPathType(ADM_STATUS_OUT_TARGET_DEFAULT));
outbound.setTarget(target);
}
}

for(MappingType inbound: activation.getAdministrativeStatus().getInbound()){
if(inbound.equals(new MappingType())){
MappingSourceDeclarationType source = new MappingSourceDeclarationType();
VariableBindingDefinitionType source = new VariableBindingDefinitionType();
source.setPath(new ItemPathType(ADM_STATUS_IN_SOURCE_DEFAULT));
inbound.getSource().add(source);

MappingTargetDeclarationType target = new MappingTargetDeclarationType();
VariableBindingDefinitionType target = new VariableBindingDefinitionType();
target.setPath(new ItemPathType(ADM_STATUS_IN_TARGET_DEFAULT));
inbound.setTarget(target);
}
Expand All @@ -157,23 +157,23 @@ private void prepareActivationObject(ResourceActivationDefinitionType activation
} else {
for(MappingType outbound: activation.getValidFrom().getOutbound()){
if(outbound.equals(new MappingType())){
MappingSourceDeclarationType source = new MappingSourceDeclarationType();
VariableBindingDefinitionType source = new VariableBindingDefinitionType();
source.setPath(new ItemPathType(VALID_FROM_OUT_SOURCE_DEFAULT));
outbound.getSource().add(source);

MappingTargetDeclarationType target = new MappingTargetDeclarationType();
VariableBindingDefinitionType target = new VariableBindingDefinitionType();
target.setPath(new ItemPathType(VALID_FROM_OUT_TARGET_DEFAULT));
outbound.setTarget(target);
}
}

for(MappingType inbound: activation.getValidFrom().getInbound()){
if(inbound.equals(new MappingType())){
MappingSourceDeclarationType source = new MappingSourceDeclarationType();
VariableBindingDefinitionType source = new VariableBindingDefinitionType();
source.setPath(new ItemPathType(VALID_FROM_IN_SOURCE_DEFAULT));
inbound.getSource().add(source);

MappingTargetDeclarationType target = new MappingTargetDeclarationType();
VariableBindingDefinitionType target = new VariableBindingDefinitionType();
target.setPath(new ItemPathType(VALID_FROM_IN_TARGET_DEFAULT));
inbound.setTarget(target);
}
Expand All @@ -185,23 +185,23 @@ private void prepareActivationObject(ResourceActivationDefinitionType activation
} else {
for(MappingType outbound: activation.getValidTo().getOutbound()){
if(outbound.equals(new MappingType())){
MappingSourceDeclarationType source = new MappingSourceDeclarationType();
VariableBindingDefinitionType source = new VariableBindingDefinitionType();
source.setPath(new ItemPathType(VALID_TO_OUT_SOURCE_DEFAULT));
outbound.getSource().add(source);

MappingTargetDeclarationType target = new MappingTargetDeclarationType();
VariableBindingDefinitionType target = new VariableBindingDefinitionType();
target.setPath(new ItemPathType(VALID_TO_OUT_TARGET_DEFAULT));
outbound.setTarget(target);
}
}

for(MappingType inbound: activation.getValidTo().getInbound()){
if(inbound.equals(new MappingType())){
MappingSourceDeclarationType source = new MappingSourceDeclarationType();
VariableBindingDefinitionType source = new VariableBindingDefinitionType();
source.setPath(new ItemPathType(VALID_TO_IN_SOURCE_DEFAULT));
inbound.getSource().add(source);

MappingTargetDeclarationType target = new MappingTargetDeclarationType();
VariableBindingDefinitionType target = new VariableBindingDefinitionType();
target.setPath(new ItemPathType(VALID_TO_IN_TARGET_DEFAULT));
inbound.setTarget(target);
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2013 Evolveum
* Copyright (c) 2010-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -83,7 +83,7 @@ public MappingTypeDto(MappingType mapping, PrismContext prismContext){

oldMappingObject = mappingObject.clone();

for(MappingSourceDeclarationType mappingSource: mappingObject.getSource()){
for(VariableBindingDefinitionType mappingSource: mappingObject.getSource()){
if(mappingSource.getPath() != null && mappingSource.getPath().getItemPath() != null){
source.add(mappingSource.getPath().getItemPath().toString());
}
Expand Down Expand Up @@ -139,21 +139,21 @@ public MappingType prepareDtoToSave(PrismContext prismContext) throws SchemaExce
}

if(target != null){
MappingTargetDeclarationType mappingTarget = new MappingTargetDeclarationType();
VariableBindingDefinitionType mappingTarget = new VariableBindingDefinitionType();
mappingTarget.setPath(new ItemPathType(target));
mappingObject.setTarget(mappingTarget);
} else {
mappingObject.setTarget(null);
}

mappingObject.getSource().clear();
List<MappingSourceDeclarationType> mappingSourceList = new ArrayList<>();
List<VariableBindingDefinitionType> mappingSourceList = new ArrayList<>();
for(String s: source){
if(s == null){
continue;
}

MappingSourceDeclarationType mappingSource = new MappingSourceDeclarationType();
VariableBindingDefinitionType mappingSource = new VariableBindingDefinitionType();
mappingSource.setPath(new ItemPathType(s));
mappingSourceList.add(mappingSource);
}
Expand Down Expand Up @@ -346,7 +346,7 @@ public static String createMappingLabel(MappingType mapping, Trace LOGGER, Prism
}

if(!mapping.getSource().isEmpty()){
for(MappingSourceDeclarationType source: mapping.getSource()){
for(VariableBindingDefinitionType source: mapping.getSource()){
if(source.getPath() != null && source.getPath().getItemPath() != null
&& source.getPath().getItemPath().getSegments() != null){

Expand All @@ -367,7 +367,7 @@ public static String createMappingLabel(MappingType mapping, Trace LOGGER, Prism
sb.append("->");

if (mapping.getTarget() != null) {
MappingTargetDeclarationType target = mapping.getTarget();
VariableBindingDefinitionType target = mapping.getTarget();
if (target.getPath() != null && !ItemPath.isNullOrEmpty(target.getPath().getItemPath())) {
List<ItemPathSegment> segments = target.getPath().getItemPath().getSegments();
sb.append(segments.get(segments.size() - 1));
Expand Down
Expand Up @@ -676,4 +676,8 @@ public CompositeRefinedObjectClassDefinitionImpl deepClone(Map<QName, ComplexTyp
return new CompositeRefinedObjectClassDefinitionImpl(structuralClone, auxiliaryClones);
}

@Override
public boolean isListMarker() {
return structuralObjectClassDefinition.isListMarker();
}
}
Expand Up @@ -578,6 +578,16 @@ public RefinedAttributeDefinition<T> deepClone(Map<QName, ComplexTypeDefinition>
return new LayerRefinedAttributeDefinitionImpl<T>(refinedAttributeDefinition.deepClone(ctdMap), layer);
}

@Override
public QName getSubstitutionHead() {
return refinedAttributeDefinition.getSubstitutionHead();
}

@Override
public boolean isHeterogeneousListItem() {
return refinedAttributeDefinition.isHeterogeneousListItem();
}

//endregion

}
Expand Up @@ -380,7 +380,12 @@ public boolean isXsdAnyMarker() {
return refinedObjectClassDefinition.isXsdAnyMarker();
}

@Override
@Override
public boolean isListMarker() {
return refinedObjectClassDefinition.isListMarker();
}

@Override
public QName getSuperType() {
return refinedObjectClassDefinition.getSuperType();
}
Expand Down
Expand Up @@ -207,6 +207,13 @@ public <TD extends TypeDefinition> TD findTypeDefinitionByType(@NotNull QName ty
return refinedResourceSchema.findTypeDefinitionByType(typeName, definitionClass);
}

@NotNull
@Override
public <TD extends TypeDefinition> Collection<? extends TD> findTypeDefinitionsByType(@NotNull QName typeName,
@NotNull Class<TD> definitionClass) {
return refinedResourceSchema.findTypeDefinitionsByType(typeName, definitionClass);
}

@Override
public int hashCode() {
final int prime = 31;
Expand Down
Expand Up @@ -757,6 +757,11 @@ public ResourceAttributeContainer instantiate(QName elementName) {
return ObjectClassComplexTypeDefinitionImpl.instantiate(elementName, this);
}

@Override
public boolean isListMarker() {
return originalObjectClassDefinition.isListMarker();
}

//endregion

//region ==== Parsing =================================================================================
Expand Down
Expand Up @@ -561,6 +561,13 @@ public <ID extends ItemDefinition> List<ID> findItemDefinitionsByElementName(@No
return originalResourceSchema.findItemDefinitionsByElementName(elementName, definitionClass);
}

@NotNull
@Override
public <TD extends TypeDefinition> Collection<? extends TD> findTypeDefinitionsByType(@NotNull QName typeName,
@NotNull Class<TD> definitionClass) {
return originalResourceSchema.findTypeDefinitionsByType(typeName, definitionClass);
}

//endregion

}
Expand Up @@ -77,6 +77,9 @@ public interface ComplexTypeDefinition extends TypeDefinition, LocalDefinitionSt
*/
boolean isXsdAnyMarker();

// TODO. EXPERIMENTAL.
boolean isListMarker();

/**
* When resolving unqualified names for items contained in this CTD, what should be the default namespace
* to look into at first. Currently does NOT apply recursively (to inner CTDs).
Expand Down
Expand Up @@ -45,10 +45,10 @@ public class ComplexTypeDefinitionImpl extends TypeDefinitionImpl implements Com
private boolean containerMarker;
private boolean objectMarker;
private boolean xsdAnyMarker;
private boolean listMarker;
private QName extensionForType;

private String defaultNamespace;

@NotNull private List<String> ignoredNamespaces = new ArrayList<>();

public ComplexTypeDefinitionImpl(@NotNull QName typeName, @NotNull PrismContext prismContext) {
Expand Down Expand Up @@ -110,6 +110,14 @@ public void setXsdAnyMarker(boolean xsdAnyMarker) {
this.xsdAnyMarker = xsdAnyMarker;
}

public boolean isListMarker() {
return listMarker;
}

public void setListMarker(boolean listMarker) {
this.listMarker = listMarker;
}

@Override
public String getDefaultNamespace() {
return defaultNamespace;
Expand Down
Expand Up @@ -96,6 +96,17 @@ public interface ItemDefinition<I extends Item> extends Definition {
*/
boolean canAdd();

/**
* Returns the name of an element this one can be substituted for (e.g. c:user -> c:object,
* s:pipeline -> s:expression, etc). EXPERIMENTAL
*/
QName getSubstitutionHead();

/**
* Can be used in heterogeneous lists as a list item. EXPERIMENTAL.
*/
boolean isHeterogeneousListItem();

PrismReferenceValue getValueEnumerationRef();

boolean isValidFor(QName elementQName, Class<? extends ItemDefinition> clazz);
Expand Down

0 comments on commit 1317bf0

Please sign in to comment.