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 Feb 8, 2016
2 parents 945eaf6 + bbc9f83 commit fa2dacb
Show file tree
Hide file tree
Showing 33 changed files with 1,132 additions and 137 deletions.
Expand Up @@ -15,6 +15,7 @@
*/
package com.evolveum.midpoint.web.component.input;

import java.util.ArrayList;
import java.util.List;

import org.apache.wicket.markup.html.form.IChoiceRenderer;
Expand All @@ -23,7 +24,10 @@
import com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition;
import com.evolveum.midpoint.common.refinery.RefinedResourceSchema;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.util.DebugUtil;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType;

/**
Expand All @@ -32,6 +36,8 @@
*/
public class RefinedObjectTypeChoicePanel extends DropDownChoicePanel<RefinedObjectClassDefinition> {

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

public RefinedObjectTypeChoicePanel(String id, IModel<RefinedObjectClassDefinition> model, IModel<PrismObject<ResourceType>> resourceModel) {
super(id, model, createChoiceModel(resourceModel), createRenderer(), false);
}
Expand All @@ -46,7 +52,14 @@ public List<? extends RefinedObjectClassDefinition> getObject() {
} catch (SchemaException e) {
throw new IllegalArgumentException(e.getMessage(),e);
}
return refinedSchema.getRefinedDefinitions();
List<? extends RefinedObjectClassDefinition> refinedDefinitions = refinedSchema.getRefinedDefinitions();
List<? extends RefinedObjectClassDefinition> defs = new ArrayList<>();
for (RefinedObjectClassDefinition rdef: refinedDefinitions) {
if (rdef.getKind() != null) {
((List)defs).add(rdef);
}
}
return defs;
}

@Override
Expand Down
Expand Up @@ -625,7 +625,6 @@ private ObjectQuery createQuery() {

private IModel<RefinedObjectClassDefinition> createObjectClassModel() {
return new LoadableModel<RefinedObjectClassDefinition>(false) {

@Override
protected RefinedObjectClassDefinition load() {
try {
Expand All @@ -634,6 +633,12 @@ protected RefinedObjectClassDefinition load() {
throw new SystemException(ex.getMessage(), ex);
}
}

@Override
public void setObject(RefinedObjectClassDefinition object) {
super.setObject(object);
}

};
}

Expand Down
Expand Up @@ -100,7 +100,7 @@ public Iterator<AccountContentDto> internalIterator(long first, long count) {
query.setPaging(paging);

if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Query filter:\n{}", query);
LOGGER.trace("Query filter for {}:\n{}", objectClassModel.getObject(), query.debugDump());
}

Collection<SelectorOptions<GetOperationOptions>> options =
Expand Down Expand Up @@ -133,11 +133,19 @@ private boolean isUseObjectCounting() {
}

private ObjectQuery getObjectQuery() throws SchemaException {
if (objectClassModel.getObject() == null) {
throw new SchemaException("No default account definition in resource "+resourceOidModel.getObject());
RefinedObjectClassDefinition rOcDef = objectClassModel.getObject();
if (rOcDef == null) {
throw new SchemaException("No object class definition ("+resourceOidModel.getObject()+")");
}
ObjectQuery baseQuery = ObjectQueryUtil.createResourceAndObjectClassQuery(resourceOidModel.getObject(),
objectClassModel.getObject().getTypeName(), getPage().getPrismContext());

ObjectQuery baseQuery;
if (rOcDef.getKind() != null) {
baseQuery = ObjectQueryUtil.createResourceAndKindIntent(resourceOidModel.getObject(),
rOcDef.getKind(), rOcDef.getIntent(), getPage().getPrismContext());
} else {
baseQuery = ObjectQueryUtil.createResourceAndObjectClassQuery(resourceOidModel.getObject(),
rOcDef.getTypeName(), getPage().getPrismContext());
}
ObjectQuery query = getQuery();
if (query != null) {
ObjectFilter baseFilter = baseQuery.getFilter();
Expand Down
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2015 Evolveum
* Copyright (c) 2015-2016 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 @@ -158,13 +158,20 @@ public RefinedAttributeDefinition<?> getDisplayNameAttribute() {
return structuralObjectClassDefinition.getDisplayNameAttribute();
}

@Override
public Collection<? extends RefinedAttributeDefinition<?>> getIdentifiers() {
return structuralObjectClassDefinition.getIdentifiers();
}

@Override
public Collection<? extends RefinedAttributeDefinition<?>> getSecondaryIdentifiers() {
return structuralObjectClassDefinition.getSecondaryIdentifiers();
}

@Override
public Collection<? extends RefinedAttributeDefinition<?>> getAllIdentifiers() {
return structuralObjectClassDefinition.getAllIdentifiers();
}

public boolean isAuxiliary() {
return structuralObjectClassDefinition.isAuxiliary();
Expand Down Expand Up @@ -316,6 +323,46 @@ public CompositeRefinedObjectClassDefinition clone() {
return new CompositeRefinedObjectClassDefinition(structuralObjectClassDefinitionClone, auxiliaryObjectClassDefinitionsClone);
}

@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result
+ ((auxiliaryObjectClassDefinitions == null) ? 0 : auxiliaryObjectClassDefinitions.hashCode());
result = prime * result
+ ((structuralObjectClassDefinition == null) ? 0 : structuralObjectClassDefinition.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
CompositeRefinedObjectClassDefinition other = (CompositeRefinedObjectClassDefinition) obj;
if (auxiliaryObjectClassDefinitions == null) {
if (other.auxiliaryObjectClassDefinitions != null) {
return false;
}
} else if (!auxiliaryObjectClassDefinitions.equals(other.auxiliaryObjectClassDefinitions)) {
return false;
}
if (structuralObjectClassDefinition == null) {
if (other.structuralObjectClassDefinition != null) {
return false;
}
} else if (!structuralObjectClassDefinition.equals(other.structuralObjectClassDefinition)) {
return false;
}
return true;
}

@Override
public String debugDump() {
return debugDump(0);
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2015 Evolveum
* Copyright (c) 2010-2016 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 @@ -205,6 +205,11 @@ public void setDisplayNameAttribute(QName displayName) {
public Collection<? extends LayerRefinedAttributeDefinition<?>> getIdentifiers() {
return substituteLayerRefinedAttributeDefinitionCollection(refinedObjectClassDefinition.getIdentifiers());
}

@Override
public Collection<? extends LayerRefinedAttributeDefinition<?>> getAllIdentifiers() {
return substituteLayerRefinedAttributeDefinitionCollection(refinedObjectClassDefinition.getAllIdentifiers());
}

@Override
public <D extends ItemDefinition> D findItemDefinition(QName name, Class<D> clazz) {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2015 Evolveum
* Copyright (c) 2010-2016 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 @@ -200,6 +200,17 @@ public Collection<? extends RefinedAttributeDefinition<?>> getSecondaryIdentifie
}
return secondaryIdentifiers;
}

public Collection<? extends RefinedAttributeDefinition<?>> getAllIdentifiers() {
Collection<? extends RefinedAttributeDefinition<?>> allIdentifiers = new ArrayList<>();
if (identifiers != null) {
allIdentifiers.addAll((Collection)getIdentifiers());
}
if (secondaryIdentifiers != null) {
allIdentifiers.addAll((Collection)getSecondaryIdentifiers());
}
return allIdentifiers;
}

private Collection<? extends RefinedAttributeDefinition<?>> createIdentifiersCollection() {
return new ArrayList<>();
Expand Down Expand Up @@ -929,6 +940,159 @@ public boolean matches(ShadowType shadowType) {
}

@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((associations == null) ? 0 : associations.hashCode());
result = prime * result + ((attributeDefinitions == null) ? 0 : attributeDefinitions.hashCode());
result = prime * result
+ ((auxiliaryObjectClassDefinitions == null) ? 0 : auxiliaryObjectClassDefinitions.hashCode());
result = prime * result + ((baseContext == null) ? 0 : baseContext.hashCode());
result = prime * result + ((description == null) ? 0 : description.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 + ((intent == null) ? 0 : intent.hashCode());
result = prime * result + (isDefault ? 1231 : 1237);
result = prime * result + ((kind == null) ? 0 : kind.hashCode());
result = prime * result + ((objectClassDefinition == null) ? 0 : objectClassDefinition.hashCode());
result = prime * result + ((objectDefinition == null) ? 0 : objectDefinition.hashCode());
result = prime * result + ((protectedObjectPatterns == null) ? 0 : protectedObjectPatterns.hashCode());
result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode());
result = prime * result + ((schemaHandlingObjectTypeDefinitionType == null) ? 0
: schemaHandlingObjectTypeDefinitionType.hashCode());
result = prime * result + ((secondaryIdentifiers == null) ? 0 : secondaryIdentifiers.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
RefinedObjectClassDefinition other = (RefinedObjectClassDefinition) obj;
if (associations == null) {
if (other.associations != null) {
return false;
}
} else if (!associations.equals(other.associations)) {
return false;
}
if (attributeDefinitions == null) {
if (other.attributeDefinitions != null) {
return false;
}
} else if (!attributeDefinitions.equals(other.attributeDefinitions)) {
return false;
}
if (auxiliaryObjectClassDefinitions == null) {
if (other.auxiliaryObjectClassDefinitions != null) {
return false;
}
} else if (!auxiliaryObjectClassDefinitions.equals(other.auxiliaryObjectClassDefinitions)) {
return false;
}
if (baseContext == null) {
if (other.baseContext != null) {
return false;
}
} else if (!baseContext.equals(other.baseContext)) {
return false;
}
if (description == null) {
if (other.description != null) {
return false;
}
} else if (!description.equals(other.description)) {
return false;
}
if (displayName == null) {
if (other.displayName != null) {
return false;
}
} else if (!displayName.equals(other.displayName)) {
return false;
}
if (displayNameAttributeDefinition == null) {
if (other.displayNameAttributeDefinition != null) {
return false;
}
} else if (!displayNameAttributeDefinition.equals(other.displayNameAttributeDefinition)) {
return false;
}
if (identifiers == null) {
if (other.identifiers != null) {
return false;
}
} else if (!identifiers.equals(other.identifiers)) {
return false;
}
if (intent == null) {
if (other.intent != null) {
return false;
}
} else if (!intent.equals(other.intent)) {
return false;
}
if (isDefault != other.isDefault) {
return false;
}
if (kind != other.kind) {
return false;
}
if (objectClassDefinition == null) {
if (other.objectClassDefinition != null) {
return false;
}
} else if (!objectClassDefinition.equals(other.objectClassDefinition)) {
return false;
}
if (objectDefinition == null) {
if (other.objectDefinition != null) {
return false;
}
} else if (!objectDefinition.equals(other.objectDefinition)) {
return false;
}
if (protectedObjectPatterns == null) {
if (other.protectedObjectPatterns != null) {
return false;
}
} else if (!protectedObjectPatterns.equals(other.protectedObjectPatterns)) {
return false;
}
if (resourceType == null) {
if (other.resourceType != null) {
return false;
}
} else if (!resourceType.equals(other.resourceType)) {
return false;
}
if (schemaHandlingObjectTypeDefinitionType == null) {
if (other.schemaHandlingObjectTypeDefinitionType != null) {
return false;
}
} else if (!schemaHandlingObjectTypeDefinitionType.equals(other.schemaHandlingObjectTypeDefinitionType)) {
return false;
}
if (secondaryIdentifiers == null) {
if (other.secondaryIdentifiers != null) {
return false;
}
} else if (!secondaryIdentifiers.equals(other.secondaryIdentifiers)) {
return false;
}
return true;
}

@Override
public String debugDump() {
return debugDump(0);
}
Expand Down Expand Up @@ -977,8 +1141,21 @@ protected String getDebugDumpClassName() {
public String getHumanReadableName() {
if (getDisplayName() != null) {
return getDisplayName();
} else {
} else if (getKind() != null) {
return getKind()+":"+getIntent();
} else if (getTypeName() != null) {
return getTypeName().getLocalPart();
} else {
return "null";
}
}

@Override
public String toString() {
if (getKind() == null) {
return getDebugDumpClassName() + " ("+PrettyPrinter.prettyPrint(getTypeName())+")";
} else {
return getDebugDumpClassName() + " ("+getKind()+":"+getIntent()+"="+PrettyPrinter.prettyPrint(getTypeName())+")";
}
}

Expand Down

0 comments on commit fa2dacb

Please sign in to comment.