ItEr35S09CUConfiguracionMaquinasItEr34S09: Added validators to alpha in MachineWorkersConfigurationUnit
This commit is contained in:
parent
3cde93298a
commit
adf0fdeb65
3 changed files with 11 additions and 4 deletions
|
|
@ -27,6 +27,7 @@ import java.util.HashSet;
|
|||
import java.util.Set;
|
||||
|
||||
import org.hibernate.validator.AssertTrue;
|
||||
import org.hibernate.validator.Valid;
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
|
||||
/**
|
||||
|
|
@ -75,6 +76,7 @@ public class MachineWorkersConfigurationUnit extends BaseEntity {
|
|||
this.alpha = alpha;
|
||||
}
|
||||
|
||||
@Valid
|
||||
public BigDecimal getAlpha() {
|
||||
return alpha;
|
||||
}
|
||||
|
|
@ -159,6 +161,11 @@ public class MachineWorkersConfigurationUnit extends BaseEntity {
|
|||
return assigned;
|
||||
}
|
||||
|
||||
@AssertTrue(message = "Alpha must be greater than 0")
|
||||
public boolean checkAlpha() {
|
||||
return (this.alpha.compareTo(new BigDecimal(0)) > 0);
|
||||
}
|
||||
|
||||
@AssertTrue(message = "All Machine worker assignments must have a start date earlier than the finish date")
|
||||
public boolean checkWorkerAssignmentsIntervalsProperlyDefined() {
|
||||
boolean correctIntervals = true;
|
||||
|
|
|
|||
|
|
@ -40,17 +40,17 @@
|
|||
<row>
|
||||
<label value="${i18n:_('Code')}" />
|
||||
<textbox value="@{controller.machine.code}" width="500px"
|
||||
constraint="no empty:${i18n:_('cannot be null or empty')}" />
|
||||
constraint="no empty:${i18n:_('Code cannot be null or empty')}" />
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Name')}" />
|
||||
<textbox value="@{controller.machine.name}" width="500px"
|
||||
constraint="no empty:${i18n:_('cannot be null or empty')}" />
|
||||
constraint="no empty:${i18n:_('Name cannot be null or empty')}" />
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Description')}" />
|
||||
<textbox value="@{controller.machine.description}" width="500px"
|
||||
constraint="no empty:${i18n:_('cannot be null or empty')}" />
|
||||
constraint="no empty:${i18n:_('Description cannot be null or empty')}" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@
|
|||
<textbox value="@{configurationUnit.name}"
|
||||
constraint="no empty:${i18n:_('cannot be null or empty')}" />
|
||||
<textbox value="@{configurationUnit.alpha}"
|
||||
constraint="no negative,no zero,no empty:${i18n:_('cannot be null or empty')}" />
|
||||
constraint="no zero,no empty,/[1-9][0-9]*(\.[0-9][0-9]?)?/:${i18n:_('must be a real positive number')}" />
|
||||
<button sclass="icono" image="/common/img/ico_borrar1.png"
|
||||
hoverImage="/common/img/ico_borrar.png" tooltiptext="${i18n:_('Delete')}"
|
||||
onClick="configurationController.deleteConfigurationUnit(self.parent.value)">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue