Project

General

Profile

« Previous | Next » 

Revision 5027

Added by daigle over 14 years ago

Change MetaCatVersion to MetacatVersion

View differences:

SchedulerService.java
26 26

  
27 27
package edu.ucsb.nceas.metacat.scheduler;
28 28

  
29
import java.io.PrintWriter;
29 30
import java.util.Calendar;
30 31
import java.util.HashMap;
31 32
import java.util.Vector;
......
538 539
	}
539 540
	
540 541
	/**
542
	 * Get the information for jobs in a group in an xml format. A parameter
543
	 * key/value pair can be provided as well to limit the jobs returned.
544
	 * 
545
	 * @param groupName
546
	 *            the job group that we are searching for
547
	 * @param paramName
548
	 *            the parameter name that we are looking for. this is ignored if
549
	 *            null
550
	 * @param paramValue
551
	 *            the parameter value that we are looking for. this is ignored
552
	 *            if null
553
	 * @return an XML representation of the jobs.
554
	 */
555
	public void getJobsInfoXML(String groupName, String paramName, String paramValue, PrintWriter pw) throws ServiceException {
556
		
557
		try {
558
			ScheduledJobAccess jobAccess = new ScheduledJobAccess();
559
			HashMap<Long, ScheduledJobDAO> JobDAOMap = jobAccess.getJobsWithParameter(groupName, paramName, paramValue);
560
			
561
			pw.print("<scheduledWorkflowResultset>");
562
			for (Long jobDAOId : JobDAOMap.keySet()) {
563
				ScheduledJobDAO jobDAO = JobDAOMap.get(jobDAOId); 
564
				if (paramValue != null && paramName != null) {
565
					ScheduledJobParamDAO jobParamDAO = jobDAO.getJobParam(paramName);
566
					if(jobParamDAO != null && jobParamDAO.getValue().equals(paramValue)) {
567
						pw.print(jobToXML(JobDAOMap.get(jobDAOId))); 
568
					}
569
				}
570
			}				
571
			pw.print("</scheduledWorkflowResultset>");
572
			
573
		} catch (AccessException ae) {
574
			throw new ServiceException("SchedulerService.getJobInfoXML - Could not get jobs info for group: " 
575
					+ groupName, ae);
576
		}
577
	}
578
	
579
	/**
541 580
	 * Convert a single job to XML
542 581
	 * @param scheduledJobDAO the job we want to convert
543 582
	 * @return an XML representation of the job

Also available in: Unified diff