Compare commits

..

No commits in common. "17240b8fd27ada05b13717b9cb328dda77f9aca0" and "7c0eb7ad33a8c26593c9dd1e604488fb8fa9a518" have entirely different histories.

3 changed files with 13 additions and 10 deletions

View File

@ -41,12 +41,6 @@ public class Variable extends BaseEntity {
this.fuzzyTerms = fuzzyTerms; this.fuzzyTerms = fuzzyTerms;
} }
public Variable(VariableForm variableForm) {
setId(variableForm.getId());
this.name = variableForm.getName();
this.input = variableForm.isInput();
}
public String getName() { public String getName() {
return name; return name;
} }

View File

@ -39,7 +39,7 @@ public class FuzzyTermService {
} else { } else {
term = getById(fuzzyTermForm.getId()); term = getById(fuzzyTermForm.getId());
} }
term.setDescription(fuzzyTermForm.getDescription().replaceAll(" ", "")); term.setDescription(fuzzyTermForm.getDescription());
term.setCrispValue(fuzzyTermForm.getCrispValue()); term.setCrispValue(fuzzyTermForm.getCrispValue());
FuzzyTerm ft = fuzzyTermRepository.save(term); FuzzyTerm ft = fuzzyTermRepository.save(term);
if (fuzzyTermForm.getId() == null || fuzzyTermForm.getId() == 0) { if (fuzzyTermForm.getId() == null || fuzzyTermForm.getId() == 0) {

View File

@ -30,7 +30,16 @@ public class VariableService {
} }
public Variable save(VariableForm variableForm) { public Variable save(VariableForm variableForm) {
return save(new Variable(variableForm), variableForm.getProjectId()); Variable variable;
if (variableForm.getId() == null || variableForm.getId() == 0) {
variable = new Variable();
} else {
variable = getById(variableForm.getId());
}
variable.setProject(projectService.getById(variableForm.getProjectId()));
variable.setName(variableForm.getName());
variable.setInput(variableForm.isInput());
return variableRepository.save(variable);
} }
public Variable save(Variable variable, Integer projectId) { public Variable save(Variable variable, Integer projectId) {
@ -41,9 +50,9 @@ public class VariableService {
dbVariable = getById(variable.getId()); dbVariable = getById(variable.getId());
} }
dbVariable.setProject(projectService.getById(projectId)); dbVariable.setProject(projectService.getById(projectId));
dbVariable.setName(variable.getName().replaceAll(" ", "")); dbVariable.setName(variable.getName());
dbVariable.setInput(variable.isInput()); dbVariable.setInput(variable.isInput());
return variableRepository.save(dbVariable); return variableRepository.save(variable);
} }
public void delete(VariableForm ruleForm) { public void delete(VariableForm ruleForm) {