Class Project

    • 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
      • TRACKERS

        public static final Property<java.util.Set<Tracker>> TRACKERS
        Trackers available for this project
    • Constructor Detail

      • Project

        public Project​(Transport transport)
      • Project

        public Project​(Transport transport,
                       java.lang.String name,
                       java.lang.String key)
    • 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 interface Identifiable
        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 class java.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 class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • create

        public Project create()
                       throws RedmineException
        Sample usage:
         
         	Project project = new Project(transport);
         	Long timeStamp = Calendar.getInstance().getTimeInMillis();
         	String key = "projkey" + timeStamp;
         	String name = &quot;project number &quot; + timeStamp;
         	String description = &quot;some description for the project&quot;;
         	project.setIdentifier(key)
         	  .setName(name)
         	  .setDescription(description)
         	  .create();
         
         

        Note: if project trackers have not been set with addTrackers(java.util.Collection<com.taskadapter.redmineapi.bean.Tracker>) and if they have been cleared with clearTrackers(), the created project will get the server default trackers (if any). Otherwise, the Project 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
      • 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 found
        RedmineException