Class ServicesManagerEntry
- All Implemented Interfaces:
ServicesManager
- Author:
- Slavek Licehammer <glory@ics.muni.cz>
-
Field Summary
Fields inherited from interface cz.metacentrum.perun.core.api.ServicesManager
SERVICE_NAME_REGEXP
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddDestination
(PerunSession sess, Service service, Facility facility, Destination destination) Adds an destination for the facility and service.addDestination
(PerunSession perunSession, List<Service> services, Facility facility, Destination destination) Adds an destination for the facility and all services.addDestinationsDefinedByHostsOnFacility
(PerunSession perunSession, Facility facility) Defines services destination for all hosts using their hostnames.addDestinationsDefinedByHostsOnFacility
(PerunSession perunSession, Service service, Facility facility) Defines service destination for all hosts using theirs hostnames.addDestinationsDefinedByHostsOnFacility
(PerunSession perunSession, List<Service> services, Facility facility) Defines services destination for all hosts using their hostnames.addDestinationsForAllServicesOnFacility
(PerunSession sess, Facility facility, Destination destination) Adds destination for all services defined on the facility.void
addRequiredAttribute
(PerunSession sess, Service service, AttributeDefinition attribute) Mark the attribute as required for the service.void
addRequiredAttributes
(PerunSession sess, Service service, List<? extends AttributeDefinition> attributes) Batch version of addRequiredAttributevoid
addServiceToServicesPackage
(PerunSession sess, ServicesPackage servicesPackage, Service service) Add the service to the packagevoid
blockAllServicesOnDestination
(PerunSession sess, int destinationId) Block all services currently assigned on this destination.void
blockAllServicesOnFacility
(PerunSession sess, Facility facility) Block all services currently assigned on this facility.void
blockServiceOnDestination
(PerunSession sess, Service service, int destinationId) Bans Service on destination.void
blockServiceOnFacility
(PerunSession sess, Service service, Facility facility) Bans Service on facility.void
blockServicesOnDestinations
(PerunSession sess, List<RichDestination> richDestinations) Bans the Service on the destination - each pair defined by the rich destination.void
blockServicesOnFacility
(PerunSession sess, List<Service> services, Facility facility) Bans services on facility.createService
(PerunSession sess, Service service) Creates new service.createServicesPackage
(PerunSession sess, ServicesPackage servicesPackage) Insert a new packagevoid
deleteService
(PerunSession sess, Service service, boolean forceFlag) Deletes the service.void
deleteServices
(PerunSession sess, List<Service> services, boolean forceFlag) Deletes given services.void
deleteServicesPackage
(PerunSession sess, ServicesPackage servicesPackage) Remove the packageboolean
forceServicePropagation
(PerunSession sess, Facility facility, Service service) Forces service propagation on defined facility.boolean
forceServicePropagation
(PerunSession sess, Service service) Forces service propagation on all facilities where the service is defined on.void
forceServicePropagationBulk
(PerunSession sess, Facility facility, List<Service> services) Forces services propagation on defined facility.void
forceServicePropagationBulk
(PerunSession sess, List<Service> services) Forces services propagation on all facilities where the services are defined on.forceServicePropagationForHostname
(PerunSession sess, String hostname) Forces service propagation on all facilities for all services where hostname is used.getAllRichDestinations
(PerunSession perunSession, Facility facility) Get list of all rich destinations defined for the facility.getAllRichDestinations
(PerunSession perunSession, Service service) Get list of all rich destinations defined for the service.getAssignedResources
(PerunSession sess, Service service) Get all resources where the service is defined.getAssignedServices
(PerunSession sess, Facility facility) List all services associated with the facility (via resource).getAssignedServices
(PerunSession sess, Facility facility, Vo vo) List all services associated with the facility and vo (via resource).getDestinationById
(PerunSession sess, int id) Get destination by idint
getDestinationIdByName
(PerunSession sess, String name, String type) Return ID of Destination by its value (name) and type.getDestinations
(PerunSession perunSession) Get list of all destinations.getDestinations
(PerunSession sess, Service service, Facility facility) Get list of all destinations defined for the service and facility.int
Get count of all destinations.getFacilitiesDestinations
(PerunSession sess, Vo vo) List all destinations for all facilities which are joined by resources to the VO.getFacilityAssignedServicesForGUI
(PerunSession perunSession, Facility facility) Return list of ServiceForGUI assigned on facility, (Service with "allowedOnFacility" property filled).getHashedDataWithGroups
(PerunSession sess, Service service, Facility facility, boolean consentEval, int taskRunId) Generates hashed data with group structure for given service and facility.getHashedHierarchicalData
(PerunSession sess, Service service, Facility facility, boolean consentEval, int taskRunId) Generates hashed hierarchical data structure for given service and facility.getRichDestinations
(PerunSession perunSession, Facility facility, Service service) Get list of all rich destinations defined for the facility and the service.getServiceById
(PerunSession sess, int id) Get service by id.getServiceByName
(PerunSession sess, String name) Get service by name.getServices
(PerunSession sess) get all services in perungetServicesBlockedOnDestination
(PerunSession sess, int destinationId) List all the Services that are banned on this destination.getServicesBlockedOnFacility
(PerunSession perunSession, Facility facility) List all the Services that are banned on this facility.getServicesByAttributeDefinition
(PerunSession sess, AttributeDefinition attributeDefinition) Get all services with given attribute.getServicesFromServicesPackage
(PerunSession sess, ServicesPackage servicesPackage) List services stored in the packagesgetServicesPackageById
(PerunSession sess, int servicesPackageId) Get package by IdgetServicesPackageByName
(PerunSession sess, String servicesPackageName) Get package by nameList packagesboolean
isServiceBlockedOnDestination
(PerunSession sess, Service service, int destinationId) Is this Service denied on the destination?boolean
isServiceBlockedOnFacility
(PerunSession sess, Service service, Facility facility) Is this Service denied on the facility?boolean
planServicePropagation
(PerunSession sess, Facility facility, Service service) Plans service propagation on defined facility.boolean
planServicePropagation
(PerunSession perunSession, Service service) Forces service propagation on all facilities where the service is defined on.void
removeAllDestinations
(PerunSession sess, Service service, Facility facility) Removes all defined destinations for the service and facility.void
removeAllRequiredAttributes
(PerunSession sess, Service service) Detate all required attributes from servicevoid
removeDestination
(PerunSession sess, Service service, Facility facility, Destination destination) Removes an destination from the facility and service.void
removeDestinationsByRichDestinations
(PerunSession sess, List<RichDestination> richDestinations) Removes destinations defined by list of rich destinations.void
removeRequiredAttribute
(PerunSession sess, Service service, AttributeDefinition attribute) Remove required attribute from service.void
removeRequiredAttributes
(PerunSession sess, Service service, List<? extends AttributeDefinition> attributes) Batch version of removeRequiredAttributevoid
removeServiceFromServicesPackage
(PerunSession sess, ServicesPackage servicesPackage, Service service) Remove Service from Services Packagevoid
setPerunBl
(PerunBl perunBl) Sets the perunBl for this instance.void
setServicesManagerBl
(ServicesManagerBl servicesManagerBl) Sets the servicesManagerBl for this instance.void
unblockAllServicesOnDestination
(PerunSession sess, int destinationId) Erase all the possible denials on this destination.void
unblockAllServicesOnDestination
(PerunSession sess, String destinationName) Erase all the possible denials on destinations defined by the destinationName.void
unblockAllServicesOnFacility
(PerunSession sess, Facility facility) Erase all the possible denials on this facility.void
unblockServiceOnDestination
(PerunSession sess, Service service, int destinationId) Free the denial of the Service on this destination.void
unblockServiceOnFacility
(PerunSession sess, Service service, Facility facility) Free the denial of the Service on this facility.void
unblockServicesOnDestinations
(PerunSession sess, List<RichDestination> richDestinations) Free the denial of the Service on the destination - each pair defined by the rich destination.void
unblockServicesOnFacility
(PerunSession sess, List<Service> services, Facility facility) Free the denial of the services on this facility.void
updateService
(PerunSession sess, Service service) Updates the service.void
updateServicesPackage
(PerunSession sess, ServicesPackage servicesPackage) Update package
-
Constructor Details
-
ServicesManagerEntry
-
ServicesManagerEntry
public ServicesManagerEntry()
-
-
Method Details
-
addDestination
public Destination addDestination(PerunSession perunSession, List<Service> services, Facility facility, Destination destination) throws PrivilegeException, ServiceNotExistsException, FacilityNotExistsException, WrongPatternException Description copied from interface:ServicesManager
Adds an destination for the facility and all services. Destination id doesn't need to be filled. If destination doesn't exist it will be created.- Specified by:
addDestination
in interfaceServicesManager
destination
- (id of this destination doesn't need to be filled.)- Returns:
- destination with it's id set
- Throws:
PrivilegeException
ServiceNotExistsException
FacilityNotExistsException
WrongPatternException
-
addDestination
public Destination addDestination(PerunSession sess, Service service, Facility facility, Destination destination) throws PrivilegeException, ServiceNotExistsException, FacilityNotExistsException, DestinationAlreadyAssignedException, WrongPatternException Description copied from interface:ServicesManager
Adds an destination for the facility and service. Destination.id doesn't need to be filled. If destination doesn't exist it will be created.- Specified by:
addDestination
in interfaceServicesManager
destination
- (Id of this destination doesn't need to be filled.)- Returns:
- destination with it's id set.
- Throws:
PrivilegeException
ServiceNotExistsException
FacilityNotExistsException
DestinationAlreadyAssignedException
WrongPatternException
-
addDestinationsDefinedByHostsOnFacility
public List<Destination> addDestinationsDefinedByHostsOnFacility(PerunSession perunSession, Service service, Facility facility) throws PrivilegeException, ServiceNotExistsException, FacilityNotExistsException, DestinationAlreadyAssignedException Description copied from interface:ServicesManager
Defines service destination for all hosts using theirs hostnames.- Specified by:
addDestinationsDefinedByHostsOnFacility
in interfaceServicesManager
- Returns:
- list of added destinations
- Throws:
PrivilegeException
ServiceNotExistsException
FacilityNotExistsException
DestinationAlreadyAssignedException
-
addDestinationsDefinedByHostsOnFacility
public List<Destination> addDestinationsDefinedByHostsOnFacility(PerunSession perunSession, List<Service> services, Facility facility) throws PrivilegeException, ServiceNotExistsException, FacilityNotExistsException Description copied from interface:ServicesManager
Defines services destination for all hosts using their hostnames. Do it for all services in List.If some destination for service and facility already exist, do not create it but still return back in the list.
- Specified by:
addDestinationsDefinedByHostsOnFacility
in interfaceServicesManager
- Returns:
- list of added destinations (even if they already was added before)
- Throws:
PrivilegeException
ServiceNotExistsException
FacilityNotExistsException
-
addDestinationsDefinedByHostsOnFacility
public List<Destination> addDestinationsDefinedByHostsOnFacility(PerunSession perunSession, Facility facility) throws PrivilegeException, FacilityNotExistsException Description copied from interface:ServicesManager
Defines services destination for all hosts using their hostnames. Use all assigned services to resources for the facility.If some destination for service and facility already exist, do not create it but still return back in the list.
- Specified by:
addDestinationsDefinedByHostsOnFacility
in interfaceServicesManager
- Returns:
- list of added destinations (even if they already was added before)
- Throws:
PrivilegeException
FacilityNotExistsException
-
addDestinationsForAllServicesOnFacility
public List<Destination> addDestinationsForAllServicesOnFacility(PerunSession sess, Facility facility, Destination destination) throws PrivilegeException, FacilityNotExistsException, DestinationAlreadyAssignedException, WrongPatternException Description copied from interface:ServicesManager
Adds destination for all services defined on the facility.- Specified by:
addDestinationsForAllServicesOnFacility
in interfaceServicesManager
- Returns:
- list of added destinations
- Throws:
PrivilegeException
FacilityNotExistsException
DestinationAlreadyAssignedException
WrongPatternException
-
addRequiredAttribute
public void addRequiredAttribute(PerunSession sess, Service service, AttributeDefinition attribute) throws PrivilegeException, AttributeNotExistsException, ServiceNotExistsException, AttributeAlreadyAssignedException, ServiceAttributesCannotExtend Description copied from interface:ServicesManager
Mark the attribute as required for the service. Required attribues are requisite for Service to run. If you add attribute which has a default attribute then this default attribute will be automatically add too.- Specified by:
addRequiredAttribute
in interfaceServicesManager
- Parameters:
sess
- perunSessionservice
- service to which the attribute will be addedattribute
- attribute to add- Throws:
PrivilegeException
- if privileges are not givenAttributeNotExistsException
- if the attribute doesn't exists in underlaying data sourceServiceNotExistsException
- if the service doesn't exists in underlaying data sourceAttributeAlreadyAssignedException
- if the attribute is already addedServiceAttributesCannotExtend
- if trying to add user-related attribute that could invalidate consents
-
addRequiredAttributes
public void addRequiredAttributes(PerunSession sess, Service service, List<? extends AttributeDefinition> attributes) throws PrivilegeException, AttributeNotExistsException, ServiceNotExistsException, AttributeAlreadyAssignedException, ServiceAttributesCannotExtend Description copied from interface:ServicesManager
Batch version of addRequiredAttribute- Specified by:
addRequiredAttributes
in interfaceServicesManager
- Throws:
PrivilegeException
AttributeNotExistsException
ServiceNotExistsException
AttributeAlreadyAssignedException
ServiceAttributesCannotExtend
- See Also:
-
addServiceToServicesPackage
public void addServiceToServicesPackage(PerunSession sess, ServicesPackage servicesPackage, Service service) throws ServicesPackageNotExistsException, ServiceNotExistsException, PrivilegeException, ServiceAlreadyAssignedException Description copied from interface:ServicesManager
Add the service to the package- Specified by:
addServiceToServicesPackage
in interfaceServicesManager
servicesPackage
- services package to which the service supposed to be addedservice
- service to be added to the services package- Throws:
ServicesPackageNotExistsException
ServiceNotExistsException
PrivilegeException
ServiceAlreadyAssignedException
-
blockAllServicesOnDestination
public void blockAllServicesOnDestination(PerunSession sess, int destinationId) throws PrivilegeException, DestinationNotExistsException, FacilityNotExistsException Description copied from interface:ServicesManager
Block all services currently assigned on this destination. From this moment on, there are no Services being allowed on this destination. If you assign a new service to the destination, it will be allowed!- Specified by:
blockAllServicesOnDestination
in interfaceServicesManager
destinationId
- The id of a destination we want to block all services on.- Throws:
PrivilegeException
DestinationNotExistsException
FacilityNotExistsException
-
blockAllServicesOnFacility
public void blockAllServicesOnFacility(PerunSession sess, Facility facility) throws FacilityNotExistsException, PrivilegeException Description copied from interface:ServicesManager
Block all services currently assigned on this facility. From this moment on, there are no Services being allowed on this facility. If you assign a new service to the facility, it will be allowed!- Specified by:
blockAllServicesOnFacility
in interfaceServicesManager
facility
- Facility we want to block all services on.- Throws:
FacilityNotExistsException
PrivilegeException
-
blockServiceOnDestination
public void blockServiceOnDestination(PerunSession sess, Service service, int destinationId) throws PrivilegeException, DestinationNotExistsException, ServiceAlreadyBannedException, FacilityNotExistsException Description copied from interface:ServicesManager
Bans Service on destination. It wouldn't be possible to execute the given Service on this destination, however, it still can be executed on all the other destinations in the facility.- Specified by:
blockServiceOnDestination
in interfaceServicesManager
service
- The Service to be banned on this particular destinationdestinationId
- The destination on which we want to ban the Service- Throws:
PrivilegeException
DestinationNotExistsException
ServiceAlreadyBannedException
FacilityNotExistsException
-
blockServiceOnFacility
public void blockServiceOnFacility(PerunSession sess, Service service, Facility facility) throws ServiceAlreadyBannedException, PrivilegeException Description copied from interface:ServicesManager
Bans Service on facility. It wouldn't be possible to execute the given Service on the whole facility nor on any of its destinations.- Specified by:
blockServiceOnFacility
in interfaceServicesManager
service
- The Service to be banned on the facilityfacility
- The facility on which we want to ban the Service- Throws:
ServiceAlreadyBannedException
PrivilegeException
-
blockServicesOnDestinations
public void blockServicesOnDestinations(PerunSession sess, List<RichDestination> richDestinations) throws PrivilegeException, DestinationNotExistsException, FacilityNotExistsException Description copied from interface:ServicesManager
Bans the Service on the destination - each pair defined by the rich destination. It wouldn't be possible to execute the given Service on this destination, however, it still can be executed on all the other destinations in the facility.- Specified by:
blockServicesOnDestinations
in interfaceServicesManager
richDestinations
- the list of rich destinations- Throws:
PrivilegeException
DestinationNotExistsException
FacilityNotExistsException
-
blockServicesOnFacility
public void blockServicesOnFacility(PerunSession sess, List<Service> services, Facility facility) throws ServiceAlreadyBannedException, PrivilegeException, FacilityNotExistsException Description copied from interface:ServicesManager
Bans services on facility. It wouldn't be possible to execute the given services on the whole facility nor on any of their destinations.- Specified by:
blockServicesOnFacility
in interfaceServicesManager
- Parameters:
sess
- perun sessionservices
- list of servicesfacility
- The facility on which we want to ban services- Throws:
ServiceAlreadyBannedException
- when service was already bannedPrivilegeException
- insufficient permissionsFacilityNotExistsException
- when facility does not exist
-
createService
public Service createService(PerunSession sess, Service service) throws PrivilegeException, ServiceExistsException Description copied from interface:ServicesManager
Creates new service.- Specified by:
createService
in interfaceServicesManager
- Returns:
- new service
- Throws:
PrivilegeException
ServiceExistsException
-
createServicesPackage
public ServicesPackage createServicesPackage(PerunSession sess, ServicesPackage servicesPackage) throws PrivilegeException, ServicesPackageExistsException Description copied from interface:ServicesManager
Insert a new package- Specified by:
createServicesPackage
in interfaceServicesManager
servicesPackage
- package to be inserted- Returns:
- ServicesPackage object completely filled (including Id)
- Throws:
PrivilegeException
ServicesPackageExistsException
-
deleteService
public void deleteService(PerunSession sess, Service service, boolean forceFlag) throws ServiceNotExistsException, PrivilegeException, RelationExistsException, ServiceAlreadyRemovedException Description copied from interface:ServicesManager
Deletes the service.- Specified by:
deleteService
in interfaceServicesManager
forceFlag
- if true, removes all dependant objects from database instead of raising exception- Throws:
ServiceNotExistsException
PrivilegeException
RelationExistsException
ServiceAlreadyRemovedException
- if there are 0 rows affected by deleting from DB
-
deleteServices
public void deleteServices(PerunSession sess, List<Service> services, boolean forceFlag) throws ServiceNotExistsException, PrivilegeException, RelationExistsException, ServiceAlreadyRemovedException Description copied from interface:ServicesManager
Deletes given services.- Specified by:
deleteServices
in interfaceServicesManager
services
- list of servicesforceFlag
- if true, removes all dependant objects from database instead of raising exception- Throws:
ServiceNotExistsException
PrivilegeException
RelationExistsException
ServiceAlreadyRemovedException
- if there are 0 rows affected by deleting from DB
-
deleteServicesPackage
public void deleteServicesPackage(PerunSession sess, ServicesPackage servicesPackage) throws ServicesPackageNotExistsException, PrivilegeException, RelationExistsException Description copied from interface:ServicesManager
Remove the package- Specified by:
deleteServicesPackage
in interfaceServicesManager
servicesPackage
- services package to be removed.- Throws:
ServicesPackageNotExistsException
PrivilegeException
RelationExistsException
-
forceServicePropagation
public boolean forceServicePropagation(PerunSession sess, Facility facility, Service service) throws PrivilegeException Description copied from interface:ServicesManager
Forces service propagation on defined facility.- Specified by:
forceServicePropagation
in interfaceServicesManager
- Returns:
- true if it is possible, false if not
- Throws:
PrivilegeException
-
forceServicePropagation
public boolean forceServicePropagation(PerunSession sess, Service service) throws PrivilegeException Description copied from interface:ServicesManager
Forces service propagation on all facilities where the service is defined on.- Specified by:
forceServicePropagation
in interfaceServicesManager
- Returns:
- true if it is possible, false if not
- Throws:
PrivilegeException
-
forceServicePropagationBulk
public void forceServicePropagationBulk(PerunSession sess, Facility facility, List<Service> services) throws PrivilegeException, FacilityNotExistsException, ForceServicePropagationDisabledException Description copied from interface:ServicesManager
Forces services propagation on defined facility.- Specified by:
forceServicePropagationBulk
in interfaceServicesManager
- Parameters:
sess
- perun sessionfacility
- facilityservices
- list of services- Throws:
PrivilegeException
- insufficient permissionsFacilityNotExistsException
- when facility does not existForceServicePropagationDisabledException
- when forcing propagation is not possible
-
forceServicePropagationBulk
public void forceServicePropagationBulk(PerunSession sess, List<Service> services) throws PrivilegeException, ForceServicePropagationDisabledException Description copied from interface:ServicesManager
Forces services propagation on all facilities where the services are defined on.- Specified by:
forceServicePropagationBulk
in interfaceServicesManager
- Parameters:
sess
- sessionservices
- list of services- Throws:
PrivilegeException
- insufficient permissionsForceServicePropagationDisabledException
- when forcing propagation is not possible
-
forceServicePropagationForHostname
public String forceServicePropagationForHostname(PerunSession sess, String hostname) throws PrivilegeException Description copied from interface:ServicesManager
Forces service propagation on all facilities for all services where hostname is used. Service must be correctly assigned, have destination matching hostname and not be blocked on any level (globally, facility, destination).- Specified by:
forceServicePropagationForHostname
in interfaceServicesManager
hostname
- Hostname to get facilities for- Returns:
- message Space separated list of forced services or error message (no facilities found, services are blocked)
- Throws:
PrivilegeException
-
getAllRichDestinations
public List<RichDestination> getAllRichDestinations(PerunSession perunSession, Facility facility) throws PrivilegeException, FacilityNotExistsException Description copied from interface:ServicesManager
Get list of all rich destinations defined for the facility.- Specified by:
getAllRichDestinations
in interfaceServicesManager
- Returns:
- Throws:
PrivilegeException
- if privileges are not givenFacilityNotExistsException
- if facility which we get from service and destination not exist
-
getAllRichDestinations
public List<RichDestination> getAllRichDestinations(PerunSession perunSession, Service service) throws PrivilegeException, ServiceNotExistsException Description copied from interface:ServicesManager
Get list of all rich destinations defined for the service.- Specified by:
getAllRichDestinations
in interfaceServicesManager
- Returns:
- Throws:
PrivilegeException
- if privileges are not givenServiceNotExistsException
- if service which we get from facility and destination not exist
-
getAssignedResources
public List<Resource> getAssignedResources(PerunSession sess, Service service) throws PrivilegeException, ServiceNotExistsException Description copied from interface:ServicesManager
Get all resources where the service is defined.- Specified by:
getAssignedResources
in interfaceServicesManager
- Returns:
- list of resources where the service is defined
- Throws:
PrivilegeException
ServiceNotExistsException
-
getAssignedServices
public List<Service> getAssignedServices(PerunSession sess, Facility facility) throws FacilityNotExistsException, PrivilegeException Description copied from interface:ServicesManager
List all services associated with the facility (via resource).- Specified by:
getAssignedServices
in interfaceServicesManager
- Returns:
- list of services assigned to facility
- Throws:
FacilityNotExistsException
PrivilegeException
-
getAssignedServices
public List<Service> getAssignedServices(PerunSession sess, Facility facility, Vo vo) throws FacilityNotExistsException, VoNotExistsException, PrivilegeException Description copied from interface:ServicesManager
List all services associated with the facility and vo (via resource).- Specified by:
getAssignedServices
in interfaceServicesManager
- Returns:
- list of services assigned to facility and vo
- Throws:
FacilityNotExistsException
VoNotExistsException
PrivilegeException
-
getDestinationById
public Destination getDestinationById(PerunSession sess, int id) throws PrivilegeException, DestinationNotExistsException Description copied from interface:ServicesManager
Get destination by id- Specified by:
getDestinationById
in interfaceServicesManager
- Returns:
- Destination with the id
- Throws:
PrivilegeException
DestinationNotExistsException
-
getDestinationIdByName
public int getDestinationIdByName(PerunSession sess, String name, String type) throws DestinationNotExistsException Description copied from interface:ServicesManager
Return ID of Destination by its value (name) and type.- Specified by:
getDestinationIdByName
in interfaceServicesManager
name
- Name (value) of Destinationtype
- Type of destination- Returns:
- ID of Destination
- Throws:
DestinationNotExistsException
-
getDestinations
public List<Destination> getDestinations(PerunSession sess, Service service, Facility facility) throws PrivilegeException, ServiceNotExistsException, FacilityNotExistsException Description copied from interface:ServicesManager
Get list of all destinations defined for the service and facility.- Specified by:
getDestinations
in interfaceServicesManager
- Returns:
- list list of destinations defined for the service and facility
- Throws:
PrivilegeException
ServiceNotExistsException
FacilityNotExistsException
-
getDestinations
Description copied from interface:ServicesManager
Get list of all destinations.- Specified by:
getDestinations
in interfaceServicesManager
- Returns:
- list of all destinations for session
- Throws:
PrivilegeException
-
getDestinationsCount
Description copied from interface:ServicesManager
Get count of all destinations.- Specified by:
getDestinationsCount
in interfaceServicesManager
- Parameters:
sess
- PerunSession- Returns:
- count of all destinations
-
getFacilitiesDestinations
public List<Destination> getFacilitiesDestinations(PerunSession sess, Vo vo) throws VoNotExistsException Description copied from interface:ServicesManager
List all destinations for all facilities which are joined by resources to the VO.- Specified by:
getFacilitiesDestinations
in interfaceServicesManager
vo
- vo for which we are searching destinations- Returns:
- list of destinations
- Throws:
VoNotExistsException
-
getFacilityAssignedServicesForGUI
public List<ServiceForGUI> getFacilityAssignedServicesForGUI(PerunSession perunSession, Facility facility) throws PrivilegeException, FacilityNotExistsException Description copied from interface:ServicesManager
Return list of ServiceForGUI assigned on facility, (Service with "allowedOnFacility" property filled). 1 - allowed / 0 - service is denied).- Specified by:
getFacilityAssignedServicesForGUI
in interfaceServicesManager
- Returns:
- list of assigned services with allowed property
- Throws:
PrivilegeException
FacilityNotExistsException
-
getHashedDataWithGroups
public HashedGenData getHashedDataWithGroups(PerunSession sess, Service service, Facility facility, boolean consentEval, int taskRunId) throws FacilityNotExistsException, ServiceNotExistsException, PrivilegeException Description copied from interface:ServicesManager
Generates hashed data with group structure for given service and facility. If enforcing consents is turned on on the instance and on the resource's consent hub, generates only the users that granted a consent to all the service required attributes. New UNSIGNED consents are created to users that don't have a consent containing all the service required attributes.Generates data in format:
attributes: {...hashes...} hierarchy: { "1": { ** facility id ** members: { ** all members on the facility ** "4" : 5, ** member id : user id ** "6" : 7, ** member id : user id ** ... } children: [ "2": { ** resource id ** voId: 99, children: [ "89": { ** group id ** "children": {}, "members": { "91328": 57986, "91330": 60838 } } ], "members": { ** all members on the resource with id 2 ** "91328": 57986, "91330": 60838 } }, "3": { ... } ] } }
- Specified by:
getHashedDataWithGroups
in interfaceServicesManager
- Parameters:
sess
- perun sessionservice
- servicefacility
- facilityconsentEval
- if the generator should force evaluation of consentstaskRunId
- Integer id of the task run propagation- Returns:
- generated hashed data structure
- Throws:
FacilityNotExistsException
- if there is no such facilityServiceNotExistsException
- if there is no such servicePrivilegeException
- insufficient permissions
-
getHashedHierarchicalData
public HashedGenData getHashedHierarchicalData(PerunSession sess, Service service, Facility facility, boolean consentEval, int taskRunId) throws FacilityNotExistsException, ServiceNotExistsException, PrivilegeException Description copied from interface:ServicesManager
Generates hashed hierarchical data structure for given service and facility. If enforcing consents is turned on on the instance and on the resource's consent hub, generates only the users that granted a consent to all the service required attributes. New UNSIGNED consents are created to users that don't have a consent containing all the service required attributes.attributes: {...hashes...} hierarchy: { "1": { ** facility id ** members: { ** all members on the facility ** "4" : 5, ** member id : user id ** "6" : 7, ** member id : user id ** ... } children: [ "2": { ** resource id ** children: [], voId: 99, members: { ** all members on the resource with id 2 ** "4" : 5 ** member id : user id ** } }, "3": { ... } ] } }
- Specified by:
getHashedHierarchicalData
in interfaceServicesManager
- Parameters:
sess
- perun sessionservice
- servicefacility
- facilityconsentEval
- if the generator should force evaluation of consentstaskRunId
- Integer id of the task run propagation- Returns:
- generated hashed data structure
- Throws:
FacilityNotExistsException
- if there is no such facilityServiceNotExistsException
- if there is no such servicePrivilegeException
- insufficient permissions
-
getPerunBl
-
getRichDestinations
public List<RichDestination> getRichDestinations(PerunSession perunSession, Facility facility, Service service) throws PrivilegeException, FacilityNotExistsException, ServiceNotExistsException Description copied from interface:ServicesManager
Get list of all rich destinations defined for the facility and the service.- Specified by:
getRichDestinations
in interfaceServicesManager
- Returns:
- Throws:
PrivilegeException
- if privileges are not givenFacilityNotExistsException
- if the facility not existServiceNotExistsException
- if the service not exist
-
getServiceById
public Service getServiceById(PerunSession sess, int id) throws PrivilegeException, ServiceNotExistsException Description copied from interface:ServicesManager
Get service by id.- Specified by:
getServiceById
in interfaceServicesManager
- Returns:
- service with specified id
- Throws:
PrivilegeException
ServiceNotExistsException
-
getServiceByName
public Service getServiceByName(PerunSession sess, String name) throws PrivilegeException, ServiceNotExistsException Description copied from interface:ServicesManager
Get service by name.- Specified by:
getServiceByName
in interfaceServicesManager
name
- name of the service- Returns:
- service with specified name
- Throws:
PrivilegeException
ServiceNotExistsException
-
getServices
Description copied from interface:ServicesManager
get all services in perun- Specified by:
getServices
in interfaceServicesManager
- Returns:
- all services in perun
- Throws:
PrivilegeException
-
getServicesBlockedOnDestination
public List<Service> getServicesBlockedOnDestination(PerunSession sess, int destinationId) throws PrivilegeException, DestinationNotExistsException, FacilityNotExistsException Description copied from interface:ServicesManager
List all the Services that are banned on this destination.- Specified by:
getServicesBlockedOnDestination
in interfaceServicesManager
- Returns:
- a list of Services that are denied on the destination
- Throws:
PrivilegeException
DestinationNotExistsException
FacilityNotExistsException
-
getServicesBlockedOnFacility
public List<Service> getServicesBlockedOnFacility(PerunSession perunSession, Facility facility) throws PrivilegeException Description copied from interface:ServicesManager
List all the Services that are banned on this facility.- Specified by:
getServicesBlockedOnFacility
in interfaceServicesManager
- Returns:
- a list of Services that are denied on the facility
- Throws:
PrivilegeException
-
getServicesByAttributeDefinition
public List<Service> getServicesByAttributeDefinition(PerunSession sess, AttributeDefinition attributeDefinition) throws PrivilegeException Description copied from interface:ServicesManager
Get all services with given attribute.- Specified by:
getServicesByAttributeDefinition
in interfaceServicesManager
- Parameters:
sess
- perun session- Returns:
- all services with given attribute
- Throws:
PrivilegeException
-
getServicesFromServicesPackage
public List<Service> getServicesFromServicesPackage(PerunSession sess, ServicesPackage servicesPackage) throws ServicesPackageNotExistsException, PrivilegeException Description copied from interface:ServicesManager
List services stored in the packages- Specified by:
getServicesFromServicesPackage
in interfaceServicesManager
servicesPackage
- the package from which we want to list the services- Returns:
- list consisting services
- Throws:
ServicesPackageNotExistsException
PrivilegeException
-
getServicesManagerBl
-
getServicesPackageById
public ServicesPackage getServicesPackageById(PerunSession sess, int servicesPackageId) throws ServicesPackageNotExistsException, PrivilegeException Description copied from interface:ServicesManager
Get package by Id- Specified by:
getServicesPackageById
in interfaceServicesManager
servicesPackageId
- id of the package we want to retrieve- Returns:
- package
- Throws:
ServicesPackageNotExistsException
PrivilegeException
-
getServicesPackageByName
public ServicesPackage getServicesPackageByName(PerunSession sess, String servicesPackageName) throws ServicesPackageNotExistsException, PrivilegeException Description copied from interface:ServicesManager
Get package by name- Specified by:
getServicesPackageByName
in interfaceServicesManager
servicesPackageName
- name of the services package- Returns:
- package
- Throws:
ServicesPackageNotExistsException
PrivilegeException
-
getServicesPackages
Description copied from interface:ServicesManager
List packages- Specified by:
getServicesPackages
in interfaceServicesManager
- Returns:
- list of packages in the DB
- Throws:
PrivilegeException
-
isServiceBlockedOnDestination
public boolean isServiceBlockedOnDestination(PerunSession sess, Service service, int destinationId) throws PrivilegeException, DestinationNotExistsException, FacilityNotExistsException Description copied from interface:ServicesManager
Is this Service denied on the destination?- Specified by:
isServiceBlockedOnDestination
in interfaceServicesManager
service
- The Service, the denial of which we want to examinedestinationId
- The destination on which we want to look up the denial of the Service- Returns:
- true - in case the Service is denied on the destination false - in case the Service in NOT denied on the destination
- Throws:
PrivilegeException
DestinationNotExistsException
FacilityNotExistsException
-
isServiceBlockedOnFacility
public boolean isServiceBlockedOnFacility(PerunSession sess, Service service, Facility facility) throws PrivilegeException Description copied from interface:ServicesManager
Is this Service denied on the facility?- Specified by:
isServiceBlockedOnFacility
in interfaceServicesManager
service
- The Service, the denial of which we want to examinefacility
- The facility on which we want to look up the denial of the Service- Returns:
- true - in case the Service is denied on the facility false - in case the Service in NOT denied on the facility
- Throws:
PrivilegeException
-
planServicePropagation
public boolean planServicePropagation(PerunSession sess, Facility facility, Service service) throws PrivilegeException Description copied from interface:ServicesManager
Plans service propagation on defined facility.- Specified by:
planServicePropagation
in interfaceServicesManager
- Returns:
- true if it is possible, false if not
- Throws:
PrivilegeException
-
planServicePropagation
public boolean planServicePropagation(PerunSession perunSession, Service service) throws PrivilegeException Description copied from interface:ServicesManager
Forces service propagation on all facilities where the service is defined on.- Specified by:
planServicePropagation
in interfaceServicesManager
- Returns:
- true if it is possible, false if not
- Throws:
PrivilegeException
-
removeAllDestinations
public void removeAllDestinations(PerunSession sess, Service service, Facility facility) throws PrivilegeException, ServiceNotExistsException, FacilityNotExistsException Description copied from interface:ServicesManager
Removes all defined destinations for the service and facility.- Specified by:
removeAllDestinations
in interfaceServicesManager
- Throws:
PrivilegeException
ServiceNotExistsException
FacilityNotExistsException
-
removeAllRequiredAttributes
public void removeAllRequiredAttributes(PerunSession sess, Service service) throws PrivilegeException, ServiceNotExistsException Description copied from interface:ServicesManager
Detate all required attributes from service- Specified by:
removeAllRequiredAttributes
in interfaceServicesManager
- Parameters:
sess
- perunSessionservice
- service from which the attributes will be removed- Throws:
PrivilegeException
- if privileges are not givenServiceNotExistsException
- if the service doesn't exists in underlaying data source
-
removeDestination
public void removeDestination(PerunSession sess, Service service, Facility facility, Destination destination) throws PrivilegeException, ServiceNotExistsException, FacilityNotExistsException, DestinationAlreadyRemovedException Description copied from interface:ServicesManager
Removes an destination from the facility and service.- Specified by:
removeDestination
in interfaceServicesManager
destination
- string contains destination address (mail, url, hostname, ...)- Throws:
PrivilegeException
ServiceNotExistsException
FacilityNotExistsException
DestinationAlreadyRemovedException
-
removeDestinationsByRichDestinations
public void removeDestinationsByRichDestinations(PerunSession sess, List<RichDestination> richDestinations) throws PrivilegeException, ServiceNotExistsException, FacilityNotExistsException, DestinationAlreadyRemovedException Description copied from interface:ServicesManager
Removes destinations defined by list of rich destinations. Each destination is removed from the rich destination's facility and service.- Specified by:
removeDestinationsByRichDestinations
in interfaceServicesManager
richDestinations
- list of rich destinations- Throws:
PrivilegeException
ServiceNotExistsException
FacilityNotExistsException
DestinationAlreadyRemovedException
-
removeRequiredAttribute
public void removeRequiredAttribute(PerunSession sess, Service service, AttributeDefinition attribute) throws PrivilegeException, AttributeNotExistsException, ServiceNotExistsException, AttributeNotAssignedException Description copied from interface:ServicesManager
Remove required attribute from service. TODO If you try to remove attribute which is default for other Required attribute ...- Specified by:
removeRequiredAttribute
in interfaceServicesManager
- Parameters:
sess
- perunSessionservice
- service from which the attribute will be removedattribute
- attribute to remove- Throws:
PrivilegeException
- if privileges are not givenAttributeNotExistsException
ServiceNotExistsException
- if the service doesn't exists in underlaying data sourceAttributeNotAssignedException
-
removeRequiredAttributes
public void removeRequiredAttributes(PerunSession sess, Service service, List<? extends AttributeDefinition> attributes) throws PrivilegeException, AttributeNotExistsException, ServiceNotExistsException, AttributeNotAssignedException Description copied from interface:ServicesManager
Batch version of removeRequiredAttribute -
removeServiceFromServicesPackage
public void removeServiceFromServicesPackage(PerunSession sess, ServicesPackage servicesPackage, Service service) throws ServicesPackageNotExistsException, ServiceNotExistsException, PrivilegeException, ServiceAlreadyRemovedFromServicePackageException Description copied from interface:ServicesManager
Remove Service from Services Package- Specified by:
removeServiceFromServicesPackage
in interfaceServicesManager
servicesPackage
- services package from which the service supposed to be removedservice
- service that will be removed from the services package- Throws:
ServicesPackageNotExistsException
ServiceNotExistsException
PrivilegeException
ServiceAlreadyRemovedFromServicePackageException
- there are 0 rows affected by removing service from servicePackage in DB
-
setPerunBl
Sets the perunBl for this instance.- Parameters:
perunBl
- The perunBl.
-
setServicesManagerBl
Sets the servicesManagerBl for this instance.- Parameters:
servicesManagerBl
- The servicesManagerBl.
-
unblockAllServicesOnDestination
public void unblockAllServicesOnDestination(PerunSession sess, String destinationName) throws FacilityNotExistsException Description copied from interface:ServicesManager
Erase all the possible denials on destinations defined by the destinationName. From this moment on, there are no Services being denied on these destinations.- Specified by:
unblockAllServicesOnDestination
in interfaceServicesManager
destinationName
- The name of destinations we want to clear of all the denials.- Throws:
FacilityNotExistsException
-
unblockAllServicesOnDestination
public void unblockAllServicesOnDestination(PerunSession sess, int destinationId) throws PrivilegeException, FacilityNotExistsException, DestinationNotExistsException Description copied from interface:ServicesManager
Erase all the possible denials on this destination. From this moment on, there are no Services being denied on this destination.- Specified by:
unblockAllServicesOnDestination
in interfaceServicesManager
destinationId
- The id of a destination we want to clear of all the denials.- Throws:
PrivilegeException
FacilityNotExistsException
DestinationNotExistsException
-
unblockAllServicesOnFacility
public void unblockAllServicesOnFacility(PerunSession sess, Facility facility) throws PrivilegeException Description copied from interface:ServicesManager
Erase all the possible denials on this facility. From this moment on, there are no Services being denied on this facility.- Specified by:
unblockAllServicesOnFacility
in interfaceServicesManager
facility
- Facility we want to clear of all the denials.- Throws:
PrivilegeException
-
unblockServiceOnDestination
public void unblockServiceOnDestination(PerunSession sess, Service service, int destinationId) throws PrivilegeException, FacilityNotExistsException, DestinationNotExistsException Description copied from interface:ServicesManager
Free the denial of the Service on this destination. If the Service was banned on this destination, it will be freed. In case the Service was not banned on this destination, nothing will happen.- Specified by:
unblockServiceOnDestination
in interfaceServicesManager
service
- The Service, the denial of which we want to free on this destination.destinationId
- The id of a destination on which we want to free the denial of the Service.- Throws:
PrivilegeException
FacilityNotExistsException
DestinationNotExistsException
-
unblockServiceOnFacility
public void unblockServiceOnFacility(PerunSession sess, Service service, Facility facility) throws PrivilegeException Description copied from interface:ServicesManager
Free the denial of the Service on this facility. If the Service was banned on this facility, it will be freed. In case the Service was not banned on this facility, nothing will happen.- Specified by:
unblockServiceOnFacility
in interfaceServicesManager
service
- The Service, the denial of which we want to free on this facility.facility
- The facility on which we want to free the denial of the Service.- Throws:
PrivilegeException
-
unblockServicesOnDestinations
public void unblockServicesOnDestinations(PerunSession sess, List<RichDestination> richDestinations) throws PrivilegeException, FacilityNotExistsException, DestinationNotExistsException Description copied from interface:ServicesManager
Free the denial of the Service on the destination - each pair defined by the rich destination. If the Service was banned on the destination, it will be freed. In case the Service was not banned on the destination, nothing will happen.- Specified by:
unblockServicesOnDestinations
in interfaceServicesManager
richDestinations
- the list of rich destinations- Throws:
PrivilegeException
FacilityNotExistsException
DestinationNotExistsException
-
unblockServicesOnFacility
public void unblockServicesOnFacility(PerunSession sess, List<Service> services, Facility facility) throws PrivilegeException, FacilityNotExistsException, ServiceIsNotBannedException Description copied from interface:ServicesManager
Free the denial of the services on this facility.- Specified by:
unblockServicesOnFacility
in interfaceServicesManager
- Parameters:
sess
- perun sessionservices
- list of servicesfacility
- facility- Throws:
PrivilegeException
- insufficient permissionsFacilityNotExistsException
- when facility does not existServiceIsNotBannedException
- when unblocking service which is not blocked
-
updateService
public void updateService(PerunSession sess, Service service) throws ServiceNotExistsException, PrivilegeException Description copied from interface:ServicesManager
Updates the service.- Specified by:
updateService
in interfaceServicesManager
- Throws:
ServiceNotExistsException
PrivilegeException
-
updateServicesPackage
public void updateServicesPackage(PerunSession sess, ServicesPackage servicesPackage) throws ServicesPackageNotExistsException, PrivilegeException Description copied from interface:ServicesManager
Update package- Specified by:
updateServicesPackage
in interfaceServicesManager
servicesPackage
- with which is the old one supposed to be updated :-)- Throws:
ServicesPackageNotExistsException
PrivilegeException
-