Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.collabnet.ce.webservices;
  
  import  com.collabnet.ce.soap50.webservices.ClientSoapStubFactory;
  
  import  com.collabnet.ce.soap50.webservices.tracker.ITrackerAppSoap;
  import  com.collabnet.ce.soap50.webservices.tracker.ArtifactSoapDO;
  import  com.collabnet.ce.soap50.webservices.tracker.ArtifactSoapList;
  import  com.collabnet.ce.soap50.webservices.tracker.ArtifactSoapRow;
  import  com.collabnet.ce.soap50.webservices.tracker.TrackerSoapList;
 import  com.collabnet.ce.soap50.webservices.tracker.TrackerSoapRow;
 
 import  com.collabnet.ce.soap50.types.SoapFieldValues;
 import  com.collabnet.ce.soap50.types.SoapFilter;
 
 import java.util.Date;
Class to hold the tracker-related methods. Wraps a collabNetApp.
 
 public class TrackerApp {
     private CollabNetApp collabNetApp;
     private ITrackerAppSoap itas;
    
    
Contructs a new TrackerApp.

Parameters:
collabNetApp a valid (logged-in) instance.
 
     public TrackerApp(CollabNetApp collabNetApp) {
         this. = collabNetApp;
         this. = this.getITrackerAppSoap();
     }
    
    

Returns:
an instance of the Client Soap stub for TrackerApp.wsdl.
 
     private ITrackerAppSoap getITrackerAppSoap() {
         String soapURL = this.getUrl() + . +
             "TrackerApp?wsdl";
         return (ITrackerAppSoap) ClientSoapStubFactory.
             getSoapStub(ITrackerAppSoap.classsoapURL);
     } 
    
    
Find the matching tracker id.

Parameters:
projectId
trackerName
Returns:
the tracker id for this name, in this project, if found. Otherwise, null.
Throws:
RemoteException
 
     public String getTrackerId(String projectIdString trackerName
         throws RemoteException {
         this.checkValidSessionId();
         TrackerSoapList tslist = this..getTrackerList(this.getSessionId(), 
                                                           projectId);
         for (TrackerSoapRow rowtslist.getDataRows()) {
             if (row.getTitle().equals(trackerName)) {
                 return row.getId();
             }
         }
         return null;
     }

    
Return a list of unique tracker titles for a given project.

Parameters:
projectId
Returns:
Collection of unique tracker names.
 
     public Collection<StringgetTrackers(String projectId
         throws RemoteException {
         this.checkValidSessionId();
         Collection<Stringnames = new TreeSet<String>();
         TrackerSoapList tslist = this..getTrackerList(this.getSessionId(), 
                                                           projectId);
         for (TrackerSoapRow rowtslist.getDataRows()) {
             names.add(row.getTitle());
         }
         return names;
     }
    
    
Find the most recently submitted TrackerArtifact matching the given title.

Parameters:
trackerId
title of the tracker to find.
Returns:
artifact for the last artifact with that title.
Throws:
RemoteException
 
     public ArtifactSoapDO findLastTrackerArtifact(String trackerId
                                                   String title
        throws RemoteException {
        this.checkValidSessionId();
        SoapFilter[] filters = new SoapFilter[1];
        filters[0] = new SoapFilter("title"title);
        ArtifactSoapList aslist = this..
            getArtifactList(this.getSessionId(), trackerIdfilters);
        ArtifactSoapRow latestRow = this.getLastSubmitted(aslist.
                                                          getDataRows());
        if (latestRow != null) {
            return this.getArtifactDO(latestRow.getId());
        } else {
            return null;
        }
    }
    
    
Given an artifactId (which you can get from an ArtifactSoapRow) return the appropriate ArtifactSoapDO.

Parameters:
artifactId
Returns:
artifact data object with the given id.
Throws:
RemoteException
    public ArtifactSoapDO getArtifactDO(String artifactId
        throws RemoteException {
        this.checkValidSessionId();
        return this..getArtifactData(this.getSessionId(), artifactId);
    }
    
    
Return the row with the latest submitted date

Parameters:
rows of artifacts.
Returns:
the artifact with the last submitted date.
    private ArtifactSoapRow getLastSubmitted(ArtifactSoapRow[] rows) {
        if (rows.length < 1) {
            return null;
        }
        Date latest_date = rows[0].getSubmittedDate();
        int latest_index = 0;
        for (int index = 1; index < rows.length; index++) {
            Date row_date = rows[index].getSubmittedDate();
            if (row_date.after(latest_date)) {
                latest_date = row_date;
                latest_index = index;
            }
        }
        return rows[latest_index];
    }
    
    
Create a new tracker artifact with the given values.

Parameters:
trackerId
title for the new tracker
description of the tracker
group of the tracker
category of the tracker
status of the tracker (open, closed, etc).
customer this artifact affects.
priority of the artifact.
estimatedHours to fix the issue.
assignTo user to assign this issue to.
releaseId of the release this issue is associated with.
flexFields user-defined fields.
fileName of the attachment.
fileMimeType of the attachment.
fileId of the attachment (returned when attachment was uploaded).
Returns:
the newly created ArtifactSoapDO.
Throws:
RemoteException
    public ArtifactSoapDO createNewTrackerArtifact(String trackerId,
                                                   String title,
                                                   String description,
                                                   String group,
                                                   String category,
                                                   String status,
                                                   String customer,
                                                   int priority,
                                                   int estimatedHours,
                                                   String assignTo,
                                                   String releaseId,
                                                   SoapFieldValues flexFields,
                                                   String fileName,
                                                   String fileMimeType,
                                                   String fileId
    throws RemoteException {
        this.checkValidSessionId();
        return this..createArtifact(this.getSessionId(), trackerIdtitle,
                                        descriptiongroupcategory,  status
                                        customerpriorityestimatedHours
                                        assignToreleaseIdflexFields,
                                        fileNamefileMimeTypefileId);
    }
    
    
Update an existing artifact.

Parameters:
artifact to update
comment of this update.
fileName of associated attachment.
fileMimeType of associated attachment.
fileId of associated attachment (returned when attachment was uploaded)
Throws:
RemoteExcpetion
    public void setArtifactData(ArtifactSoapDO artifactString comment
                                String fileNameString fileMimeType
                                String fileIdthrows RemoteException {
        this.checkValidSessionId();
        this..setArtifactData(this.getSessionId(), artifactcomment
                                  fileNamefileMimeTypefileId);
    }
    
    
    
Below are wrapping functions, to make the code neater and in case, something changes. /
    
    private void checkValidSessionId() {
        this..checkValidSessionId();
    }
    
    private String getSessionId() {
        return this..getSessionId();
    }
    
    private String getUrl() {
        return this..getServerUrl();
    }
New to GrepCode? Check out our FAQ X