View Javadoc

1   /* ------------------------------------
2    * © BNP Paribas - SIG/CGI/SFRI - 2005
3    * ------------------------------------
4    * Projet  : projectName
5    * Fichier : Component.java
6    * $Id$ 
7    * $Date$ 
8    * $Log$
9    * 
10   */
11  package com.atlassian.jira.util.entities;
12  
13  import java.util.Map;
14  
15  import org.ofbiz.core.entity.GenericEntityException;
16  import org.ofbiz.core.util.UtilMisc;
17  
18  import com.atlassian.core.ofbiz.CoreFactory;
19  
20  /**
21   * @author BNP Paribas - SIG/CGI/SFRI - 2005
22   * <b>Description :</b>
23   * @version $Id$
24   * @history <ul>
25   * <li/>Date    		- UserId - Observations
26   * <li/>22 juin 2005 - 139611 - Initialisation de la classe.
27   * </ul>
28   * 
29   */
30  public class Component extends Entity {
31  
32  	private String url;
33  	private String lead;
34  	private int project;
35  	private long assigneeType;
36  	
37  	/** @see com.bnpparibas.jira.jelly.tag.AddEntity#getType()
38  	 */
39  	protected String getType() {
40  		return "Component";
41  	}
42  
43  	public int getNewId() throws NumberFormatException, GenericEntityException {
44  		return CoreFactory.getGenericDelegator().getNextSeqId(getType()).intValue();
45  	}
46  
47  	/** @see com.bnpparibas.jira.jelly.tag.AddEntity#addFields(java.util.Map)
48  	 */
49  	protected void addFields(Map _fields) {
50  		super.addFields(_fields);
51  		_fields.put("assigneetype", getAssigneeType());
52  		_fields.put("lead", getLead());
53  		_fields.put("project", getProject());
54  		_fields.put("url", getUrl());
55  	}
56  	
57  
58  	/**
59  	 * @return
60  	 */
61  	public Long getAssigneeType() {
62  		return new Long(assigneeType);
63  	}
64  
65  	/**
66  	 * @return
67  	 */
68  	public String getLead() {
69  		return lead;
70  	}
71  
72  	/**
73  	 * @return
74  	 */
75  	public Long getProject() {
76  		return new Long(project);
77  	}
78  
79  	/**
80  	 * @return
81  	 */
82  	public String getUrl() {
83  		return url;
84  	}
85  
86  	/**
87  	 * @param i
88  	 */
89  	public void setAssigneeType(long i) {
90  		assigneeType = i;
91  	}
92  
93  	/**
94  	 * @param string
95  	 */
96  	public void setLead(String string) {
97  		lead = string;
98  	}
99  
100 	/**
101 	 * @param i
102 	 */
103 	public void setProject(int i) {
104 		project = i;
105 	}
106 
107 	/**
108 	 * @param string
109 	 */
110 	public void setUrl(String string) {
111 		url = string;
112 	}
113 
114 	/** @see com.bnpparibas.jira.tools.entity.Entity#exist()
115 	 */
116 	public boolean exist() throws GenericEntityException {
117 		return !(CoreFactory.getGenericDelegator().findByAnd(getType(), UtilMisc.toMap("project", String.valueOf(getProject()),"name", String.valueOf(getName()) ) ).size() == 0);
118 	}
119 
120 	/** @see com.bnpparibas.jira.tools.entity.Entity#doStorage()
121 	 */
122 	public boolean doStorage() throws GenericEntityException {
123 		return !exist();
124 	}
125 
126 }