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 Jan 31, 2019
2 parents 2daddbe + d1551b1 commit f0753d6
Show file tree
Hide file tree
Showing 64 changed files with 1,623 additions and 100 deletions.
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 Evolveum
* Copyright (c) 2016-2019 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 @@ -161,6 +161,11 @@ public class GuiStyleConstants {
public static final String CLASS_MINUS_CIRCLE_DANGER = CLASS_MINUS_CIRCLE + " text-danger";
public static final String CLASS_CIRCLE_FULL = "fa fa-circle";

/**
* Plus icon used for overlaid buttons (button with + or - in the bottom-right corner)
*/
public static final String CLASS_BUTTON_OVERLAY_PLUS = "fa fa-plus";

public static final String CLASS_FILE_TEXT = "fa fa-file-text-o";
public static final String CLASS_POLICY_RULES_ICON = "fa fa-balance-scale";
public static final String CLASS_POLICY_RULES_ICON_COLORED = "fa fa-balance-scale"; //TODO
Expand Down
Expand Up @@ -58,6 +58,9 @@ public class ObjectBrowserPanel<O extends ObjectType> extends BasePanel<O> imple
private PageBase parentPage;
private ObjectFilter queryFilter;
private List<O> selectedObjectsList = new ArrayList<>();
private Class<? extends O> defaultType;
private List<QName> supportedTypes = new ArrayList<>();
boolean multiselect;

/**
* @param defaultType specifies type of the object that will be selected by default
Expand Down Expand Up @@ -95,10 +98,17 @@ protected ObjectTypes load() {

};

initLayout(defaultType, supportedTypes, multiselect);
this.defaultType = defaultType;
this.supportedTypes = supportedTypes;
this.multiselect = multiselect;
}

private void initLayout(Class<? extends O> type, final List<QName> supportedTypes, final boolean multiselect) {
protected void onInitialize(){
super.onInitialize();
initLayout();
}

private void initLayout() {
List<ObjectTypes> supported = new ArrayList<>();
for (QName qname : supportedTypes) {
supported.add(ObjectTypes.getObjectTypeFromTypeQName(qname));
Expand Down Expand Up @@ -134,7 +144,7 @@ protected void onUpdate(AjaxRequestTarget target) {
});
typePanel.add(typeSelect);

ObjectTypes objType = type != null ? ObjectTypes.getObjectType(type) : null;
ObjectTypes objType = defaultType != null ? ObjectTypes.getObjectType(defaultType) : null;
ObjectListPanel<O> listPanel = createObjectListPanel(objType, multiselect);
add(listPanel);

Expand Down
Expand Up @@ -57,7 +57,7 @@ private void initLayout(){

CompositedIconBuilder builder = new CompositedIconBuilder();
builder.setBasicIcon(getDefaultButtonStyle(), IconCssStyle.IN_ROW_STYLE, "")
.appendLayerIcon(GuiStyleConstants.CLASS_PLUS_CIRCLE, IconCssStyle.BOTTOM_RIGHT_STYLE, "green");
.appendLayerIcon(GuiStyleConstants.CLASS_BUTTON_OVERLAY_PLUS, IconCssStyle.BOTTOM_RIGHT_STYLE, "green");

AjaxCompositedIconButton mainButton = new AjaxCompositedIconButton(ID_MAIN_BUTTON, builder.build(),
createStringResource("MainObjectListPanel.newObject")) {
Expand Down
Expand Up @@ -150,10 +150,10 @@
}

i.bottom-right-layer {
font-size: 100%;
font-size: 85%;
position: absolute;
right: 10%;
bottom: 5%;
right: 13%;
bottom: 7%;
}

i.bottom-left-layer {
Expand Down
Expand Up @@ -464,8 +464,8 @@ public boolean isReturnedByDefault() {
}

@Override
public boolean isIdentifier(ResourceAttributeContainerDefinition objectDefinition) {
return refinedAttributeDefinition.isIdentifier(objectDefinition);
public boolean isPrimaryIdentifier(ResourceAttributeContainerDefinition objectDefinition) {
return refinedAttributeDefinition.isPrimaryIdentifier(objectDefinition);
}

@Override
Expand Down Expand Up @@ -495,8 +495,8 @@ public int getMaxOccurs() {
}

@Override
public boolean isIdentifier(ObjectClassComplexTypeDefinition objectDefinition) {
return refinedAttributeDefinition.isIdentifier(objectDefinition);
public boolean isPrimaryIdentifier(ObjectClassComplexTypeDefinition objectDefinition) {
return refinedAttributeDefinition.isPrimaryIdentifier(objectDefinition);
}

@Override
Expand All @@ -520,8 +520,8 @@ public QName getValueType() {
}

@Override
public boolean isSecondaryIdentifier() {
return refinedAttributeDefinition.isSecondaryIdentifier();
public Boolean isSecondaryIdentifierOverride() {
return refinedAttributeDefinition.isSecondaryIdentifierOverride();
}

@Override
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2018 Evolveum
* Copyright (c) 2010-2019 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 @@ -36,7 +36,7 @@
public interface RefinedAttributeDefinition<T> extends ResourceAttributeDefinition<T> {
boolean isTolerant();

boolean isSecondaryIdentifier();
Boolean isSecondaryIdentifierOverride();

boolean canAdd(LayerType layer);

Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2018 Evolveum
* Copyright (c) 2010-2019 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 @@ -59,7 +59,7 @@ public class RefinedAttributeDefinitionImpl<T> extends ResourceAttributeDefiniti
private String description;
private boolean tolerant = true;
private boolean isExclusiveStrong = false;
protected boolean secondaryIdentifier = false;
protected Boolean secondaryIdentifierOverride = null;
private boolean isDisplayNameAttribute = false;
private List<String> intolerantValuePattern;
private List<String> tolerantValuePattern;
Expand Down Expand Up @@ -94,12 +94,12 @@ public void setTolerant(boolean tolerant) {
}

@Override
public boolean isSecondaryIdentifier() {
return secondaryIdentifier;
public Boolean isSecondaryIdentifierOverride() {
return secondaryIdentifierOverride;
}

public void setSecondaryIdentifier(boolean secondaryIdentifier) {
this.secondaryIdentifier = secondaryIdentifier;
public void setSecondaryIdentifierOverride(Boolean secondaryIdentifier) {
this.secondaryIdentifierOverride = secondaryIdentifier;
}

@Override
Expand Down Expand Up @@ -428,11 +428,7 @@ static <T> RefinedAttributeDefinition<T> parse(ResourceAttributeDefinition<T> sc
rAttrDef.tolerant = schemaHandlingAttrDefType.isTolerant();
}

if (schemaHandlingAttrDefType.isSecondaryIdentifier() == null) {
rAttrDef.secondaryIdentifier = false;
} else {
rAttrDef.secondaryIdentifier = schemaHandlingAttrDefType.isSecondaryIdentifier();
}
rAttrDef.secondaryIdentifierOverride = schemaHandlingAttrDefType.isSecondaryIdentifier();

rAttrDef.tolerantValuePattern = schemaHandlingAttrDefType.getTolerantValuePattern();
rAttrDef.intolerantValuePattern = schemaHandlingAttrDefType.getIntolerantValuePattern();
Expand Down Expand Up @@ -568,7 +564,7 @@ protected void copyDefinitionData(RefinedAttributeDefinitionImpl<T> clone) {
clone.modificationPriority = this.modificationPriority;
clone.outboundMappingType = this.outboundMappingType;
clone.readReplaceMode = this.readReplaceMode;
clone.secondaryIdentifier = this.secondaryIdentifier;
clone.secondaryIdentifierOverride = this.secondaryIdentifierOverride;
clone.tolerant = this.tolerant;
clone.tolerantValuePattern = this.tolerantValuePattern;
}
Expand Down
Expand Up @@ -74,7 +74,7 @@ public class RefinedObjectClassDefinitionImpl implements RefinedObjectClassDefin
private String description;
private boolean isDefault;
private boolean shared = true; // experimental
@NotNull private final List<RefinedAttributeDefinition<?>> identifiers = new ArrayList<>();
@NotNull private final List<RefinedAttributeDefinition<?>> primaryIdentifiers = new ArrayList<>();
@NotNull private final List<RefinedAttributeDefinition<?>> secondaryIdentifiers = new ArrayList<>();
@NotNull private final List<ResourceObjectPattern> protectedObjectPatterns = new ArrayList<>();
private ResourceObjectReferenceType baseContext;
Expand Down Expand Up @@ -138,7 +138,7 @@ public <ID extends ItemDefinition> ID findLocalItemDefinition(@NotNull QName nam
@NotNull
@Override
public Collection<RefinedAttributeDefinition<?>> getPrimaryIdentifiers() {
return identifiers;
return primaryIdentifiers;
}

@NotNull
Expand Down Expand Up @@ -599,7 +599,7 @@ private void copyDefinitionData(RefinedObjectClassDefinitionImpl clone) {
clone.displayName = this.displayName;
clone.description = this.description;
clone.isDefault = this.isDefault;
clone.identifiers.addAll(cloneDefinitions(this.identifiers));
clone.primaryIdentifiers.addAll(cloneDefinitions(this.primaryIdentifiers));
clone.secondaryIdentifiers.addAll(cloneDefinitions(this.secondaryIdentifiers));
clone.protectedObjectPatterns.addAll(this.protectedObjectPatterns);
clone.baseContext = this.baseContext;
Expand Down Expand Up @@ -1091,10 +1091,16 @@ private void parseAttributesFrom(RefinedResourceSchema rSchema, ObjectClassCompl

private void processIdentifiers(RefinedAttributeDefinition rAttrDef, ObjectClassComplexTypeDefinition objectClassDef) {
QName attrName = rAttrDef.getName();

if (objectClassDef.isPrimaryIdentifier(attrName)) {
((Collection)getPrimaryIdentifiers()).add(rAttrDef);
}
if (objectClassDef.isSecondaryIdentifier(attrName) || rAttrDef.isSecondaryIdentifier()) {

if (rAttrDef.isSecondaryIdentifierOverride() == null) {
if (objectClassDef.isSecondaryIdentifier(attrName)) {
((Collection)getSecondaryIdentifiers()).add(rAttrDef);
}
} else if (rAttrDef.isSecondaryIdentifierOverride()) {
((Collection)getSecondaryIdentifiers()).add(rAttrDef);
}
}
Expand Down Expand Up @@ -1203,7 +1209,7 @@ public int hashCode() {
result = prime * result + ((displayName == null) ? 0 : displayName.hashCode());
result = prime * result
+ ((displayNameAttributeDefinition == null) ? 0 : displayNameAttributeDefinition.hashCode());
result = prime * result + ((identifiers == null) ? 0 : identifiers.hashCode());
result = prime * result + ((primaryIdentifiers == null) ? 0 : primaryIdentifiers.hashCode());
result = prime * result + ((intent == null) ? 0 : intent.hashCode());
result = prime * result + (isDefault ? 1231 : 1237);
result = prime * result + ((kind == null) ? 0 : kind.hashCode());
Expand Down Expand Up @@ -1266,11 +1272,11 @@ public boolean equals(Object obj) {
} else if (!displayNameAttributeDefinition.equals(other.displayNameAttributeDefinition)) {
return false;
}
if (identifiers == null) {
if (other.identifiers != null) {
if (primaryIdentifiers == null) {
if (other.primaryIdentifiers != null) {
return false;
}
} else if (!identifiers.equals(other.identifiers)) {
} else if (!primaryIdentifiers.equals(other.primaryIdentifiers)) {
return false;
}
if (intent == null) {
Expand Down
Expand Up @@ -372,7 +372,7 @@ public String debugDump(int indent) {
if (def instanceof ResourceAttributeDefinition) {
ResourceAttributeDefinition attrDef = (ResourceAttributeDefinition)def;
sb.append(attrDef.debugDump(indent+1));
if (attrDef.isIdentifier(this)) {
if (attrDef.isPrimaryIdentifier(this)) {
sb.deleteCharAt(sb.length()-1);
sb.append(" id");
}
Expand Down
Expand Up @@ -37,9 +37,9 @@ public interface ResourceAttributeDefinition<T> extends PrismPropertyDefinition<

boolean isReturnedByDefault();

boolean isIdentifier(ResourceAttributeContainerDefinition objectDefinition);
boolean isPrimaryIdentifier(ResourceAttributeContainerDefinition objectDefinition);

boolean isIdentifier(ObjectClassComplexTypeDefinition objectDefinition);
boolean isPrimaryIdentifier(ObjectClassComplexTypeDefinition objectDefinition);

boolean isSecondaryIdentifier(ObjectClassComplexTypeDefinition objectDefinition);

Expand Down
Expand Up @@ -94,12 +94,12 @@ public void setReturnedByDefault(Boolean returnedByDefault) {
* @return true if the attribute is a (primary) identifier.
*/
@Override
public boolean isIdentifier(ResourceAttributeContainerDefinition objectDefinition) {
return isIdentifier(objectDefinition.getComplexTypeDefinition());
public boolean isPrimaryIdentifier(ResourceAttributeContainerDefinition objectDefinition) {
return isPrimaryIdentifier(objectDefinition.getComplexTypeDefinition());
}

@Override
public boolean isIdentifier(ObjectClassComplexTypeDefinition objectDefinition) {
public boolean isPrimaryIdentifier(ObjectClassComplexTypeDefinition objectDefinition) {
for (ResourceAttributeDefinition<?> identifier : objectDefinition.getPrimaryIdentifiers()) {
if (this == identifier) {
return true;
Expand Down
Expand Up @@ -217,7 +217,7 @@ public void test060AddRoleStupidAssignment() throws Exception {
assertSuccess(result);

PrismObject<RoleType> role = getObject(RoleType.class, ROLE_STUPID_ASSIGNMENT_OID);
assertObject(role);
assertObjectSanity(role);
}

/**
Expand Down
Expand Up @@ -87,7 +87,7 @@ public void test050GetRolePirate() throws Exception {
}

protected void assertRolePirate(PrismObject<RoleType> role) {
assertObject(role);
assertObjectSanity(role);
assertEquals("Wrong "+role+" OID (prism)", ROLE_PIRATE_OID, role.getOid());
RoleType roleType = role.asObjectable();
assertEquals("Wrong "+role+" OID (jaxb)", ROLE_PIRATE_OID, roleType.getOid());
Expand Down
Expand Up @@ -287,7 +287,7 @@ public void test230ModifyAccountWillChangePasswordAndEnable() throws Exception {
assertAttribute(shadowProvisioningFuture, ATTR_USERNAME_QNAME, USER_WILL_NAME);
assertAttribute(shadowProvisioningFuture, ATTR_FULLNAME_QNAME, USER_WILL_FULL_NAME_PIRATE);
assertAttributeFromBackingStore(shadowProvisioningFuture, ATTR_DESCRIPTION_QNAME, ACCOUNT_WILL_DESCRIPTION_MANUAL);
assertShadow(shadowProvisioningFuture);
assertShadowSanity(shadowProvisioningFuture);

assertNotNull("No async reference in result", willSecondLastCaseOid);

Expand Down
Expand Up @@ -340,7 +340,7 @@ protected void assertAccountWillAfterChangePasswordAndEnable(final String TEST_N
assertAttribute(shadowProvisioningFuture, ATTR_USERNAME_QNAME, USER_WILL_NAME);
assertAttribute(shadowProvisioningFuture, ATTR_FULLNAME_QNAME, USER_WILL_FULL_NAME_PIRATE);
assertAttributeFromBackingStore(shadowProvisioningFuture, ATTR_DESCRIPTION_QNAME, ACCOUNT_WILL_DESCRIPTION_MANUAL);
assertShadow(shadowProvisioningFuture);
assertShadowSanity(shadowProvisioningFuture);

assertNull("Unexpected async reference in result", willSecondLastCaseOid);
}
Expand Down Expand Up @@ -467,7 +467,7 @@ public void test235RunPropagationAfterInterval() throws Exception {
assertAttribute(shadowProvisioningFuture, ATTR_USERNAME_QNAME, USER_WILL_NAME);
assertAttribute(shadowProvisioningFuture, ATTR_FULLNAME_QNAME, USER_WILL_FULL_NAME_PIRATE);
assertAttributeFromBackingStore(shadowProvisioningFuture, ATTR_DESCRIPTION_QNAME, ACCOUNT_WILL_DESCRIPTION_MANUAL);
assertShadow(shadowProvisioningFuture);
assertShadowSanity(shadowProvisioningFuture);

assertCase(willLastCaseOid, SchemaConstants.CASE_STATE_OPEN);

Expand Down
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.evolveum.midpoint.model.intest;
package com.evolveum.midpoint.model.intest.misc;

import static org.testng.AssertJUnit.assertFalse;
import static org.testng.AssertJUnit.assertTrue;
Expand All @@ -35,6 +35,7 @@
import org.testng.annotations.Test;
import org.w3c.dom.Document;

import com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest;
import com.evolveum.midpoint.prism.Objectable;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.PrismReference;
Expand Down

0 comments on commit f0753d6

Please sign in to comment.