[Bug #1149] Fixed ClassCastException on ResourceDAO
* There was a bad cast of the query result to Worker instead of Resource FEA: ItEr75S04BugFixing
This commit is contained in:
parent
8a38a22b17
commit
9fd9427253
3 changed files with 15 additions and 14 deletions
|
|
@ -21,19 +21,20 @@
|
|||
|
||||
package org.navalplanner.business.reports.dtos;
|
||||
|
||||
import org.navalplanner.business.resources.entities.Worker;
|
||||
import org.navalplanner.business.workingday.EffortDuration;
|
||||
import org.navalplanner.business.resources.entities.Resource;
|
||||
|
||||
|
||||
|
||||
public class HoursWorkedPerWorkerInAMonthDTO {
|
||||
|
||||
private String workerName;
|
||||
private String resourceName;
|
||||
|
||||
private EffortDuration numHours;
|
||||
|
||||
public HoursWorkedPerWorkerInAMonthDTO(Worker worker,
|
||||
public HoursWorkedPerWorkerInAMonthDTO(Resource resource,
|
||||
EffortDuration numHours) {
|
||||
this.workerName = worker.getName();
|
||||
this.resourceName = resource.getName();
|
||||
this.numHours = numHours;
|
||||
}
|
||||
|
||||
|
|
@ -45,16 +46,16 @@ public class HoursWorkedPerWorkerInAMonthDTO {
|
|||
this.numHours = numHours;
|
||||
}
|
||||
|
||||
public String getWorkerName() {
|
||||
return workerName;
|
||||
public String getResourceName() {
|
||||
return resourceName;
|
||||
}
|
||||
|
||||
public void setWorkerName(String workerName) {
|
||||
this.workerName = workerName;
|
||||
public void setResourceName(String resourceName) {
|
||||
this.resourceName = resourceName;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return getWorkerName() + "; " + getNumHours();
|
||||
return getResourceName() + "; " + getNumHours();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -242,12 +242,12 @@ public class ResourceDAO extends IntegrationEntityDAO<Resource> implements
|
|||
|
||||
for (Object row: rows) {
|
||||
Object[] columns = (Object[]) row;
|
||||
Worker worker = (Worker) findExistingEntity((Long) columns[0]);
|
||||
Resource resource = (Resource) findExistingEntity((Long) columns[0]);
|
||||
EffortDuration effort = EffortDuration.seconds(((Long) columns[1])
|
||||
.intValue());
|
||||
|
||||
HoursWorkedPerWorkerInAMonthDTO dto = new HoursWorkedPerWorkerInAMonthDTO(
|
||||
worker, effort);
|
||||
resource, effort);
|
||||
result.add(dto);
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parameter name="year" class="java.lang.String"/>
|
||||
<parameter name="month" class="java.lang.String"/>
|
||||
<parameter name="logo" class="java.lang.String"/>
|
||||
<field name="workerName" class="java.lang.String"/>
|
||||
<field name="resourceName" class="java.lang.String"/>
|
||||
<field name="numHours" class="org.navalplanner.business.workingday.EffortDuration"/>
|
||||
<variable name="sumNumHours" class="java.lang.String" calculation="System">
|
||||
<variableExpression><![CDATA[$P{REPORT_SCRIPTLET}.getNumHours()]]></variableExpression>
|
||||
|
|
@ -128,7 +128,7 @@
|
|||
<textField isBlankWhenNull="true">
|
||||
<reportElement x="13" y="0" width="200" height="15"/>
|
||||
<textElement textAlignment="Center"/>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$F{workerName}]]></textFieldExpression>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$F{resourceName}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</detail>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue