You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
2.5 KiB
Java

import com.dassault_systemes.enovia.enterprisechangemgt.common.ChangeAction;
import com.matrixone.apps.domain.util.ContextUtil;
import com.matrixone.apps.domain.util.MapList;
import com.matrixone.apps.domain.util.MqlUtil;
import matrix.db.Context;
import java.util.Map;
import java.util.logging.Logger;
public class AegChangeReject_mxJPO {
private static final Logger LOGGER = Logger.getLogger(AegChangeReject_mxJPO.class.getName());
public void setAffectItemState(Context context, String[] args) throws Exception {
String inboxTaskId = args[0];
String ApprovalStatus = args[1];
LOGGER.info("inboxTaskId ==> " + inboxTaskId);
LOGGER.info("ApprovalStatus ==> " + ApprovalStatus);
String getProjectType = "print bus " + inboxTaskId + " select from[Route Task].to.to[Object Route].from.type dump |";
String projectType = MqlUtil.mqlCommand(context, getProjectType);
if("Change Action".equals(projectType) && "Reject".equals(ApprovalStatus)){
String getProjectId = "print bus " + inboxTaskId + " select from[Route Task].to.to[Object Route].from.id dump |";
String projectId = MqlUtil.mqlCommand(context, getProjectId);
if(!"".equals(projectId)){
ChangeAction changeAction = new ChangeAction(projectId);
MapList mapList = changeAction.getAffectedItems(context);
for (int i = 0; i < mapList.size(); i++) {
Map<String, String> map = (Map) mapList.get(i);
String affectItemId = (String) map.get("id");
String affectItemCurrent = (String) map.get("current");
LOGGER.info("affectItemId ==> " + affectItemId);
LOGGER.info("affectItemCurrent ==> " + affectItemCurrent);
// for (String key : map.keySet()){
// LOGGER.info("key : " + key + " , value : " + map.get(key));
// }
if(!"RELEASED".equals(affectItemCurrent)){
String updateAffectState = "modify bus " + affectItemId + " current IN_WORK";
LOGGER.info("updateAffectState ==> " + updateAffectState);
ContextUtil.pushContext(context);
MqlUtil.mqlCommand(context, updateAffectState);
ContextUtil.popContext(context);
}
}
}
}
}
}