Java tutorial
/* Copyright (C) 2006 NTT DATA Corporation This program is free software; you can redistribute it and/or Modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ package com.clustercontrol.jobmanagement.factory; import java.util.Calendar; import java.util.Collection; import java.util.HashSet; import java.util.List; import javax.persistence.EntityExistsException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.clustercontrol.accesscontrol.bean.PrivilegeConstant.ObjectPrivilegeMode; import com.clustercontrol.accesscontrol.util.ObjectPrivilegeUtil; import com.clustercontrol.bean.EndStatusConstant; import com.clustercontrol.bean.HinemosModuleConstant; import com.clustercontrol.commons.util.HinemosEntityManager; import com.clustercontrol.commons.util.JpaTransactionManager; import com.clustercontrol.commons.util.NotifyGroupIdGenerator; import com.clustercontrol.fault.HinemosUnknown; import com.clustercontrol.fault.InvalidRole; import com.clustercontrol.fault.InvalidSetting; import com.clustercontrol.fault.JobInvalid; import com.clustercontrol.fault.JobMasterDuplicate; import com.clustercontrol.fault.JobMasterNotFound; import com.clustercontrol.fault.ObjectPrivilege_InvalidRole; import com.clustercontrol.jobmanagement.bean.CommandStopTypeConstant; import com.clustercontrol.jobmanagement.bean.JobCommandParam; import com.clustercontrol.jobmanagement.bean.JobConstant; import com.clustercontrol.jobmanagement.bean.JobEndStatusInfo; import com.clustercontrol.jobmanagement.bean.JobEnvVariableInfo; import com.clustercontrol.jobmanagement.bean.JobInfo; import com.clustercontrol.jobmanagement.bean.JobObjectInfo; import com.clustercontrol.jobmanagement.bean.JobParameterInfo; import com.clustercontrol.jobmanagement.bean.JobTreeItem; import com.clustercontrol.jobmanagement.bean.JobWaitRuleInfo; import com.clustercontrol.jobmanagement.bean.JudgmentObjectConstant; import com.clustercontrol.jobmanagement.model.JobCommandParamMstEntity; import com.clustercontrol.jobmanagement.model.JobStartParamMstEntity; import com.clustercontrol.jobmanagement.model.JobEnvVariableMstEntity; import com.clustercontrol.jobmanagement.model.JobMstEntity; import com.clustercontrol.jobmanagement.model.JobParamMstEntity; import com.clustercontrol.jobmanagement.model.JobStartJobMstEntity; import com.clustercontrol.jobmanagement.util.QueryUtil; import com.clustercontrol.notify.model.NotifyRelationInfo; import com.clustercontrol.notify.session.NotifyControllerBean; import com.clustercontrol.util.HinemosTime; /** * ??? * * @version 4.1.0 * @since 1.0.0 */ public class ModifyJob { /** ? */ private static Log m_log = LogFactory.getLog(ModifyJob.class); public Long replaceJobunit(List<JobInfo> oldList, List<JobInfo> newList, String userId) throws JobInvalid, JobMasterNotFound, EntityExistsException, HinemosUnknown, JobMasterDuplicate, InvalidSetting, InvalidRole { //?ID? String jobunitId = newList.get(0).getJobunitId(); // long start = HinemosTime.currentTimeMillis(); HashSet<JobInfo> delJobs = new HashSet<JobInfo>(oldList); HashSet<JobInfo> newJobs = new HashSet<JobInfo>(newList); delJobs.removeAll(newJobs); long timeJobToDelete = HinemosTime.currentTimeMillis(); m_log.info("Find jobs to delete " + (timeJobToDelete - start) + "ms"); HashSet<JobInfo> addJobs = newJobs; addJobs.removeAll(new HashSet<JobInfo>(oldList)); long timeJobToAdd = HinemosTime.currentTimeMillis(); m_log.info("Find jobs to add " + (timeJobToAdd - timeJobToDelete) + "ms"); m_log.info("oldList=" + oldList.size() + ", newList=" + newList.size() + ", delJobs=" + delJobs.size() + ", addJobs=" + addJobs.size()); JpaTransactionManager jtm = new JpaTransactionManager(); for (JobInfo delJob : delJobs) { JobMstEntity entity = QueryUtil.getJobMstPK(delJob.getJobunitId(), delJob.getId()); deleteJob(entity); } jtm.flush(); long timestamp = HinemosTime.currentTimeMillis(); // ???????? for (JobInfo addJob : addJobs) { int type = addJob.getType(); if (type == JobConstant.TYPE_JOBUNIT) { String jobId = addJob.getId(); String parentJobId = addJob.getParentId(); if (jobunitId.equals(jobId)) { parentJobId = CreateJobSession.TOP_JOB_ID; } createJobMasterData(addJob, jobunitId, parentJobId, userId, timestamp); addJobs.remove(addJob); break; } } for (JobInfo addJob : addJobs) { String jobId = addJob.getId(); String parentJobId = addJob.getParentId(); if (jobunitId.equals(jobId)) { parentJobId = CreateJobSession.TOP_JOB_ID; } createJobMasterData(addJob, jobunitId, parentJobId, userId, timestamp); } // ?? String jobId = newList.get(0).getId(); JobMstEntity entity = QueryUtil.getJobMstPK(jobunitId, jobId); entity.setUpdateDate(timestamp); m_log.info("Left tasks in replaceJobunit " + (HinemosTime.currentTimeMillis() - timeJobToAdd) + "ms"); // ?? return timestamp; } /** * ??? * <p> * <ol> * <li>????</li> * <li>???????????</li> * <ol> * <li>???</li> * <li>???</li> * <li>????</li> * <ol> * <li>?????</li> * <li>?????</li> * <li>?????</li> * </ol> * <li>???</li> * <li>???</li> * <li>???</li> * <li>???</li> * </ol> * <li>??????</li> * </ol> * * @param item * @param userId ID * @throws HinemosUnknown * @throws JobMasterNotFound * @throws JobInvalid * @throws JobMasterDuplicate * @throws InvalidRole * @see com.clustercontrol.jobmanagement.factory.ModifyJob#createJobMaster(JobTreeItem, String) */ public Long registerJobunit(JobTreeItem jobunit, String userId) throws HinemosUnknown, JobMasterNotFound, JobInvalid, JobMasterDuplicate, InvalidSetting, InvalidRole { //?ID? String jobunitId = jobunit.getData().getJobunitId(); int msec = HinemosTime.getCalendarInstance().get(Calendar.MILLISECOND); m_log.debug("registerJobunit() start : " + msec); long timestamp = HinemosTime.currentTimeMillis(); // ? createJobMaster(jobunit, jobunitId, CreateJobSession.TOP_JOB_ID, userId, timestamp); m_log.debug("registerJobunit() End : " + msec); // ?? return timestamp; } /** * ??? * * @param jobunitId ?ID * @throws HinemosUnknown * @throws JobMasterNotFound * @throws JobInvalid * */ public void deleteJobunit(String jobunitId, String userId) throws HinemosUnknown, JobMasterNotFound, JobInvalid, ObjectPrivilege_InvalidRole { HinemosEntityManager em = new JpaTransactionManager().getEntityManager(); // ???ID??? Collection<JobMstEntity> ct = em .createNamedQuery("JobMstEntity.findByJobunitId", JobMstEntity.class, ObjectPrivilegeMode.MODIFY) .setParameter("jobunitId", jobunitId).getResultList(); // ??(??????) if (ct == null || ct.size() == 0) { ObjectPrivilege_InvalidRole e = new ObjectPrivilege_InvalidRole( "targetClass = " + JobMstEntity.class.getSimpleName()); m_log.info("deleteJobunit() : object privilege invalid. jobunitId = " + jobunitId); throw e; } for (JobMstEntity jobMstEntity : ct) { deleteJob(jobMstEntity); } // ?? ObjectPrivilegeUtil.deleteObjectPrivilege(HinemosModuleConstant.JOB, jobunitId); } private void deleteJob(JobMstEntity jobMstEntity) { HinemosEntityManager em = new JpaTransactionManager().getEntityManager(); if (jobMstEntity != null) { String jobunitId = jobMstEntity.getId().getJobunitId(); String jobId = jobMstEntity.getId().getJobId(); // ????? // "JOB_MST-junit-job-0" em.createNamedQuery("NotifyRelationInfoEntity.deleteByNotifyGroupId", Integer.class) .setParameter("notifyGroupId", HinemosModuleConstant.JOB_MST + "-" + jobunitId + "-" + jobId + "-0") .executeUpdate(); em.remove(jobMstEntity); } } /** * ???? ?????? * <p> * <ol> * <li>??????</li> * <li>???????</li> * <li>????????????</li> * <ol> * <li>??????</li> * </ol> * </ol> * * @param item * * @param user * ID * @throws HinemosUnknown * @throws JobMasterDuplicate * @throws JobMasterNotFound * @throws InvalidRole * @see com.clustercontrol.jobmanagement.factory.ModifyJob#createJobMasterData(JobTreeItem, * String) */ private void createJobMaster(JobTreeItem item, String jobunitId, String parentId, String user, Long updateDate) throws HinemosUnknown, JobMasterDuplicate, JobMasterNotFound, InvalidSetting, InvalidRole { //? createJobMasterData(item.getData(), jobunitId, parentId, user, updateDate); //?JobTreeItem? for (JobTreeItem child : item.getChildrenArray()) { //? createJobMaster(child, jobunitId, item.getData().getId(), user, updateDate); } } /** * ???? * <p> * <ol> * <li>??????</li> * <li>??????</li> * <li>????????</li> * <li>????????</li> * <li>????????</li> * <li>??????</li> * <li>???????</li> * <li>??????</li> * <li>??????</li> * <li>??????</li> * </ol> * * @param item * @param user ID * @throws HinemosUnknown * @throws JobMasterDuplicate * @throws JobMasterNotFound * @throws InvalidRole */ private void createJobMasterData(JobInfo info, String jobunitId, String parentId, String user, Long updateDate) throws HinemosUnknown, JobMasterDuplicate, JobMasterNotFound, InvalidSetting, InvalidRole { m_log.debug("createJobMasterData"); JpaTransactionManager jtm = new JpaTransactionManager(); // ???????????ID???? // ????TOP?ID?TOP?? String parentJobunitId = null; if (CreateJobSession.TOP_JOB_ID.equals(parentId)) { parentJobunitId = CreateJobSession.TOP_JOBUNIT_ID; } else { parentJobunitId = jobunitId; } //??? String waitJobunitId = jobunitId; if (info.getCreateUser() == null) { info.setCreateUser(user); } if (info.getCreateTime() == null) { info.setCreateTime(updateDate); } try { //? // ? JobMstEntity jobMst = new JobMstEntity(jobunitId, info.getId(), info.getType()); // ?? jtm.checkEntityExists(JobMstEntity.class, jobMst.getId()); jobMst.setDescription(info.getDescription()); jobMst.setJobName(info.getName()); jobMst.setRegisteredModule(info.isRegisteredModule()); jobMst.setRegDate(info.getCreateTime()); jobMst.setRegUser(info.getCreateUser()); jobMst.setUpdateDate(updateDate); jobMst.setUpdateUser(user); jobMst.setParentJobunitId(parentJobunitId); jobMst.setParentJobId(parentId); jobMst.setIconId(info.getIconId()); if (info.getType() == JobConstant.TYPE_JOBUNIT) { jobMst.setOwnerRoleId(info.getOwnerRoleId()); } else { QueryUtil.getJobMstPK(jobunitId, jobunitId); } //??? if (info.getWaitRule() != null) { m_log.debug("info.getWaitRule = " + info.getWaitRule()); JobWaitRuleInfo waitRule = info.getWaitRule(); Long startDelayTime = null; Long endDelayTime = null; if (waitRule.getStart_delay_time_value() != null) { startDelayTime = waitRule.getStart_delay_time_value(); } if (waitRule.getEnd_delay_time_value() != null) { endDelayTime = waitRule.getEnd_delay_time_value(); } jobMst.setConditionType(waitRule.getCondition()); jobMst.setSuspend(waitRule.isSuspend()); jobMst.setSkip(waitRule.isSkip()); jobMst.setSkipEndStatus(waitRule.getSkipEndStatus()); jobMst.setSkipEndValue(waitRule.getSkipEndValue()); jobMst.setUnmatchEndFlg(waitRule.isEndCondition()); jobMst.setUnmatchEndStatus(waitRule.getEndStatus()); jobMst.setUnmatchEndValue(waitRule.getEndValue()); jobMst.setCalendar(waitRule.isCalendar()); jobMst.setCalendarId(waitRule.getCalendarId()); jobMst.setCalendarEndStatus(waitRule.getCalendarEndStatus()); jobMst.setCalendarEndValue(waitRule.getCalendarEndValue()); jobMst.setStartDelay(waitRule.isStart_delay()); jobMst.setStartDelaySession(waitRule.isStart_delay_session()); jobMst.setStartDelaySessionValue(waitRule.getStart_delay_session_value()); jobMst.setStartDelayTime(waitRule.isStart_delay_time()); jobMst.setStartDelayTimeValue(startDelayTime); jobMst.setStartDelayConditionType(waitRule.getStart_delay_condition_type()); jobMst.setStartDelayNotify(waitRule.isStart_delay_notify()); jobMst.setStartDelayNotifyPriority(waitRule.getStart_delay_notify_priority()); jobMst.setStartDelayOperation(waitRule.isStart_delay_operation()); jobMst.setStartDelayOperationType(waitRule.getStart_delay_operation_type()); jobMst.setStartDelayOperationEndStatus(waitRule.getStart_delay_operation_end_status()); jobMst.setStartDelayOperationEndValue(waitRule.getStart_delay_operation_end_value()); jobMst.setEndDelay(waitRule.isEnd_delay()); jobMst.setEndDelaySession(waitRule.isEnd_delay_session()); jobMst.setEndDelaySessionValue(waitRule.getEnd_delay_session_value()); jobMst.setEndDelayJob(waitRule.isEnd_delay_job()); jobMst.setEndDelayJobValue(waitRule.getEnd_delay_job_value()); jobMst.setEndDelayTime(waitRule.isEnd_delay_time()); jobMst.setEndDelayTimeValue(endDelayTime); jobMst.setEndDelayConditionType(waitRule.getEnd_delay_condition_type()); jobMst.setEndDelayNotify(waitRule.isEnd_delay_notify()); jobMst.setEndDelayNotifyPriority(waitRule.getEnd_delay_notify_priority()); jobMst.setEndDelayOperation(waitRule.isEnd_delay_operation()); jobMst.setEndDelayOperationType(waitRule.getEnd_delay_operation_type()); jobMst.setEndDelayOperationEndStatus(waitRule.getEnd_delay_operation_end_status()); jobMst.setEndDelayOperationEndValue(waitRule.getEnd_delay_operation_end_value()); jobMst.setMultiplicityNotify(waitRule.isMultiplicityNotify()); jobMst.setMultiplicityNotifyPriority(waitRule.getMultiplicityNotifyPriority()); jobMst.setMultiplicityOperation(waitRule.getMultiplicityOperation()); jobMst.setMultiplicityEndValue(waitRule.getMultiplicityEndValue()); if (waitRule.getObject() != null) { for (JobObjectInfo objectInfo : waitRule.getObject()) { if (objectInfo != null) { if (objectInfo.getType() == JudgmentObjectConstant.TYPE_JOB_END_STATUS) { m_log.debug("objectInfo.getType = " + objectInfo.getType()); m_log.debug("objectInfo.getJobId = " + objectInfo.getJobId()); m_log.debug("objectInfo.getValue = " + objectInfo.getValue()); m_log.debug("objectInfo.getDescription = " + objectInfo.getDescription()); // ? JobStartJobMstEntity jobStartJobMstEntity = new JobStartJobMstEntity(jobMst, waitJobunitId, objectInfo.getJobId(), JudgmentObjectConstant.TYPE_JOB_END_STATUS, objectInfo.getValue()); jobStartJobMstEntity.setTargetJobDescription(objectInfo.getDescription()); // ?? jtm.checkEntityExists(JobStartJobMstEntity.class, jobStartJobMstEntity.getId()); } else if (objectInfo.getType() == JudgmentObjectConstant.TYPE_JOB_END_VALUE) { m_log.debug("objectInfo.getType = " + objectInfo.getType()); m_log.debug("objectInfo.getJobId = " + objectInfo.getJobId()); m_log.debug("objectInfo.getValue = " + objectInfo.getValue()); m_log.debug("objectInfo.getDescription = " + objectInfo.getDescription()); // ? JobStartJobMstEntity jobStartJobMstEntity = new JobStartJobMstEntity(jobMst, waitJobunitId, objectInfo.getJobId(), JudgmentObjectConstant.TYPE_JOB_END_VALUE, objectInfo.getValue()); jobStartJobMstEntity.setTargetJobDescription(objectInfo.getDescription()); // ?? jtm.checkEntityExists(JobStartJobMstEntity.class, jobStartJobMstEntity.getId()); } else if (objectInfo.getType() == JudgmentObjectConstant.TYPE_TIME) { m_log.debug("objectInfo.getType = " + objectInfo.getType()); m_log.debug("objectInfo.getTime = " + objectInfo.getTime()); m_log.debug("objectInfo.getDescription = " + objectInfo.getDescription()); jobMst.setStartTime(objectInfo.getTime()); jobMst.setStartTimeDescription(objectInfo.getDescription()); } else if (objectInfo.getType() == JudgmentObjectConstant.TYPE_START_MINUTE) { m_log.debug("objectInfo.getType = " + objectInfo.getType()); m_log.debug("objectInfo.getStartMinute = " + objectInfo.getStartMinute()); m_log.debug("objectInfo.getDescription = " + objectInfo.getDescription()); jobMst.setStartMinute(objectInfo.getStartMinute()); jobMst.setStartMinuteDescription(objectInfo.getDescription()); } else if (objectInfo.getType() == JudgmentObjectConstant.TYPE_JOB_PARAMETER) { m_log.debug("objectInfo.getType = " + objectInfo.getType()); m_log.debug("objectInfo.getDecisionValue01 = " + objectInfo.getDecisionValue01()); m_log.debug( "objectInfo.getDecisionCondition = " + objectInfo.getDecisionCondition()); m_log.debug("objectInfo.getDecisionValue02 = " + objectInfo.getDecisionValue02()); m_log.debug("objectInfo.getDescription = " + objectInfo.getDescription()); JobStartParamMstEntity jobStartParamMstEntity = new JobStartParamMstEntity(jobMst, objectInfo.getDecisionValue01(), objectInfo.getDecisionValue02(), objectInfo.getType(), objectInfo.getDecisionCondition()); jobStartParamMstEntity.setDecisionDescription(objectInfo.getDescription()); // ?? jtm.checkEntityExists(JobStartParamMstEntity.class, jobStartParamMstEntity.getId()); } } } } } //? if (info.getCommand() != null) { jobMst.setFacilityId(info.getCommand().getFacilityID()); jobMst.setProcessMode(info.getCommand().getProcessingMethod()); jobMst.setStartCommand(info.getCommand().getStartCommand()); jobMst.setStopType(info.getCommand().getStopType()); jobMst.setStopCommand(info.getCommand().getStopCommand()); jobMst.setSpecifyUser(info.getCommand().getSpecifyUser()); jobMst.setEffectiveUser(info.getCommand().getUser()); jobMst.setMessageRetry(info.getCommand().getMessageRetry()); jobMst.setMessageRetryEndFlg(info.getCommand().getMessageRetryEndFlg()); jobMst.setMessageRetryEndValue(info.getCommand().getMessageRetryEndValue()); jobMst.setArgumentJobId(""); jobMst.setArgument(""); jobMst.setCommandRetryFlg(info.getCommand().getCommandRetryFlg()); jobMst.setCommandRetry(info.getCommand().getCommandRetry()); if (info.getCommand().getJobCommandParamList() != null && info.getCommand().getJobCommandParamList().size() > 0) { for (JobCommandParam jobCommandParam : info.getCommand().getJobCommandParamList()) { JobCommandParamMstEntity jobCommandParamEntity = new JobCommandParamMstEntity(jobMst, jobCommandParam.getParamId()); jobCommandParamEntity.setJobStandardOutputFlg(jobCommandParam.getJobStandardOutputFlg()); jobCommandParamEntity.setValue(jobCommandParam.getValue()); } } jobMst.setManagerDistribution(info.getCommand().getManagerDistribution()); jobMst.setScriptName(info.getCommand().getScriptName()); jobMst.setScriptEncoding(info.getCommand().getScriptEncoding()); jobMst.setScriptContent(info.getCommand().getScriptContent()); // if (info.getCommand().getEnvVariableInfo() != null) { for (JobEnvVariableInfo envVariableInfo : info.getCommand().getEnvVariableInfo()) { if (envVariableInfo != null) { // ? JobEnvVariableMstEntity jobEnvVariableMstEntity = new JobEnvVariableMstEntity(jobMst, envVariableInfo.getEnvVariableId()); // ?? jtm.checkEntityExists(JobEnvVariableMstEntity.class, jobEnvVariableMstEntity.getId()); jobEnvVariableMstEntity.setDescription(envVariableInfo.getDescription()); jobEnvVariableMstEntity.setValue(envVariableInfo.getValue()); } } } } //?? if (info.getFile() != null) { jobMst.setProcessMode(info.getFile().getProcessingMethod()); jobMst.setSrcFacilityId(info.getFile().getSrcFacilityID()); jobMst.setDestFacilityId(info.getFile().getDestFacilityID()); jobMst.setSrcFile(info.getFile().getSrcFile()); jobMst.setSrcWorkDir(info.getFile().getSrcWorkDir()); jobMst.setDestDirectory(info.getFile().getDestDirectory()); jobMst.setDestWorkDir(info.getFile().getDestWorkDir()); jobMst.setCompressionFlg(info.getFile().isCompressionFlg()); jobMst.setCheckFlg(info.getFile().isCheckFlg()); jobMst.setSpecifyUser(info.getFile().isSpecifyUser()); jobMst.setEffectiveUser(info.getFile().getUser()); jobMst.setMessageRetry(info.getFile().getMessageRetry()); jobMst.setMessageRetryEndFlg(info.getFile().isMessageRetryEndFlg()); jobMst.setMessageRetryEndValue(info.getFile().getMessageRetryEndValue()); jobMst.setCommandRetryFlg(info.getFile().isCommandRetryFlg()); jobMst.setCommandRetry(info.getFile().getCommandRetry()); } // ? if (info.getMonitor() != null) { jobMst.setFacilityId(info.getMonitor().getFacilityID()); jobMst.setStopType(CommandStopTypeConstant.DESTROY_PROCESS); jobMst.setProcessMode(info.getMonitor().getProcessingMethod()); jobMst.setArgumentJobId(""); jobMst.setArgument(""); jobMst.setMonitorId(info.getMonitor().getMonitorId()); jobMst.setMonitorInfoEndValue(info.getMonitor().getMonitorInfoEndValue()); jobMst.setMonitorWarnEndValue(info.getMonitor().getMonitorWarnEndValue()); jobMst.setMonitorCriticalEndValue(info.getMonitor().getMonitorCriticalEndValue()); jobMst.setMonitorUnknownEndValue(info.getMonitor().getMonitorUnknownEndValue()); jobMst.setMonitorWaitTime(info.getMonitor().getMonitorWaitTime()); jobMst.setMonitorWaitEndValue(info.getMonitor().getMonitorWaitEndValue()); // ????? jobMst.setCommandRetryFlg(false); jobMst.setCommandRetry(10); // ???????? jobMst.setMessageRetry(0); jobMst.setMessageRetryEndFlg(true); jobMst.setMessageRetryEndValue(info.getMonitor().getMonitorUnknownEndValue()); } //? jobMst.setBeginPriority(info.getBeginPriority()); jobMst.setNormalPriority(info.getNormalPriority()); jobMst.setWarnPriority(info.getWarnPriority()); jobMst.setAbnormalPriority(info.getAbnormalPriority()); //notifyGroupId String notifyGroupId = NotifyGroupIdGenerator.generate(info); jobMst.setNotifyGroupId(notifyGroupId); if (info.getNotifyRelationInfos() != null) { for (NotifyRelationInfo notifyRelationInfo : info.getNotifyRelationInfos()) { notifyRelationInfo.setNotifyGroupId(notifyGroupId); } } new NotifyControllerBean().addNotifyRelation(info.getNotifyRelationInfos()); //? if (info.getEndStatus() != null) { for (JobEndStatusInfo endInfo : info.getEndStatus()) { if (endInfo != null) { if (endInfo.getType() == EndStatusConstant.TYPE_NORMAL) { // jobMst.setNormalEndValue(endInfo.getValue()); jobMst.setNormalEndValueFrom(endInfo.getStartRangeValue()); jobMst.setNormalEndValueTo(endInfo.getEndRangeValue()); } else if (endInfo.getType() == EndStatusConstant.TYPE_WARNING) { // jobMst.setWarnEndValue(endInfo.getValue()); jobMst.setWarnEndValueFrom(endInfo.getStartRangeValue()); jobMst.setWarnEndValueTo(endInfo.getEndRangeValue()); } else if (endInfo.getType() == EndStatusConstant.TYPE_ABNORMAL) { // jobMst.setAbnormalEndValue(endInfo.getValue()); jobMst.setAbnormalEndValueFrom(endInfo.getStartRangeValue()); jobMst.setAbnormalEndValueTo(endInfo.getEndRangeValue()); } } } } //? if (info.getParam() != null) { for (JobParameterInfo paramInfo : info.getParam()) { if (paramInfo != null) { // ? JobParamMstEntity jobParamMstEntity = new JobParamMstEntity(jobMst, paramInfo.getParamId()); // ?? jtm.checkEntityExists(JobParamMstEntity.class, jobParamMstEntity.getId()); jobParamMstEntity.setDescription(paramInfo.getDescription()); jobParamMstEntity.setParamType(paramInfo.getType()); jobParamMstEntity.setValue(paramInfo.getValue()); } } } //?/?? if (info.getType() == JobConstant.TYPE_REFERJOB || info.getType() == JobConstant.TYPE_REFERJOBNET) { if (info.getReferJobUnitId() != null) { jobMst.setReferJobUnitId(info.getReferJobUnitId()); } if (info.getReferJobId() != null) { jobMst.setReferJobId(info.getReferJobId()); } if (info.getReferJobSelectType() != null) { jobMst.setReferJobSelectType(info.getReferJobSelectType()); } } //? if (info.getType() == JobConstant.TYPE_APPROVALJOB) { if (info.getApprovalReqRoleId() != null) { jobMst.setApprovalReqRoleId(info.getApprovalReqRoleId()); } if (info.getApprovalReqUserId() != null) { jobMst.setApprovalReqUserId(info.getApprovalReqUserId()); } if (info.getApprovalReqSentence() != null) { jobMst.setApprovalReqSentence(info.getApprovalReqSentence()); } if (info.getApprovalReqMailTitle() != null) { jobMst.setApprovalReqMailTitle(info.getApprovalReqMailTitle()); } if (info.getApprovalReqMailBody() != null) { jobMst.setApprovalReqMailBody(info.getApprovalReqMailBody()); } jobMst.setUseApprovalReqSentence(info.isUseApprovalReqSentence()); } } catch (HinemosUnknown e) { throw e; } catch (EntityExistsException e) { JobMasterDuplicate jmd = new JobMasterDuplicate(e.getMessage(), e); m_log.info("createJobMasterData() : " + jmd.getClass().getSimpleName() + ", " + jmd.getMessage()); throw jmd; } } }