Skip to content

Commit

Permalink
Minor refactorings.
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Dec 14, 2016
1 parent 8d14539 commit 30310f5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 33 deletions.
Expand Up @@ -282,28 +282,22 @@ public PropertyDelta<T> narrow(PrismObject<? extends Objectable> object) {
}

public PropertyDelta<T> narrow(PrismObject<? extends Objectable> object, final MatchingRule<T> matchingRule) {
Comparator<PrismPropertyValue<T>> comparator = new Comparator<PrismPropertyValue<T>>() {
@Override
public int compare(PrismPropertyValue<T> o1, PrismPropertyValue<T> o2) {
if (o1.equalsComplex(o2, true, false, matchingRule)) {
return 0;
} else {
return 1;
}
Comparator<PrismPropertyValue<T>> comparator = (o1, o2) -> {
if (o1.equalsComplex(o2, true, false, matchingRule)) {
return 0;
} else {
return 1;
}
};
return (PropertyDelta<T>) super.narrow(object, comparator);
}

public boolean isRedundant(PrismObject<? extends Objectable> object, final MatchingRule<T> matchingRule) {
Comparator<PrismPropertyValue<T>> comparator = new Comparator<PrismPropertyValue<T>>() {
@Override
public int compare(PrismPropertyValue<T> o1, PrismPropertyValue<T> o2) {
if (o1.equalsComplex(o2, true, false, matchingRule)) {
return 0;
} else {
return 1;
}
Comparator<PrismPropertyValue<T>> comparator = (o1, o2) -> {
if (o1.equalsComplex(o2, true, false, matchingRule)) {
return 0;
} else {
return 1;
}
};
return super.isRedundant(object, comparator);
Expand Down
Expand Up @@ -195,7 +195,7 @@ private boolean checkUniqueness(String oid, PrismProperty identifier, ObjectQuer
List<PrismObject<ShadowType>> foundObjects = provisioningService.searchObjects(ShadowType.class, query, options, task, result);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Uniqueness check of {} resulted in {} results, using query:\n{}",
new Object[]{identifier, foundObjects.size(), query.debugDump()});
identifier, foundObjects.size(), query.debugDump());
}
if (foundObjects.isEmpty()) {
Cache.setOk(resourceType.getOid(), oid, shadowDefinition.getTypeName(), identifier.getDefinition().getName(), identifier.getValues());
Expand Down
Expand Up @@ -501,7 +501,7 @@ public <T extends ObjectType> SearchResultList<PrismObject<T>> searchObjects(Cla
result.addParam("query", query);
result.addContext(OperationResult.CONTEXT_IMPLEMENTATION_CLASS, ProvisioningServiceImpl.class);

final SearchResultList<PrismObject<T>> objListType = new SearchResultList(new ArrayList<PrismObject<T>>());
final SearchResultList<PrismObject<T>> objListType = new SearchResultList<>(new ArrayList<PrismObject<T>>());

SearchResultMetadata metadata;
try {
Expand All @@ -514,12 +514,7 @@ public <T extends ObjectType> SearchResultList<PrismObject<T>> searchObjects(Cla
return objects;
}

final ResultHandler<T> handler = new ResultHandler<T>() {
@Override
public boolean handle(PrismObject<T> object, OperationResult parentResult) {
return objListType.add(object);
}
};
final ResultHandler<T> handler = (object, parentResult1) -> objListType.add(object);

metadata = searchObjectsIterative(type, query, options, handler, task, result);

Expand Down Expand Up @@ -1146,12 +1141,7 @@ public <T extends ObjectType> SearchResultMetadata searchObjectsIterative(final

if (!ShadowType.class.isAssignableFrom(type)){

ResultHandler<T> internalHandler = new ResultHandler<T>() {
@Override
public boolean handle(PrismObject<T> object, OperationResult objResult) {
return handleRepoObject(type, object, options, handler, objResult);
}
};
ResultHandler<T> internalHandler = (object, objResult) -> handleRepoObject(type, object, options, handler, objResult);

Collection<SelectorOptions<GetOperationOptions>> repoOptions = null;
if (GetOperationOptions.isReadOnly(rootOptions)) {
Expand Down
Expand Up @@ -789,9 +789,9 @@ private void parseResourceSchema(org.identityconnectors.framework.common.objects
QName attrXsdType = icfTypeToXsdType(attributeInfo.getType(), false);

if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Attr conversion ICF: {}({}) -> XSD: {}({})",
new Object[]{icfName, attributeInfo.getType().getSimpleName(),
PrettyPrinter.prettyPrint(attrXsdName), PrettyPrinter.prettyPrint(attrXsdType)});
LOGGER.trace("Attr conversion ICF: {}({}) -> XSD: {}({})",
icfName, attributeInfo.getType().getSimpleName(),
PrettyPrinter.prettyPrint(attrXsdName), PrettyPrinter.prettyPrint(attrXsdType));
}

// Create ResourceObjectAttributeDefinition, which is midPoint
Expand Down

0 comments on commit 30310f5

Please sign in to comment.