/* enoECMChangeReportUX * ** Copyright (c) 1993-2020 Dassault Systemes. All Rights Reserved. ** This program contains proprietary and trade secret information of ** Dassault Systemes. ** Copyright notice is precautionary only and does not evidence any actual ** or intended publication of such program * */ import com.dassault_systemes.enovia.changeorder.factory.ChangeOrderFactory; import com.dassault_systemes.enovia.changeorder.interfaces.IChangeOrderServices; import com.dassault_systemes.enovia.changerequest.factory.ChangeRequestFactory; import com.dassault_systemes.enovia.changerequest.interfaces.IChangeRequest; import com.dassault_systemes.enovia.changerequest.interfaces.IChangeRequestServices; import com.matrixone.apps.domain.DomainObject; import com.matrixone.apps.domain.util.*; import com.matrixone.apps.framework.ui.UINavigatorUtil; import com.matrixone.apps.framework.ui.UIUtil; import matrix.db.BusinessObjectWithSelect; import matrix.db.Context; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.logging.Logger; public class enoECMChangeReportUX_mxJPO extends enoECMChangeReportUXBase_mxJPO { /** * Constructor. * @param context the eMatrix Context object. * @param args holds no arguments. * @throws Exception if the operation fails. * @since ECM R421.HF4 */ private static final Logger LOGGER = Logger.getLogger(enoECMChangeReportUXBase_mxJPO.class.getName()); public enoECMChangeReportUX_mxJPO (Context context, String[] args) throws Exception { super(context, args); } /** * Get change actions of Change Request for Summary Report * * @param context the eMatrix Context object. * @param args holds objectId. * @return String. * @throws Exception If the operation fails. */ public String getChangeActionsOfChangeRequest(Context context, String[] args) throws Exception { StringBuffer sbChangeActions = new StringBuffer(); try { String strLanguage = context.getSession().getLanguage(); String strChangeRequestId = args[0]; DomainObject domChange = DomainObject.newInstance(context, strChangeRequestId); IChangeOrderServices changeOrderFactory = ChangeOrderFactory.createChangeOrderFactory(); IChangeRequestServices changeRequestFactory = ChangeRequestFactory.createChangeRequestFactory(); IChangeRequest iChangeRequest = changeRequestFactory.retrieveChangeRequestFromDatabase(context, domChange); Set caPhysicalIdSet = iChangeRequest.getIndirectImplementingChangeActionIdentifiers(context); List caIdList = iChangeRequest.getImplementingChangeActionIdentifiers(context); LOGGER.info("caPhysicalIdSet == >" + caPhysicalIdSet); LOGGER.info("caIdList == >" + caIdList); List lsChangeActionId = new ArrayList<>(); if(!caIdList.isEmpty()){ for (String caId : caIdList){ lsChangeActionId.add(caId); } } if(!caPhysicalIdSet.isEmpty()){ for(String caPhysicalId : caPhysicalIdSet){ String getCaId = "temp query bus * * * where 'physicalId == " + caPhysicalId + "' select id dump | "; String caIdInfo = MqlUtil.mqlCommand(context, getCaId); String caId = caIdInfo.split("\\|")[3]; if(lsChangeActionId.isEmpty() || !lsChangeActionId.contains(caId)){ lsChangeActionId.add(caId); } } } LOGGER.info("lsChangeActionId == >" + lsChangeActionId); List changeIdCardSelectables = new ArrayList(); changeIdCardSelectables.add(IChangeOrderServices.ChangeIdCardENUM.NAMESELECTABLE); changeIdCardSelectables.add(IChangeOrderServices.ChangeIdCardENUM.TYPESELECTABLE); changeIdCardSelectables.add(IChangeOrderServices.ChangeIdCardENUM.POLICYSELECTABLE); changeIdCardSelectables.add(IChangeOrderServices.ChangeIdCardENUM.OWNERSELECTABLE); changeIdCardSelectables.add(IChangeOrderServices.ChangeIdCardENUM.CURRENTSELECTABLE); changeIdCardSelectables.add(IChangeOrderServices.ChangeIdCardENUM.CATITLESELECTABLE); Map mpChangeInfo = changeOrderFactory.getChangeIdCard(context, lsChangeActionId, changeIdCardSelectables); sbChangeActions.append(""); sbChangeActions.append(""); sbChangeActions.append(""); sbChangeActions.append(""); sbChangeActions.append(""); sbChangeActions.append(""); sbChangeActions.append(""); Set setMpChangeKeys = mpChangeInfo.keySet(); for(String key : setMpChangeKeys) { BusinessObjectWithSelect busSelectData = (BusinessObjectWithSelect) mpChangeInfo.get(key); String strType = busSelectData.getSelectData(IChangeOrderServices.ChangeIdCardENUM.TYPESELECTABLE.toString()); String strName = busSelectData.getSelectData(IChangeOrderServices.ChangeIdCardENUM.NAMESELECTABLE.toString()); String strPolicy = busSelectData.getSelectData(IChangeOrderServices.ChangeIdCardENUM.POLICYSELECTABLE.toString()); String strCurrent = busSelectData.getSelectData(IChangeOrderServices.ChangeIdCardENUM.CURRENTSELECTABLE.toString()); String strTitle = busSelectData.getSelectData(IChangeOrderServices.ChangeIdCardENUM.CATITLESELECTABLE.toString()); String strOwner= busSelectData.getSelectData(IChangeOrderServices.ChangeIdCardENUM.OWNERSELECTABLE.toString()); String strOwnerFullName = PersonUtil.getFullName(context, strOwner); String imgChangeActionType = UINavigatorUtil.getTypeIconProperty(context, strType); if (UIUtil.isNullOrEmpty(imgChangeActionType)) { imgChangeActionType = "iconSmallDefault.gif"; } sbChangeActions.append(""); sbChangeActions.append(""); sbChangeActions.append(""); sbChangeActions.append(""); sbChangeActions.append(""); sbChangeActions.append(""); } if (lsChangeActionId.size() == 0) { sbChangeActions.append(""); } } catch (FrameworkException Ex) { throw Ex; } sbChangeActions.append("
" + EnoviaResourceBundle.getProperty(context, "emxEnterpriseChangeMgtStringResource", context.getLocale(), "EnterpriseChangeMgt.Label.NAME") + "" + EnoviaResourceBundle.getProperty(context, "emxEnterpriseChangeMgtStringResource", context.getLocale(), "EnterpriseChangeMgt.Label.Title") + "" + EnoviaResourceBundle.getProperty(context, "emxEnterpriseChangeMgtStringResource", context.getLocale(), "EnterpriseChangeMgt.Label.OWNER") + "" + EnoviaResourceBundle.getProperty(context, "emxEnterpriseChangeMgtStringResource", context.getLocale(), "EnterpriseChangeMgt.Common.State") + "
\"*\" " + XSSUtil.encodeForHTML(context, strName) + " " + XSSUtil.encodeForHTML(context, strTitle) + " " + XSSUtil.encodeForHTML(context, strOwnerFullName) + " " + i18nNow.getStateI18NString(strPolicy, strCurrent, strLanguage) + " 
" + EnoviaResourceBundle.getProperty(context, "emxEnterpriseChangeMgtStringResource", context.getLocale(), "EnterpriseChangeMgt.Change.NoChangeActionConnected") + "
"); return sbChangeActions.toString(); } }