Sonar
This commit is contained in:
parent
f8cd529709
commit
cb456b0632
core/src/main/java/se/su/dsv/scipro/report
view/src/main/java/se/su/dsv/scipro/components
|
@ -43,10 +43,10 @@ public abstract class GradingCriterion extends AbstractGradingCriterion {
|
|||
super(gradingCriterionTemplate.getTitle(), gradingCriterionTemplate.getSortOrder(), gradingCriterionTemplate.getPointsRequiredToPass());
|
||||
this.gradingReport = gradingReport;
|
||||
for (GradingCriterionPointTemplate pointTemplate : gradingCriterionTemplate.getGradingCriterionPointTemplates()) {
|
||||
gradingCriterionPoints.add(new GradingCriterionPoint.Builder()
|
||||
.point(pointTemplate.getPoint())
|
||||
.description(pointTemplate.getDescription())
|
||||
.gradingCriterion(this).build());
|
||||
gradingCriterionPoints.add(new GradingCriterionPoint(
|
||||
pointTemplate.getPoint(),
|
||||
pointTemplate.getDescription(),
|
||||
this));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,31 +14,21 @@ public class GradingCriterionPoint extends AbstractGradingCriterionPoint {
|
|||
@ManyToOne(optional = false)
|
||||
private GradingCriterion gradingCriterion;
|
||||
|
||||
public GradingCriterionPoint() {
|
||||
}
|
||||
|
||||
public GradingCriterionPoint(
|
||||
final Integer point,
|
||||
final String description,
|
||||
final GradingCriterion gradingCriterion)
|
||||
{
|
||||
setPoint(point);
|
||||
setDescription(description);
|
||||
this.gradingCriterion = gradingCriterion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(AbstractGradingCriterionPoint abstractGradingCriterionPoint) {
|
||||
return this.getPoint().compareTo(abstractGradingCriterionPoint.getPoint());
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private final GradingCriterionPoint instance = new GradingCriterionPoint();
|
||||
|
||||
public Builder point(Integer point) {
|
||||
instance.setPoint(point);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder description(String description) {
|
||||
instance.setDescription(description);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder gradingCriterion(GradingCriterion gradingCriterion) {
|
||||
instance.setGradingCriterion(gradingCriterion);
|
||||
return this;
|
||||
}
|
||||
|
||||
public GradingCriterionPoint build() {
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,26 +8,26 @@ import org.apache.wicket.util.lang.Args;
|
|||
import java.util.Date;
|
||||
|
||||
public class DatesValidator extends AbstractFormValidator {
|
||||
private final FormComponent[] components;
|
||||
private final FormComponent<Date> firstDateComponent;
|
||||
private final FormComponent<Date> secondDateComponent;
|
||||
|
||||
public DatesValidator(FormComponent<Date> formComponent1, FormComponent<Date> formComponent2) {
|
||||
Args.notNull(formComponent1, "formComponent1");
|
||||
Args.notNull(formComponent2, "formComponent2");
|
||||
components = new FormComponent[]{formComponent1, formComponent2};
|
||||
firstDateComponent = Args.notNull(formComponent1, "formComponent1");
|
||||
secondDateComponent = Args.notNull(formComponent2, "formComponent2");
|
||||
}
|
||||
|
||||
@Override
|
||||
public FormComponent<?>[] getDependentFormComponents() {
|
||||
return components;
|
||||
return new FormComponent[]{firstDateComponent, secondDateComponent};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(Form<?> form) {
|
||||
Date firstDate = (Date) components[0].getConvertedInput();
|
||||
Date secondDate = (Date) components[1].getConvertedInput();
|
||||
Date firstDate = firstDateComponent.getConvertedInput();
|
||||
Date secondDate = secondDateComponent.getConvertedInput();
|
||||
|
||||
if (firstDate.after(secondDate)) {
|
||||
error(components[0]);
|
||||
error(firstDateComponent);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user