Class BTResourceForecastExportExcel
java.lang.Object
overit.geocall.bl.BusinessTask<ResourceForecastExportExcelEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<ResourceForecastExportExcelEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask<ResourceForecastExportExcelEvent>
overit.geocallapp.wfm.forecastcapacity.bl.forecast.resource.task.BTResourceForecastExportExcel
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(ResourceForecastExportExcelEvent.class)
public class BTResourceForecastExportExcel
extends ValidPermissionBusinessTask<ResourceForecastExportExcelEvent>
Business task in order to export the XLSX file of a
i.e., its
When the
BOResourceForecastHeader object, alongside its data, i.e., its
BOForecastResource resources and, for each resource, its BOResourceForecastSkill skills and BOForecastResourceDetail details (i.e., calendars). When the
ResourceForecastExportExcelEvent is launched
the BT notices the call and exports the XLSX file basing on the event's input, which is the id of the selected BOResourceForecastHeader object. Errors:
Codes.EXPORT_OPERATION_FAILED: Data to export not defined
- Since:
- 15.0
- See Also:
- GCApi:
- task
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected BOCache<BOForecastResource> protected BOCache<BOForecastGroupingConstraint> protected static final Stringprotected BOCache<BOResourceForecastHeader> protected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected 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., FSM_SKILL_ID, FSM_SKILL_DESCRIPTION etc.) associated to eachDBViewsheetDBView (e.g., Skills Sheet, Details Sheet etc.).protected voidaddGroupingConstraintColumns(String sheetIdentifier, DBView sheetDBView) protected voidappendDetailsSheet(List<BOForecastResourceDetail> resourceDetails, XlsxDocument excelDocument, PoolKit pk) Appends the Resources Details Sheet to the specifiedXlsxDocumentobject.protected voidappendGroupingConstraintsSheet(List<BOForecastResourceGroupingConstraint> resourceGroupingConstraints, XlsxDocument excelDocument, PoolKit pk) Appends the Resources Grouping Constraints Sheet to the specifiedXlsxDocumentobject.protected voidappendResourceForecastHeaderSheet(BOResourceForecastHeader resourceForecastHeader, XlsxDocument excelDocument) Appends the Resource Forecast Header Sheet to the specifiedXlsxDocumentobject.protected voidappendResourcesSheet(List<BOForecastResource> forecastResources, XlsxDocument excelDocument) Appends the Forecast Resources Sheet to the specifiedXlsxDocumentobject.protected voidappendSkillsSheet(List<BOResourceForecastSkill> resourceSkills, XlsxDocument excelDocument, PoolKit pk) Appends the Resources Skills Sheet to the specifiedXlsxDocumentobject.protected voidexecute(ResourceForecastExportExcelEvent event, PoolKit pk) Executes the exporting by creating an XLSX file associated with theBOResourceForecastHeaderobject.protected List<BOForecastResourceDetail> getAllForecastDetails(List<BOForecastResource> resources, PoolKit pk) Retrieves the list of the details (i.e., calendars) associated with eachBOForecastResourceresource linked to the providedBOResourceForecastHeaderinput.protected List<BOForecastResourceGroupingConstraint> getAllForecastGroupingConstraints(List<BOForecastResource> resources, PoolKit pk) Retrieves the list of the grouping constraints associated with eachBOForecastResourceresource linked to the providedBOResourceForecastHeaderinput.protected List<BOForecastResource> getAllForecastResources(Long resourceForecastHeaderId, PoolKit pk) Retrieves a list of forecast resources associated with theBOResourceForecastHeaderinput.protected List<BOResourceForecastSkill> getAllForecastSkills(List<BOForecastResource> resources, PoolKit pk) Retrieves the list of the skills associated with eachBOForecastResourceresource linked to the providedBOResourceForecastHeaderinput.getAllResourcesFullNames(String sheetIdentifier, DBView sheetDBView, PoolKit pk) Retrieves the list of the full names (i.e., the list of the formatted name + " " + surname combinations) to be shown in the custom column named RESOURCE_FULL_NAME of theDBViewsheetDBView.getGroupingConstraintsDescriptions(DBView sheetDBView, PoolKit pk) Retrieves the list of FSM grouping constraints' IDs to be shown in the "FSM_GROUPING_CONSTRAINT_ID" column and populates that column in theDBViewsheetDBView (i.e., Grouping Constraints Sheet).protected WebResourceReturns the report web resource.getSkillsDescriptions(DBView sheetDBView, PoolKit pk) Retrieves the list of FSM skills' IDs to be shown in the "FSM_SKILL_ID" column and populates that column in theDBViewsheetDBView (i.e., Skills Sheet).protected voidinit()booleanDetermines whether the current state is valid for execution.protected voidpopulateColumn(DBView sheetDBView, List<String> list, String column) Populates the specified column of the givenDBViewwith values from the provided list.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:
-
XLSX_DOCUMENT_PREFIX_NAME
- See Also:
-
XLSX_DOCUMENT_EXTENSION
- See Also:
-
RESOURCE_FORECAST_HEADER_SHEET
- See Also:
-
FORECAST_RESOURCES_SHEET
- See Also:
-
RESOURCES_SKILLS_SHEET
- See Also:
-
RESOURCES_DETAILS_SHEET
- See Also:
-
RESOURCES_GROUPING_CONSTRAINTS_SHEET
- See Also:
-
resourceForecastHeaderBOCache
-
forecastResourceBOCache
-
skillBOCache
-
groupingConstraintBOCache
-
-
Constructor Details
-
BTResourceForecastExportExcel
public BTResourceForecastExportExcel()
-
-
Method Details
-
execute
protected void execute(ResourceForecastExportExcelEvent event, PoolKit pk) throws DAException, DAValidateException Executes the exporting by creating an XLSX file associated with theBOResourceForecastHeaderobject.- Specified by:
executein classValidExecutionBusinessTask<ResourceForecastExportExcelEvent>- Parameters:
event- theResourceForecastExportExcelEventpk- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
getAllForecastResources
protected List<BOForecastResource> getAllForecastResources(Long resourceForecastHeaderId, PoolKit pk) throws DAValidateException, DAException Retrieves a list of forecast resources associated with theBOResourceForecastHeaderinput.- Parameters:
resourceForecastHeaderId- the ID ofBOResourceForecastHeaderinputpk- thePoolKit- Returns:
- searchEvent.launch(pk).getContent(); the list of
BOForecastResourceobjects - Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
getAllForecastSkills
protected List<BOResourceForecastSkill> getAllForecastSkills(List<BOForecastResource> resources, PoolKit pk) throws DAValidateException, DAException Retrieves the list of the skills associated with eachBOForecastResourceresource linked to the providedBOResourceForecastHeaderinput.- Parameters:
resources- the list ofBOForecastResourceresourcespk- thePoolKit- Returns:
- allSkills, the list of
BOResourceForecastSkillobjects - Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
getAllForecastDetails
protected List<BOForecastResourceDetail> getAllForecastDetails(List<BOForecastResource> resources, PoolKit pk) throws DAValidateException, DAException Retrieves the list of the details (i.e., calendars) associated with eachBOForecastResourceresource linked to the providedBOResourceForecastHeaderinput.- Parameters:
resources- the list ofBOForecastResourceresourcespk- thePoolKit- Returns:
- allDetails, the list of
BOForecastResourceDetailobjects - Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
getAllForecastGroupingConstraints
protected List<BOForecastResourceGroupingConstraint> getAllForecastGroupingConstraints(List<BOForecastResource> resources, PoolKit pk) throws DAValidateException, DAException Retrieves the list of the grouping constraints associated with eachBOForecastResourceresource linked to the providedBOResourceForecastHeaderinput.- Parameters:
resources- the list ofBOForecastResourceresourcespk- thePoolKit- Returns:
- allGroupingConstraints, the list of
BOForecastGroupingConstraintobjects - Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
appendResourceForecastHeaderSheet
protected void appendResourceForecastHeaderSheet(BOResourceForecastHeader resourceForecastHeader, XlsxDocument excelDocument) throws DAException, DAValidateException Appends the Resource Forecast Header Sheet to the specifiedXlsxDocumentobject.- Parameters:
resourceForecastHeader- theBOResourceForecastHeaderinputexcelDocument- theXlsxDocumentobject- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
appendResourcesSheet
protected void appendResourcesSheet(List<BOForecastResource> forecastResources, XlsxDocument excelDocument) throws DAException, DAValidateException Appends the Forecast Resources Sheet to the specifiedXlsxDocumentobject.- Parameters:
forecastResources- the list containing theBOForecastResourceresources linked to the providedBOResourceForecastHeaderinputexcelDocument- theXlsxDocumentobject- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
appendSkillsSheet
protected void appendSkillsSheet(List<BOResourceForecastSkill> resourceSkills, XlsxDocument excelDocument, PoolKit pk) throws DAException, DAValidateException Appends the Resources Skills Sheet to the specifiedXlsxDocumentobject.- Parameters:
resourceSkills- the list containing theBOResourceForecastSkillskills associated with eachBOForecastResourceresourceexcelDocument- theXlsxDocumentobjectpk- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
appendDetailsSheet
protected void appendDetailsSheet(List<BOForecastResourceDetail> resourceDetails, XlsxDocument excelDocument, PoolKit pk) throws DAException, DAValidateException Appends the Resources Details Sheet to the specifiedXlsxDocumentobject.- Parameters:
resourceDetails- the list containing theBOForecastResourceDetaildetails (i.e., calendars) associated with eachBOForecastResourceresourceexcelDocument- theXlsxDocumentobjectpk- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
appendGroupingConstraintsSheet
protected void appendGroupingConstraintsSheet(List<BOForecastResourceGroupingConstraint> resourceGroupingConstraints, XlsxDocument excelDocument, PoolKit pk) throws DAException, DAValidateException Appends the Resources Grouping Constraints Sheet to the specifiedXlsxDocumentobject.- Parameters:
resourceGroupingConstraints- the list containing theBOForecastGroupingConstraintgrouping constraints associated with eachBOForecastResourceresourceexcelDocument- theXlsxDocumentobjectpk- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
addCustomColumns
Adds the custom columns (e.g., FSM_SKILL_ID, FSM_SKILL_DESCRIPTION etc.) associated to eachDBViewsheetDBView (e.g., Skills Sheet, Details Sheet etc.). -
addGroupingConstraintColumns
-
getAllResourcesFullNames
protected List<String> getAllResourcesFullNames(String sheetIdentifier, DBView sheetDBView, PoolKit pk) throws DAValidateException, DAException Retrieves the list of the full names (i.e., the list of the formatted name + " " + surname combinations) to be shown in the custom column named RESOURCE_FULL_NAME of theDBViewsheetDBView.- Parameters:
sheetIdentifier- theStringobject used to determine the specificDBViewsheetsheetDBView- theDBViewsheetpk- thePoolKit- Returns:
- resourcesNames, the list of
BOForecastResourceobjects' full names - Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
getSkillsDescriptions
protected List<String> getSkillsDescriptions(DBView sheetDBView, PoolKit pk) throws DAValidateException, DAException Retrieves the list of FSM skills' IDs to be shown in the "FSM_SKILL_ID" column and populates that column in theDBViewsheetDBView (i.e., Skills Sheet). Then, it retrieves the list of FSM skills' descriptions to be shown in the "FSM_SKILL_DESCRIPTION" column.- Parameters:
sheetDBView- theDBViewpk- thePoolKit- Returns:
- skillsDescriptions the list of the FSM skills' descriptions
- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
getGroupingConstraintsDescriptions
protected List<String> getGroupingConstraintsDescriptions(DBView sheetDBView, PoolKit pk) throws DAValidateException, DAException Retrieves the list of FSM grouping constraints' IDs to be shown in the "FSM_GROUPING_CONSTRAINT_ID" column and populates that column in theDBViewsheetDBView (i.e., Grouping Constraints Sheet). Then, it retrieves the list of FSM grouping constraint' descriptions to be shown in the "FSM_GROUPING_CONSTRAINT_DESCRIPTION" column.- Parameters:
sheetDBView- theDBViewpk- thePoolKit- Returns:
- groupingConstraintDescriptions the list of the FSM grouping constraints' descriptions
- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
populateColumn
Populates the specified column of the givenDBViewwith values from the provided list. This method is used to populate a column in a database view with values from a list. It iterates through each row of the database view and assigns the corresponding value from the list to the specified column.- Parameters:
sheetDBView- theDBViewto be populatedlist- the list of values to populate the column withcolumn- the name of the column to be populated
-
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
-