functions.SecurityRole.ext Maven / Gradle / Ivy
extension java::GeneratorCommons;
extension functions::NamedElement;
cached boolean isSecurityRole(uml::Element element):
element.isStereotypeApplied("SecurityRole");
cached uml::Actor asActor(uml::Element element):
(uml::Actor) element;
cached JMM::SecurityRole asSecurityRole(uml::Element element):
(JMM::SecurityRole) element;
cached List[JMM::SecurityRole] getAssociatedSecurityRoles(uml::Element element):
element.getRelationships().typeSelect(uml::Dependency).source.select(e|e.isSecurityRole()).asSecurityRole();
cached List[JMM::JEAFService] getAuthorizedServices(JMM::SecurityRole role):
role.getRelationships().typeSelect(uml::Dependency).target.typeSelect(JMM::JEAFService).addAll(role.getRelationships().typeSelect(uml::Dependency).target.typeSelect(uml::Operation).owner).toSet().sortBy(e|e.name);
cached List[uml::Operation] getAuthorizedOperations(JMM::SecurityRole role, uml::Interface service):
role.getRelationships().typeSelect(uml::Dependency).target.typeSelect(JMM::JEAFService).ownedOperation.addAll(role.getRelationships().typeSelect(uml::Dependency).target.typeSelect(uml::Operation).select(e|e.owner == service).sortBy(e|e.name));
cached List[JMM::SecurityRole] getAssociatedSecurityRolesForRESTOperation(JMM::RESTOperation operation):
operation.getAssociatedSecurityRoles().addAll(operation.owner.getAssociatedSecurityRoles()).toSet().sortBy(e| e.name);
cached boolean hasAssociatedSecurityRolesForRESTOperation(JMM::RESTOperation operation):
operation.getAssociatedSecurityRolesForRESTOperation().size > 0;
cached List[JMM::RESTOperation] getRESTOperationsWithoutSecurityRole(uml::Package package):
package.allOwnedElements().typeSelect(JMM::RESTOperation).select(e|e.isInGeneratorWhitelist()).select(e|e.hasAssociatedSecurityRolesForRESTOperation() == false).sortBy(e|e.owner.asNamedElement().name + "." + e.name);