<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE struts-config PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
    "http://struts.apache.org/dtds/struts-config_1_3.dtd">

<!-- Descriptions: This file contains specific struts components for an report module
  History: Created 				12/15/2005	Muddaiah Ranga
-->
<struts-config>

  <!-- ====================== Form Bean Definitions ======================= -->
  <form-beans>
    <form-bean name="reportParamInfoForm" type="gov.va.med.esr.ui.report.action.ReportParamInfoForm"/>
    <form-bean name="reportScheduleInfoForm" type="gov.va.med.esr.ui.report.action.ReportScheduleInfoForm"/>
    <form-bean name="completedReportsForm" type="gov.va.med.esr.ui.report.action.CompletedReportsForm"/>
    <form-bean name="reportFilterForm" type="gov.va.med.esr.ui.report.action.ReportFilterForm"/>
  </form-beans>

  <!-- ===================================== Exception Handling Definitions  -->
  <global-exceptions>
  </global-exceptions>

  <!-- ===================================== Global forwards Definitions  -->
  <global-forwards>
    <forward name="report.availableReports" path="/viewReports.do?methodName=displayAvailableReports" redirect="true"  module="/report"/>
    <forward name="report.scheduledReports" path="/scheduledReports.do?methodName=displayScheduledReports" redirect="true"  module="/report"/>
    <forward name="report.completedReports" path="/completedReports.do?methodName=displayCompletedReports" redirect="true" module="/report"/>
  </global-forwards>

  <!-- ====================== Action Bean Definitions ===================== -->
  <action-mappings type="gov.va.med.fw.ui.struts.ServiceBrokerActionMapping">

    <action path="/viewReports"
            type="gov.va.med.fw.ui.struts.ServiceDelegatingActionProxy"
            parameter="methodName">
      <forward name="displayAvailableReports" path=".report.displayAvailableReports"/>
      <forward name="displayReport" path=".report.displayReport"/>
    </action>

    <action path="/scheduledReports"
            type="gov.va.med.fw.ui.struts.ServiceDelegatingActionProxy"
            name="reportFilterForm"
            scope="session"
            parameter="methodName">
      <forward name="displayData" path=".report.displayScheduledReports"/>
      <forward name="displayUpdatedData" path="/scheduledReports.do?methodName=DISPLAY" redirect="true"/>
      <forward name="displayScheduledReportsCancelledMsg" path="/scheduledReports.do?methodName=REFRESH&amp;infoMessage=message.report.scheduledReportCancelledSuccessfully" redirect="true"/>
      <forward name="displayScheduledReportsCancelledInvalidId" path="/scheduledReports.do?methodName=REFRESH&amp;errorMessage=errors.report.noCancelReportInvalidId" redirect="true"/>
    </action>

    <action path="/completedReports"
            type="gov.va.med.fw.ui.struts.ServiceDelegatingActionProxy"
            name="completedReportsForm"
            scope="session"
            input="failure"
            validate="true"
            parameter="methodName">
      <forward name="failure" path=".report.displayCompletedReports"/>
      <forward name="displayData" path=".report.displayCompletedReports"/>
      <forward name="displayUpdatedData" path="/completedReports.do?methodName=DISPLAY" redirect="true"/>
      <forward name="displayCompletedReportsDeleteMsg" path="/completedReports.do?methodName=REFRESH&amp;infoMessage=message.report.completedReportDeletedSuccessfully" redirect="true"/>
      <forward name="displayCompletedInactiveReportsDeleteMsg" path="/completedReports.do?methodName=REFRESH&amp;infoMessage=message.report.completedInactiveReportDeletedSuccessfully" redirect="true"/>
      <forward name="displayCompletedReportsDeleteInvalidId" path="/completedReports.do?methodName=REFRESH&amp;errorMessage=errors.report.deleteReportInvalidId" redirect="true"/>
      <forward name="displayCompletedReportsInactivateInvalidId" path="/completedReports.do?methodName=REFRESH&amp;errorMessage=errors.report.invalidateReportInvalidId" redirect="true"/>
      <forward name="displayCompletedReportsInactivationInvalid" path="/completedReports.do?methodName=REFRESH&amp;errorMessage=errors.report.invalidationReportInvalid" redirect="true"/>
      <forward name="displayCompletedReportsInactivatedMsg" path="/completedReports.do?methodName=REFRESH&amp;infoMessage=message.report.completedReportInactivatedSuccessfully" redirect="true"/>
    </action>
    <action path="/runReport"
            type="gov.va.med.fw.ui.struts.ServiceDelegatingActionProxy"
            name="reportScheduleInfoForm"
            attribute="reportInfoForm"
            scope="request"
            validate="true"
            parameter="methodName"
            input="failure">            
      <set-property property="validateOnMethod" value="generateReport"/>
      <forward name="failure" path=".report.displayReportParameters"/>
      <forward name="displayReportParameters" path=".report.displayReportParameters"/>
      <forward name="displayAvailableReportsWithMessage" path="/viewReports.do?methodName=displayAvailableReports&amp;infoMessage=reportSubmitted" redirect="true"/>
      <forward name="cancel" path="/viewReports.do?methodName=displayAvailableReports" redirect="true"/>
    </action>

    <action path="/addReportSchedule"
            type="gov.va.med.fw.ui.struts.ServiceDelegatingActionProxy"
            name="reportScheduleInfoForm"
            attribute="reportInfoForm"
            scope="request"
            validate="true"
            parameter="methodName"
            input="displayAddReportSchedule">
      <set-property property="validateOnMethod" value="addReportSchedule"/>
      <forward name="displayReportSelection" path=".report.displayReportSelection"/>
      <forward name="displayAddReportSchedule" path=".report.displayAddReportSchedule"/>
      <forward name="displayScheduledReportsWithMessage" path="/scheduledReports.do?methodName=displayScheduledReports&amp;infoMessage=reportScheduleAdded" redirect="true"/>
      <forward name="cancel" path="/scheduledReports.do?methodName=displayScheduledReports" redirect="true"/>
    </action>

  </action-mappings>

  <!-- ===================================== Message Resources Definitions  -->
  <message-resources parameter="CommonMessages,WebHelpMessages,BreadCrumbMessages,RuleMessages,ReportLabelMessages,ReportMessages" factory="gov.va.med.fw.ui.struts.CustomPropertyMessageResourcesFactory"/>
  <message-resources key="report" parameter="ReportLabelMessages,ReportMessages" factory="gov.va.med.fw.ui.struts.CustomPropertyMessageResourcesFactory"/>

  <!-- ====================== Plug Ins Configuration ====================== -->

  <!-- ========== TilesPlugin settings ===================================== -->
  <plug-in className="org.apache.struts.tiles.TilesPlugin">
    <set-property property="definitions-config" value="/WEB-INF/edb_tiles-defs.xml,/WEB-INF/report/tiles-defs.xml"/>
    <set-property property="moduleAware" value="true"/>
    <set-property property="definitions-factory-class" value="gov.va.med.fw.ui.struts.CustomTilesFactorySet"/>
  </plug-in>

  <!-- ========== ValidatorPlugin settings ===================================== -->
  <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/report/validation.xml"/>
    <set-property property="stopOnFirstError" value="true"/>
  </plug-in>
</struts-config>