📄 cmseditscheduledjobinfodialog.java
字号:
dC.getRequestedUri(),
PAGES[0],
new CmsVfsFileWidget(),
0,
1));
addWidget(new CmsWidgetDialogParameter(
m_jobInfo,
"contextInfo.localeName",
dC.getLocaleName(),
PAGES[0],
new CmsInputWidget(),
0,
1));
addWidget(new CmsWidgetDialogParameter(
m_jobInfo,
"contextInfo.encoding",
dC.getEncoding(),
PAGES[0],
new CmsInputWidget(),
0,
1));
addWidget(new CmsWidgetDialogParameter(
m_jobInfo,
"contextInfo.remoteAddr",
dC.getRemoteAddr(),
PAGES[0],
new CmsInputWidget(),
0,
1));
// widget to display on the second dialog page
addWidget(new CmsWidgetDialogParameter(m_jobInfo, "parameters", PAGES[1], new CmsInputWidget()));
}
/**
* Returns the example cron class names to show in the combo box.<p>
*
* The result list elements are of type <code>{@link org.opencms.widgets.CmsSelectWidgetOption}</code>.<p>
*
* @return the example cron class names to show in the combo box
*/
protected List getComboClasses() {
List result = new ArrayList();
result.add(new CmsSelectWidgetOption(
CmsPublishJob.class.getName(),
false,
null,
key(Messages.GUI_EDITOR_CRONCLASS_PUBLISH_0)));
result.add(new CmsSelectWidgetOption(
CmsStaticExportJob.class.getName(),
false,
null,
key(Messages.GUI_EDITOR_CRONCLASS_STATICEXPORT_0)));
result.add(new CmsSelectWidgetOption(
CmsPointerLinkValidator.class.getName(),
false,
null,
key(Messages.GUI_EDITOR_CRONCLASS_POINTERVALIDATION_0)));
result.add(new CmsSelectWidgetOption(
CmsMemoryMonitor.class.getName(),
false,
null,
key(Messages.GUI_EDITOR_CRONCLASS_MEMORYMONITOR_0)));
result.add(new CmsSelectWidgetOption(
CmsSearchManager.class.getName(),
false,
null,
key(Messages.GUI_EDITOR_CRONCLASS_SEARCHINDEX_0)));
result.add(new CmsSelectWidgetOption(
CmsContentNotificationJob.class.getName(),
false,
null,
key(Messages.GUI_EDITOR_CRONCLASS_CONTENTNOTIFICATION_0)));
result.add(new CmsSelectWidgetOption(
CmsCreateImageSizeJob.class.getName(),
false,
null,
key(Messages.GUI_EDITOR_CRONCLASS_IMAGESIZE_0)));
result.add(new CmsSelectWidgetOption(
CmsImageCacheCleanupJob.class.getName(),
false,
null,
key(Messages.GUI_EDITOR_CRONCLASS_IMAGE_CACHECLEAN_0)));
return result;
}
/**
* Returns the example cron expressions to show in the combo box.<p>
*
* The result list elements are of type <code>{@link org.opencms.widgets.CmsSelectWidgetOption}</code>.<p>
*
* @return the example cron expressions to show in the combo box
*/
protected List getComboCronExpressions() {
List result = new ArrayList();
// 0 0 3 * * ? (daily at 3 am)
result.add(new CmsSelectWidgetOption("0 0 3 * * ?", false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE1_0)));
// 0 0/30 * * * ? (daily every thirty minutes)
result.add(new CmsSelectWidgetOption("0 0/30 * * * ?", false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE2_0)));
// 0 30 8 ? * 4 (every Wednesday at 8:30 am)
result.add(new CmsSelectWidgetOption("0 30 8 ? * 4", false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE3_0)));
// 0 15 18 15 * ? (on the 20th day of the month at 6:15 pm)
result.add(new CmsSelectWidgetOption("0 15 18 20 * ?", false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE4_0)));
// 0 45 15 ? * 1 2005-2006 (every Sunday from the year 2005 to 2006 at 3:45 pm)
result.add(new CmsSelectWidgetOption(
"0 45 15 ? * 1 2005-2006",
false,
null,
key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE5_0)));
return result;
}
/**
* @see org.opencms.workplace.CmsWidgetDialog#getPageArray()
*/
protected String[] getPageArray() {
return PAGES;
}
/**
* @see org.opencms.workplace.CmsWorkplace#initMessages()
*/
protected void initMessages() {
// add specific dialog resource bundle
addMessages(Messages.get().getBundleName());
// add default resource bundles
super.initMessages();
}
/**
* Initializes the scheduled job object to work with depending on the dialog state and request parameters.<p>
*
* Three initializations of the scheduled job object on first dialog call are possible:
* <ul>
* <li>edit an existing scheduled job</li>
* <li>create a new scheduled job</li>
* <li>copy an existing scheduled job and edit it</li>
* </ul>
*/
protected void initScheduledJobObject() {
Object o;
boolean setActive = false;
if (CmsStringUtil.isEmpty(getParamAction())
|| CmsDialog.DIALOG_INITIAL.equals(getParamAction())
|| DIALOG_COPYJOB.equals(getParamAction())) {
// this is the initial dialog call
if (CmsStringUtil.isNotEmpty(getParamJobid())) {
// edit or copy an existing job, get the job object from manager
setActive = OpenCms.getScheduleManager().getJob(getParamJobid()).isActive();
o = OpenCms.getScheduleManager().getJob(getParamJobid()).clone();
} else {
// create a new job for the new job dialog
o = null;
}
} else {
// this is not the initial call, get the job object from session
o = getDialogObject();
}
if (!(o instanceof CmsScheduledJobInfo)) {
// create a new job info object
m_jobInfo = new CmsScheduledJobInfo();
m_jobInfo.setContextInfo(new CmsContextInfo());
} else {
// reuse job info object stored in session
m_jobInfo = (CmsScheduledJobInfo)o;
}
if (setActive) {
// initial call of edit an existing job, set active state of cloned job
m_jobInfo.setActive(true);
}
if (DIALOG_COPYJOB.equals(getParamAction())) {
// initial call of copy job action, clear the job id of the cloned job
m_jobInfo.clearId();
}
}
/**
* @see org.opencms.workplace.CmsWorkplace#initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest)
*/
protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, HttpServletRequest request) {
// initialize parameters and dialog actions in super implementation
super.initWorkplaceRequestValues(settings, request);
// save the current state of the job (may be changed because of the widget values)
setDialogObject(m_jobInfo);
}
/**
* @see org.opencms.workplace.CmsWidgetDialog#validateParamaters()
*/
protected void validateParamaters() throws Exception {
if (!isNewJob()) {
// test if params are available
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getParamJobid())) {
// validate the params
Iterator it = OpenCms.getScheduleManager().getJobs().iterator();
while (it.hasNext()) {
CmsScheduledJobInfo job = (CmsScheduledJobInfo)it.next();
if (job.getId().equals(getParamJobid())) {
// params are ok!
return;
}
}
}
// params are no valid
throw new Exception();
}
}
/**
* Checks if the new job dialog has to be displayed.<p>
*
* @return <code>true</code> if the new job dialog has to be displayed
*/
private boolean isNewJob() {
return getCurrentToolPath().equals("/scheduler/new");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -