use of com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition in project midpoint by Evolveum.
the class RefinedObjectTypeChoicePanel method createChoiceModel.
private static IModel<? extends List<? extends RefinedObjectClassDefinition>> createChoiceModel(final IModel<PrismObject<ResourceType>> resourceModel) {
return new IModel<List<? extends RefinedObjectClassDefinition>>() {
@Override
public List<? extends RefinedObjectClassDefinition> getObject() {
RefinedResourceSchema refinedSchema;
try {
refinedSchema = RefinedResourceSchemaImpl.getRefinedSchema(resourceModel.getObject());
} catch (SchemaException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
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
public void detach() {
}
@Override
public void setObject(List<? extends RefinedObjectClassDefinition> object) {
throw new UnsupportedOperationException();
}
};
}
use of com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition in project midpoint by Evolveum.
the class SchemaListPanel method loadAllClasses.
private List<ObjectClassDto> loadAllClasses() {
List<ObjectClassDto> list = new ArrayList<>();
RefinedResourceSchema schema = loadResourceSchema();
if (schema == null) {
return list;
}
for (RefinedObjectClassDefinition definition : schema.getRefinedDefinitions()) {
list.add(new ObjectClassDto(definition));
}
Collections.sort(list);
return list;
}
use of com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition in project midpoint by Evolveum.
the class AbstractIntegrationTest method findShadowByName.
protected PrismObject<ShadowType> findShadowByName(ShadowKindType kind, String intent, String name, PrismObject<ResourceType> resource, OperationResult result) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException {
RefinedResourceSchema rSchema = RefinedResourceSchemaImpl.getRefinedSchema(resource);
RefinedObjectClassDefinition rOcDef = rSchema.getRefinedDefinition(kind, intent);
ObjectQuery query = createShadowQuerySecondaryIdentifier(rOcDef, name, resource);
List<PrismObject<ShadowType>> shadows = repositoryService.searchObjects(ShadowType.class, query, null, result);
if (shadows.isEmpty()) {
return null;
}
assert shadows.size() == 1 : "Too many shadows found for name " + name + " on " + resource + ": " + shadows;
return shadows.iterator().next();
}
use of com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition in project midpoint by Evolveum.
the class AbstractIntegrationTest method createShadow.
protected PrismObject<ShadowType> createShadow(PrismObject<ResourceType> resource, String uid, String name) throws SchemaException {
PrismObject<ShadowType> shadow = getShadowDefinition().instantiate();
ShadowType shadowType = shadow.asObjectable();
if (name != null) {
shadowType.setName(PrismTestUtil.createPolyStringType(name));
}
ObjectReferenceType resourceRef = new ObjectReferenceType();
resourceRef.setOid(resource.getOid());
shadowType.setResourceRef(resourceRef);
shadowType.setKind(ShadowKindType.ACCOUNT);
RefinedResourceSchema refinedSchema = RefinedResourceSchemaImpl.getRefinedSchema(resource);
RefinedObjectClassDefinition objectClassDefinition = refinedSchema.getDefaultRefinedDefinition(ShadowKindType.ACCOUNT);
shadowType.setObjectClass(objectClassDefinition.getTypeName());
ResourceAttributeContainer attrContainer = ShadowUtil.getOrCreateAttributesContainer(shadow, objectClassDefinition);
if (uid != null) {
RefinedAttributeDefinition uidAttrDef = objectClassDefinition.findAttributeDefinition(new QName(SchemaConstants.NS_ICF_SCHEMA, "uid"));
ResourceAttribute<String> uidAttr = uidAttrDef.instantiate();
uidAttr.setRealValue(uid);
attrContainer.add(uidAttr);
}
if (name != null) {
RefinedAttributeDefinition nameAttrDef = objectClassDefinition.findAttributeDefinition(new QName(SchemaConstants.NS_ICF_SCHEMA, "name"));
ResourceAttribute<String> nameAttr = nameAttrDef.instantiate();
nameAttr.setRealValue(name);
attrContainer.add(nameAttr);
}
return shadow;
}
use of com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition in project midpoint by Evolveum.
the class AbstractIntegrationTest method createAccountShadowQuerySecondaryIdentifier.
protected ObjectQuery createAccountShadowQuerySecondaryIdentifier(String identifier, PrismObject<ResourceType> resource) throws SchemaException {
RefinedResourceSchema rSchema = RefinedResourceSchemaImpl.getRefinedSchema(resource);
RefinedObjectClassDefinition rAccount = rSchema.getDefaultRefinedDefinition(ShadowKindType.ACCOUNT);
return createShadowQuerySecondaryIdentifier(rAccount, identifier, resource);
}
Aggregations