Bug #1374: Move capacity field to calendar tab in order to be edited together
FEA: ItEr76S04BugFixing
This commit is contained in:
parent
4cbd9c9221
commit
5e5df4e168
8 changed files with 52 additions and 42 deletions
|
|
@ -1550,4 +1550,16 @@ public abstract class BaseCalendarEditionController extends
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isVirtualWorker() {
|
||||
return baseCalendarModel.isVirtualWorker();
|
||||
}
|
||||
|
||||
public Integer getCapacity() {
|
||||
return baseCalendarModel.getCapacity();
|
||||
}
|
||||
|
||||
public void setCapacity(Integer capacity) {
|
||||
baseCalendarModel.setCapacity(capacity);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -856,4 +856,34 @@ public class BaseCalendarModel extends IntegrationEntityModel implements
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVirtualWorker() {
|
||||
if (baseCalendar == null) {
|
||||
return false;
|
||||
}
|
||||
if (baseCalendar instanceof ResourceCalendar) {
|
||||
ResourceCalendar resourceCalendar = (ResourceCalendar) baseCalendar;
|
||||
return (resourceCalendar.getResource() != null)
|
||||
&& resourceCalendar.getResource().isVirtual();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getCapacity() {
|
||||
if (isVirtualWorker()) {
|
||||
ResourceCalendar resourceCalendar = (ResourceCalendar) baseCalendar;
|
||||
return resourceCalendar.getCapacity();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCapacity(Integer capacity) {
|
||||
if (isVirtualWorker()) {
|
||||
ResourceCalendar resourceCalendar = (ResourceCalendar) baseCalendar;
|
||||
resourceCalendar.setCapacity(capacity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -220,4 +220,10 @@ public interface IBaseCalendarModel extends IIntegrationEntityModel {
|
|||
|
||||
boolean isOwnExceptionDay();
|
||||
|
||||
boolean isVirtualWorker();
|
||||
|
||||
Integer getCapacity();
|
||||
|
||||
void setCapacity(Integer capacity);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,10 +132,6 @@ public interface IWorkerModel extends IIntegrationEntityModel {
|
|||
|
||||
BaseCalendar getDefaultCalendar();
|
||||
|
||||
Integer getCapacity();
|
||||
|
||||
void setCapacity(Integer capacity);
|
||||
|
||||
public List<Worker> getFilteredWorker(ResourcePredicate predicate);
|
||||
|
||||
public List<Worker> getAllCurrentWorkers();
|
||||
|
|
|
|||
|
|
@ -216,9 +216,6 @@ public class WorkerCRUDController extends GenericForwardComposer implements
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if (workerModel.getWorker().isVirtual()) {
|
||||
workerModel.setCapacity(getVirtualWorkerCapacity());
|
||||
}
|
||||
if (workerModel.getCalendar() == null) {
|
||||
createCalendar();
|
||||
}
|
||||
|
|
@ -517,7 +514,6 @@ public class WorkerCRUDController extends GenericForwardComposer implements
|
|||
@Override
|
||||
public void save() {
|
||||
validateCalendarExceptionCodes();
|
||||
Integer capacity = workerModel.getCapacity();
|
||||
ResourceCalendar calendar = (ResourceCalendar) resourceCalendarModel
|
||||
.getBaseCalendar();
|
||||
if (calendar != null) {
|
||||
|
|
@ -525,7 +521,6 @@ public class WorkerCRUDController extends GenericForwardComposer implements
|
|||
workerModel.setCalendar(calendar);
|
||||
}
|
||||
reloadCurrentWindow();
|
||||
workerModel.setCapacity(capacity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -603,19 +598,6 @@ public class WorkerCRUDController extends GenericForwardComposer implements
|
|||
}
|
||||
}
|
||||
|
||||
public Integer getVirtualWorkerCapacity() {
|
||||
if (isVirtualWorker()) {
|
||||
if (this.workerModel.getCalendar() != null) {
|
||||
return this.workerModel.getCapacity();
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void setVirtualWorkerCapacity(Integer capacity) {
|
||||
this.workerModel.setCapacity(capacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Operations to filter the machines by multiple filters
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -203,7 +203,6 @@ public class WorkerModel extends IntegrationEntityModel implements IWorkerModel
|
|||
|
||||
if (virtual) {
|
||||
worker = VirtualWorker.create("");
|
||||
setCapacity(1);
|
||||
} else {
|
||||
worker = Worker.create("");
|
||||
}
|
||||
|
|
@ -547,21 +546,6 @@ public class WorkerModel extends IntegrationEntityModel implements IWorkerModel
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getCapacity() {
|
||||
if (getCalendar() != null) {
|
||||
return getCalendar().getCapacity();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCapacity(Integer capacity) {
|
||||
if (getCalendar() != null) {
|
||||
getCalendar().setCapacity(capacity);
|
||||
}
|
||||
}
|
||||
|
||||
public IAssignedCriterionsModel getAssignedCriterionsModel() {
|
||||
return assignedCriterionsModel;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,6 +62,10 @@
|
|||
checked="@{calendarController.baseCalendar.codeAutogenerated}" />
|
||||
</hbox>
|
||||
</row>
|
||||
<row visible="@{calendarController.editionController.virtualWorker}">
|
||||
<label value="${i18n:_('Capacity')}" />
|
||||
<intbox value="@{calendarController.editionController.capacity}" width="100px" constraint="no negative,no zero,no empty" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
||||
|
|
|
|||
|
|
@ -85,10 +85,6 @@
|
|||
onSelect="controller.setLimitingResource(self.selectedItem.value);"
|
||||
disabled="@{controller.isEditing}" />
|
||||
</row>
|
||||
<row visible="@{controller.isVirtualWorker}">
|
||||
<label value="${i18n:_('Capacity')}" />
|
||||
<intbox value="@{controller.virtualWorkerCapacity}" width="100px" constraint="no negative,no zero,no empty" />
|
||||
</row>
|
||||
<row visible="@{controller.isVirtualWorker}">
|
||||
<label value="${i18n:_('Observations')}" />
|
||||
<textbox value="@{controller.virtualWorkerObservations}" width="500px" multiline="true" />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue