use of com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition in project midpoint by Evolveum.
the class ResourceDetailsTabPanel method createSchemaStatusInfo.
private InfoBoxPanel createSchemaStatusInfo(ResourceType resource) {
String backgroundColor = "bg-gray";
String icon = "fa-times";
String numberMessage = null;
String description = null;
Integer progress = null;
RefinedResourceSchema refinedSchema = null;
try {
refinedSchema = RefinedResourceSchemaImpl.getRefinedSchema(resource);
if (refinedSchema != null) {
backgroundColor = "bg-purple";
icon = "fa-cubes";
int numObjectTypes = 0;
List<? extends RefinedObjectClassDefinition> refinedDefinitions = refinedSchema.getRefinedDefinitions();
for (RefinedObjectClassDefinition refinedDefinition : refinedDefinitions) {
if (refinedDefinition.getKind() != null) {
numObjectTypes++;
}
}
int numAllDefinitions = refinedDefinitions.size();
numberMessage = numObjectTypes + " " + parentPage.getString("PageResource.resource.objectTypes");
if (numAllDefinitions != 0) {
progress = numObjectTypes * 100 / numAllDefinitions;
if (progress > 100) {
progress = 100;
}
}
description = numAllDefinitions + " " + parentPage.getString("PageResource.resource.schemaDefinitions");
} else {
numberMessage = parentPage.getString("PageResource.resource.noSchema");
}
} catch (SchemaException e) {
backgroundColor = "bg-danger";
icon = "fa-warning";
numberMessage = parentPage.getString("PageResource.resource.schemaError");
}
InfoBoxType infoBoxType = new InfoBoxType(backgroundColor, icon, parentPage.getString("PageResource.resource.schema"));
infoBoxType.setNumber(numberMessage);
infoBoxType.setProgress(progress);
infoBoxType.setDescription(description);
Model<InfoBoxType> boxModel = new Model<InfoBoxType>(infoBoxType);
return new InfoBoxPanel(ID_SCHEMA_STATUS, boxModel);
}
use of com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition in project midpoint by Evolveum.
the class ResourceContentResourcePanel method createAttributeDefinitionList.
private <T extends ObjectType> Map<ItemPath, ItemDefinition> createAttributeDefinitionList() {
Map<ItemPath, ItemDefinition> map = new HashMap<>();
RefinedObjectClassDefinition ocDef = null;
try {
if (getKind() != null) {
ocDef = getDefinitionByKind();
} else if (getObjectClass() != null) {
ocDef = getDefinitionByObjectClass();
}
} catch (SchemaException e) {
warn("Could not get determine object class definition");
return map;
}
if (ocDef == null) {
return map;
}
ItemPath attributePath = new ItemPath(ShadowType.F_ATTRIBUTES);
for (ItemDefinition def : (List<ItemDefinition>) ocDef.getDefinitions()) {
if (!(def instanceof PrismPropertyDefinition) && !(def instanceof PrismReferenceDefinition)) {
continue;
}
map.put(new ItemPath(attributePath, def.getName()), def);
}
return map;
}
use of com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition in project midpoint by Evolveum.
the class LensUtil method refineProjectionIntent.
public static String refineProjectionIntent(ShadowKindType kind, String intent, ResourceType resource, PrismContext prismContext) throws SchemaException {
RefinedResourceSchema refinedSchema = RefinedResourceSchemaImpl.getRefinedSchema(resource, LayerType.MODEL, prismContext);
RefinedObjectClassDefinition rObjClassDef = refinedSchema.getRefinedDefinition(kind, intent);
if (rObjClassDef == null) {
throw new SchemaException("No projection definition for kind=" + kind + " intent=" + intent + " in " + resource);
}
return rObjClassDef.getIntent();
}
use of com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition in project midpoint by Evolveum.
the class LensUtil method needsFullShadowForCredentialProcessing.
public static boolean needsFullShadowForCredentialProcessing(LensProjectionContext projCtx) throws SchemaException {
RefinedObjectClassDefinition refinedProjDef = projCtx.getStructuralObjectClassDefinition();
if (refinedProjDef == null) {
return false;
}
List<MappingType> outboundMappingType = refinedProjDef.getPasswordOutbound();
if (outboundMappingType == null) {
return false;
}
for (MappingType mappingType : outboundMappingType) {
if (mappingType.getStrength() == MappingStrengthType.STRONG || mappingType.getStrength() == MappingStrengthType.WEAK) {
return true;
}
}
return false;
}
use of com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition in project midpoint by Evolveum.
the class Construction method debugDump.
@Override
public String debugDump(int indent) {
StringBuilder sb = new StringBuilder();
DebugUtil.debugDumpLabel(sb, "Construction", indent);
if (refinedObjectClassDefinition == null) {
sb.append(" (no object class definition)");
if (getConstructionType() != null && getConstructionType().getResourceRef() != null) {
// should
// be
// always
// the
// case
sb.append("\n");
DebugUtil.debugDumpLabel(sb, "resourceRef / kind / intent", indent + 1);
sb.append(" ");
sb.append(ObjectTypeUtil.toShortString(getConstructionType().getResourceRef()));
sb.append(" / ");
sb.append(getConstructionType().getKind());
sb.append(" / ");
sb.append(getConstructionType().getIntent());
}
} else {
sb.append(refinedObjectClassDefinition.getShadowDiscriminator());
}
if (getConstructionType() != null && getConstructionType().getStrength() == ConstructionStrengthType.WEAK) {
sb.append(" weak");
}
sb.append("\n");
DebugUtil.debugDumpWithLabel(sb, "isValid", isValid(), indent + 1);
sb.append("\n");
DebugUtil.debugDumpLabel(sb, "auxiliary object classes", indent + 1);
if (auxiliaryObjectClassDefinitions == null) {
sb.append(" (null)");
} else if (auxiliaryObjectClassDefinitions.isEmpty()) {
sb.append(" (empty)");
} else {
for (RefinedObjectClassDefinition auxiliaryObjectClassDefinition : auxiliaryObjectClassDefinitions) {
sb.append("\n");
DebugUtil.indentDebugDump(sb, indent + 2);
sb.append(auxiliaryObjectClassDefinition.getTypeName());
}
}
if (getConstructionType() != null && getConstructionType().getDescription() != null) {
sb.append("\n");
DebugUtil.debugDumpLabel(sb, "description", indent + 1);
sb.append(" ").append(getConstructionType().getDescription());
}
if (attributeMappings != null && !attributeMappings.isEmpty()) {
sb.append("\n");
DebugUtil.debugDumpLabel(sb, "attribute mappings", indent + 1);
for (Mapping mapping : attributeMappings) {
sb.append("\n");
sb.append(mapping.debugDump(indent + 2));
}
}
if (associationMappings != null && !associationMappings.isEmpty()) {
sb.append("\n");
DebugUtil.debugDumpLabel(sb, "association mappings", indent + 1);
for (Mapping mapping : associationMappings) {
sb.append("\n");
sb.append(mapping.debugDump(indent + 2));
}
}
if (getAssignmentPath() != null) {
sb.append("\n");
sb.append(getAssignmentPath().debugDump(indent + 1));
}
return sb.toString();
}
Aggregations