Class BTCapacityPlanningScenarioExportExcel
java.lang.Object
overit.geocall.bl.BusinessTask<CapacityPlanningScenarioExportExcelEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<CapacityPlanningScenarioExportExcelEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask<CapacityPlanningScenarioExportExcelEvent>
overit.geocallapp.wfm.forecastcapacity.bl.capacityplanning.scenario.task.BTCapacityPlanningScenarioExportExcel
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(CapacityPlanningScenarioExportExcelEvent.class)
public class BTCapacityPlanningScenarioExportExcel
extends ValidPermissionBusinessTask<CapacityPlanningScenarioExportExcelEvent>
Business task in order to export the XLSX file of a
i.e., its
BOCapacityPlanningScenario object, alongside its data, i.e., its
BOCapacityPlanningResult results and BOCapacityPlanningResultDetail details. - Since:
- 15.0
- See Also:
- GCApi:
- task
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected BOCache<BOActivityForecastHeader> protected static final Stringprotected static final Stringprotected BOCache<BOCapacityPlanningScenario> protected BOCache<BOForecastActivity> protected BOCache<BOForecastActivityPriority> protected BOCache<BOForecastGroupingConstraint> protected BOCache<BOForecastResource> protected static final Stringprotected BOCache<BOResourceForecastHeader> protected static final StringFields inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask
LOG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddCustomColumns(String sheetIdentifier, DBView sheetDBView) Adds the custom columns (e.g., RESOURCE_FORECAST_HEADER, ACTIVITY_FORECAST_HEADER etc.) associated to eachDBViewsheetDBView (e.g., the sheet named "Capacity Planning Header" etc.).protected voidappendCapacityPlanningDetailsSheet(BOCapacityPlanningScenario capacityPlanningScenario, XlsxDocument excelDocument, PoolKit pk) Appends the "CP - Details" sheet to the specifiedXlsxDocumentobject.protected voidappendCapacityPlanningHeaderSheet(BOCapacityPlanningScenario capacityPlanningScenario, XlsxDocument excelDocument, PoolKit pk) Appends the "Capacity Planning Header" sheet to the specifiedXlsxDocumentobject.protected voidappendCapacityPlanningResultSheet(BOCapacityPlanningScenario capacityPlanningScenario, XlsxDocument excelDocument, PoolKit pk) Appends the "CP - Result" sheet to the specifiedXlsxDocumentobject.protected voidExecutes the exporting by creating an XLSX file associated with theBOCapacityPlanningScenarioobject.protected Map<Long, BOForecastActivity> getForecastActivitiesMap(Long activityForecastHeaderId) Retrieves a list ofBOForecastActivityobjects based on the provided activityForecastHeaderId, and then converts this list into a Map object (i.e., a map).protected Map<Long, BOForecastActivityDetail> getForecastDetailActivitiesMap(Long activityForecastHeaderId) Retrieves a list ofBOForecastActivityDetailobjects based on the provided activityForecastHeaderId, and then converts this list into a Map object (i.e., a map).protected WebResourceReturns the report web resource.protected List<CapacityPlanningAllTimeframesResultDetail> getResultsGroupedByTimeframeAndResource(List<CapacityPlanningAllTimeframesResultDetail> capacityPlanningAllTimeframesResultDetailList) Takes a list ofCapacityPlanningAllTimeframesResultDetailobjects and groups them by a combination of attributes, namely Activity, ActivityTimeframe, Resource, and Team.protected voidinit()booleanDetermines whether the current state is valid for execution.protected voidpopulateActivitiesConstraintsData(Map<String, Object> row, BOForecastActivityDetail forecastActivityDetail) Populates the column named "ACTIVITY_GROUPING_CONSTRAINT" with the grouping constraint applied to a givenBOForecastActivityDetailobject.protected voidpopulateActivitiesData(Map<String, Object> row, BOForecastActivity forecastActivity) Populates the columns named "ACTIVITY_CODE" and "ACTIVITY_DESCRIPTION" with the values retrieved from the givenBOForecastActivityobject.protected voidpopulateActivitiesDetailsData(Map<String, Object> row, Long activityId, BOCapacityPlanningScenario capacityPlanningScenario, PoolKit pk) Populates the time columns which are related to a givenBOForecastActivityobject.protected voidpopulateActivitiesPrioritiesData(Map<String, Object> row, BOForecastActivityDetail forecastActivityDetail) Populates the column named "ACTIVITY_PRIORITY" with the value applied to a givenBOForecastActivityDetailobject.protected voidpopulateActivitiesSkillsData(Map<String, Object> row, Long activityId, BOCapacityPlanningScenario capacityPlanningScenario, PoolKit pk) Populates the column named "ACTIVITY_SKILLS" with the skills applied to a givenBOForecastActivityobject.protected voidPopulates the column named "RESOURCE_GROUPING_CONSTRAINT" with the grouping constraints applied to a givenBOForecastResourceobject.protected voidpopulateResourcesData(Map<String, Object> row, Long resourceId, BOCapacityPlanningScenario capacityPlanningScenario, PoolKit pk) Populates the columns which are related to theBOForecastResourceobject (e.g., "RESOURCE_CODE", "RESOURCE_NAME", "RESOURCE_SURNAME" etc.).protected voidpopulateResourcesDetailsData(Map<String, Object> row, Long activityDetailId, Long resourceId, BOCapacityPlanningScenario capacityPlanningScenario, BOForecastActivityDetail forecastActivityDetail, PoolKit pk) Populates the column named "RESOURCE_OVERTIME" with the sum of theBOForecastResourceDetailobjects' overtimes in a given timeframe.protected voidpopulateResourcesSkillsData(Map<String, Object> row, Long resourceId, BOCapacityPlanningScenario capacityPlanningScenario, PoolKit pk) Populates the column named "RESOURCE_SKILLS" with the skills applied to a givenBOForecastResourceobject.protected voidpopulateTimeframesData(Map<String, Object> row, BOForecastActivityDetail forecastActivityDetail) Populates the columns which are related to aBOForecastActivityDetailobject (i.e., a calculated timeframe).protected BOCapacityPlanningResultSets the null fields of aBOCapacityPlanningResultobject to 0 (i.e., a zero).Methods inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask
checkValidExecution, getException, throwExceptionIfInvalidMethods inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask
body, getEventMethods inherited from class overit.geocall.bl.BusinessTask
start, start, startAlone, startInBackground
-
Field Details
-
XLSX_DOCUMENT
- See Also:
-
CAPACITY_PLANNING_HEADER
- See Also:
-
RESOURCE_AGGREGATE_RESULT
- See Also:
-
ACTIVITY_AGGREGATE_RESULT
- See Also:
-
CAPACITY_PLANNING_DETAILS
- See Also:
-
capacityPlanningScenarioCache
-
resourceForecastHeaderCache
-
activityForecastHeaderCache
-
forecastResourceCache
-
forecastActivityCache
-
forecastGroupingConstraintCache
-
skillCache
-
forecastActivityPriorityCache
-
-
Constructor Details
-
BTCapacityPlanningScenarioExportExcel
public BTCapacityPlanningScenarioExportExcel()
-
-
Method Details
-
execute
protected void execute(CapacityPlanningScenarioExportExcelEvent event, PoolKit pk) throws DAException, DAValidateException Executes the exporting by creating an XLSX file associated with theBOCapacityPlanningScenarioobject.- Specified by:
executein classValidExecutionBusinessTask<CapacityPlanningScenarioExportExcelEvent>- Parameters:
event- theCapacityPlanningScenarioExportExcelEventpk- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
appendCapacityPlanningHeaderSheet
protected void appendCapacityPlanningHeaderSheet(BOCapacityPlanningScenario capacityPlanningScenario, XlsxDocument excelDocument, PoolKit pk) throws DAException, DAValidateException Appends the "Capacity Planning Header" sheet to the specifiedXlsxDocumentobject.- Parameters:
capacityPlanningScenario- the loadedBOCapacityPlanningScenarioobjectexcelDocument- theXlsxDocumentobjectpk- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
appendCapacityPlanningResultSheet
protected void appendCapacityPlanningResultSheet(BOCapacityPlanningScenario capacityPlanningScenario, XlsxDocument excelDocument, PoolKit pk) throws DAValidateException, DAException Appends the "CP - Result" sheet to the specifiedXlsxDocumentobject. More precisely, aggregated data are appended to twoXlsxTableViewobjects, one representing the "Resource Aggregate Results", the other the "Activity Aggregate Results".- Parameters:
capacityPlanningScenario- the loadedBOCapacityPlanningScenarioobjectexcelDocument- theXlsxDocumentobjectpk- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
appendCapacityPlanningDetailsSheet
protected void appendCapacityPlanningDetailsSheet(BOCapacityPlanningScenario capacityPlanningScenario, XlsxDocument excelDocument, PoolKit pk) throws DAValidateException, DAException Appends the "CP - Details" sheet to the specifiedXlsxDocumentobject.- Parameters:
capacityPlanningScenario- the loadedBOCapacityPlanningScenarioobjectexcelDocument- theXlsxDocumentobjectpk- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
addCustomColumns
Adds the custom columns (e.g., RESOURCE_FORECAST_HEADER, ACTIVITY_FORECAST_HEADER etc.) associated to eachDBViewsheetDBView (e.g., the sheet named "Capacity Planning Header" etc.). -
setFieldsToZero
Sets the null fields of aBOCapacityPlanningResultobject to 0 (i.e., a zero).- Parameters:
input- theBOCapacityPlanningResultinput- Returns:
- input the
BOCapacityPlanningResultinput
-
getResultsGroupedByTimeframeAndResource
protected List<CapacityPlanningAllTimeframesResultDetail> getResultsGroupedByTimeframeAndResource(List<CapacityPlanningAllTimeframesResultDetail> capacityPlanningAllTimeframesResultDetailList) Takes a list ofCapacityPlanningAllTimeframesResultDetailobjects and groups them by a combination of attributes, namely Activity, ActivityTimeframe, Resource, and Team. Then, it calculates the total duration and total overtime for each group and returns a list of aggregated results, namely the list ofCapacityPlanningAllTimeframesResultDetailobjects.- Parameters:
capacityPlanningAllTimeframesResultDetailList- , the list ofCapacityPlanningAllTimeframesResultDetailobjects- Returns:
- the list passed as parameter, but its object are grouped by a combination of attributes
-
getForecastActivitiesMap
protected Map<Long,BOForecastActivity> getForecastActivitiesMap(Long activityForecastHeaderId) throws DAException, DAValidateException Retrieves a list ofBOForecastActivityobjects based on the provided activityForecastHeaderId, and then converts this list into a Map object (i.e., a map). In the map, the keys are Long values representing the id of eachBOForecastActivityobject, and the values are theBOForecastActivityobjects themselves.- Parameters:
activityForecastHeaderId- , theBOActivityForecastHeader's id- Returns:
- the list of
BOForecastActivityobjects collected as a map - Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
getForecastDetailActivitiesMap
protected Map<Long,BOForecastActivityDetail> getForecastDetailActivitiesMap(Long activityForecastHeaderId) throws DAException, DAValidateException Retrieves a list ofBOForecastActivityDetailobjects based on the provided activityForecastHeaderId, and then converts this list into a Map object (i.e., a map). In the map, the keys are Long values representing the id of eachBOForecastActivityDetailobject, and the values are theBOForecastActivityDetailobjects themselves.- Parameters:
activityForecastHeaderId- , theBOActivityForecastHeader's id- Returns:
- the list of
BOForecastActivityDetailobjects collected as a map - Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
populateResourcesData
protected void populateResourcesData(Map<String, Object> row, Long resourceId, BOCapacityPlanningScenario capacityPlanningScenario, PoolKit pk) throws DAValidateException, DAExceptionPopulates the columns which are related to theBOForecastResourceobject (e.g., "RESOURCE_CODE", "RESOURCE_NAME", "RESOURCE_SURNAME" etc.).- Parameters:
row- the row to be updatedresourceId- theBOForecastResource's id fieldcapacityPlanningScenario- the loadedBOCapacityPlanningScenarioobjectpk- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
populateResourcesDetailsData
protected void populateResourcesDetailsData(Map<String, Object> row, Long activityDetailId, Long resourceId, BOCapacityPlanningScenario capacityPlanningScenario, BOForecastActivityDetail forecastActivityDetail, PoolKit pk) throws DAValidateException, DAExceptionPopulates the column named "RESOURCE_OVERTIME" with the sum of theBOForecastResourceDetailobjects' overtimes in a given timeframe.- Parameters:
row- the row to be updatedactivityDetailId- theBOForecastActivityDetail's id fieldresourceId- theBOForecastResource's id fieldcapacityPlanningScenario- the loadedBOCapacityPlanningScenarioobjectforecastActivityDetail- theBOForecastActivityDetailobjectpk- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
populateResourcesConstraintsData
protected void populateResourcesConstraintsData(Map<String, Object> row, Long resourceId, PoolKit pk) throws DAValidateException, DAExceptionPopulates the column named "RESOURCE_GROUPING_CONSTRAINT" with the grouping constraints applied to a givenBOForecastResourceobject.- Parameters:
row- the row to be updatedresourceId- theBOForecastResource's id fieldpk- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
populateResourcesSkillsData
protected void populateResourcesSkillsData(Map<String, Object> row, Long resourceId, BOCapacityPlanningScenario capacityPlanningScenario, PoolKit pk) throws DAValidateException, DAExceptionPopulates the column named "RESOURCE_SKILLS" with the skills applied to a givenBOForecastResourceobject.- Parameters:
row- the row to be updatedresourceId- theBOForecastResource's id fieldcapacityPlanningScenario- the loadedBOCapacityPlanningScenarioobjectpk- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
populateActivitiesData
Populates the columns named "ACTIVITY_CODE" and "ACTIVITY_DESCRIPTION" with the values retrieved from the givenBOForecastActivityobject.- Parameters:
row- the row to be updatedforecastActivity- theBOForecastActivityobject
-
populateActivitiesSkillsData
protected void populateActivitiesSkillsData(Map<String, Object> row, Long activityId, BOCapacityPlanningScenario capacityPlanningScenario, PoolKit pk) throws DAValidateException, DAExceptionPopulates the column named "ACTIVITY_SKILLS" with the skills applied to a givenBOForecastActivityobject.- Parameters:
row- the row to be updatedactivityId- theBOForecastActivity's id fieldcapacityPlanningScenario- the loadedBOCapacityPlanningScenarioobjectpk- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
populateTimeframesData
protected void populateTimeframesData(Map<String, Object> row, BOForecastActivityDetail forecastActivityDetail) Populates the columns which are related to aBOForecastActivityDetailobject (i.e., a calculated timeframe).- Parameters:
row- the row to be updatedforecastActivityDetail- theBOForecastActivityDetailobject
-
populateActivitiesPrioritiesData
protected void populateActivitiesPrioritiesData(Map<String, Object> row, BOForecastActivityDetail forecastActivityDetail) Populates the column named "ACTIVITY_PRIORITY" with the value applied to a givenBOForecastActivityDetailobject.- Parameters:
row- the row to be updatedforecastActivityDetail- theBOForecastActivityDetailobject
-
populateActivitiesDetailsData
protected void populateActivitiesDetailsData(Map<String, Object> row, Long activityId, BOCapacityPlanningScenario capacityPlanningScenario, PoolKit pk) throws DAValidateException, DAExceptionPopulates the time columns which are related to a givenBOForecastActivityobject.- Parameters:
row- the row to be updatedactivityId- theBOForecastActivity's id fieldcapacityPlanningScenario- the loadedBOCapacityPlanningScenarioobjectpk- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
populateActivitiesConstraintsData
protected void populateActivitiesConstraintsData(Map<String, Object> row, BOForecastActivityDetail forecastActivityDetail) Populates the column named "ACTIVITY_GROUPING_CONSTRAINT" with the grouping constraint applied to a givenBOForecastActivityDetailobject.- Parameters:
row- the row to be updatedforecastActivityDetail- theBOForecastActivityDetailobject
-
getReportWebResource
Returns the report web resource.- Returns:
- the report web resource
-
init
protected void init()Initializes the caches forBOResourceForecastHeader,BOForecastResourceandBOSkillobjects. This method sets up theBOCacheinstances for efficient data loading. -
isValidExecution
public boolean isValidExecution()Description copied from interface:ValidExecutionDetermines whether the current state is valid for execution.- Returns:
- true if execution is valid, false otherwise
-