Search in sources :

Example 1 with RatingDTO

use of io.hops.hopsworks.dela.dto.hopssite.RatingDTO in project hopsworks by logicalclocks.

the class HopssiteController method getDatasetAllRating.

// **************************************************RATING PUBLIC*****************************************************
public RatingDTO getDatasetAllRating(String publicDSId) throws DelaException {
    checkHopssiteReady();
    try {
        ClientWrapper client = getClient(HopsSite.RatingService.getDatasetAllRating(publicDSId), RatingDTO.class);
        LOG.log(Settings.DELA_DEBUG, "hops-site:rating:get:all - {0}", client.getFullPath());
        RatingDTO result = (RatingDTO) client.doGet();
        LOG.log(Settings.DELA_DEBUG, "hops-site:rating:get:all - done {0}", client.getFullPath());
        return result;
    } catch (IllegalStateException ise) {
        throw new DelaException(RESTCodes.DelaErrorCode.COMMUNICATION_FAILURE, Level.SEVERE, DelaException.Source.HOPS_SITE, null, ise.getMessage(), ise);
    }
}
Also used : RatingDTO(io.hops.hopsworks.dela.dto.hopssite.RatingDTO) DelaException(io.hops.hopsworks.exceptions.DelaException) ClientWrapper(io.hops.hopsworks.common.util.ClientWrapper)

Example 2 with RatingDTO

use of io.hops.hopsworks.dela.dto.hopssite.RatingDTO in project hopsworks by logicalclocks.

the class HopssiteController method getDatasetUserRating.

// **************************************************RATING CLUSTER****************************************************
public RatingDTO getDatasetUserRating(String publicCId, String publicDSId, String email) throws DelaException {
    checkHopssiteReady();
    try {
        ClientWrapper client = getClient(HopsSite.RatingService.getDatasetUserRating(publicCId, publicDSId), RatingDTO.class).setPayload(email);
        LOG.log(Settings.DELA_DEBUG, "hops-site:rating:get:user - {0}", client.getFullPath());
        RatingDTO result = (RatingDTO) client.doPost();
        LOG.log(Settings.DELA_DEBUG, "hops-site:rating:get:user - done {0}", client.getFullPath());
        return result;
    } catch (IllegalStateException ise) {
        throw new DelaException(RESTCodes.DelaErrorCode.COMMUNICATION_FAILURE, Level.SEVERE, DelaException.Source.HOPS_SITE, null, ise.getMessage(), ise);
    }
}
Also used : RatingDTO(io.hops.hopsworks.dela.dto.hopssite.RatingDTO) DelaException(io.hops.hopsworks.exceptions.DelaException) ClientWrapper(io.hops.hopsworks.common.util.ClientWrapper)

Example 3 with RatingDTO

use of io.hops.hopsworks.dela.dto.hopssite.RatingDTO in project hopsworks by logicalclocks.

the class RatingService method getDatasetAllRating.

private Response getDatasetAllRating() throws DelaException {
    LOGGER.log(Settings.DELA_DEBUG, "hops-site:rating:get:all {0}", publicDSId);
    RatingDTO rating = hopsSite.getDatasetAllRating(publicDSId);
    LOGGER.log(Settings.DELA_DEBUG, "hops-site:rating:get:all - done {0}", publicDSId);
    return noCacheResponse.getNoCacheResponseBuilder(Response.Status.OK).entity(rating).build();
}
Also used : RatingDTO(io.hops.hopsworks.dela.dto.hopssite.RatingDTO)

Example 4 with RatingDTO

use of io.hops.hopsworks.dela.dto.hopssite.RatingDTO in project hopsworks by logicalclocks.

the class RatingService method getDatasetUserRating.

private Response getDatasetUserRating(SecurityContext sc) throws DelaException {
    LOGGER.log(Settings.DELA_DEBUG, "hops-site:rating:get:user {0}", publicDSId);
    String publicCId = SettingsHelper.clusterId(settings);
    Users user = jWTHelper.getUserPrincipal(sc);
    RatingDTO rating = hopsSite.getDatasetUserRating(publicCId, publicDSId, user.getEmail());
    LOGGER.log(Settings.DELA_DEBUG, "hops-site:rating:get:user - done {0}", publicDSId);
    return noCacheResponse.getNoCacheResponseBuilder(Response.Status.OK).entity(rating).build();
}
Also used : RatingDTO(io.hops.hopsworks.dela.dto.hopssite.RatingDTO) Users(io.hops.hopsworks.persistence.entity.user.Users)

Aggregations

RatingDTO (io.hops.hopsworks.dela.dto.hopssite.RatingDTO)4 ClientWrapper (io.hops.hopsworks.common.util.ClientWrapper)2 DelaException (io.hops.hopsworks.exceptions.DelaException)2 Users (io.hops.hopsworks.persistence.entity.user.Users)1