Search in sources :

Example 1 with Involvement

use of org.finos.waltz.model.involvement.Involvement in project waltz by khartec.

the class PermissionGroupService method findPermissions.

public List<Permission> findPermissions(EntityReference parentEntityRef, String username) {
    Person person = personService.getPersonByUserId(username);
    if (isNull(person)) {
        return Collections.emptyList();
    }
    List<Involvement> involvements = involvementService.findByEmployeeId(person.employeeId()).stream().filter(involvement -> involvement.entityReference().equals(parentEntityRef)).collect(Collectors.toList());
    if (involvements.isEmpty()) {
        return Collections.emptyList();
    }
    return permissionGroupDao.getDefaultPermissions();
}
Also used : Logger(org.slf4j.Logger) EntityKind(org.finos.waltz.model.EntityKind) LoggerFactory(org.slf4j.LoggerFactory) Autowired(org.springframework.beans.factory.annotation.Autowired) PersonService(org.finos.waltz.service.person.PersonService) Collectors(java.util.stream.Collectors) Person(org.finos.waltz.model.person.Person) InvolvementService(org.finos.waltz.service.involvement.InvolvementService) List(java.util.List) Involvement(org.finos.waltz.model.involvement.Involvement) Service(org.springframework.stereotype.Service) EntityReference(org.finos.waltz.model.EntityReference) Objects.isNull(java.util.Objects.isNull) Permission(org.finos.waltz.model.permission_group.Permission) Collections(java.util.Collections) Involvement(org.finos.waltz.model.involvement.Involvement) Person(org.finos.waltz.model.person.Person)

Example 2 with Involvement

use of org.finos.waltz.model.involvement.Involvement in project waltz by khartec.

the class InvolvementService method removeEntityInvolvement.

public boolean removeEntityInvolvement(String userId, EntityReference entityReference, EntityInvolvementChangeCommand command) {
    Involvement involvement = mkInvolvement(entityReference, command);
    boolean result = involvementDao.remove(involvement) > 0;
    if (result) {
        logChange(entityReference, userId, command);
    }
    return result;
}
Also used : Involvement(org.finos.waltz.model.involvement.Involvement)

Example 3 with Involvement

use of org.finos.waltz.model.involvement.Involvement in project waltz by khartec.

the class InvolvementService method addEntityInvolvement.

public boolean addEntityInvolvement(String userId, EntityReference entityReference, EntityInvolvementChangeCommand command) {
    Involvement involvement = mkInvolvement(entityReference, command);
    boolean result = involvementDao.save(involvement) == 1;
    if (result) {
        logChange(entityReference, userId, command);
    }
    return result;
}
Also used : Involvement(org.finos.waltz.model.involvement.Involvement)

Aggregations

Involvement (org.finos.waltz.model.involvement.Involvement)3 Collections (java.util.Collections)1 List (java.util.List)1 Objects.isNull (java.util.Objects.isNull)1 Collectors (java.util.stream.Collectors)1 EntityKind (org.finos.waltz.model.EntityKind)1 EntityReference (org.finos.waltz.model.EntityReference)1 Permission (org.finos.waltz.model.permission_group.Permission)1 Person (org.finos.waltz.model.person.Person)1 InvolvementService (org.finos.waltz.service.involvement.InvolvementService)1 PersonService (org.finos.waltz.service.person.PersonService)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 Service (org.springframework.stereotype.Service)1