Package com.taskadapter.redmineapi.bean
Class Project
- java.lang.Object
-
- com.taskadapter.redmineapi.bean.Project
-
- All Implemented Interfaces:
FluentStyle,Identifiable,java.io.Serializable
public class Project extends java.lang.Object implements Identifiable, java.io.Serializable, FluentStyle
Redmine Project.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static Property<java.util.Date>CREATED_ONstatic Property<java.util.Set<CustomField>>CUSTOM_FIELDSstatic Property<java.lang.Integer>DATABASE_IDdatabase IDstatic Property<java.lang.String>DESCRIPTIONstatic Property<java.lang.String>HOMEPAGEstatic Property<java.lang.Boolean>INHERIT_MEMBERSstatic Property<java.lang.String>NAMECan contain any symbolsstatic Property<java.lang.Integer>PARENT_DATABASE_IDThis is the *database ID*, not a String-based key.static Property<java.lang.Boolean>PUBLICstatic Property<java.lang.Integer>STATUSstatic Property<java.lang.String>STRING_IDENTIFIERString "identifier" (human-readable name without spaces and other extra stuff)static Property<java.util.Set<Tracker>>TRACKERSTrackers available for this projectstatic Property<java.util.Date>UPDATED_ON
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ProjectaddCustomFields(java.util.Collection<CustomField> customFields)ProjectaddTrackers(java.util.Collection<Tracker> trackers)Adds the specified trackers to this project.ProjectclearTrackers()Removes all of the trackers from this project.Projectcreate()Sample usage:voiddelete()The project object must have projectKey set (String-based identifier like "project-ABC", NOT a database numeric ID!)booleanequals(java.lang.Object o)java.util.DategetCreatedOn()CustomFieldgetCustomFieldById(int customFieldId)java.util.Collection<CustomField>getCustomFields()java.lang.StringgetDescription()java.lang.StringgetHomepage()java.lang.IntegergetId()java.lang.StringgetIdentifier()java.lang.BooleangetInheritMembers()java.lang.StringgetName()java.lang.IntegergetParentId()Redmine's REST API "get project" operation does NOT return the parent project ID in redmine 1.1.2 (and maybe earlier).java.lang.BooleangetProjectPublic()Deprecated.java.lang.IntegergetStatus()Returns the project status.PropertyStoragegetStorage()TrackergetTrackerByName(java.lang.String trackerName)java.util.Collection<Tracker>getTrackers()java.util.DategetUpdatedOn()inthashCode()ProjectsetCreatedOn(java.util.Date createdOn)ProjectsetDescription(java.lang.String description)ProjectsetHomepage(java.lang.String homepage)ProjectsetId(java.lang.Integer id)ProjectsetIdentifier(java.lang.String identifier)ProjectsetInheritMembers(java.lang.Boolean inheritMembers)ProjectsetName(java.lang.String name)ProjectsetParentId(java.lang.Integer parentId)ProjectsetProjectPublic(java.lang.Boolean projectPublic)ProjectsetStatus(java.lang.Integer status)Sets the project status (Note that this will not take effect when updating a project as the **current Redmine version in 2018** does not allow reopen, close or archive projects, see https://www.redmine.org/issues/13725)voidsetTransport(Transport transport)ProjectsetUpdatedOn(java.util.Date updatedOn)java.lang.StringtoString()voidupdate()
-
-
-
Field Detail
-
DATABASE_ID
public static final Property<java.lang.Integer> DATABASE_ID
database ID
-
STRING_IDENTIFIER
public static final Property<java.lang.String> STRING_IDENTIFIER
String "identifier" (human-readable name without spaces and other extra stuff)
-
NAME
public static final Property<java.lang.String> NAME
Can contain any symbols
-
DESCRIPTION
public static final Property<java.lang.String> DESCRIPTION
-
HOMEPAGE
public static final Property<java.lang.String> HOMEPAGE
-
CREATED_ON
public static final Property<java.util.Date> CREATED_ON
-
UPDATED_ON
public static final Property<java.util.Date> UPDATED_ON
-
PARENT_DATABASE_ID
public static final Property<java.lang.Integer> PARENT_DATABASE_ID
This is the *database ID*, not a String-based key.
-
STATUS
public static final Property<java.lang.Integer> STATUS
-
PUBLIC
public static final Property<java.lang.Boolean> PUBLIC
-
INHERIT_MEMBERS
public static final Property<java.lang.Boolean> INHERIT_MEMBERS
-
CUSTOM_FIELDS
public static final Property<java.util.Set<CustomField>> CUSTOM_FIELDS
-
-
Method Detail
-
setId
public Project setId(java.lang.Integer id)
-
getHomepage
public java.lang.String getHomepage()
-
setHomepage
public Project setHomepage(java.lang.String homepage)
-
getIdentifier
public java.lang.String getIdentifier()
- Returns:
- project's string "key" (not a numeric database id!). Example: "project_ABC"
-
setIdentifier
public Project setIdentifier(java.lang.String identifier)
-
getId
public java.lang.Integer getId()
- Specified by:
getIdin interfaceIdentifiable- Returns:
- numeric database ID
-
getName
public java.lang.String getName()
- Returns:
- project name
-
setName
public Project setName(java.lang.String name)
- Parameters:
name- the project name
-
getTrackers
public java.util.Collection<Tracker> getTrackers()
- Returns:
- Trackers allowed in this project (e.g.: Bug, Feature, Support, Task, ...)
-
addTrackers
public Project addTrackers(java.util.Collection<Tracker> trackers)
Adds the specified trackers to this project. If this project is created or updated on the redmine server, each tracker id must be a valid tracker on the server.
-
clearTrackers
public Project clearTrackers()
Removes all of the trackers from this project.
-
getTrackerByName
public Tracker getTrackerByName(java.lang.String trackerName)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getDescription
public java.lang.String getDescription()
-
setDescription
public Project setDescription(java.lang.String description)
-
getCreatedOn
public java.util.Date getCreatedOn()
-
setCreatedOn
public Project setCreatedOn(java.util.Date createdOn)
-
getUpdatedOn
public java.util.Date getUpdatedOn()
-
setUpdatedOn
public Project setUpdatedOn(java.util.Date updatedOn)
-
getParentId
public java.lang.Integer getParentId()
Redmine's REST API "get project" operation does NOT return the parent project ID in redmine 1.1.2 (and maybe earlier). Which means calling getParentId() of the project loaded from Redmine server will return NULL with that redmine. This bug was fixed in redmine 1.2.1. See bug http://www.redmine.org/issues/8229- Returns:
- the parent project Id if it was set programmatically or NULL (!!!) if the project was loaded from the server.
-
setParentId
public Project setParentId(java.lang.Integer parentId)
-
getStatus
public java.lang.Integer getStatus()
Returns the project status. This number can theoretically be different for different Redmine versions, But the **current Redmine version in 2018** defines these numbers as:- 1: status active
- 5: status closed
- 9: status archived
see http://www.redmine.org/projects/redmine/repository/entry/trunk/app/models/project.rb
- Returns:
- possibly Redmine-version-specific number that represents project status (active/closed/archived)
- Since:
- Redmine REST API 2.5.0
-
setStatus
public Project setStatus(java.lang.Integer status)
Sets the project status (Note that this will not take effect when updating a project as the **current Redmine version in 2018** does not allow reopen, close or archive projects, see https://www.redmine.org/issues/13725)
-
getProjectPublic
@Deprecated public java.lang.Boolean getProjectPublic()
Deprecated.- Returns:
- true if the project is public, false if the project is private.
Returns
nullif the project visibility was not specified or if the project was just retrieved from server. - Since:
- Redmine 2.6.0. see http://www.redmine.org/issues/17628 . this property is for writing only before Redmine 2.6.0. The value is not returned by older Redmine versions.
-
setInheritMembers
public Project setInheritMembers(java.lang.Boolean inheritMembers)
-
getInheritMembers
public java.lang.Boolean getInheritMembers()
-
setProjectPublic
public Project setProjectPublic(java.lang.Boolean projectPublic)
-
getCustomFields
public java.util.Collection<CustomField> getCustomFields()
-
addCustomFields
public Project addCustomFields(java.util.Collection<CustomField> customFields)
-
getCustomFieldById
public CustomField getCustomFieldById(int customFieldId)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getStorage
public PropertyStorage getStorage()
-
setTransport
public void setTransport(Transport transport)
- Specified by:
setTransportin interfaceFluentStyle
-
create
public Project create() throws RedmineException
Sample usage:Project project = new Project(transport); Long timeStamp = Calendar.getInstance().getTimeInMillis(); String key = "projkey" + timeStamp; String name = "project number " + timeStamp; String description = "some description for the project"; project.setIdentifier(key) .setName(name) .setDescription(description) .create();Note: if
projecttrackers have not been set withaddTrackers(java.util.Collection<com.taskadapter.redmineapi.bean.Tracker>)and if they have been cleared withclearTrackers(), the created project will get the server default trackers (if any). Otherwise, theProjecttrackers will override the server default settings.- Returns:
- the newly created Project object.
- Throws:
RedmineAuthenticationException- invalid or no API access key is used with the server, which requires authorization. Check the constructor arguments.RedmineException
-
update
public void update() throws RedmineException- Throws:
RedmineException
-
delete
public void delete() throws RedmineExceptionThe project object must have projectKey set (String-based identifier like "project-ABC", NOT a database numeric ID!)- Throws:
RedmineAuthenticationException- invalid or no API access key is used with the server, which requires authorization. Check the constructor arguments.NotFoundException- if the project with this key is not foundRedmineException
-
-