Commit d47108ea authored by Richard Bruskiewich's avatar Richard Bruskiewich Committed by Matija Obreza
Browse files

Cleaned out LOG comments from debugging. Code for creation of

category and property ("trait" or Parameter) otherwise seems to work.
The next part for validation if Method.
parent 88f4507d
......@@ -572,36 +572,19 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
@Transactional(readOnly = false)
public Parameter addParameter(Crop crop, String category, String title) {"addParameter(Crop:"+(crop!=null?crop.getName():"null")+","+category+","+title+")");"new Parameter() ");
Parameter parameter = new Parameter();"setCrop ");
parameter.setCrop(crop); // BEWARE: Crop Rules are defective in JSON rendering"parameterCategoryRepository.findByName(category)");
ParameterCategory parameterCategory =
parameter.setTitle(title);"");;"return parameter");
return parameter;
......@@ -157,41 +157,33 @@ public class TraitsController extends RestController {
@PathVariable("crop") String cropName,
@RequestBody PropertyJson propertyJson
) throws ValidationException {"Creating property for crop '"+cropName+"':");
Validator validator = new Validator();
List<ConstraintViolation> violations = validator.validate(propertyJson);
if (violations.size() > 0) {
// TODO We could do better messages on validation error
throw new ModelValidationException("Validation problem", violations);
}"Calling cropService.getCrop('"+cropName+"'):");
Crop crop = cropService.getCrop(cropName) ;
//LOG.debug("getParameter? ");
LOG.debug("Calling getParameter()");
Parameter property = traitService.getParameter(crop, propertyJson.title);
if(property == null) {
// create if not available already?
property = traitService.addParameter(crop, propertyJson.category, propertyJson.title);
} else
LOG.warn("Property '"+propertyJson.title+"' in category '"+
propertyJson.category+"' for crop '"+
cropName+"' already exists?");
//Parameter property = traitService.getParameter(crop, propertyJson.title);
//if(property == null) { // create if not available already?"Calling traitService.addParameter()");
Parameter property = traitService.addParameter(crop, propertyJson.category, propertyJson.title);"Returning from createProperty()");
// property = traitService.addParameter(crop, propertyJson.category, propertyJson.title);
// LOG.debug("...done.");
//} else
// LOG.warn("Property '"+propertyJson.title+"' in category '"+
// propertyJson.category+"' for crop '"+
// cropName+"' already exists?");
return property;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment