public static <O extends ObjectType> boolean hasSubtype(PrismObject<O> object, String subtype) { List<String> objectSubtypes = determineSubTypes(object); if (objectSubtypes == null) { return false; } return objectSubtypes.contains(subtype); }
protected <F extends FocusType> boolean isTypeAndSubtype(PrismObject<F> focus, Class<F> expectedType, String subtype) { if (!expectedType.isAssignableFrom(focus.getCompileTimeClass())) { return false; } if (!FocusTypeUtil.hasSubtype(focus, subtype)) { return false; } return true; }
public static AssignmentType createRoleAssignment(String roleOid) { return createTargetAssignment(roleOid, RoleType.COMPLEX_TYPE); }
String resourceOid = FocusTypeUtil.determineConstructionResource(evaluatedAssignment.getAssignmentType()); if (resourceOid == null) { FocusTypeUtil.determineConstructionKind(evaluatedAssignment.getAssignmentType()), FocusTypeUtil.determineConstructionIntent(evaluatedAssignment.getAssignmentType())); LensProjectionContext accCtx = context.findProjectionContext(rad); if (accCtx != null) {
FocusTypeUtil.createRoleAssignment(ROLE_PIRATE_OID), FocusTypeUtil.createRoleAssignment(ROLE_NICE_PIRATE_OID));
String resourceOid = FocusTypeUtil.determineConstructionResource(assignmentType); if (resourceOid == null) { FocusTypeUtil.determineConstructionKind(assignmentType), FocusTypeUtil.determineConstructionIntent(assignmentType)); LensProjectionContext accCtx = context.findProjectionContext(rad); if (accCtx != null) {
FocusTypeUtil.createRoleAssignment(ROLE_THIEF_OID));
@NotNull @Deprecated public static <O extends ObjectType> Collection<String> getSubtypeValues(@NotNull PrismObject<O> object) { return FocusTypeUtil.determineSubTypes(object); }
protected <O extends ObjectType> void assertSubtype(PrismObject<O> object, String subtype) { assertTrue("Object "+object+" does not have subtype "+subtype, FocusTypeUtil.hasSubtype(object, subtype)); }
FocusTypeUtil.createRoleAssignment(ROLE_THIEF_OID));
public static AssignmentType createOrgAssignment(String roleOid) { return createTargetAssignment(roleOid, OrgType.COMPLEX_TYPE); }
private boolean matchesForRecursion(OrgType thisOrg) { for (String recurseUpOrgType: evaluatorType.getRecurseUpOrgType()) { if (FocusTypeUtil.determineSubTypes(thisOrg).contains(recurseUpOrgType)) { return true; } } return false; }
protected <O extends ObjectType> void assertSubtype(PrismObject<O> object, String subtype) { assertTrue("Object "+object+" does not have subtype "+subtype, FocusTypeUtil.hasSubtype(object, subtype)); }
FocusTypeUtil.createRoleAssignment(ROLE_THIEF_OID));
@NotNull // to eliminate the need for extensive NPE avoidance public static <O extends ObjectType> List<String> determineSubTypes(O object) { return object != null ? determineSubTypes(object.asPrismObject()) : emptyList(); }
public static <O extends ObjectType> ObjectPolicyConfigurationType determineObjectPolicyConfiguration(PrismObject<O> object, SystemConfigurationType systemConfigurationType) throws ConfigurationException { List<String> subTypes = FocusTypeUtil.determineSubTypes(object); return determineObjectPolicyConfiguration(object.getCompileTimeClass(), subTypes, systemConfigurationType); }
@Override public boolean isManagerOfOrgType(UserType user, String orgType, boolean preAuthorized) throws SchemaException { for (ObjectReferenceType objectReferenceType : user.getParentOrgRef()) { if (relationRegistry.isManager(objectReferenceType.getRelation())) { OrgType org = getOrgByOid(objectReferenceType.getOid(), preAuthorized); if (determineSubTypes(org).contains(orgType)) { return true; } } } return false; }
@Experimental public boolean hasActiveAssignmentTargetSubtype(String roleSubtype) { LensContext<ObjectType> lensContext = ModelExpressionThreadLocalHolder.getLensContext(); if (lensContext == null) { throw new UnsupportedOperationException("hasActiveAssignmentRoleSubtype works only with model context"); } DeltaSetTriple<EvaluatedAssignmentImpl<?>> evaluatedAssignmentTriple = lensContext.getEvaluatedAssignmentTriple(); if (evaluatedAssignmentTriple == null) { throw new UnsupportedOperationException("hasActiveAssignmentRoleSubtype works only with evaluatedAssignmentTriple"); } Collection<EvaluatedAssignmentImpl<?>> nonNegativeEvaluatedAssignments = evaluatedAssignmentTriple.getNonNegativeValues(); if (nonNegativeEvaluatedAssignments == null) { return false; } for (EvaluatedAssignmentImpl<?> nonNegativeEvaluatedAssignment : nonNegativeEvaluatedAssignments) { PrismObject<?> target = nonNegativeEvaluatedAssignment.getTarget(); if (target == null) { continue; } Collection<String> targetSubtypes = FocusTypeUtil.determineSubTypes((PrismObject) target); if (targetSubtypes.contains(roleSubtype)) { return true; } } return false; }
private boolean personaMatches(FocusType persona, PersonaKey key) { PrismObject<? extends FocusType> personaObj = persona.asPrismObject(); QName personaType = personaObj.getDefinition().getTypeName(); if (!QNameUtil.match(personaType, key.getType())) { return false; } List<String> objectSubtypes = FocusTypeUtil.determineSubTypes(personaObj); for (String keySubtype: key.getSubtypes()) { if (!objectSubtypes.contains(keySubtype)) { return false; } } return true; }
continue; if (!determineSubTypes(org).contains(orgType)) { continue; } else {