use of com.swiftmq.swiftlet.scheduler.JobParameter in project swiftmq-ce by iitsoftware.
the class JobGroupImpl method addJobFactory.
public synchronized void addJobFactory(String jobName, JobFactory jobFactory) {
if (!hasJobFactory(jobName)) {
Entity entity = jobList.createEntity();
entity.setName(jobFactory.getName());
entity.createCommands();
entity.setDynamic(true);
entity.setDynamicObject(jobFactory);
try {
Property prop = entity.getProperty("description");
prop.setReadOnly(false);
prop.setValue(jobFactory.getDescription());
prop.setReadOnly(true);
Map parmMap = jobFactory.getJobParameters();
if (parmMap != null) {
EntityList parmList = (EntityList) entity.getEntity("parameters");
for (Iterator iter = parmMap.entrySet().iterator(); iter.hasNext(); ) {
JobParameter parm = (JobParameter) ((Map.Entry) iter.next()).getValue();
Entity pe = parmList.createEntity();
pe.setName(parm.getName());
pe.setDynamic(true);
pe.createCommands();
pe.setDynamicObject(parm);
prop = pe.getProperty("description");
prop.setReadOnly(false);
prop.setValue(parm.getDescription());
prop.setReadOnly(true);
prop = pe.getProperty("default");
prop.setReadOnly(false);
prop.setValue(parm.getDefaultValue());
prop.setReadOnly(true);
prop = pe.getProperty("mandatory");
prop.setReadOnly(false);
prop.setValue(new Boolean(parm.isMandatory()));
prop.setReadOnly(true);
parmList.addEntity(pe);
}
}
jobList.addEntity(entity);
ctx.scheduler.enqueue(new JobFactoryAdded(name, jobName, jobFactory));
} catch (Exception e) {
}
}
}
Aggregations