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_ON
static Property<java.util.Set<CustomField>>
CUSTOM_FIELDS
static Property<java.lang.Integer>
DATABASE_ID
database IDstatic Property<java.lang.String>
DESCRIPTION
static Property<java.lang.String>
HOMEPAGE
static Property<java.lang.Boolean>
INHERIT_MEMBERS
static Property<java.lang.String>
NAME
Can contain any symbolsstatic Property<java.lang.Integer>
PARENT_DATABASE_ID
This is the *database ID*, not a String-based key.static Property<java.lang.Boolean>
PUBLIC
static Property<java.lang.Integer>
STATUS
static Property<java.lang.String>
STRING_IDENTIFIER
String "identifier" (human-readable name without spaces and other extra stuff)static Property<java.util.Set<Tracker>>
TRACKERS
Trackers 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 Project
addCustomFields(java.util.Collection<CustomField> customFields)
Project
addTrackers(java.util.Collection<Tracker> trackers)
Adds the specified trackers to this project.Project
clearTrackers()
Removes all of the trackers from this project.Project
create()
Sample usage:void
delete()
The project object must have projectKey set (String-based identifier like "project-ABC", NOT a database numeric ID!)boolean
equals(java.lang.Object o)
java.util.Date
getCreatedOn()
CustomField
getCustomFieldById(int customFieldId)
java.util.Collection<CustomField>
getCustomFields()
java.lang.String
getDescription()
java.lang.String
getHomepage()
java.lang.Integer
getId()
java.lang.String
getIdentifier()
java.lang.Boolean
getInheritMembers()
java.lang.String
getName()
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).java.lang.Boolean
getProjectPublic()
Deprecated.java.lang.Integer
getStatus()
Returns the project status.PropertyStorage
getStorage()
Tracker
getTrackerByName(java.lang.String trackerName)
java.util.Collection<Tracker>
getTrackers()
java.util.Date
getUpdatedOn()
int
hashCode()
Project
setCreatedOn(java.util.Date createdOn)
Project
setDescription(java.lang.String description)
Project
setHomepage(java.lang.String homepage)
Project
setId(java.lang.Integer id)
Project
setIdentifier(java.lang.String identifier)
Project
setInheritMembers(java.lang.Boolean inheritMembers)
Project
setName(java.lang.String name)
Project
setParentId(java.lang.Integer parentId)
Project
setProjectPublic(java.lang.Boolean projectPublic)
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)void
setTransport(Transport transport)
Project
setUpdatedOn(java.util.Date updatedOn)
java.lang.String
toString()
void
update()
-
-
-
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:
getId
in 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:
toString
in 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
null
if 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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getStorage
public PropertyStorage getStorage()
-
setTransport
public void setTransport(Transport transport)
- Specified by:
setTransport
in 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
project
trackers 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, theProject
trackers 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 RedmineException
The 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
-
-