Java Code Examples for org.quartz.JobDataMap#keySet()

The following examples show how to use org.quartz.JobDataMap#keySet() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JobDataMapUtils.java    From quartz-glass with Apache License 2.0 6 votes vote down vote up
public static boolean jobDataMapEquals(JobDetail leftJobDetail, JobDetail rightJobDetail) {
    JobDataMap left = leftJobDetail.getJobDataMap();
    JobDataMap right = rightJobDetail.getJobDataMap();

    int leftKeys = 0;

    for (String key : left.getKeys()) {
        if (GlassConstants.POJO_JOB_META.equals(key)) continue;
        if (GlassConstants.GLASS_SCHEDULER.equals(key)) continue;

        ++leftKeys;
        if (!left.get(key).equals(right.get(key))) return false;
    }

    Set<String> rightKeySet = right.keySet();
    int rightKeys = rightKeySet.size();
    if (rightKeySet.contains(GlassConstants.POJO_JOB_META)) --rightKeys;
    if (rightKeySet.contains(GlassConstants.GLASS_SCHEDULER)) --rightKeys;

    return leftKeys == rightKeys;
}
 
Example 2
Source File: HelloJob.java    From open-platform-demo with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
  JobDetail detail = context.getJobDetail();
  JobDataMap data = context.getJobDetail().getJobDataMap();

  String name = detail.getKey().getName();
  String desc = detail.getDescription();

  System.err.println("Job fired: " + name + " (" + desc + ")");
  if (data != null && data.size() > 0) {
    for (String key : data.keySet()) {
      System.err.println("    " + key + " = " + data.getString(key));
    }
  }
}
 
Example 3
Source File: RedisJobStore.java    From redis-quartz with MIT License 5 votes vote down vote up
private Map<String, String> getStringDataMap(JobDataMap jobDataMap) {
     Map<String, String> stringDataMap = new HashMap<>();
	for (String key : jobDataMap.keySet())
		stringDataMap.put(key, jobDataMap.get(key).toString());
				
	return stringDataMap;
}
 
Example 4
Source File: DistributeJob.java    From Lottery with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 
 * @param jdm
 * @return jdm中key参数(文件夹名称)
 */
@SuppressWarnings("unchecked")
private List<String> getFolderdKeys(JobDataMap jdm){
	List<String>keys=new ArrayList<String>();
	Set<String>keySet=jdm.keySet();
	Iterator<String>it=keySet.iterator();
	while(it.hasNext()){
		String key=it.next();
		if(key.startsWith(CmsTask.TASK_PARAM_FOLDER_PREFIX)){
			keys.add(key);
		}
	}
	return keys;
}