All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.na.jira.api.IssueDto Maven / Gradle / Ivy

Go to download

Common artifacts, mostly DTOs shared between jira plug-in and the REST service.

The newest version!
package com.na.jira.api;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.xml.bind.annotation.XmlRootElement;

import com.google.common.base.Joiner;

/** DTO for sending data about issues from JIRA to the mapper application. */
@XmlRootElement
public class IssueDto {
	
	/** Date format */
	public static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss:SS");
	
	// Issue fields
	private String key;
	private Long projectId;
	private Long issueNumber;
	private String issueTypeId;
	private String summary;
	private String description;
	private String environment;
	private String assignee;
	private String reporter;
	private String created;
	
	private String updated;
	private String dueDate;
	private String resolutionDate;
	private Long securityLevelId;
	private String priorityId;
	private String resolutionId;
	private String statusId;
	private Long votes;
	private Long watches;
	private Long originalEstimate;
	private Long estimate;
	private Long timespent;
	private Long workflowId;
	private Set labels;
	
	// Related entities
	private String issueType;
	private Collection components;
	private Collection affectedVersions;
	private Collection fixVersions;
	private String securityLevel;
	private Collection attachments;
	
	private String priority;
	private String resolution;
	private String status;
	private String project;
	
	private Collection dependsOn;
	private Collection blocked;
	
	private Collection workLogs;
	private Collection comments;
	private Map customFields = new HashMap();
	
	public IssueDto() {
		
	}
	
	public String getProject() {
		return project;
	}
	
	public void setProject(String project) {
		this.project = project;
	}
	
	public Long getProjectId() {
		return projectId;
	}
	
	public void setProjectId(Long projectId) {
		this.projectId = projectId;
	}
	
	public Long getIssueNumber() {
		return issueNumber;
	}
	
	public void setIssueNumber(Long issueNumber) {
		this.issueNumber = issueNumber;
	}
	
	public String getIssueTypeId() {
		return issueTypeId;
	}
	
	public void setIssueTypeId(String issueTypeId) {
		this.issueTypeId = issueTypeId;
	}
	
	public String getSummary() {
		return summary;
	}
	
	public void setSummary(String summary) {
		this.summary = summary;
	}
	
	public String getDescription() {
		return description;
	}
	
	public void setDescription(String description) {
		this.description = description;
	}
	
	public String getEnvironment() {
		return environment;
	}
	
	public void setEnvironment(String environment) {
		this.environment = environment;
	}
	
	public String getAssignee() {
		return assignee;
	}
	
	/**
	 * @param assignee
	 *            Assignee's email address.
	 */
	public void setAssignee(String assignee) {
		this.assignee = assignee;
	}
	
	public String getReporter() {
		return reporter;
	}
	
	/**
	 * @param reporter
	 *            Assignee's email address.
	 */
	public void setReporter(String reporter) {
		this.reporter = reporter;
	}
	
	public String getCreated() {
		return created;
	}
	
	public void setCreated(String created) {
		this.created = created;
	}
	
	public String getUpdated() {
		return updated;
	}
	
	public void setUpdated(String updated) {
		this.updated = updated;
	}
	
	public String getDueDate() {
		return dueDate;
	}
	
	public void setDueDate(String dueDate) {
		this.dueDate = dueDate;
	}
	
	public String getResolutionDate() {
		return resolutionDate;
	}
	
	public void setResolutionDate(String resolutionDate) {
		this.resolutionDate = resolutionDate;
	}
	
	public Long getSecurityLevelId() {
		return securityLevelId;
	}
	
	public void setSecurityLevelId(Long securityLevelId) {
		this.securityLevelId = securityLevelId;
	}
	
	public String getPriorityId() {
		return priorityId;
	}
	
	public void setPriorityId(String priorityId) {
		this.priorityId = priorityId;
	}
	
	public String getResolutionId() {
		return resolutionId;
	}
	
	public void setResolutionId(String resolutionId) {
		this.resolutionId = resolutionId;
	}
	
	public String getStatusId() {
		return statusId;
	}
	
	public void setStatusId(String statusId) {
		this.statusId = statusId;
	}
	
	public Long getVotes() {
		return votes;
	}
	
	public void setVotes(Long votes) {
		this.votes = votes;
	}
	
	public Long getWatches() {
		return watches;
	}
	
	public void setWatches(Long watches) {
		this.watches = watches;
	}
	
	public Long getOriginalEstimate() {
		return originalEstimate;
	}
	
	public void setOriginalEstimate(Long originalEstimate) {
		this.originalEstimate = originalEstimate;
	}
	
	public Long getEstimate() {
		return estimate;
	}
	
	public void setEstimate(Long estimate) {
		this.estimate = estimate;
	}
	
	public Long getTimespent() {
		return timespent;
	}
	
	public void setTimespent(Long timespent) {
		this.timespent = timespent;
	}
	
	public Long getWorkflowId() {
		return workflowId;
	}
	
	public void setWorkflowId(Long workflowId) {
		this.workflowId = workflowId;
	}
	
	public Set getLabels() {
		return labels;
	}
	
	public void setLabels(Set labels) {
		this.labels = labels;
	}
	
	public String getIssueType() {
		return issueType;
	}
	
	public void setIssueType(String issueType) {
		this.issueType = issueType;
	}
	
	public Collection getComponents() {
		return components;
	}
	
	public void setComponents(Collection components) {
		this.components = components;
	}
	
	public Collection getAffectedVersions() {
		return affectedVersions;
	}
	
	public void setAffectedVersions(Collection affectedVersions) {
		this.affectedVersions = affectedVersions;
	}
	
	public Collection getFixVersions() {
		return fixVersions;
	}
	
	public void setFixVersions(Collection fixVersions) {
		this.fixVersions = fixVersions;
	}
	
	public String getSecurityLevel() {
		return securityLevel;
	}
	
	public void setSecurityLevel(String securityLevel) {
		this.securityLevel = securityLevel;
	}
	
	public String getPriority() {
		return priority;
	}
	
	public void setPriority(String priority) {
		this.priority = priority;
	}
	
	public String getResolution() {
		return resolution;
	}
	
	public void setResolution(String resolution) {
		this.resolution = resolution;
	}
	
	public String getStatus() {
		return status;
	}
	
	public void setStatus(String status) {
		this.status = status;
	}
	
	public String getKey() {
		return key;
	}
	
	public void setKey(String key) {
		this.key = key;
	}
	
	@Override
	public String toString() {
		List vals = new ArrayList();
		for (Method method : this.getClass().getDeclaredMethods()) {
			if (method.getName().startsWith("get") && method.getParameterTypes().length == 0) {
				try {
					
					Object val = method.invoke(this);
					vals.add(method.getName().substring(3) + "=" + val);
					
				} catch (IllegalAccessException e) {
					e.printStackTrace();
				} catch (IllegalArgumentException e) {
					e.printStackTrace();
				} catch (InvocationTargetException e) {
					e.printStackTrace();
				}
			}
		}
		return Joiner.on("; ").join(vals);
	}
	
	/**
	 * This issues depends on the issues which keys are in collection; is
	 * blocked by in JIRA.
	 */
	public Collection getDependsOn() {
		return dependsOn;
	}
	
	/**
	 * This issues depends on the issues which keys are in collection; is
	 * blocked by in JIRA.
	 */
	public void setDependsOn(Collection dependsOn) {
		this.dependsOn = dependsOn;
	}
	
	/** Keys of issues that are blocked by this one; blocks in JIRA. */
	public Collection getBlocked() {
		return blocked;
	}
	
	/** Keys of issues that are blocked by this one; blocks in JIRA. */
	public void setBlocked(Collection blocked) {
		this.blocked = blocked;
	}
	
	public Collection getAttachments() {
		return attachments;
	}
	
	public void setAttachments(Collection attachments) {
		this.attachments = attachments;
	}
	
	/**
	 * @return the workLogs
	 */
	public Collection getWorkLogs() {
		return workLogs;
	}
	
	/**
	 * @param workLogs
	 *            the workLogs to set
	 */
	public void setWorkLogs(Collection workLogs) {
		this.workLogs = workLogs;
	}
	
	/**
	 * @return the comments
	 */
	public Collection getComments() {
		return comments;
	}
	
	/**
	 * @param comments
	 *            the comments to set
	 */
	public void setComments(Collection comments) {
		this.comments = comments;
	}
	
	/**
	 * @return the customFields
	 */
	public Map getCustomFields() {
		return customFields;
	}
	
	/**
	 * @param customFields
	 *            the customFields to set
	 */
	public void setCustomFields(Map customFields) {
		this.customFields = customFields;
	}
	
	/** Sets value of given custom field. */
	public void putCustomField(String name, String value) {
		getCustomFields().put(name, value);
	}
	
	/** Gets value of given custom field. */
	public Object getCustomField(String name) {
		Object result = getCustomFields().get(name);
		if (result == null) {
			return "";
		}
		return result;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy