use of org.finos.waltz.model.assessment_definition.AssessmentDefinition in project waltz by khartec.
the class AssessmentRatingExtractor method register.
@Override
public void register() {
post(WebUtilities.mkPath("data-extract", "assessment-rating", "by-definition", ":id"), (request, response) -> {
long definitionId = WebUtilities.getId(request);
AssessmentDefinition definition = assessmentDefinitionDao.getById(definitionId);
SelectConditionStep<?> qry = prepareExtractQuery(definitionId);
String fileName = String.format("assessment-ratings-for-%s", definition.name().toLowerCase());
LOG.debug("extracted assessment ratings for definition {}", definition.name());
return writeExtract(fileName, qry, request, response);
});
}
use of org.finos.waltz.model.assessment_definition.AssessmentDefinition in project waltz by khartec.
the class AssessmentDefinitionEndpoint method saveRoute.
private long saveRoute(Request request, Response response) throws IOException {
ensureUserHasEditRights(request);
AssessmentDefinition def = ImmutableAssessmentDefinition.copyOf(WebUtilities.readBody(request, AssessmentDefinition.class)).withLastUpdatedAt(DateTimeUtilities.nowUtc()).withLastUpdatedBy(WebUtilities.getUsername(request));
return assessmentDefinitionService.save(def);
}
use of org.finos.waltz.model.assessment_definition.AssessmentDefinition in project waltz by khartec.
the class AssessmentRatingEndpoint method verifyCanWrite.
private void verifyCanWrite(Request request, long defId) {
AssessmentDefinition def = assessmentDefinitionService.getById(defId);
def.permittedRole().ifPresent(r -> requireRole(userRoleService, request, r));
if (def.isReadOnly()) {
throw new NotAuthorizedException("Assessment is read-only");
}
}
Aggregations