use of cz.metacentrum.perun.core.api.exceptions.FacilityNotExistsException in project perun by CESNET.
the class EventProcessorImpl method getFacilityEntityIdValue.
/**
* Get entityID value from perun by facilityId.
*
* @param facilityId the facilityId
* @return value of entityID or null, if value is null or user not exists yet
* @throws InternalErrorException if some exception is thrown from RPC
*/
private String getFacilityEntityIdValue(int facilityId) throws InternalErrorException {
Facility facility = null;
try {
facility = Rpc.FacilitiesManager.getFacilityById(ldapcManager.getRpcCaller(), facilityId);
} catch (PrivilegeException ex) {
throw new InternalErrorException("There are no privilegies for getting facility by id.", ex);
} catch (FacilityNotExistsException ex) {
//If facility not exist in perun now, probably will be deleted in next step so its ok. The value is null anyway.
return null;
}
cz.metacentrum.perun.core.api.Attribute entityID = null;
try {
entityID = Rpc.AttributesManager.getAttribute(ldapcManager.getRpcCaller(), facility, AttributesManager.NS_FACILITY_ATTR_DEF + ":entityID");
} catch (PrivilegeException ex) {
throw new InternalErrorException("There are no privilegies for getting facility attribute.", ex);
} catch (AttributeNotExistsException ex) {
throw new InternalErrorException("There is no such attribute.", ex);
} catch (FacilityNotExistsException ex) {
//If facility not exist in perun now, probably will be deleted in next step so its ok. The value is null anyway.
return null;
} catch (WrongAttributeAssignmentException ex) {
throw new InternalErrorException("There is problem with wrong attribute assignment exception.", ex);
}
if (entityID.getValue() == null)
return null;
else
return (String) entityID.getValue();
}
Aggregations