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

com.taskadapter.redmineapi.TimeEntryManager Maven / Gradle / Ivy

Go to download

Free open-source Java API for Redmine and Chiliproject bug/task management systems. This project was originally a part of Task Adapter application (http://www.taskadapter.com) and then was open-sourced.

The newest version!
package com.taskadapter.redmineapi;

import com.taskadapter.redmineapi.bean.TimeEntry;
import com.taskadapter.redmineapi.bean.TimeEntryActivity;
import com.taskadapter.redmineapi.internal.DirectObjectsSearcher;
import com.taskadapter.redmineapi.internal.RequestParam;
import com.taskadapter.redmineapi.internal.ResultsWrapper;
import com.taskadapter.redmineapi.internal.Transport;

import java.util.List;
import java.util.Map;

/**
 * Class to operate on Time Entry instances.
 * 

* Sample usage: *

 RedmineManager redmineManager = RedmineManagerFactory.createWithUserAuth(redmineURI, login, password);
 redmineManager.getTimeEntryManager();
 * 
*/ public final class TimeEntryManager { private final Transport transport; TimeEntryManager(Transport transport) { this.transport = transport; } public List getTimeEntries() throws RedmineException { return transport.getObjectsList(TimeEntry.class); } /** * @param id the database Id of the TimeEntry record */ public TimeEntry getTimeEntry(Integer id) throws RedmineException { return transport.getObject(TimeEntry.class, id); } public List getTimeEntriesForIssue(Integer issueId) throws RedmineException { return transport.getObjectsList(TimeEntry.class, new RequestParam("issue_id", Integer.toString(issueId))); } /** * Direct method to search for objects using any Redmine REST API parameters you want. *

Unlike other getXXXObjects() methods in this library, this one does NOT handle paging for you so * you have to provide "offset" and "limit" parameters if you want to control paging. * *

Sample usage:

     final Map params = new HashMap();
     params.put("project_id", projectId);
     params.put("activity_id", activityId);
     final List elements = issueManager.getTimeEntries(params);
     
* see other possible parameters on Redmine REST doc page: * http://www.redmine.org/projects/redmine/wiki/Rest_TimeEntries#Listing-time-entries * * @param parameters the http parameters key/value pairs to append to the rest api request * @return resultsWrapper with raw response from Redmine REST API * @throws RedmineAuthenticationException invalid or no API access key is used with the server, which * requires authorization. Check the constructor arguments. * @throws RedmineException */ public ResultsWrapper getTimeEntries(Map parameters) throws RedmineException { return DirectObjectsSearcher.getObjectsListNoPaging(transport, parameters, TimeEntry.class); } @Deprecated public TimeEntry createTimeEntry(TimeEntry obj) throws RedmineException { return obj.create(); } @Deprecated public void deleteTimeEntry(Integer id) throws RedmineException { new TimeEntry(transport).setId(id).delete(); } public List getTimeEntryActivities() throws RedmineException { return transport.getObjectsList(TimeEntryActivity.class); } @Deprecated public void update(TimeEntry obj) throws RedmineException { obj.update(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy