use of io.hops.hopsworks.common.featurestore.datavalidation.RuleDTO in project hopsworks by logicalclocks.
the class RulesBuilder method build.
public RuleDTO build(UriInfo uriInfo, ResourceRequest resourceRequest) {
RuleDTO dto = new RuleDTO();
uri(dto, uriInfo);
expand(dto, resourceRequest);
if (dto.isExpand()) {
AbstractFacade.CollectionInfo collectionInfo = ruleDefinitionFacade.findAll(resourceRequest.getOffset(), resourceRequest.getLimit(), resourceRequest.getFilter(), resourceRequest.getSort());
// set the count
dto.setCount(collectionInfo.getCount());
collectionInfo.getItems().forEach((validationRule) -> dto.addItem(build(uriInfo, resourceRequest, (ValidationRule) validationRule)));
}
return dto;
}
use of io.hops.hopsworks.common.featurestore.datavalidation.RuleDTO in project hopsworks by logicalclocks.
the class RulesResource method get.
@ApiOperation(value = "Get a specific data validation rule that can be applied to a feature group", response = RuleDTO.class)
@GET
@Path("/{name}")
@Produces(MediaType.APPLICATION_JSON)
@JWTRequired(acceptedTokens = { Audience.API, Audience.JOB }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@ApiKeyRequired(acceptedScopes = { ApiScope.JOB }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
public Response get(@ApiParam(value = "name of the rule", required = true) @PathParam("name") Name name, @Context UriInfo uriInfo, @Context SecurityContext sc) throws FeaturestoreException {
ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.RULES);
RuleDTO dto = rulesBuilder.build(uriInfo, resourceRequest, name);
return Response.ok().entity(dto).build();
}
use of io.hops.hopsworks.common.featurestore.datavalidation.RuleDTO in project hopsworks by logicalclocks.
the class RulesBuilder method build.
public RuleDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, ValidationRule validationRule) {
RuleDTO dto = new RuleDTO();
uri(dto, uriInfo, validationRule);
expand(dto, resourceRequest);
if (dto.isExpand()) {
dto.setName(validationRule.getName());
dto.setDescription(validationRule.getDescription());
dto.setPredicate(validationRule.getPredicate());
dto.setAcceptedType(validationRule.getAcceptedType());
dto.setFeatureType(validationRule.getFeatureType());
}
return dto;
}
use of io.hops.hopsworks.common.featurestore.datavalidation.RuleDTO in project hopsworks by logicalclocks.
the class RulesResource method getAll.
@ApiOperation(value = "Get a list of all data validation rules that can be applied to a feature group", response = RuleDTO.class)
@GET
@Produces(MediaType.APPLICATION_JSON)
@JWTRequired(acceptedTokens = { Audience.API, Audience.JOB }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@ApiKeyRequired(acceptedScopes = { ApiScope.JOB }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
public Response getAll(@BeanParam Pagination pagination, @BeanParam RulesBeanParam ruleDefinitionsBeanParam, @Context UriInfo uriInfo, @Context SecurityContext sc) {
ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.RULES);
resourceRequest.setOffset(pagination.getOffset());
resourceRequest.setLimit(pagination.getLimit());
resourceRequest.setSort(ruleDefinitionsBeanParam.getSortBySet());
RuleDTO dto = rulesBuilder.build(uriInfo, resourceRequest);
return Response.ok().entity(dto).build();
}
Aggregations