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

Debugging - uncovered problem with "CropRules" rendering into JSON -

infinite recursion?
parent f9472926
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
org.eclipse.jdt.core.builder.invalidClasspath=abort
org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
org.eclipse.jdt.core.circularClasspath=error
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
org.eclipse.jdt.core.codeComplete.fieldPrefixes=
......@@ -21,6 +30,7 @@ org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
......@@ -383,3 +393,5 @@ org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
org.eclipse.jdt.core.incompleteClasspath=error
......@@ -573,17 +573,35 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
@Transactional(readOnly = false)
public Parameter addParameter(Crop crop, String category, String title) {
Parameter parameter = new Parameter();
LOG.info("addParameter(Crop:"+(crop!=null?crop.getName():"null")+","+category+","+title+")");
LOG.info("new Parameter() ");
parameter.setCrop(crop);
Parameter parameter = new Parameter();
LOG.info("setCrop ");
parameter.setCrop(crop); // BEWARE: Crop Rules are defective in JSON rendering
LOG.info("parameterCategoryRepository.findByName(category)");
ParameterCategory parameterCategory =
parameterCategoryRepository.findByName(category);
LOG.info("setCategory(parameterCategory);");
parameter.setCategory(parameterCategory);
LOG.info("setTitle(title)");
parameter.setTitle(title);
LOG.info("parameterRepository.save(parameter)");
parameterRepository.save(parameter);
LOG.info("return parameter");
return parameter;
}
......
......@@ -158,7 +158,7 @@ public class TraitsController extends RestController {
@RequestBody PropertyJson propertyJson
) throws ValidationException {
LOG.info("Creating crop property:");
LOG.info("Creating property for crop '"+cropName+"':");
Validator validator = new Validator();
List<ConstraintViolation> violations = validator.validate(propertyJson);
......@@ -167,16 +167,30 @@ public class TraitsController extends RestController {
throw new ModelValidationException("Validation problem", violations);
}
LOG.info("Calling cropService.getCrop('"+cropName+"'):");
Crop crop = cropService.getCrop(cropName) ;
//LOG.debug("getParameter? ");
//Parameter property = traitService.getParameter(crop, propertyJson.title);
Parameter property = traitService.getParameter(crop, propertyJson.title);
//LOG.debug(property.toString());
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?");
//if(property == null) { // create if not available already?
LOG.info("Calling traitService.addParameter()");
Parameter property = traitService.addParameter(crop, propertyJson.category, propertyJson.title);
LOG.info("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