Jira-integration: classes renamed and basic comments added
This commit is contained in:
parent
25d1461263
commit
78e1d7b10b
19 changed files with 172 additions and 106 deletions
|
|
@ -22,6 +22,11 @@ package org.libreplan.business.common.entities;
|
|||
import org.libreplan.business.common.BaseEntity;
|
||||
import org.libreplan.business.costcategories.entities.TypeOfWorkHours;
|
||||
|
||||
/**
|
||||
* JiraConfiguration entity
|
||||
*
|
||||
* @author Miciele Ghiorghis <m.ghiorghis@antoniusziekenhuis.nl>
|
||||
*/
|
||||
public class JiraConfiguration extends BaseEntity {
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import org.libreplan.business.advance.entities.AdvanceMeasurement;
|
|||
import org.libreplan.business.advance.entities.DirectAdvanceAssignment;
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
import org.libreplan.business.orders.entities.OrderElement;
|
||||
import org.libreplan.importers.jira.Issue;
|
||||
import org.libreplan.importers.jira.IssueDTO;
|
||||
|
||||
/**
|
||||
* Synchronize order elements inclusive progress assignments and measurements of
|
||||
|
|
@ -60,7 +60,7 @@ public interface IJiraOrderElementSynchronizer {
|
|||
*
|
||||
* @return list of jira issues
|
||||
*/
|
||||
List<Issue> getJiraIssues(String label);
|
||||
List<IssueDTO> getJiraIssues(String label);
|
||||
|
||||
/**
|
||||
* Synchronizes the list of {@link OrderElement}s,
|
||||
|
|
@ -80,7 +80,7 @@ public interface IJiraOrderElementSynchronizer {
|
|||
* @param issues
|
||||
* jira issues
|
||||
*/
|
||||
void syncOrderElementsWithJiraIssues(List<Issue> issues, Order order);
|
||||
void syncOrderElementsWithJiraIssues(List<IssueDTO> issues, Order order);
|
||||
|
||||
/**
|
||||
* returns synchronization info, success or fail info
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import java.util.List;
|
|||
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
import org.libreplan.business.workreports.entities.WorkReportType;
|
||||
import org.libreplan.importers.jira.Issue;
|
||||
import org.libreplan.importers.jira.IssueDTO;
|
||||
|
||||
/**
|
||||
* Synchronize the timesheets of order tasks of an existing order with jira
|
||||
|
|
@ -52,7 +52,7 @@ public interface IJiraTimesheetSynchronizer {
|
|||
* @param order
|
||||
* an existing order
|
||||
*/
|
||||
void syncJiraTimesheetWithJiraIssues(List<Issue> issues, Order order);
|
||||
void syncJiraTimesheetWithJiraIssues(List<IssueDTO> issues, Order order);
|
||||
|
||||
/**
|
||||
* returns synchronization info, success or fail info
|
||||
|
|
|
|||
|
|
@ -44,17 +44,22 @@ import org.libreplan.business.orders.entities.Order;
|
|||
import org.libreplan.business.orders.entities.OrderElement;
|
||||
import org.libreplan.business.orders.entities.OrderLine;
|
||||
import org.libreplan.business.workingday.EffortDuration;
|
||||
import org.libreplan.importers.jira.Issue;
|
||||
import org.libreplan.importers.jira.Status;
|
||||
import org.libreplan.importers.jira.TimeTracking;
|
||||
import org.libreplan.importers.jira.WorkLog;
|
||||
import org.libreplan.importers.jira.WorkLogItem;
|
||||
import org.libreplan.importers.jira.IssueDTO;
|
||||
import org.libreplan.importers.jira.StatusDTO;
|
||||
import org.libreplan.importers.jira.TimeTrackingDTO;
|
||||
import org.libreplan.importers.jira.WorkLogDTO;
|
||||
import org.libreplan.importers.jira.WorkLogItemDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* Implementation of Synchronize order elements with jira issues
|
||||
*
|
||||
* @author Miciele Ghiorghis <m.ghiorghis@antoniusziekenhuis.nl>
|
||||
*/
|
||||
@Component
|
||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||
public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchronizer {
|
||||
|
|
@ -83,7 +88,7 @@ public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchroniz
|
|||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<Issue> getJiraIssues(String label) {
|
||||
public List<IssueDTO> getJiraIssues(String label) {
|
||||
JiraConfiguration jiraConfiguration = configurationDAO
|
||||
.getConfiguration().getJiraConfiguration();
|
||||
|
||||
|
|
@ -94,7 +99,7 @@ public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchroniz
|
|||
String path = JiraRESTClient.PATH_SEARCH;
|
||||
String query = "labels=" + label;
|
||||
|
||||
List<Issue> issues = JiraRESTClient.getIssues(url, username, password,
|
||||
List<IssueDTO> issues = JiraRESTClient.getIssues(url, username, password,
|
||||
path, query);
|
||||
|
||||
return issues;
|
||||
|
|
@ -102,11 +107,11 @@ public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchroniz
|
|||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public void syncOrderElementsWithJiraIssues(List<Issue> issues, Order order) {
|
||||
public void syncOrderElementsWithJiraIssues(List<IssueDTO> issues, Order order) {
|
||||
|
||||
jiraSyncInfo = new JiraSyncInfo();
|
||||
|
||||
for (Issue issue : issues) {
|
||||
for (IssueDTO issue : issues) {
|
||||
String code = JiraConfiguration.CODE_PREFIX + order.getCode() + "-"
|
||||
+ issue.getKey();
|
||||
String name = issue.getFields().getSummary();
|
||||
|
|
@ -206,10 +211,10 @@ public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchroniz
|
|||
* jira's issue to synchronize with progress assignment and
|
||||
* measurement
|
||||
*/
|
||||
private void syncProgressMeasurement(OrderLine orderLine, Issue issue,
|
||||
private void syncProgressMeasurement(OrderLine orderLine, IssueDTO issue,
|
||||
EffortDuration estimatedHours, EffortDuration loggedHours) {
|
||||
|
||||
WorkLog workLog = issue.getFields().getWorklog();
|
||||
WorkLogDTO workLog = issue.getFields().getWorklog();
|
||||
|
||||
if (workLog == null) {
|
||||
jiraSyncInfo.addSyncFailedReason("No worklogs found for '"
|
||||
|
|
@ -217,7 +222,7 @@ public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchroniz
|
|||
return;
|
||||
}
|
||||
|
||||
List<WorkLogItem> workLogItems = workLog.getWorklogs();
|
||||
List<WorkLogItemDTO> workLogItems = workLog.getWorklogs();
|
||||
if (workLogItems.isEmpty()) {
|
||||
jiraSyncInfo.addSyncFailedReason("No worklog items found for '"
|
||||
+ issue.getKey() + "' issue");
|
||||
|
|
@ -246,8 +251,8 @@ public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchroniz
|
|||
|
||||
/**
|
||||
* Get the estimated seconds from
|
||||
* {@link TimeTracking#getRemainingEstimateSeconds()} plus logged hours or
|
||||
* {@link TimeTracking#getOriginalEstimateSeconds()} and convert it to
|
||||
* {@link TimeTrackingDTO#getRemainingEstimateSeconds()} plus logged hours or
|
||||
* {@link TimeTrackingDTO#getOriginalEstimateSeconds()} and convert it to
|
||||
* {@link EffortDuration}
|
||||
*
|
||||
* @param timeTracking
|
||||
|
|
@ -256,7 +261,7 @@ public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchroniz
|
|||
* hours already logged
|
||||
* @return estimatedHours
|
||||
*/
|
||||
private EffortDuration getEstimatedHours(TimeTracking timeTracking,
|
||||
private EffortDuration getEstimatedHours(TimeTrackingDTO timeTracking,
|
||||
EffortDuration loggedHours) {
|
||||
if (timeTracking == null) {
|
||||
return EffortDuration.zero();
|
||||
|
|
@ -277,14 +282,14 @@ public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchroniz
|
|||
|
||||
/**
|
||||
* Get the time spent in seconds from
|
||||
* {@link TimeTracking#getTimeSpentSeconds()} and convert it to
|
||||
* {@link TimeTrackingDTO#getTimeSpentSeconds()} and convert it to
|
||||
* {@link EffortDuration}
|
||||
*
|
||||
* @param timeTracking
|
||||
* where the timespent to get from
|
||||
* @return timespent in hous
|
||||
*/
|
||||
private EffortDuration getLoggedHours(TimeTracking timeTracking) {
|
||||
private EffortDuration getLoggedHours(TimeTrackingDTO timeTracking) {
|
||||
if (timeTracking == null) {
|
||||
return EffortDuration.zero();
|
||||
}
|
||||
|
|
@ -363,7 +368,7 @@ public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchroniz
|
|||
* the status of the issue
|
||||
* @return true if status is Closed
|
||||
*/
|
||||
private boolean isIssueClosed(Status status) {
|
||||
private boolean isIssueClosed(StatusDTO status) {
|
||||
if (status == null) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -377,9 +382,9 @@ public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchroniz
|
|||
* list of workLogItems
|
||||
* @return latest date
|
||||
*/
|
||||
private Date getTheLatestWorkLoggedDate(List<WorkLogItem> workLogItems) {
|
||||
private Date getTheLatestWorkLoggedDate(List<WorkLogItemDTO> workLogItems) {
|
||||
List<Date> dates = new ArrayList<Date>();
|
||||
for (WorkLogItem workLogItem : workLogItems) {
|
||||
for (WorkLogItemDTO workLogItem : workLogItems) {
|
||||
if (workLogItem.getStarted() != null) {
|
||||
dates.add(workLogItem.getStarted());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ import javax.ws.rs.core.Response.Status;
|
|||
import org.apache.cxf.jaxrs.client.WebClient;
|
||||
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
|
||||
import org.codehaus.jackson.map.DeserializationConfig.Feature;
|
||||
import org.libreplan.importers.jira.Issue;
|
||||
import org.libreplan.importers.jira.SearchResult;
|
||||
import org.libreplan.importers.jira.IssueDTO;
|
||||
import org.libreplan.importers.jira.SearchResultDTO;
|
||||
import org.libreplan.ws.cert.NaiveTrustProvider;
|
||||
import org.libreplan.ws.common.impl.Util;
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ public class JiraRESTClient {
|
|||
* the query
|
||||
* @return List of jira Issues
|
||||
*/
|
||||
public static List<Issue> getIssues(String url, String username,
|
||||
public static List<IssueDTO> getIssues(String url, String username,
|
||||
String password, String path, String query) {
|
||||
|
||||
WebClient client = createClient(url);
|
||||
|
|
@ -97,7 +97,7 @@ public class JiraRESTClient {
|
|||
client.query("jql", query);
|
||||
client.query("maxResults", 1000);
|
||||
}
|
||||
SearchResult searchResult = client.get(SearchResult.class);
|
||||
SearchResultDTO searchResult = client.get(SearchResultDTO.class);
|
||||
|
||||
return getIssuesDetails(client, searchResult.getIssues());
|
||||
}
|
||||
|
|
@ -155,14 +155,14 @@ public class JiraRESTClient {
|
|||
*
|
||||
* @return List of jira issue details
|
||||
*/
|
||||
private static List<Issue> getIssuesDetails(WebClient client, List<Issue> issues) {
|
||||
private static List<IssueDTO> getIssuesDetails(WebClient client, List<IssueDTO> issues) {
|
||||
|
||||
client.back(true);
|
||||
client.path(PATH_ISSUE);
|
||||
|
||||
List<Issue> issueDetails = new ArrayList<Issue>();
|
||||
for (Issue issue : issues) {
|
||||
issueDetails.add(client.path(issue.getId()).get(Issue.class));
|
||||
List<IssueDTO> issueDetails = new ArrayList<IssueDTO>();
|
||||
for (IssueDTO issue : issues) {
|
||||
issueDetails.add(client.path(issue.getId()).get(IssueDTO.class));
|
||||
client.back(false);
|
||||
}
|
||||
return issueDetails;
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ import org.libreplan.business.workreports.entities.WorkReportLine;
|
|||
import org.libreplan.business.workreports.entities.WorkReportType;
|
||||
import org.libreplan.business.workreports.valueobjects.DescriptionField;
|
||||
import org.libreplan.business.workreports.valueobjects.DescriptionValue;
|
||||
import org.libreplan.importers.jira.Issue;
|
||||
import org.libreplan.importers.jira.WorkLog;
|
||||
import org.libreplan.importers.jira.WorkLogItem;
|
||||
import org.libreplan.importers.jira.IssueDTO;
|
||||
import org.libreplan.importers.jira.WorkLogDTO;
|
||||
import org.libreplan.importers.jira.WorkLogItemDTO;
|
||||
import org.libreplan.web.workreports.IWorkReportModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
|
|
@ -54,6 +54,11 @@ import org.springframework.context.annotation.Scope;
|
|||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* Implementation of Synchronize timesheets with jira issues
|
||||
*
|
||||
* @author Miciele Ghiorghis <m.ghiorghis@antoniusziekenhuis.nl>
|
||||
*/
|
||||
@Component
|
||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||
public class JiraTimesheetSynchronizer implements IJiraTimesheetSynchronizer {
|
||||
|
|
@ -92,7 +97,7 @@ public class JiraTimesheetSynchronizer implements IJiraTimesheetSynchronizer {
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public void syncJiraTimesheetWithJiraIssues(List<Issue> issues, Order order) {
|
||||
public void syncJiraTimesheetWithJiraIssues(List<IssueDTO> issues, Order order) {
|
||||
jiraSyncInfo = new JiraSyncInfo();
|
||||
|
||||
workReportType = getJiraTimesheetsWorkReportType();
|
||||
|
|
@ -108,13 +113,13 @@ public class JiraTimesheetSynchronizer implements IJiraTimesheetSynchronizer {
|
|||
|
||||
WorkReport workReport = updateOrCreateWorkReport(code);
|
||||
|
||||
for (Issue issue : issues) {
|
||||
WorkLog worklog = issue.getFields().getWorklog();
|
||||
for (IssueDTO issue : issues) {
|
||||
WorkLogDTO worklog = issue.getFields().getWorklog();
|
||||
if (worklog == null) {
|
||||
jiraSyncInfo.addSyncFailedReason("No worklogs found for '"
|
||||
+ issue.getKey() + "'");
|
||||
} else {
|
||||
List<WorkLogItem> workLogItems = worklog.getWorklogs();
|
||||
List<WorkLogItemDTO> workLogItems = worklog.getWorklogs();
|
||||
if (workLogItems == null || workLogItems.isEmpty()) {
|
||||
jiraSyncInfo
|
||||
.addSyncFailedReason("No worklog items found for '"
|
||||
|
|
@ -180,9 +185,9 @@ public class JiraTimesheetSynchronizer implements IJiraTimesheetSynchronizer {
|
|||
*/
|
||||
private void updateOrCreateWorkReportLineAndAddToWorkReport(WorkReport workReport,
|
||||
OrderElement orderElement,
|
||||
List<WorkLogItem> workLogItems) {
|
||||
List<WorkLogItemDTO> workLogItems) {
|
||||
|
||||
for (WorkLogItem workLogItem : workLogItems) {
|
||||
for (WorkLogItemDTO workLogItem : workLogItems) {
|
||||
Resource resource = getWorker(workLogItem.getAuthor().getName());
|
||||
if (resource == null) {
|
||||
continue;
|
||||
|
|
@ -218,7 +223,7 @@ public class JiraTimesheetSynchronizer implements IJiraTimesheetSynchronizer {
|
|||
* the resource
|
||||
*/
|
||||
private void updateWorkReportLine(WorkReportLine workReportLine,
|
||||
OrderElement orderElement, WorkLogItem workLogItem,
|
||||
OrderElement orderElement, WorkLogItemDTO workLogItem,
|
||||
Resource resource) {
|
||||
|
||||
int timeSpent = workLogItem.getTimeSpentSeconds().intValue();
|
||||
|
|
|
|||
|
|
@ -19,12 +19,18 @@
|
|||
|
||||
package org.libreplan.importers.jira;
|
||||
|
||||
public class Field {
|
||||
|
||||
/**
|
||||
* DTO representing a jira-issue Field
|
||||
*
|
||||
* @author Miciele Ghiorghis <m.ghiorghis@antoniusziekenhuis.nl>
|
||||
*/
|
||||
public class FieldDTO {
|
||||
|
||||
private String summary;
|
||||
private Status status;
|
||||
private TimeTracking timetracking;
|
||||
private WorkLog worklog;
|
||||
private StatusDTO status;
|
||||
private TimeTrackingDTO timetracking;
|
||||
private WorkLogDTO worklog;
|
||||
|
||||
public String getSummary() {
|
||||
return summary;
|
||||
|
|
@ -34,27 +40,27 @@ public class Field {
|
|||
this.summary = summary;
|
||||
}
|
||||
|
||||
public TimeTracking getTimetracking() {
|
||||
public TimeTrackingDTO getTimetracking() {
|
||||
return timetracking;
|
||||
}
|
||||
|
||||
public void setTimetracking(TimeTracking timetracking) {
|
||||
public void setTimetracking(TimeTrackingDTO timetracking) {
|
||||
this.timetracking = timetracking;
|
||||
}
|
||||
|
||||
public WorkLog getWorklog() {
|
||||
public WorkLogDTO getWorklog() {
|
||||
return worklog;
|
||||
}
|
||||
|
||||
public void setWorklog(WorkLog worklog) {
|
||||
public void setWorklog(WorkLogDTO worklog) {
|
||||
this.worklog = worklog;
|
||||
}
|
||||
|
||||
public Status getStatus() {
|
||||
public StatusDTO getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Status status) {
|
||||
public void setStatus(StatusDTO status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
|
@ -19,7 +19,13 @@
|
|||
|
||||
package org.libreplan.importers.jira;
|
||||
|
||||
public class Issue {
|
||||
|
||||
/**
|
||||
* DTO representing a jira-issue
|
||||
*
|
||||
* @author Miciele Ghiorghis <m.ghiorghis@antoniusziekenhuis.nl>
|
||||
*/
|
||||
public class IssueDTO {
|
||||
|
||||
private String expand;
|
||||
|
||||
|
|
@ -29,7 +35,7 @@ public class Issue {
|
|||
|
||||
private String self;
|
||||
|
||||
private Field fields;
|
||||
private FieldDTO fields;
|
||||
|
||||
public String getExpand() {
|
||||
return expand;
|
||||
|
|
@ -63,11 +69,11 @@ public class Issue {
|
|||
this.self = self;
|
||||
}
|
||||
|
||||
public Field getFields() {
|
||||
public FieldDTO getFields() {
|
||||
return fields;
|
||||
}
|
||||
|
||||
public void setFields(Field fields) {
|
||||
public void setFields(FieldDTO fields) {
|
||||
this.fields = fields;
|
||||
}
|
||||
|
||||
|
|
@ -19,7 +19,12 @@
|
|||
|
||||
package org.libreplan.importers.jira;
|
||||
|
||||
public class LabelIssue {
|
||||
/**
|
||||
* DTO representing a jira-issue LabelIssue
|
||||
*
|
||||
* @author Miciele Ghiorghis <m.ghiorghis@antoniusziekenhuis.nl>
|
||||
*/
|
||||
public class LabelIssueDTO {
|
||||
|
||||
String key;
|
||||
String self;
|
||||
|
|
@ -21,12 +21,20 @@ package org.libreplan.importers.jira;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class SearchResult {
|
||||
import org.libreplan.business.orders.entities.OrderElement;
|
||||
|
||||
/**
|
||||
* DTO representing jira search result(response), it will be used for
|
||||
* synchronization with {@link OrderElement}
|
||||
*
|
||||
* @author Miciele Ghiorghis <m.ghiorghis@antoniusziekenhuis.nl>
|
||||
*/
|
||||
public class SearchResultDTO {
|
||||
|
||||
private Integer startAt;
|
||||
private Integer maxResults;
|
||||
private Integer total;
|
||||
private List<Issue> issues;
|
||||
private List<IssueDTO> issues;
|
||||
|
||||
public Integer getStartAt() {
|
||||
return startAt;
|
||||
|
|
@ -52,11 +60,11 @@ public class SearchResult {
|
|||
this.total = total;
|
||||
}
|
||||
|
||||
public List<Issue> getIssues() {
|
||||
public List<IssueDTO> getIssues() {
|
||||
return issues;
|
||||
}
|
||||
|
||||
public void setIssues(List<Issue> issues) {
|
||||
public void setIssues(List<IssueDTO> issues) {
|
||||
this.issues = issues;
|
||||
}
|
||||
|
||||
|
|
@ -19,7 +19,13 @@
|
|||
|
||||
package org.libreplan.importers.jira;
|
||||
|
||||
public class Status {
|
||||
|
||||
/**
|
||||
* DTO representing a jira-issue Status
|
||||
*
|
||||
* @author Miciele Ghiorghis <m.ghiorghis@antoniusziekenhuis.nl>
|
||||
*/
|
||||
public class StatusDTO {
|
||||
Integer id;
|
||||
String name;
|
||||
String self;
|
||||
|
|
@ -20,7 +20,12 @@
|
|||
package org.libreplan.importers.jira;
|
||||
|
||||
|
||||
public class TimeTracking {
|
||||
/**
|
||||
* DTO representing a jira-issue TimeTracking
|
||||
*
|
||||
* @author Miciele Ghiorghis <m.ghiorghis@antoniusziekenhuis.nl>
|
||||
*/
|
||||
public class TimeTrackingDTO {
|
||||
|
||||
private Integer originalEstimateSeconds;
|
||||
private Integer remainingEstimateSeconds;
|
||||
|
|
@ -19,7 +19,12 @@
|
|||
|
||||
package org.libreplan.importers.jira;
|
||||
|
||||
public class WorkLogAuthor {
|
||||
/**
|
||||
* DTO representing a jira-issue WorkLogAuthor
|
||||
*
|
||||
* @author Miciele Ghiorghis <m.ghiorghis@antoniusziekenhuis.nl>
|
||||
*/
|
||||
public class WorkLogAuthorDTO {
|
||||
private boolean active;
|
||||
private String displayName;
|
||||
private String name;
|
||||
|
|
@ -21,12 +21,17 @@ package org.libreplan.importers.jira;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class WorkLog {
|
||||
/**
|
||||
* DTO representing a jira-issue WorkLog
|
||||
*
|
||||
* @author Miciele Ghiorghis <m.ghiorghis@antoniusziekenhuis.nl>
|
||||
*/
|
||||
public class WorkLogDTO {
|
||||
|
||||
private Integer startAt;
|
||||
private Integer maxResults;
|
||||
private Integer total;
|
||||
private List<WorkLogItem> worklogs;
|
||||
private List<WorkLogItemDTO> worklogs;
|
||||
|
||||
public Integer getStartAt() {
|
||||
return startAt;
|
||||
|
|
@ -52,11 +57,11 @@ public class WorkLog {
|
|||
this.total = total;
|
||||
}
|
||||
|
||||
public List<WorkLogItem> getWorklogs() {
|
||||
public List<WorkLogItemDTO> getWorklogs() {
|
||||
return worklogs;
|
||||
}
|
||||
|
||||
public void setWorklogs(List<WorkLogItem> worklogs) {
|
||||
public void setWorklogs(List<WorkLogItemDTO> worklogs) {
|
||||
this.worklogs = worklogs;
|
||||
}
|
||||
|
||||
|
|
@ -21,9 +21,14 @@ package org.libreplan.importers.jira;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
public class WorkLogItem {
|
||||
/**
|
||||
* DTO representing a jira-issue WorkLogItem
|
||||
*
|
||||
* @author Miciele Ghiorghis <m.ghiorghis@antoniusziekenhuis.nl>
|
||||
*/
|
||||
public class WorkLogItemDTO {
|
||||
|
||||
private WorkLogAuthor author;
|
||||
private WorkLogAuthorDTO author;
|
||||
private Integer id;
|
||||
private String self;
|
||||
private Date created;
|
||||
|
|
@ -32,11 +37,11 @@ public class WorkLogItem {
|
|||
private Integer timeSpentSeconds;
|
||||
private String comment;
|
||||
|
||||
public WorkLogAuthor getAuthor() {
|
||||
public WorkLogAuthorDTO getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(WorkLogAuthor author) {
|
||||
public void setAuthor(WorkLogAuthorDTO author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ import org.libreplan.business.users.entities.UserRole;
|
|||
import org.libreplan.importers.IJiraOrderElementSynchronizer;
|
||||
import org.libreplan.importers.IJiraTimesheetSynchronizer;
|
||||
import org.libreplan.importers.JiraSyncInfo;
|
||||
import org.libreplan.importers.jira.Issue;
|
||||
import org.libreplan.importers.jira.IssueDTO;
|
||||
import org.libreplan.web.common.ConfirmCloseUtil;
|
||||
import org.libreplan.web.common.IMessagesForUser;
|
||||
import org.libreplan.web.common.Level;
|
||||
|
|
@ -1739,7 +1739,7 @@ public class OrderCRUDController extends GenericForwardComposer {
|
|||
try {
|
||||
Order order = getOrder();
|
||||
|
||||
List<Issue> issues = jiraOrderElementSynchronizer
|
||||
List<IssueDTO> issues = jiraOrderElementSynchronizer
|
||||
.getJiraIssues(label);
|
||||
|
||||
order.setCodeAutogenerated(false);
|
||||
|
|
|
|||
|
|
@ -64,10 +64,10 @@ import org.libreplan.business.orders.entities.OrderLine;
|
|||
import org.libreplan.business.scenarios.IScenarioManager;
|
||||
import org.libreplan.business.scenarios.entities.OrderVersion;
|
||||
import org.libreplan.business.scenarios.entities.Scenario;
|
||||
import org.libreplan.importers.jira.Issue;
|
||||
import org.libreplan.importers.jira.TimeTracking;
|
||||
import org.libreplan.importers.jira.WorkLog;
|
||||
import org.libreplan.importers.jira.WorkLogItem;
|
||||
import org.libreplan.importers.jira.IssueDTO;
|
||||
import org.libreplan.importers.jira.TimeTrackingDTO;
|
||||
import org.libreplan.importers.jira.WorkLogDTO;
|
||||
import org.libreplan.importers.jira.WorkLogItemDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
|
@ -106,7 +106,7 @@ public class JiraOrderElementSynchronizerTest {
|
|||
|
||||
private static final String LABEL = "labels=epd_12a_ZorgActiviteiten";
|
||||
|
||||
private List<Issue> issues;
|
||||
private List<IssueDTO> issues;
|
||||
|
||||
@Autowired
|
||||
private IOrderDAO orderDAO;
|
||||
|
|
@ -130,8 +130,8 @@ public class JiraOrderElementSynchronizerTest {
|
|||
transactionService.runOnAnotherTransaction(load);
|
||||
}
|
||||
|
||||
private List<Issue> getJiraIssues() {
|
||||
List<Issue> issues = new ArrayList<Issue>();
|
||||
private List<IssueDTO> getJiraIssues() {
|
||||
List<IssueDTO> issues = new ArrayList<IssueDTO>();
|
||||
try {
|
||||
Properties properties = loadProperties();
|
||||
issues = JiraRESTClient.getIssues(properties.getProperty("url"),
|
||||
|
|
@ -208,7 +208,7 @@ public class JiraOrderElementSynchronizerTest {
|
|||
.getDefaultCalendar());
|
||||
OrderVersion version = setupVersionUsing(scenarioManager, order);
|
||||
order.useSchedulingDataFor(version);
|
||||
for (Issue issue : issues) {
|
||||
for (IssueDTO issue : issues) {
|
||||
String code = JiraConfiguration.CODE_PREFIX + order.getCode() + "-"
|
||||
+ issue.getKey();
|
||||
String name = issue.getFields().getSummary();
|
||||
|
|
@ -267,9 +267,9 @@ public class JiraOrderElementSynchronizerTest {
|
|||
|
||||
}
|
||||
|
||||
private void syncPorgressMeasurement(OrderElement orderElement, Issue issue) {
|
||||
private void syncPorgressMeasurement(OrderElement orderElement, IssueDTO issue) {
|
||||
|
||||
WorkLog workLog = issue.getFields().getWorklog();
|
||||
WorkLogDTO workLog = issue.getFields().getWorklog();
|
||||
|
||||
if (workLog == null) {
|
||||
return;
|
||||
|
|
@ -278,7 +278,7 @@ public class JiraOrderElementSynchronizerTest {
|
|||
return;
|
||||
}
|
||||
|
||||
List<WorkLogItem> workLogItems = workLog.getWorklogs();
|
||||
List<WorkLogItemDTO> workLogItems = workLog.getWorklogs();
|
||||
if (workLogItems.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -342,7 +342,7 @@ public class JiraOrderElementSynchronizerTest {
|
|||
|
||||
}
|
||||
|
||||
private Integer getEstimatedHours(TimeTracking timeTracking) {
|
||||
private Integer getEstimatedHours(TimeTrackingDTO timeTracking) {
|
||||
if (timeTracking == null) {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -360,7 +360,7 @@ public class JiraOrderElementSynchronizerTest {
|
|||
return 0;
|
||||
}
|
||||
|
||||
private Integer getLoggedHours(TimeTracking timeTracking) {
|
||||
private Integer getLoggedHours(TimeTrackingDTO timeTracking) {
|
||||
if (timeTracking == null) {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -377,7 +377,7 @@ public class JiraOrderElementSynchronizerTest {
|
|||
@Ignore("Only working if you have a JIRA server configured")
|
||||
public void testSyncOrderElementsOfAnExistingOrderWithNoOrderLines() {
|
||||
Order order = givenOrder();
|
||||
for (Issue issue : issues) {
|
||||
for (IssueDTO issue : issues) {
|
||||
String code = JiraConfiguration.CODE_PREFIX + order.getCode() + "-"
|
||||
+ issue.getKey();
|
||||
String name = issue.getFields().getSummary();
|
||||
|
|
@ -401,7 +401,7 @@ public class JiraOrderElementSynchronizerTest {
|
|||
public void testReSyncOrderElementsOfAnExistingOrderWithOrderLines() {
|
||||
Order order = givenOrderWithValidOrderLines();
|
||||
Integer workingHours = order.getWorkHours();
|
||||
for (Issue issue : issues) {
|
||||
for (IssueDTO issue : issues) {
|
||||
String code = JiraConfiguration.CODE_PREFIX + order.getCode() + "-"
|
||||
+ issue.getKey();
|
||||
String name = issue.getFields().getSummary();
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import org.apache.commons.lang.StringUtils;
|
|||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.libreplan.importers.jira.Issue;
|
||||
import org.libreplan.importers.jira.IssueDTO;
|
||||
|
||||
/**
|
||||
* Test for {@link JiraRESTClient }
|
||||
|
|
@ -73,7 +73,7 @@ public class JiraRESTClientTest {
|
|||
@Test
|
||||
@Ignore("Only working if you have a JIRA server configured")
|
||||
public void testGetIssuesForValidLabelAndAuthorizedUser() {
|
||||
List<Issue> issues = JiraRESTClient.getIssues(
|
||||
List<IssueDTO> issues = JiraRESTClient.getIssues(
|
||||
properties.getProperty("url"),
|
||||
properties.getProperty("username"),
|
||||
properties.getProperty("password"), JiraRESTClient.PATH_SEARCH,
|
||||
|
|
@ -90,7 +90,7 @@ public class JiraRESTClientTest {
|
|||
@Test
|
||||
@Ignore("Only working if you have a JIRA server configured")
|
||||
public void testGetIssuesForEmptyLabel() {
|
||||
List<Issue> issues = JiraRESTClient.getIssues(
|
||||
List<IssueDTO> issues = JiraRESTClient.getIssues(
|
||||
properties.getProperty("url"),
|
||||
properties.getProperty("username"),
|
||||
properties.getProperty("password"), JiraRESTClient.PATH_SEARCH,
|
||||
|
|
|
|||
|
|
@ -65,9 +65,9 @@ import org.libreplan.business.workreports.entities.WorkReportLine;
|
|||
import org.libreplan.business.workreports.entities.WorkReportType;
|
||||
import org.libreplan.business.workreports.valueobjects.DescriptionField;
|
||||
import org.libreplan.business.workreports.valueobjects.DescriptionValue;
|
||||
import org.libreplan.importers.jira.Issue;
|
||||
import org.libreplan.importers.jira.WorkLog;
|
||||
import org.libreplan.importers.jira.WorkLogItem;
|
||||
import org.libreplan.importers.jira.IssueDTO;
|
||||
import org.libreplan.importers.jira.WorkLogDTO;
|
||||
import org.libreplan.importers.jira.WorkLogItemDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
|
@ -106,7 +106,7 @@ public class JiraTimesheetSynchronizerTest {
|
|||
|
||||
private static final String LABEL = "labels=epd_12a_ZorgActiviteiten";
|
||||
|
||||
private List<Issue> issues;
|
||||
private List<IssueDTO> issues;
|
||||
|
||||
@Autowired
|
||||
private IOrderDAO orderDAO;
|
||||
|
|
@ -137,8 +137,8 @@ public class JiraTimesheetSynchronizerTest {
|
|||
transactionService.runOnAnotherTransaction(load);
|
||||
}
|
||||
|
||||
private List<Issue> getJiraIssues() {
|
||||
List<Issue> issues = new ArrayList<Issue>();
|
||||
private List<IssueDTO> getJiraIssues() {
|
||||
List<IssueDTO> issues = new ArrayList<IssueDTO>();
|
||||
try {
|
||||
Properties properties = loadProperties();
|
||||
issues = JiraRESTClient.getIssues(properties.getProperty("url"),
|
||||
|
|
@ -186,7 +186,7 @@ public class JiraTimesheetSynchronizerTest {
|
|||
.getDefaultCalendar());
|
||||
OrderVersion version = setupVersionUsing(scenarioManager, order);
|
||||
order.useSchedulingDataFor(version);
|
||||
for (Issue issue : issues) {
|
||||
for (IssueDTO issue : issues) {
|
||||
String code = JiraConfiguration.CODE_PREFIX + order.getCode() + "-"
|
||||
+ issue.getKey();
|
||||
String name = issue.getFields().getSummary();
|
||||
|
|
@ -228,9 +228,9 @@ public class JiraTimesheetSynchronizerTest {
|
|||
|
||||
private void updateOrCreateWorkReportLineAndAddToWorkReport(
|
||||
WorkReport workReport, OrderElement orderElement,
|
||||
List<WorkLogItem> workLogItems) {
|
||||
List<WorkLogItemDTO> workLogItems) {
|
||||
|
||||
for (WorkLogItem workLogItem : workLogItems) {
|
||||
for (WorkLogItemDTO workLogItem : workLogItems) {
|
||||
WorkReportLine workReportLine;
|
||||
try {
|
||||
workReportLine = workReport
|
||||
|
|
@ -255,7 +255,7 @@ public class JiraTimesheetSynchronizerTest {
|
|||
}
|
||||
|
||||
private void updateWorkReportLine(WorkReportLine workReportLine,
|
||||
OrderElement orderElement, WorkLogItem workLogItem,
|
||||
OrderElement orderElement, WorkLogItemDTO workLogItem,
|
||||
org.libreplan.business.resources.entities.Resource resource) {
|
||||
|
||||
String code = orderElement.getCode() + "-" + workLogItem.getId();
|
||||
|
|
@ -334,10 +334,10 @@ public class JiraTimesheetSynchronizerTest {
|
|||
|
||||
WorkReport workReport = getOrCreateWorkReport(code);
|
||||
|
||||
for (Issue issue : issues) {
|
||||
WorkLog worklog = issue.getFields().getWorklog();
|
||||
for (IssueDTO issue : issues) {
|
||||
WorkLogDTO worklog = issue.getFields().getWorklog();
|
||||
if (worklog != null) {
|
||||
List<WorkLogItem> workLogItems = worklog.getWorklogs();
|
||||
List<WorkLogItemDTO> workLogItems = worklog.getWorklogs();
|
||||
if (workLogItems != null && !workLogItems.isEmpty()) {
|
||||
|
||||
String code1 = JiraConfiguration.CODE_PREFIX
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue