本文整理汇总了Java中com.owera.xaps.dbi.JobFlag.JobServiceWindow类的典型用法代码示例。如果您正苦于以下问题:Java JobServiceWindow类的具体用法?Java JobServiceWindow怎么用?Java JobServiceWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JobServiceWindow类属于com.owera.xaps.dbi.JobFlag包,在下文中一共展示了JobServiceWindow类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setFlags
import com.owera.xaps.dbi.JobFlag.JobServiceWindow; //导入依赖的package包/类
public void setFlags(JobFlag flags) {
if (validateInput && flags == null)
throw new IllegalArgumentException("Job Type/ServiceWindow cannot be null");
if (flags == null)
flags = new JobFlag(JobType.CONFIG, JobServiceWindow.REGULAR);
this.flags = flags;
}
示例2: stop
import com.owera.xaps.dbi.JobFlag.JobServiceWindow; //导入依赖的package包/类
public void stop(String unitJobStatus) throws SQLException, NoAvailableConnectionException {
try {
Integer jobId = null;
if (serverSideJob)
jobId = sessionData.getJob().getId();
else {
if (sessionData == null || sessionData.getOweraParameters() == null)
return;
String jobIdStr = sessionData.getOweraParameters().getValue(SystemParameters.JOB_CURRENT);
if (jobIdStr == null)
return;
try {
jobId = Integer.parseInt(jobIdStr);
} catch (NumberFormatException nfe) {
return;
}
Log.debug(UnitJob.class, "Current jobId param is " + jobId + ", will stop unit job with unit job status set to " + unitJobStatus);
job = DBAccess.getJob(sessionData, jobIdStr);
if (job == null && !unitJobStatus.equals(UnitJobStatus.CONFIRMED_FAILED)) {
Log.warn(UnitJob.class, "Couldn't find job with jobId " + jobId + ", unit job status changed to " + UnitJobStatus.CONFIRMED_FAILED);
unitJobStatus = UnitJobStatus.CONFIRMED_FAILED;
}
}
try {
List<UnitParameter> upList = new ArrayList<UnitParameter>();
if (!serverSideJob) {
upList.add(makeUnitParameter(SystemParameters.JOB_CURRENT, ""));
upList.add(makeUnitParameter(SystemParameters.JOB_CURRENT_KEY, ""));
}
if (unitJobStatus.equals(UnitJobStatus.COMPLETED_OK)) {
// if (!serverSideJob && job.getMoveToProfile() != null) {
// sessionData.getDbAccess().writeProfileChange(sessionData.getUnitId(), job.getMoveToProfile());
// sessionData.setProfile(job.getMoveToProfile());
// }
upList.add(makeHistoryParameter(job.getId()));
if (job.getFlags().getServiceWindow() == JobServiceWindow.DISRUPTIVE)
upList.add(makeUnitParameter(SystemParameters.JOB_DISRUPTIVE, "1"));
if (serverSideJob) {
Log.notice(UnitJob.class, "UnitJob is COMPLETED, job history is updated");
} else {
// updateSessionWithJobParams(true);
Map<String, JobParameter> jobParams = job.getDefaultParameters();
sessionData.setJobParams(jobParams);
for (JobParameter jp : sessionData.getJobParams().values()) {
String jpName = jp.getParameter().getUnittypeParameter().getName();
if (jpName.equals(SystemParameters.RESTART) || jpName.equals(SystemParameters.RESET))
continue;
if (jp.getParameter().getUnittypeParameter().getFlag().isReadOnly())
continue;
UnitParameter up = new UnitParameter(jp.getParameter(), sessionData.getUnitId(), sessionData.getProfile());
upList.add(up);
}
Log.notice(UnitJob.class, "UnitJob is COMPLETED, job history, profile/unit parameters are updated");
}
}
DBAccessStatic.stopUnitJob(sessionData.getUnitId(), jobId, unitJobStatus);
sessionData.getPIIDecision().setCurrentJobStatus(unitJobStatus);
// Write directly to database, no queuing, since the all data are flushed in next step (most likely)
XAPS xaps = sessionData.getDbAccess().getXaps();
XAPSUnit xapsUnit = DBAccess.getXAPSUnit(xaps);
xapsUnit.addOrChangeUnitParameters(upList, sessionData.getProfile());
// sessionData.getDbAccess().writeUnitParameters(sessionData.getUnit(), upList, sessionData.getProfile());
if (!serverSideJob) {
sessionData.setFromDB(null);
sessionData.setOweraParameters(null);
sessionData.setJobParams(null);
Log.debug(UnitJob.class, "Unit-information will be reloaded to reflect changes in profile/unit parameters");
sessionData.updateParametersFromDB(sessionData.getUnitId());
}
} catch (SQLException sqle) {
Log.error(UnitJob.class, "UnitJob update failed", sqle);
throw sqle;
}
} catch (Throwable t) {
Log.error(UnitJob.class, "An error ocurred in stop()", t);
}
}