public JobResult copyJob(String srcJobname, String dstJobName, boolean bAsProfile) {
        HttpPost postRequest = new HttpPost(baseUrl + "job/" + srcJobname);
        List<NameValuePair> nvp = new LinkedList<NameValuePair>();
        nvp.add(new BasicNameValuePair("copyTo", dstJobName));
        if (bAsProfile) {
            nvp.add(new BasicNameValuePair("asProfile", "on"));
        }
        StringEntity postEntity = null;
        try {
            postEntity = new UrlEncodedFormEntity(nvp);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        postEntity.setContentType("application/x-www-form-urlencoded");
        postRequest.addHeader("Accept", "application/xml");
        postRequest.setEntity(postEntity);
        return jobResult(postRequest);
    }
public JobResult copyJob ( String srcJobname , String dstJobName , boolean bAsProfile ) { HttpPost postRequest = new HttpPost ( baseUrl + "job/" + srcJobname ) ; List < NameValuePair > nvp = new LinkedList < NameValuePair > ( ) ; nvp . add ( new BasicNameValuePair ( "copyTo" , dstJobName ) ) ; if ( bAsProfile ) { nvp . add ( new BasicNameValuePair ( "asProfile" , "on" ) ) ; } StringEntity postEntity = null ; try { postEntity = new UrlEncodedFormEntity ( nvp ) ; } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; } postEntity . setContentType ( "application/x-www-form-urlencoded" ) ; postRequest . addHeader ( "Accept" , "application/xml" ) ; postRequest . setEntity ( postEntity ) ; return jobResult ( postRequest ) ; }
Copy a job.
@param srcJobname source job name
@param dstJobName destination job name
@param bAsProfile define if the job should be copied as a profile or not
@return job state of new job