class GroupResourceEndpointController {

	public Response getGroup(String identifier) throws SCIMException {
		log.debug("Calling SCIM REST method getGroup by id {}", identifier);
		if (identifier == null) {
			throw new NullPointerException("identifier is null");
		}
		try {
			Group perunGroup = perunBl.getGroupsManagerBl().getGroupById(session, Integer.parseInt(identifier));
			ObjectMapper mapper = new ObjectMapper();
			return Response.ok(mapper.writeValueAsString(mapPerunGroupToScimGroup(perunGroup))).build();
		} catch (InternalErrorException ex) {
			log.warn("Internal exception occured while getting group with id {}.", identifier);
			return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
		} catch (GroupNotExistsException ex) {
			log.warn("Group with id {} does not exists.", identifier);
			return Response.status(Response.Status.NOT_FOUND).build();
		} catch (IOException ex) {
			throw new SCIMException("Cannot convert group resource to json string", ex);
		}
	}

	public  GroupResourceEndpointController(PerunSession session);

}