Skip to content

Commit

Permalink
Merge branch 'master' into bootstrap-upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Oct 12, 2014
2 parents d8c0fcb + b01dab8 commit 6985f0d
Show file tree
Hide file tree
Showing 109 changed files with 2,359 additions and 1,185 deletions.
Expand Up @@ -3,7 +3,7 @@ NameStep.connectorBundle=Bundle
NameStep.connectorInformation=Information
NameStep.connectorName=Connector name
NameStep.connectorNotSelected=Connector was not selected.
NameStep.connectorType=Type
NameStep.connectorType=Connector
NameStep.connectorVersion=Connector version
NameStep.hostNotUsed=Not used
NameStep.location=Location
Expand Down
Expand Up @@ -4,7 +4,7 @@ NameStep.connectorHost=Connector host
NameStep.connectorInformation=Information
NameStep.connectorName=Connector name
NameStep.connectorNotSelected=Connector was not selected.
NameStep.connectorType=Connector type
NameStep.connectorType=Connector
NameStep.connectorVersion=Connector version
NameStep.description=Description
NameStep.hostNotUsed=Not used
Expand Down
Expand Up @@ -4,7 +4,7 @@ NameStep.connectorHost=Connector host
NameStep.connectorInformation=Information
NameStep.connectorName=Connector name
NameStep.connectorNotSelected=Connector was not selected.
NameStep.connectorType=Type
NameStep.connectorType=Connector
NameStep.connectorVersion=Connector version
NameStep.description=Description
NameStep.hostNotUsed=Not used
Expand Down
Expand Up @@ -233,6 +233,7 @@ public PrismContainerValue getNewValue() throws SchemaException {
} else {
ObjectReferenceType ref = new ObjectReferenceType();
ref.setOid(this.tenantRef.getOid());
ref.setType(OrgType.COMPLEX_TYPE);
newAssignment.setTenantRef(ref);
}
}
Expand Down
Expand Up @@ -101,7 +101,7 @@ public List<AssignmentType> getAssignmentTypeList(){
}

public List<AssignmentEditorDto> loadFromAssignmentTypeList(List<AssignmentType> asgList, OperationResult result){
List<AssignmentEditorDto> list = new ArrayList<AssignmentEditorDto>();
List<AssignmentEditorDto> list = new ArrayList<>();

for (AssignmentType assignment : asgList) {
ObjectType targetObject = null;
Expand Down Expand Up @@ -221,7 +221,7 @@ public ObjectQuery getProviderQuery(){
return null;
} else {
ObjectQuery query = new ObjectQuery();
List<String> oids = new ArrayList<String>();
List<String> oids = new ArrayList<>();
oids.add(getExcludeOid());

ObjectFilter oidFilter = InOidFilter.createInOid(oids);
Expand Down Expand Up @@ -253,7 +253,7 @@ public void yesPerformed(AjaxRequestTarget target){
}

private List<InlineMenuItem> createAssignmentMenu(){
List<InlineMenuItem> items = new ArrayList<InlineMenuItem>();
List<InlineMenuItem> items = new ArrayList<>();

InlineMenuItem item = new InlineMenuItem(createStringResource("AssignmentTablePanel.menu.assign"),
new InlineMenuItemAction(){
Expand Down Expand Up @@ -300,7 +300,7 @@ public void onClick(AjaxRequestTarget target) {
}

private List<AssignmentEditorDto> getSelectedAssignments(){
List<AssignmentEditorDto> selected = new ArrayList<AssignmentEditorDto>();
List<AssignmentEditorDto> selected = new ArrayList<>();

List<AssignmentEditorDto> all = assignmentModel.getObject();

Expand Down
Expand Up @@ -20,7 +20,7 @@

<dl class="dl-horizontal">
<dt>
<label><wicket:message key="ExpressionEditorPanel.label.type" /></label>
<label wicket:id="typeLabel"></label>
</dt>
<dd>
<select wicket:id="type" class="form-control input-sm"></select>
Expand All @@ -47,7 +47,7 @@

<dl class="dl-horizontal">
<dt>
<label><wicket:message key="ExpressionEditorPanel.label.expression" /></label>
<label wicket:id="expressionLabel"></label>
</dt>
<dd>
<textarea wicket:id="expression" class="form-control input-sm" rows="5"></textarea>
Expand Down
Expand Up @@ -35,11 +35,10 @@
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.EnumChoiceRenderer;
import org.apache.wicket.markup.html.form.IChoiceRenderer;
import org.apache.wicket.markup.html.form.TextArea;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.*;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
Expand All @@ -66,6 +65,8 @@ public class ExpressionEditorPanel extends SimplePanel<ExpressionType>{
private static final String ID_LANGUAGE_CONTAINER = "languageContainer";
private static final String ID_POLICY_CONTAINER = "policyRefContainer";
private static final String ID_BUTTON_UPDATE = "update";
private static final String ID_LABEL_TYPE = "typeLabel";
private static final String ID_LABEL_EXPRESSION = "expressionLabel";

private IModel<ExpressionTypeDto> model;
private Map<String, String> policyMap = new HashMap<>();
Expand Down Expand Up @@ -94,6 +95,9 @@ protected ExpressionTypeDto load() {
protected void initLayout(){
loadModel();

Label typeLabel = new Label(ID_LABEL_TYPE, createStringResource(getTypeLabelKey()));
add(typeLabel);

DropDownChoice type = new DropDownChoice<>(ID_TYPE,
new PropertyModel<ExpressionUtil.ExpressionEvaluatorType>(model, ExpressionTypeDto.F_TYPE),
WebMiscUtil.createReadonlyModelFromEnum(ExpressionUtil.ExpressionEvaluatorType.class),
Expand All @@ -108,6 +112,7 @@ protected void onUpdate(AjaxRequestTarget target) {
});
type.setOutputMarkupId(true);
type.setOutputMarkupPlaceholderTag(true);
type.setNullValid(true);
add(type);

WebMarkupContainer languageContainer = new WebMarkupContainer(ID_LANGUAGE_CONTAINER);
Expand Down Expand Up @@ -180,14 +185,17 @@ protected void onUpdate(AjaxRequestTarget target) {
policyRef.setNullValid(true);
policyContainer.add(policyRef);

Label expressionLabel = new Label(ID_LABEL_EXPRESSION, createStringResource(getExpressionLabelKey()));
add(expressionLabel);

TextArea expression = new TextArea<>(ID_EXPRESSION, new PropertyModel<String>(model, ExpressionTypeDto.F_EXPRESSION));
expression.setOutputMarkupId(true);
add(expression);

AjaxLink update = new AjaxLink(ID_BUTTON_UPDATE) {
AjaxSubmitLink update = new AjaxSubmitLink(ID_BUTTON_UPDATE) {

@Override
public void onClick(AjaxRequestTarget target) {
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
updateExpressionPerformed(target);
}
};
Expand Down Expand Up @@ -246,8 +254,19 @@ protected void updateExpressionPerformed(AjaxRequestTarget target){
/**
* Override this in component with ExpressionEditorPanel to provide additional functionality when expression is updated
* */
public void performExpressionHook(AjaxRequestTarget target){
public void performExpressionHook(AjaxRequestTarget target){}

/**
* Provide key for expression type label
* */
public String getTypeLabelKey(){
return "ExpressionEditorPanel.label.type";
}

/**
* Provide key for expression label
* */
public String getExpressionLabelKey(){
return "ExpressionEditorPanel.label.expression";
}
}
Expand Up @@ -15,7 +15,7 @@
#

ExpressionEditorPanel.label.type=Expression Type
ExpressionEditorPanel.label.language=Expression Language
ExpressionEditorPanel.label.language=Language
ExpressionEditorPanel.label.valuePolicyRef=Policy Ref.
ExpressionEditorPanel.label.expression=Expression
ExpressionEditorPanel.button.expressionSave=Update Expression
Expand All @@ -24,6 +24,7 @@ ExpressionEditorPanel.message.cantSerialize=Could not create JAXBElement<?> from
ExpressionEditorPanel.message.expressionSuccess=Expression has been update successfully.

policyRef.nullValid=Choose One
type.nullValid=Choose One
ExpressionEvaluatorType.LITERAL=Literal
ExpressionEvaluatorType.AS_IS=As is
ExpressionEvaluatorType.PATH=Path
Expand Down
Expand Up @@ -16,7 +16,6 @@

package com.evolveum.midpoint.web.component.input;

import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.logging.LoggingUtils;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
Expand All @@ -25,7 +24,8 @@
import com.evolveum.midpoint.web.component.util.SimplePanel;
import com.evolveum.prism.xml.ns._public.query_3.SearchFilterType;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextArea;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
Expand All @@ -41,7 +41,7 @@ public class SearchFilterPanel<T extends SearchFilterType> extends SimplePanel<T
private static final String ID_FILTER_CLAUSE = "filterClause";
private static final String ID_BUTTON_UPDATE = "update";

private IModel<SearchFilterTypeDto> model;
protected IModel<SearchFilterTypeDto> model;

public SearchFilterPanel(String id, IModel<T> model){
super(id, model);
Expand Down Expand Up @@ -71,10 +71,10 @@ protected void initLayout(){
new PropertyModel<String>(model, SearchFilterTypeDto.F_FILTER_CLAUSE));
add(filterClause);

AjaxLink update = new AjaxLink(ID_BUTTON_UPDATE) {
AjaxSubmitLink update = new AjaxSubmitLink(ID_BUTTON_UPDATE) {

@Override
public void onClick(AjaxRequestTarget target) {
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
updateClausePerformed(target);
}
};
Expand All @@ -86,7 +86,7 @@ private void updateClausePerformed(AjaxRequestTarget target){
model.getObject().updateFilterClause(getPageBase().getPrismContext());

success(getString("SearchFilterPanel.message.expressionSuccess"));
} catch (SchemaException e){
} catch (Exception e){
LoggingUtils.logException(LOGGER, "Could not create MapXNode from provided XML filterClause.", e);
error(getString("SearchFilterPanel.message.cantSerialize"));
}
Expand All @@ -98,7 +98,5 @@ private void updateClausePerformed(AjaxRequestTarget target){
/**
* Override this in component with SearchFilterPanel to provide additional functionality when filterClause is updated
* */
public void performFilterClauseHook(AjaxRequestTarget target){
target.add();
}
public void performFilterClauseHook(AjaxRequestTarget target){}
}
Expand Up @@ -17,17 +17,14 @@
package com.evolveum.midpoint.web.component.input.dto;

import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.xnode.MapXNode;
import com.evolveum.midpoint.prism.xnode.RootXNode;
import com.evolveum.midpoint.prism.xnode.XNode;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.logging.LoggingUtils;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.prism.xml.ns._public.query_3.SearchFilterType;
import org.apache.commons.lang.StringUtils;

import javax.xml.namespace.QName;
import java.io.Serializable;

/**
Expand Down Expand Up @@ -86,6 +83,11 @@ public void updateFilterClause(PrismContext context) throws SchemaException{
RootXNode filterClauseNode = (RootXNode) context.parseToXNode(filterClause, PrismContext.LANG_XML);

filterObject.setFilterClauseXNode(filterClauseNode);
} else {
String oldDescription = filterObject.getDescription();

filterObject = new SearchFilterType();
filterObject.setDescription(oldDescription);
}
}

Expand Down
Expand Up @@ -20,7 +20,9 @@
import com.evolveum.midpoint.common.refinery.RefinedResourceSchema;
import com.evolveum.midpoint.prism.*;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.prism.schema.PrismSchema;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.util.ConnectorTypeUtil;
import com.evolveum.midpoint.schema.util.ResourceTypeUtil;
import com.evolveum.midpoint.util.DOMUtil;
import com.evolveum.midpoint.util.exception.SchemaException;
Expand Down Expand Up @@ -187,6 +189,12 @@ private List<PropertyWrapper> createProperties(PageBase pageBase) {
} else {
definition = containerDefinition;
}
} else if (ResourceType.class.isAssignableFrom(clazz)) {
if (containerDefinition != null){
definition = containerDefinition;
} else{
definition = container.getDefinition();
}
} else {
definition = containerDefinition;
}
Expand Down
Expand Up @@ -357,11 +357,8 @@ private List<ContainerWrapper> createReportContainers(PageBase pageBase) throws
private List<ContainerWrapper> createResourceContainers(PageBase pageBase) throws SchemaException {
List<ContainerWrapper> containers = new ArrayList<ContainerWrapper>();
PrismObject<ConnectorType> connector = loadConnector();

containers.add(createResourceContainerWrapper(SchemaConstants.ICF_CONFIGURATION_PROPERTIES, connector, pageBase));
containers.add(createResourceContainerWrapper(SchemaConstants.ICF_CONNECTOR_POOL_CONFIGURATION, connector, pageBase));
containers.add(createResourceContainerWrapper(SchemaConstants.ICF_TIMEOUTS, connector, pageBase));


containers.addAll(createResourceContainerWrapper(connector, pageBase));
return containers;
}

Expand All @@ -371,30 +368,22 @@ private PrismObject<ConnectorType> loadConnector() {
//todo reimplement
}

private ContainerWrapper createResourceContainerWrapper(QName name, PrismObject<ConnectorType> connector, PageBase pageBase)
private List<ContainerWrapper> createResourceContainerWrapper(PrismObject<ConnectorType> connector, PageBase pageBase)
throws SchemaException {

PrismContainer container = object.findContainer(ResourceType.F_CONNECTOR_CONFIGURATION);
if (container != null && container.size() == 1 && container.getValue() != null) {
PrismContainerValue value = container.getValue();
container = value.findContainer(name);
}

ConnectorType connectorType = connector.asObjectable();
PrismSchema schema = ConnectorTypeUtil.parseConnectorSchema(connectorType, connector.getPrismContext());
PrismContainerDefinition definition = ConnectorTypeUtil.findConfigurationContainerDefintion(connectorType, schema);

ContainerStatus status = container != null ? ContainerStatus.MODIFYING : ContainerStatus.ADDING;
if (container == null) {
ConnectorType connectorType = connector.asObjectable();
PrismSchema schema = ConnectorTypeUtil.parseConnectorSchema(connectorType, connector.getPrismContext());
PrismContainerDefinition definition = ConnectorTypeUtil.findConfigurationContainerDefintion(connectorType, schema);

definition = definition.findContainerDefinition(new ItemPath(name));
container = definition.instantiate();
}

ContainerWrapper wrapper = new ContainerWrapper(this, container, status,
new ItemPath(ResourceType.F_CONNECTOR_CONFIGURATION, name), pageBase);
addSubresult(wrapper.getResult());

return wrapper;

return createContainerWrapper(container, new ItemPath(ResourceType.F_CONNECTOR_CONFIGURATION), pageBase);

}

private List<ContainerWrapper> createContainerWrapper(PrismContainer parent, ItemPath path, PageBase pageBase) {
Expand Down Expand Up @@ -432,9 +421,9 @@ private List<ContainerWrapper> createContainerWrapper(PrismContainer parent, Ite
}

ItemPath newPath = createPropertyPath(parentPath, containerDef.getName());
PrismContainer prismContainer = object.findContainer(def.getName());
PrismContainer prismContainer = parent.findContainer(def.getName());
ContainerWrapper container;
if (prismContainer != null) {
if (prismContainer != null && !prismContainer.getElementName().equals(CredentialsType.F_PASSWORD)) {
container = new ContainerWrapper(this, prismContainer, ContainerStatus.MODIFYING, newPath, pageBase);
} else {
prismContainer = containerDef.instantiate();
Expand Down
Expand Up @@ -436,7 +436,7 @@ private String createAssociationTooltipText(PrismProperty property){
PrismObject<ShadowType> shadowPrism = (PrismObject<ShadowType>)property.getParent().getParent();
ShadowType shadow = shadowPrism.asObjectable();

if(shadow.getActivation() != null){
if(shadow.getAttributes() != null){
ShadowAttributesType attributes = shadow.getAttributes();
AnyArrayList attrs = (AnyArrayList)attributes.getAny();

Expand Down
Expand Up @@ -78,7 +78,10 @@ public void revive(PrismContext prismContext) throws SchemaException {
}

protected PrismPropertyDefinition getItemDefinition() {
PrismPropertyDefinition propDef = container.getContainerDefinition().findPropertyDefinition(property.getDefinition().getName());
PrismPropertyDefinition propDef = null;
if (container.getContainerDefinition() != null){
propDef = container.getContainerDefinition().findPropertyDefinition(property.getDefinition().getName());
}
if (propDef == null) {
propDef = property.getDefinition();
}
Expand Down

0 comments on commit 6985f0d

Please sign in to comment.