Skip to content

Commit

Permalink
Improves documentation of methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Antoni Casas i Muñoz committed Jun 3, 2019
1 parent 00f3bee commit e8380d1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,17 @@ public class StakeholdersRecommenderController {
@RequestMapping(value = "batch_process", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation(value = "Batch process request to upload required data for stakeholder recommendation." +
" \n The parameter withAvailability specifies whether a availability is calculated based on the stakeholder's past history" +
" or not.", notes = "", response = BatchReturnSchema.class)
public ResponseEntity addBatch(@RequestBody BatchSchema batch, @RequestParam Boolean withAvailability) throws Exception {
" or not. All information in the database is purged every time this method is called. A person's relation to the project is defined with" +
"PARTICIPANT (availability is expressed in hours), while the person is defined in PERSONS, the requirements in REQUIREMENTS, the project in PROJECTS, and a person's" +
"relation to a requirement in RESPONSIBLES.", notes = "", response = BatchReturnSchema.class)
public ResponseEntity<BatchReturnSchema> addBatch(@RequestBody BatchSchema batch, @RequestParam Boolean withAvailability) throws Exception {
int res = 0;
try {
res = stakeholdersRecommenderService.addBatch(batch, withAvailability);
} catch (IOException e) {
return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
}
return new ResponseEntity(new BatchReturnSchema(res), HttpStatus.CREATED);
return new ResponseEntity<BatchReturnSchema>(new BatchReturnSchema(res), HttpStatus.CREATED);
}


Expand All @@ -59,17 +61,17 @@ public ResponseEntity recommend_reject(@RequestParam("rejected") String rejected
"recommendation and returns a list of the best K stakeholders based on the historic data given in the batch_process." +
"\n The parameter projectSpecific specifies if the recommendation takes into account all stakeholders given in the batch_process, or only those" +
" specified in \"PARTICIPANTS\", in the batch_process", notes = "", response = RecommendReturnSchema[].class)
public ResponseEntity<List<Responsible>> recommend(@RequestBody RecommendSchema request,
public ResponseEntity<List<RecommendReturnSchema>> recommend(@RequestBody RecommendSchema request,
@RequestParam Integer k, @RequestParam Boolean projectSpecific) throws Exception {
List<RecommendReturnSchema> ret = stakeholdersRecommenderService.recommend(request, k, projectSpecific);
return new ResponseEntity(ret, HttpStatus.CREATED);
return new ResponseEntity<List<RecommendReturnSchema>>(ret, HttpStatus.CREATED);
}

@RequestMapping(value = "setEffort", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation(value = "Set the mapping of effort points into hours, the effort points go in a scale from 1 to 5, the effort is specific to a project", notes = "")
public ResponseEntity setEffort(@RequestBody SetEffortSchema eff, @RequestParam String project) throws IOException {
effortCalc.setEffort(eff, project);
return new ResponseEntity(HttpStatus.OK);
return new ResponseEntity(HttpStatus.CREATED);
}

@RequestMapping(value = "computeEffort", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
Expand All @@ -78,7 +80,7 @@ public ResponseEntity setEffort(@RequestBody SetEffortSchema eff, @RequestParam
"in a scale from 1 to 5", notes = "")
public ResponseEntity calculateEffort(@RequestBody EffortCalculatorSchema eff, @RequestParam String project) throws IOException {
effortCalc.effortCalc(eff, project);
return new ResponseEntity(HttpStatus.OK);
return new ResponseEntity(HttpStatus.CREATED);
}


Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ spring.jpa.generate-ddl=true

#If "update", the database will persist, if "create", the database will be purged every
#time the application closes
spring.jpa.hibernate.ddl-auto=create
spring.jpa.hibernate.ddl-auto=update

0 comments on commit e8380d1

Please sign in to comment.