/* ** ${CLASS:enoECMChangeRequest} ** ** Copyright (c) 1993-2020 Dassault Systemes. All Rights Reserved. */ import com.dassault_systemes.enovia.enterprisechangemgt.common.ChangeConstants; import com.matrixone.apps.domain.DomainObject; import com.matrixone.apps.domain.util.MapList; import com.matrixone.apps.domain.util.MqlUtil; import com.matrixone.apps.domain.util.PersonUtil; import matrix.db.Context; import matrix.util.StringList; import java.util.*; /** * The enoECMChangeOrder class contains code for the "Change Order" business type. * * @version ECM R215 - # Copyright (c) 1992-2020 Dassault Systemes. */ public class enoECMChangeRequest_mxJPO extends enoECMChangeRequestBase_mxJPO { /** * Constructor. * * @param context the eMatrix Context object. * @param args holds no arguments. * @throws Exception if the operation fails. * @since ECM R215. */ public enoECMChangeRequest_mxJPO (Context context, String[] args) throws Exception { super(context, args); } public MapList getMyChangeRequests(Context context, String args[]) throws Exception{ MapList objList = new MapList(); String user = context.getUser(); if(user != null && user.equals("admin_platform")){ String getCRValue = "temp query bus 'Change Request' * * select id dump |"; String crInfo = MqlUtil.mqlCommand(context, getCRValue); System.out.println("123=====>"+getCRValue); String[] split = crInfo.split("\\n"); if(split.length - 1 != 0) { for (String value : split) { String[] crDetail = value.split("\\|"); String objId = crDetail[3]; Map map =new HashMap(); map.put("id",objId); objList.add(map); } return objList; } } try{ System.out.println(" inside getMyChangeRequests " ); String objectId = PersonUtil.getPersonObjectID(context); StringList strCROwned = (StringList)getOwnedCR(context, args); StringList sRouteCR = getRouteTaskAssignedCRs(context, objectId); StringList sRouteTemplateCR = getRouteTemplateAssignedCRs(context, objectId); Set hs = new HashSet(); hs.addAll(strCROwned); hs.addAll(sRouteCR); hs.addAll(sRouteTemplateCR); String[] args1 = new String[hs.size()]; int i=0; for(String s : hs ) { args1[i++] = s; } StringList objectSelects = new StringList(); objectSelects.add(ChangeConstants.SELECT_ID); objectSelects.add(ChangeConstants.SELECT_POLICY); DomainObject domObj = new DomainObject(objectId); MapList crListwithPolicyInfo = domObj.getInfo(context, args1 , objectSelects); Iterator itr = crListwithPolicyInfo.iterator(); String id = ""; while(itr.hasNext()){ Map eachCR = (Map)itr.next(); String policy = (String) eachCR.get(SELECT_POLICY); System.out.println(" policy " + policy); if(!"".equalsIgnoreCase(policy) && policy.equalsIgnoreCase(ChangeConstants.POLICY_REQUEST_FOR_CHANGE)) objList.add(eachCR); } if(objList.size()!=0) return objList; else return new MapList(); }catch (Exception e) { throw e; } } }