Hi Jorge,
this action 'relatedProceedingViewAction' is defined as a transition inside a flow definition in an xml file (since we are using spring web flow).
<
transition on="relatedProceedingViewAction" to="relatedProceedingView" >
<set name="caseFormBean.showProceedingDetailsToModify"
value="false"
/>
<set name="caseFormBean.showProceedingDetailsToReadOnly"
value="true"
/>
<set name="proceedingFormBean.showProceedingEditButton" value="true" />
<set name="proceedingFormBean.showProceedingSaveButton" value="false" />
<set name="proceedingFormBean.showProceedingReturnButton" value="false" />
<set name="proceedingFormBean.showAddAppealProceedingButton" value="true" />
<set name="proceedingFormBean.showProceedingDeleteButton" value="false" />
<evaluate expression="proceedingServiceAction.showProceedingRelatedData(caseFormBean,personCaseAndProcTO,messageContext,flowRequestContext)"
result="caseFormBean" />
</transition>
and java code is here.
public
CaseFormBean showProceedingRelatedData(CaseFormBean pCaseFormBean,PersonCaseAndProcTO personCaseAndProcTO,MessageContext pMessageContext, RequestContext flowRequestContext) {
logger.info("Inside show proceeing data...");
ServiceLocator locator =
null; List<AccidentResolutionVO> accidentResolutions =
null;pCaseFormBean.setAddingNewProceeding(
false); personCaseAndProcTO =
new PersonCaseAndProcTO();
try {locator = ServiceLocator.getInstance();
caseServiceRemote = (CaseServiceRemote) locator.lookup("test.facade.CaseServiceRemote");Integer personId = (Integer) flowRequestContext.getExternalContext().getSessionMap().get(
"personId");
if(null==personId){personId = pCaseFormBean.getPersonId();
PersonSearchCriteriaTO criteriaTO =
new PersonSearchCriteriaTO();criteriaTO.setPersonId(personId);
setPersonIntoSession(
new Person(), criteriaTO, caseServiceRemote, flowRequestContext);}
personCaseAndProcTO.setPersonId(personId);
personCaseAndProcTO.setCaseId(pCaseFormBean.getCaseId());
personCaseAndProcTO.setProceedingId(pCaseFormBean.getProceedingId());
personCaseAndProcTO.setCaseSubtype(pCaseFormBean.getCaseSubtype());
personCaseAndProcTO.setOperation(MashaConstants.
SHOW_PROCEEDING_RELATED_DATA);
pCaseFormBean.setSelectedTab(
"Perustiedot");
//If we are in document's cases n proceeding the code inside if will be executed, other wise code of else block will be executed to show normal proceeding view.
if(pCaseFormBean.getShowDocAttachFragmentProcView() != null
&& pCaseFormBean.getShowDocAttachFragmentProcView()){pCaseFormBean.setSelectedTab(
"Asiakirjat");pCaseFormBean.setDocumentViewSelectedTab(
"DocumentsToimenpiteet");ActionTO actionTO =
new ActionTO();Integer documentCaseId = pCaseFormBean.getDocumentCaseId();
actionTO.setCaseId(documentCaseId);
Integer documentProceedingId = pCaseFormBean.getDocumentProceedingId();
actionTO.setProceedingId(documentProceedingId);
actionTO.setInquiryID(
null);actionTO.setOpenState(
true);actionTO.setInProgressState(
true);actionTO.setAlarmState(
true);actionTO.setReadyState(
true);List<ActionsListObject> actionObjectList = loadActions(actionTO, pCaseFormBean, flowRequestContext);
pCaseFormBean.setActionObjectList(actionObjectList);
pCaseFormBean = setProceedingDetailForDocument(pCaseFormBean, flowRequestContext, personId);
logger.debug("Returning from the controller, after document proceeding fetch....");}
else{pCaseFormBean.setSelectedTabForDS(
"Toimenpiteet");
pCaseFormBean.setShowResolutionRowsLink(
false);pCaseFormBean.setAccidentDateEditable(
true);String caseOfficerId_DB =
"";String caseType =
"";
if(!checkUserHasPermission("showProceedingRelatedData", getUserProfile(flowRequestContext), null, flowRequestContext)){pCaseFormBean.setMessage(
null, getLocalizedMessage("privlige.required", flowRequestContext), MashaConstants.ERROR_MESSAGE, flowRequestContext, pCaseFormBean);
return pCaseFormBean;}
logger.info("Showing proceeding of case type : "+pCaseFormBean.getCaseType());pCaseFormBean.setShowMessage(
false);pCaseFormBean.cleanMessages(flowRequestContext);
NotificationFormBean.loadNotificationDropDowns(pCaseFormBean.getCaseId());
logger.info("Loading dropdown data for party and resolutions");PartyFormBean partyFormBean =
new PartyFormBean();partyFormBean.loadPartyResolutionDropDownLists(pCaseFormBean.getCaseId(), pCaseFormBean.getProceedingId());
logger.info("Loaded dropdown data for party and resolutions");UserProfile userProfile = getUserProfile(flowRequestContext);
String caseOfficerId = userProfile.getCaseOfficerPO() !=
null ? userProfile.getCaseOfficerPO().getCaseOfficerId(): "";String cToken = getCaseOfficerLoginToken(caseOfficerId);
setcToken(cToken);
Integer caseId = pCaseFormBean.getCaseId();
//pCaseFormBean = new CaseFormBean();
logger.info("Loading case for the current proceeding as we need number of proceedings for this case . ");CaseVO caseVO =
caseServiceRemote.getCaseVOByCaseId(caseId, MashaConstants.GET_CASEVO_BY_ID, userProfile);
if( caseVO != null ){Integer numberOfProceedings = caseVO.getProceedings() !=
null ? caseVO.getProceedings().size() : null;pCaseFormBean.setNumberOfProceedingInCase(numberOfProceedings);
caseType = caseVO.getCaseType();
caseVO.setCaseTypeLabel(pCaseFormBean.getCaseTypeMap().get(caseType));
caseVO.setCaseSubtypeLabel(pCaseFormBean.getCaseSubtypeMap().get(
""+caseVO.getCaseSubtype()));pCaseFormBean.setCaseVO(caseVO);
String caseSubType = caseVO.getCaseSubtype();
if( (caseSubType!=null && (caseSubType.equalsIgnoreCase(MashaConstants.CASE_SUBTYPES_015.toString().trim()) || caseSubType.equalsIgnoreCase(MashaConstants.CASE_SUBTYPES_016.toString().trim()) || caseSubType.equalsIgnoreCase(MashaConstants.
CASE_SUBTYPES_020.toString().trim()) || caseSubType.equalsIgnoreCase(MashaConstants.CASE_SUBTYPES_030.toString().trim()) || caseSubType.equalsIgnoreCase(MashaConstants.
CASE_SUBTYPES_090.toString().trim()))) ){pCaseFormBean.setShowResolutionRowsLink(
true);}
if(pCaseFormBean.getShowDocAttachFragmentProcView() != null && pCaseFormBean.getShowDocAttachFragmentProcView()){pCaseFormBean.getCaseVO().setDocumentRelated(
true);}
else{pCaseFormBean.getCaseVO().setDocumentRelated(
false);}
accidentResolutions = caseVO.getAccidentResolutions();
List<AccidentResolutionVO> accidentResolutionListAfterSorting =
new ArrayList<AccidentResolutionVO>();
if ( accidentResolutions != null && accidentResolutions.size() > 0){
logger.debug("Inside if loop accidentResolutions.size() ###############: " + accidentResolutions.size());Collections.sort(accidentResolutions);
accidentResolutionListAfterSorting.add(accidentResolutions.get(0));
}
for (AccidentResolutionVO accidentResolutionVO : accidentResolutionListAfterSorting) {
if(StringUtils.isNotEmpty(accidentResolutionVO.getResolution())){
logger.debug("Inside for loop AccidentResolutionVO ###############");
//accidentResolutionVO.setResolution(pCaseFormBean.getAccidentResolResolutionMap().get(""+accidentResolutionVO.getResolution()));
pCaseFormBean.setAccidentDateEditable(
false);}
}
}
// Get Proceeding
logger.debug("Calling caseServiceRemote.getProceedingDetail");ProceedingVO proceedingVO =
caseServiceRemote.getProceedingDetail(personCaseAndProcTO, MashaConstants.GET_PROCEEDING, userProfile);
logger.debug("Response caseServiceRemote.getProceedingDetail :" + proceedingVO);
if(proceedingVO == null){pCaseFormBean.setProceedingVO(
new ProceedingVO());
return pCaseFormBean;}
else{
if(proceedingVO.getIsProceedingResolved() != null && proceedingVO.getIsProceedingResolved() && StringUtils.isBlank(proceedingVO.getResolverId())){String label = getLocalizedMessage(
"party.resolution.maker.emptyValue", flowRequestContext);proceedingVO.setResolverId(label);
proceedingVO.setResolverName(CaseOfficerProxy.getCaseOfficerNameById(label));
}
caseOfficerId_DB = proceedingVO.getCaseOfficerId();
pCaseFormBean.setProceedingVO(proceedingVO);
List<ProceedingActivationVO> procActivatList = proceedingVO.getProceedingActivations();
List<PartyVO> partyList = proceedingVO.getParties() !=
null ? proceedingVO.getParties() : new ArrayList<PartyVO>();List<AccidentVO> accidentsList =
new ArrayList<AccidentVO>();
if(proceedingVO.getCase1() != null){pCaseFormBean.setCaseNumber(proceedingVO.getCase1().getCaseNumber());
pCaseFormBean.setCaseId(proceedingVO.getCase1().getCaseId());
pCaseFormBean.setCaseType(proceedingVO.getCase1().getCaseType());
pCaseFormBean.setCaseSubtypeLabel(proceedingVO.getCase1().getCaseSubtypeLabel());
accidentsList = proceedingVO.getCase1().getAccidents();
}
if(accidentsList == null){accidentsList =
new ArrayList<AccidentVO>();}
if(proceedingVO.getParties() != null && proceedingVO.getParties().size() > 0){PartyVO partyVO = proceedingVO.getParties().get(0);
pCaseFormBean.setPartyVO(partyVO);
pCaseFormBean.setPartyId(partyVO.getPartyId());
proceedingVO.setPartyId(partyVO.getPartyId());
}
pCaseFormBean.setProceedingVO(proceedingVO);
pCaseFormBean.setProceedingId(proceedingVO.getProceedingId());
HistoryFormBean historyFormBean = pCaseFormBean.getHistoryFormBean();
historyFormBean.setProceedingId(proceedingVO.getProceedingId());
historyFormBean.setViewCaseHistoryDetailsFragment(
false);
if( "006".equalsIgnoreCase(proceedingVO.getProceedingReason()) ||
"007".equalsIgnoreCase(proceedingVO.getProceedingReason()) ||
"007".equalsIgnoreCase(proceedingVO.getProceedingSubject()) ){pCaseFormBean.setShowResolutionRowsLink(
false);}
pCaseFormBean.setSelectedProceedingDetail(pCaseFormBean, proceedingVO, procActivatList, partyList, accidentsList,
true);}
pCaseFormBean.setShowProceedingDetailsToReadOnly(
true);setViewType(MashaConstants.
SHOW_PROCEEDING, flowRequestContext);performRoleCheckForProceedingOperation(pCaseFormBean, caseOfficerId_DB, userProfile, flowRequestContext);
if(pCaseFormBean.getUserAllowedToAddAppealProceeding() != null && pCaseFormBean.getUserAllowedToAddAppealProceeding() == false){
if(isRestrictedUser(flowRequestContext) && caseType != null && !caseType.equals("4")){pCaseFormBean.setUserAllowedToAddAppealProceeding(
true);}
else{pCaseFormBean.setUserAllowedToAddAppealProceeding(
false);}
}
if(checkUserHasPermission("PRINT_OUT", userProfile, caseOfficerId_DB, flowRequestContext)){pCaseFormBean.setUserAllowedToPrintProceeding(
true);}
else{pCaseFormBean.setUserAllowedToPrintProceeding(
false);}
flowRequestContext.getExternalContext().getSessionMap().remove(
"proceedingStatus");flowRequestContext.getExternalContext().getSessionMap().put(
"proceedingStatus", proceedingVO.getProceedingStatusCode());
logger.debug("Returning from the controller, after normal proceeding fetch....");}
}
catch (NamingException ne) {
errorCode = MashaConstants.masha_naming_exception_key;
errorDescription = MashaConstants.masha_naming_exception_value;
logger.error(String.format("errorCode = '%s' errorDescription = '%s' ", errorCode,errorDescription), ne);pCaseFormBean.setMessage(
errorCode, errorDescription, MashaConstants.ERROR_MESSAGE, flowRequestContext, pCaseFormBean);}
catch (BusinessException mbe) {
errorCode = mbe.getErrorCode();
errorDescription = mbe.getErrorDescription();
logger.error(String.format("errorCode = '%s' errorDescription = '%s' ", errorCode,errorDescription), mbe);pCaseFormBean.setMessage(
errorCode, errorDescription, MashaConstants.ERROR_MESSAGE, flowRequestContext, pCaseFormBean);}
catch(Exception e){
errorCode = MashaConstants.masha_application_errorcode_key_100135;
errorDescription = MashaConstants.masha_application_errorcode_value_100135;
logger.error(String.format("errorCode = '%s' errorDescription = '%s'", errorCode,errorDescription),e);pCaseFormBean.setMessage(
errorCode, errorDescription, MashaConstants.ERROR_MESSAGE, flowRequestContext, pCaseFormBean);}
logger.info("Now show proceeding data to the view..");
// this is for doctor statement usecase of action module
return pCaseFormBean;}