Search in sources :

Example 11 with ServiceAttributes

use of cz.metacentrum.perun.core.api.ServiceAttributes in project perun by CESNET.

the class ServicesManagerBlImpl method getDataWithVo.

private ServiceAttributes getDataWithVo(PerunSession sess, Service service, Facility facility, Vo vo, List<Resource> resources) throws InternalErrorException {
    ServiceAttributes voServiceAttributes = new ServiceAttributes();
    voServiceAttributes.addAttributes(getPerunBl().getAttributesManagerBl().getRequiredAttributes(sess, service, vo));
    for (Resource resource : resources) {
        ServiceAttributes resourceServiceAttributes = getDataWithGroups(sess, service, facility, resource);
        voServiceAttributes.addChildElement(resourceServiceAttributes);
    }
    return voServiceAttributes;
}
Also used : ServiceAttributes(cz.metacentrum.perun.core.api.ServiceAttributes) Resource(cz.metacentrum.perun.core.api.Resource)

Example 12 with ServiceAttributes

use of cz.metacentrum.perun.core.api.ServiceAttributes in project perun by CESNET.

the class ServicesManagerBlImpl method getData.

private ServiceAttributes getData(PerunSession sess, Service service, Facility facility, Resource resource, Member member) throws InternalErrorException {
    ServiceAttributes memberServiceAttributes = new ServiceAttributes();
    User user;
    try {
        user = getPerunBl().getUsersManagerBl().getUserById(sess, member.getUserId());
        memberServiceAttributes.addAttributes(getPerunBl().getAttributesManagerBl().getRequiredAttributes(sess, service, facility, resource, user, member));
    } catch (UserNotExistsException e) {
        throw new ConsistencyErrorException("Member has assigned non-existing user.", e);
    } catch (WrongAttributeAssignmentException ex) {
        throw new InternalErrorException(ex);
    }
    return memberServiceAttributes;
}
Also used : ConsistencyErrorException(cz.metacentrum.perun.core.api.exceptions.ConsistencyErrorException) User(cz.metacentrum.perun.core.api.User) UserNotExistsException(cz.metacentrum.perun.core.api.exceptions.UserNotExistsException) ServiceAttributes(cz.metacentrum.perun.core.api.ServiceAttributes) WrongAttributeAssignmentException(cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException) InternalErrorException(cz.metacentrum.perun.core.api.exceptions.InternalErrorException)

Aggregations

ServiceAttributes (cz.metacentrum.perun.core.api.ServiceAttributes)12 ArrayList (java.util.ArrayList)7 Resource (cz.metacentrum.perun.core.api.Resource)5 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)5 WrongAttributeAssignmentException (cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException)5 Member (cz.metacentrum.perun.core.api.Member)4 List (java.util.List)4 AbstractPerunIntegrationTest (cz.metacentrum.perun.core.AbstractPerunIntegrationTest)2 Attribute (cz.metacentrum.perun.core.api.Attribute)2 Group (cz.metacentrum.perun.core.api.Group)2 User (cz.metacentrum.perun.core.api.User)2 Vo (cz.metacentrum.perun.core.api.Vo)2 ConsistencyErrorException (cz.metacentrum.perun.core.api.exceptions.ConsistencyErrorException)2 Test (org.junit.Test)2 UserNotExistsException (cz.metacentrum.perun.core.api.exceptions.UserNotExistsException)1 VoNotExistsException (cz.metacentrum.perun.core.api.exceptions.VoNotExistsException)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1