Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixing delta computation for wrappers, adding tests, improvements for…
… construction in GUIl
- Loading branch information
Showing
25 changed files
with
875 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...-gui/src/main/java/com/evolveum/midpoint/gui/impl/factory/ConstructionWrapperFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.evolveum.midpoint.gui.impl.factory; | ||
|
||
import com.evolveum.midpoint.gui.api.prism.PrismContainerWrapper; | ||
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils; | ||
import com.evolveum.midpoint.gui.impl.prism.ConstructionValueWrapper; | ||
import com.evolveum.midpoint.gui.impl.prism.PrismContainerValueWrapper; | ||
import com.evolveum.midpoint.gui.impl.prism.PrismContainerValueWrapperImpl; | ||
import com.evolveum.midpoint.model.api.ModelService; | ||
import com.evolveum.midpoint.prism.ItemDefinition; | ||
import com.evolveum.midpoint.prism.PrismContainerValue; | ||
import com.evolveum.midpoint.prism.PrismObject; | ||
import com.evolveum.midpoint.schema.GetOperationOptions; | ||
import com.evolveum.midpoint.schema.SelectorOptions; | ||
import com.evolveum.midpoint.util.exception.*; | ||
import com.evolveum.midpoint.util.logging.Trace; | ||
import com.evolveum.midpoint.util.logging.TraceManager; | ||
import com.evolveum.midpoint.web.component.prism.ValueStatus; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ConstructionType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class ConstructionWrapperFactory extends AssignmentDetailsWrapperFactoryImpl<ConstructionType> { | ||
|
||
private static final transient Trace LOGGER = TraceManager.getTrace(ConstructionWrapperFactory.class); | ||
|
||
@Autowired private ModelService model; | ||
|
||
@Override | ||
public int getOrder() { | ||
return super.getOrder() - 10; | ||
} | ||
|
||
@Override | ||
public boolean match(ItemDefinition<?> def) { | ||
return ConstructionType.COMPLEX_TYPE .equals(def.getTypeName()); | ||
} | ||
|
||
|
||
@Override | ||
public PrismContainerValueWrapper<ConstructionType> createContainerValueWrapper(PrismContainerWrapper<ConstructionType> objectWrapper, PrismContainerValue<ConstructionType> objectValue, ValueStatus status, WrapperContext context) { | ||
ConstructionValueWrapper constructionValueWrapper = new ConstructionValueWrapper(objectWrapper, objectValue, status); | ||
ConstructionType constructionType = objectValue.asContainerable(); | ||
if (constructionType.getResource() != null) { | ||
constructionValueWrapper.setResource(constructionType.getResource().asPrismObject()); | ||
return constructionValueWrapper; | ||
} | ||
|
||
ObjectReferenceType resourceRef = constructionType.getResourceRef(); | ||
|
||
PrismObject<ResourceType> resource = null; | ||
try { | ||
resource = model.getObject(ResourceType.class, resourceRef.getOid(), SelectorOptions.createCollection(GetOperationOptions.createNoFetch()), context.getTask(), context.getResult()); | ||
} catch (ObjectNotFoundException | SchemaException | SecurityViolationException | CommunicationException | ConfigurationException | ExpressionEvaluationException e) { | ||
LOGGER.error("Problem occurred during resolving resource, reason: {}", e.getMessage(), e); | ||
context.getResult().recordFatalError("A problem occurred during resolving resource, reason: " + e.getMessage(), e); | ||
return constructionValueWrapper; | ||
} | ||
|
||
constructionValueWrapper.setResource(resource); | ||
return constructionValueWrapper; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.