From a8f56820f992825f51c3310b6dd402a849186be2 Mon Sep 17 00:00:00 2001 From: Miciele Ghiorghis Date: Wed, 24 Oct 2012 11:30:29 +0200 Subject: [PATCH] Jira-integration: synchronize order-elements with jira issues An interface that JiraOrderElementSynchronizer implements. It synchronizes order-elements inclusive progress assignments and measurements of an existing order with jira issues --- .../IJiraOrderElementSynchronizer.java | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100755 libreplan-webapp/src/main/java/org/libreplan/importers/IJiraOrderElementSynchronizer.java diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/IJiraOrderElementSynchronizer.java b/libreplan-webapp/src/main/java/org/libreplan/importers/IJiraOrderElementSynchronizer.java new file mode 100755 index 000000000..40d2deb0e --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/IJiraOrderElementSynchronizer.java @@ -0,0 +1,89 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2012 Igalia, S.L. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.importers; + +import java.util.List; + +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; + +/** + * Synchronize order elements inclusive progress assignments and measurements of + * an existing order with Jira issues. + * + * Jira issues will be retrieved from Jira RESTful web service using + * {@link JiraRESTClient} + * + * @author Miciele Ghiorghis + */ +public interface IJiraOrderElementSynchronizer { + + /** + * Gets all distinct jira lables from an external 'php' script. + * + * This is because at this moment Jira doesn't support Labels request. As + * workaround we build a simple php script to do the query in Jira database + * and returns a comma separated string(labels). Once Jira supports the + * labels request this method will be modified. + * + * @return A list of labels + */ + List getAllJiraLabels(); + + /** + * Get all jira issues based on the specified label parameter + * from jira RESTFul web service + * + * @param label + * search criteria for jira issues + * + * @return list of jira issues + */ + List getJiraIssues(String label); + + /** + * Synchronizes the list of {@link OrderElement}s, + * {@link DirectAdvanceAssignment}s and {@link AdvanceMeasurement}s of the + * given {@link Order} with jira issues. + * + * Loops through all jira issues and check if an + * {@link OrderElement} of the given order exists. If it + * exists, update the {@link OrderElement} with the issue item. If not + * create new {@link OrderElement}, update it with the issue item and add to + * the order and start synchronization of + * {@link DirectAdvanceAssignment} and {@link AdvanceMeasurement} + * + * @param order + * an existing order where its orderElements will be synchronized + * with jira issues + * @param issues + * jira issues + */ + void syncOrderElementsWithJiraIssues(Order order, List issues); + + /** + * returns synchronization info, success or fail info + */ + JiraSyncInfo getJiraSyncInfo(); + +}