Class BTActivityForecastExportExcel
java.lang.Object
overit.geocall.bl.BusinessTask<ActivityForecastExportExcelEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<ActivityForecastExportExcelEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask<ActivityForecastExportExcelEvent>
overit.geocallapp.wfm.forecastcapacity.bl.forecast.activity.task.BTActivityForecastExportExcel
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(ActivityForecastExportExcelEvent.class)
public class BTActivityForecastExportExcel
extends ValidPermissionBusinessTask<ActivityForecastExportExcelEvent>
Business task in order to export the XLSX file of a
i.e., its
When the
BOActivityForecastHeader object, alongside its data, i.e., its
BOForecastActivity activities and, for each activity, its BOForecastActivitySkill skills and BOForecastActivityDetail details (i.e., calendars). When the
ActivityForecastExportExcelEvent 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 BOActivityForecastHeader 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 static final Stringprotected static final Stringprotected BOCache<BOActivityForecastHeader> protected static final Stringprotected BOCache<BOForecastActivity> protected BOCache<BOForecastGroupingConstraint> protected 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 voidappendActivitiesSheet(List<BOForecastActivity> forecastActivities, XlsxDocument excelDocument) Appends the Forecast Activities Sheet to the specifiedXlsxDocumentobject.protected voidappendActivityForecastHeaderSheet(BOActivityForecastHeader activityForecastHeader, XlsxDocument excelDocument) Appends the Activity Forecast Header Sheet to the specifiedXlsxDocumentobject.protected voidappendDetailsSheet(List<BOForecastActivityDetail> activityDetails, XlsxDocument excelDocument, PoolKit pk) Appends the Activities Details Sheet to the specifiedXlsxDocumentobject.protected voidappendSkillsSheet(List<BOForecastActivitySkill> activitySkills, XlsxDocument excelDocument, PoolKit pk) Appends the Activities Skills Sheet to the specifiedXlsxDocumentobject.protected voidexecute(ActivityForecastExportExcelEvent event, PoolKit pk) Executes the exporting by creating an XLSX file associated with theBOActivityForecastHeaderobject.protected List<BOForecastActivity> getAllForecastActivities(Long activityForecastHeaderId, PoolKit pk) Retrieves a list of forecast activities associated with theBOActivityForecastHeaderinput.protected List<BOForecastActivityDetail> getAllForecastDetails(List<BOForecastActivity> activities, PoolKit pk) Retrieves the list of the details (i.e., calendars) associated with eachBOForecastActivityactivity linked to the providedBOActivityForecastHeaderinput.protected List<BOForecastActivitySkill> getAllForecastSkills(List<BOForecastActivity> activities, PoolKit pk) Retrieves the list of the skills associated with eachBOForecastActivityactivity linked to the providedBOActivityForecastHeaderinput.getAllFormattedActivities(String sheetIdentifier, DBView sheetDBView, PoolKit pk) Retrieves the list of the activities (i.e., the list of the formatted code + " " + description combinations) to be shown in the custom column named ACTIVITY of theDBViewsheetDBView.getAllFormattedGroupingConstraints(String sheetIdentifier, DBView sheetDBView, PoolKit pk) 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:
-
ACTIVITY_FORECAST_HEADER_SHEET
- See Also:
-
FORECAST_ACTIVITIES_SHEET
- See Also:
-
ACTIVITIES_SKILLS_SHEET
- See Also:
-
ACTIVITIES_DETAILS_SHEET
- See Also:
-
activityForecastHeaderBOCache
-
forecastActivityBOCache
-
forecastGroupingConstraintBOCache
-
skillBOCache
-
-
Constructor Details
-
BTActivityForecastExportExcel
public BTActivityForecastExportExcel()
-
-
Method Details
-
execute
protected void execute(ActivityForecastExportExcelEvent event, PoolKit pk) throws DAException, DAValidateException Executes the exporting by creating an XLSX file associated with theBOActivityForecastHeaderobject.- Specified by:
executein classValidExecutionBusinessTask<ActivityForecastExportExcelEvent>- Parameters:
event- theActivityForecastExportExcelEventpk- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
getAllForecastActivities
protected List<BOForecastActivity> getAllForecastActivities(Long activityForecastHeaderId, PoolKit pk) throws DAValidateException, DAException Retrieves a list of forecast activities associated with theBOActivityForecastHeaderinput.- Parameters:
activityForecastHeaderId- the ID ofBOActivityForecastHeaderinputpk- thePoolKit- Returns:
- searchEvent.launch(pk).getContent(); the list of
BOForecastActivityobjects - Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
getAllForecastSkills
protected List<BOForecastActivitySkill> getAllForecastSkills(List<BOForecastActivity> activities, PoolKit pk) throws DAValidateException, DAException Retrieves the list of the skills associated with eachBOForecastActivityactivity linked to the providedBOActivityForecastHeaderinput.- Parameters:
activities- the list ofBOForecastActivityactivitiespk- thePoolKit- Returns:
- allSkills, the list of
BOForecastActivitySkillobjects - Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
getAllForecastDetails
protected List<BOForecastActivityDetail> getAllForecastDetails(List<BOForecastActivity> activities, PoolKit pk) throws DAValidateException, DAException Retrieves the list of the details (i.e., calendars) associated with eachBOForecastActivityactivity linked to the providedBOActivityForecastHeaderinput.- Parameters:
activities- the list ofBOForecastActivityactivitiespk- thePoolKit- Returns:
- allDetails, the list of
BOForecastActivityDetailobjects - Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
appendActivityForecastHeaderSheet
protected void appendActivityForecastHeaderSheet(BOActivityForecastHeader activityForecastHeader, XlsxDocument excelDocument) throws DAException, DAValidateException Appends the Activity Forecast Header Sheet to the specifiedXlsxDocumentobject.- Parameters:
activityForecastHeader- theBOActivityForecastHeaderinputexcelDocument- theXlsxDocumentobject- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
appendActivitiesSheet
protected void appendActivitiesSheet(List<BOForecastActivity> forecastActivities, XlsxDocument excelDocument) throws DAException, DAValidateException Appends the Forecast Activities Sheet to the specifiedXlsxDocumentobject.- Parameters:
forecastActivities- the list containing theBOForecastActivityactivities linked to the providedBOActivityForecastHeaderinputexcelDocument- theXlsxDocumentobject- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
appendSkillsSheet
protected void appendSkillsSheet(List<BOForecastActivitySkill> activitySkills, XlsxDocument excelDocument, PoolKit pk) throws DAException, DAValidateException Appends the Activities Skills Sheet to the specifiedXlsxDocumentobject.- Parameters:
activitySkills- the list containing theBOForecastActivitySkillskills associated with eachBOForecastActivityactivityexcelDocument- theXlsxDocumentobjectpk- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
appendDetailsSheet
protected void appendDetailsSheet(List<BOForecastActivityDetail> activityDetails, XlsxDocument excelDocument, PoolKit pk) throws DAException, DAValidateException Appends the Activities Details Sheet to the specifiedXlsxDocumentobject.- Parameters:
activityDetails- the list containing theBOForecastActivityDetaildetails (i.e., calendars) associated with eachBOForecastActivityactivityexcelDocument- 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.). -
getAllFormattedActivities
protected List<String> getAllFormattedActivities(String sheetIdentifier, DBView sheetDBView, PoolKit pk) throws DAValidateException, DAException Retrieves the list of the activities (i.e., the list of the formatted code + " " + description combinations) to be shown in the custom column named ACTIVITY of theDBViewsheetDBView.- Parameters:
sheetIdentifier- theStringobject used to determine the specificDBViewsheetsheetDBView- theDBViewsheetpk- thePoolKit- Returns:
- formattedActivities, the list of
BOForecastActivity's "formatted code + description" objects - Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
getAllFormattedGroupingConstraints
protected List<String> getAllFormattedGroupingConstraints(String sheetIdentifier, DBView sheetDBView, PoolKit pk) throws DAValidateException, DAException - Throws:
DAValidateExceptionDAException
-
getPrioritiesById
- Throws:
DAValidateExceptionDAException
-
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
-
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 forBOActivityForecastHeader,BOForecastActivityandBOSkillobjects. 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
-