├── .gitignore ├── .travis.yml ├── README.md ├── assembly.xml ├── plugin └── src │ └── main │ └── resources │ ├── images │ ├── navigate_left2_16.png │ └── navigate_left_16.png │ └── templates │ └── images │ ├── navigate_left2_16.png │ └── navigate_left_16.png ├── pom.xml └── src ├── main ├── java │ └── org │ │ └── everit │ │ └── jira │ │ ├── analytics │ │ ├── AnalyticsDTO.java │ │ ├── AnalyticsSender.java │ │ ├── AnalyticsSenderImpl.java │ │ ├── PiwikUrlBuilder.java │ │ ├── UserSelection.java │ │ └── event │ │ │ ├── ActiveFieldDurationChangedEvent.java │ │ │ ├── AnalyticsEvent.java │ │ │ ├── AnalyticsStatusChangedEvent.java │ │ │ ├── CreateReportEvent.java │ │ │ ├── ExportSummaryReportEvent.java │ │ │ ├── ExportWorklogDetailsReportEvent.java │ │ │ ├── NoEstimateUsageChangedEvent.java │ │ │ ├── NonWorkingUsageEvent.java │ │ │ ├── ProgressIndicatorChangedEvent.java │ │ │ ├── ShowFutureLogWarningChangedEvent.java │ │ │ ├── ShowIssueSummaryChangedEvent.java │ │ │ ├── ShowRemaningEstimateChangedEvent.java │ │ │ └── TimeZoneUsageChangedEvent.java │ │ ├── core │ │ ├── EVWorklogManager.java │ │ ├── RemainingEstimateType.java │ │ ├── SupportManager.java │ │ ├── TimetrackerManager.java │ │ ├── dto │ │ │ └── WorklogParameter.java │ │ ├── impl │ │ │ ├── DateTimeServer.java │ │ │ ├── InitializerComponent.java │ │ │ ├── SupportComponent.java │ │ │ ├── TimetrackerComponent.java │ │ │ └── WorklogComponent.java │ │ └── util │ │ │ ├── TimetrackerUtil.java │ │ │ └── WorklogUtil.java │ │ ├── reporting │ │ └── plugin │ │ │ ├── ReportingCondition.java │ │ │ ├── ReportingPlugin.java │ │ │ ├── ReportingPluginImpl.java │ │ │ ├── SearcherValue.java │ │ │ ├── column │ │ │ ├── IssueSummaryColumns.java │ │ │ ├── ProjectSummaryColumns.java │ │ │ ├── UserSummaryColumns.java │ │ │ └── WorklogDetailsColumns.java │ │ │ ├── dto │ │ │ ├── ConvertedSearchParam.java │ │ │ ├── DownloadWorklogDetailsParam.java │ │ │ ├── FilterCondition.java │ │ │ ├── IssueSummaryDTO.java │ │ │ ├── IssueSummaryReportDTO.java │ │ │ ├── MissingsPageingDTO.java │ │ │ ├── MissingsWorklogsDTO.java │ │ │ ├── OrderBy.java │ │ │ ├── PagingDTO.java │ │ │ ├── PickerComponentDTO.java │ │ │ ├── PickerEpicLinkDTO.java │ │ │ ├── PickerLabelDTO.java │ │ │ ├── PickerVersionDTO.java │ │ │ ├── ProjectSummaryDTO.java │ │ │ ├── ProjectSummaryReportDTO.java │ │ │ ├── ReportSearchParam.java │ │ │ ├── ReportingSessionData.java │ │ │ ├── UserForPickerDTO.java │ │ │ ├── UserPickerContainerDTO.java │ │ │ ├── UserSummaryDTO.java │ │ │ ├── UserSummaryReportDTO.java │ │ │ ├── WorklogDetailsDTO.java │ │ │ └── WorklogDetailsReportDTO.java │ │ │ ├── exception │ │ │ └── JTRPException.java │ │ │ ├── export │ │ │ ├── AbstractExportListReport.java │ │ │ ├── ExcelToCsvConverter.java │ │ │ ├── ExportSummariesListReport.java │ │ │ └── ExportWorklogDetailsListReport.java │ │ │ ├── query │ │ │ ├── AbstractReportQuery.java │ │ │ ├── IssueSummaryReportQueryBuilder.java │ │ │ ├── PickerComponentQuery.java │ │ │ ├── PickerEpicLinkQuery.java │ │ │ ├── PickerLabelQuery.java │ │ │ ├── PickerVersionQuery.java │ │ │ ├── ProjectSummaryReportQueryBuilder.java │ │ │ ├── UserSummaryReportQueryBuilder.java │ │ │ ├── WorklogDetailsReportQueryBuilder.java │ │ │ └── util │ │ │ │ └── QueryUtil.java │ │ │ ├── rest │ │ │ ├── DownloadReportResource.java │ │ │ ├── PagingReport.java │ │ │ └── PickerResource.java │ │ │ ├── util │ │ │ ├── ConverterUtil.java │ │ │ └── PermissionUtil.java │ │ │ └── web │ │ │ ├── JiraTimetrackerChartWebAction.java │ │ │ ├── JiraTimetrackerTableWebAction.java │ │ │ ├── JiraTimetrackerWorklogsWebAction.java │ │ │ ├── ReportingUserSettingsWebAction.java │ │ │ └── ReportingWebAction.java │ │ ├── settings │ │ ├── TimeTrackerSettingsHelper.java │ │ ├── TimeTrackerSettingsHelperImpl.java │ │ └── dto │ │ │ ├── GlobalSettingsKey.java │ │ │ ├── JTTPSettingsKey.java │ │ │ ├── ReportingGlobalSettings.java │ │ │ ├── ReportingSettingKey.java │ │ │ ├── SettingsMapper.java │ │ │ ├── TimeTrackerGlobalSettings.java │ │ │ ├── TimeTrackerUserSettings.java │ │ │ ├── TimeZoneTypes.java │ │ │ └── UserSettingKey.java │ │ ├── timetracker │ │ ├── plugin │ │ │ ├── DurationFormatter.java │ │ │ ├── IssueEstimatedTimeChecker.java │ │ │ ├── JiraTimetrackerAnalytics.java │ │ │ ├── PluginCondition.java │ │ │ ├── TimetrackerCondition.java │ │ │ ├── dto │ │ │ │ ├── ChartData.java │ │ │ │ ├── EveritWorklog.java │ │ │ │ ├── EveritWorklogComparator.java │ │ │ │ ├── PluginSettingsValues.java │ │ │ │ ├── ReportingSettingsValues.java │ │ │ │ ├── SummaryDTO.java │ │ │ │ ├── SummaryUnitDTO.java │ │ │ │ ├── TimetrackerReportsSessionData.java │ │ │ │ └── WorklogValues.java │ │ │ ├── exception │ │ │ │ └── WorklogException.java │ │ │ ├── util │ │ │ │ ├── DateTimeConverterUtil.java │ │ │ │ ├── ExceptionUtil.java │ │ │ │ ├── HashUtil.java │ │ │ │ ├── PiwikPropertiesUtil.java │ │ │ │ ├── PropertiesUtil.java │ │ │ │ ├── TimeAutoCompleteUtil.java │ │ │ │ └── VersionComperatorUtil.java │ │ │ └── web │ │ │ │ ├── AdminSettingsWebAction.java │ │ │ │ ├── JiraTimetrackerUserSettingsWebAction.java │ │ │ │ ├── JiraTimetrackerWebAction.java │ │ │ │ └── PermissionSettingsWebAction.java │ │ └── popup │ │ │ └── SurveyDialogWebAction.java │ │ └── updatenotifier │ │ ├── TimetrackerVersionUpdater.java │ │ ├── UpdateNotifier.java │ │ ├── exception │ │ └── UpdateException.java │ │ ├── json │ │ ├── Embedded.java │ │ ├── JiraMarketplaceJSONDTO.java │ │ └── Version.java │ │ └── rest │ │ └── UpdateNotifierRest.java └── resources │ ├── atlassian-plugin.xml │ ├── css │ ├── admin_settings.css │ ├── bootstrap-progress.css │ ├── jtrp-aui-table-sortable.css │ ├── jttp.css │ ├── news_popup.css │ ├── reporting.css │ ├── update_notifier.css │ └── user_settings.css │ ├── i18n │ ├── jtrp.properties │ ├── jtrp_hu.properties │ ├── jttp.properties │ └── jttp_hu.properties │ ├── icons │ ├── E_logo.png │ ├── e_logo16.png │ ├── e_logo72.png │ ├── jttp144.png │ └── jttp16.png │ ├── images │ ├── additional.png │ ├── remain.png │ └── timezone.png │ ├── js │ ├── chart_report.js │ ├── jttp.js │ ├── jttp_admin_setting.js │ ├── missing_days_report.js │ ├── moment-with-locales.js │ ├── popup │ │ └── survey-dialog.js │ ├── report_common_scripts.js │ ├── reporting.js │ ├── reporting_user_settings.js │ └── update_notifier.js │ ├── jttp_build.properties │ └── templates │ ├── common │ ├── analytics.vm │ ├── error.vm │ ├── timeselect.vm │ └── updatenotifier.vm │ ├── popup │ └── survey-dialog.vm │ ├── reporting │ ├── chart_report.vm │ ├── missing_worklogs_report.vm │ ├── reporting.vm │ ├── reporting_popup.vm │ ├── reporting_result.vm │ ├── reporting_result_issue_summary.vm │ ├── reporting_result_project_summary.vm │ ├── reporting_result_summaries.vm │ ├── reporting_result_user_summary.vm │ ├── reporting_result_worklog_details.vm │ ├── reportingusersettings.vm │ ├── table_report.vm │ └── table_report_list.vm │ └── timetracker │ ├── adminsettings.vm │ ├── delete_confirmation_dialog.vm │ ├── jttp-head.vm │ ├── jttp.vm │ ├── list.vm │ ├── permission_settings.vm │ ├── summary.vm │ └── user_settings.vm └── test └── java └── org └── everit └── jira └── tests ├── core ├── DummyDateTimeFromatter.java ├── impl │ ├── supportmanager │ │ ├── GetDatesTest.java │ │ ├── GetDatesTestWithUserTimeZone.java │ │ ├── GetProjectIdsTest.java │ │ └── SummaryTest.java │ ├── timetrackermanager │ │ ├── CountWorkDaysInWeekTest.java │ │ ├── FirstMissingWorklogsDateTest.java │ │ ├── GetExtraDaysOfTheMonthTest.java │ │ ├── GetLoggedDaysOfTheMonthTest.java │ │ └── LastEndTimeTest.java │ └── worklogmanager │ │ ├── CreateWorklogTest.java │ │ ├── DeleteWorklogTest.java │ │ ├── EditWorklogTest.java │ │ ├── GetWorklogTest.java │ │ └── GetWorklogsTest.java └── util │ ├── DateTImeConverterUtilTest.java │ ├── TimetrackerUtilTest.java │ └── WorklogUtilTest.java ├── settings ├── DummyPluginSettings.java └── SettingsLoadTest.java ├── timetracker └── plugin │ ├── DurationBuilder.java │ ├── DurationFormatterTest.java │ ├── VersionComperatorTest.java │ └── dto │ └── EveritWorklogTest.java ├── updatenotifier └── UpdateNotifierTest.java └── util └── converterUtilForTests.java /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | .project 3 | .classpath 4 | .settings 5 | .checkstyle 6 | .fbExcludeFilterFile 7 | .pmd 8 | .pmdruleset.xml 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: java 3 | jdk: 4 | - openjdk7 5 | script: mvn verify 6 | install: true 7 | cache: 8 | directories: 9 | - $HOME/.m2 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | jira-timetracker-plugin 2 | ======================= 3 | 4 | Sharing values is part of our culture, so it was obvious that we would share Timetracker with JIRA users on github and the Atlassian Marketplace. Timetracker is now installed in more than 2000 systems. We would like to thank you - this superb community - for sending us so many feedback, opinions, development suggestions and critical remarks. 5 | 6 | To keep serving your requests in a professional way, from version 3.5.0, the Timetracker for JIRA Add-on will be released as a Paid-via-Atlassian Add-on. 7 | It's important to know, that the free versions (up to 2.8.4 and 3.4.4) and this repository will remain available, but we will stop supporting them. Furthermore, the source code will no longer be managed here in the future. 8 | 9 | Check out the Timetracker's page on the [Marketplace](https://marketplace.atlassian.com/plugins/org.everit.jira.timetracker.plugin/server/overview) to see more information about the pricing and what you get in the new paid version. 10 | If you have any questions/suggestions about Timetracker, feel free to contact us at support.ejs@everit.biz or info@everit.biz. 11 | 12 | [![Analytics](https://ga-beacon.appspot.com/UA-15041869-4/everit-org/jira-timetracker-plugin)](https://github.com/igrigorik/ga-beacon) 13 | -------------------------------------------------------------------------------- /assembly.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 23 | jar-with-dependencies 24 | 25 | 26 | jar 27 | 28 | 29 | false 30 | 31 | 32 | true 33 | compile 34 | true 35 | / 36 | 37 | org.everit.jira.timetracker:* 38 | com.atlassian.usercompatibility:* 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /plugin/src/main/resources/images/navigate_left2_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/everit-org/jira-timetracker-plugin/55c1f169e5495e3b697355f70eb2bd27d48c2d92/plugin/src/main/resources/images/navigate_left2_16.png -------------------------------------------------------------------------------- /plugin/src/main/resources/images/navigate_left_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/everit-org/jira-timetracker-plugin/55c1f169e5495e3b697355f70eb2bd27d48c2d92/plugin/src/main/resources/images/navigate_left_16.png -------------------------------------------------------------------------------- /plugin/src/main/resources/templates/images/navigate_left2_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/everit-org/jira-timetracker-plugin/55c1f169e5495e3b697355f70eb2bd27d48c2d92/plugin/src/main/resources/templates/images/navigate_left2_16.png -------------------------------------------------------------------------------- /plugin/src/main/resources/templates/images/navigate_left_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/everit-org/jira-timetracker-plugin/55c1f169e5495e3b697355f70eb2bd27d48c2d92/plugin/src/main/resources/templates/images/navigate_left_16.png -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/analytics/AnalyticsDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.analytics; 17 | 18 | import java.io.Serializable; 19 | 20 | /** 21 | * Contains required details to analytics. 22 | */ 23 | public class AnalyticsDTO implements Serializable { 24 | 25 | private static final long serialVersionUID = 8679468686190076439L; 26 | 27 | private boolean analyticsCheck; 28 | 29 | private String baseUrl; 30 | 31 | private String installedPluginId; 32 | 33 | private String jiraVersion; 34 | 35 | private String piwikHost; 36 | 37 | private String piwikSiteId; 38 | 39 | private String pluginVersion; 40 | 41 | private String userId; 42 | 43 | public AnalyticsDTO analyticsCheck(final boolean analyticsCheck) { 44 | this.analyticsCheck = analyticsCheck; 45 | return this; 46 | } 47 | 48 | public AnalyticsDTO baseUrl(final String baseUrl) { 49 | this.baseUrl = baseUrl; 50 | return this; 51 | } 52 | 53 | public String getBaseUrl() { 54 | return baseUrl; 55 | } 56 | 57 | public String getInstalledPluginId() { 58 | return installedPluginId; 59 | } 60 | 61 | public String getJiraVersion() { 62 | return jiraVersion; 63 | } 64 | 65 | public String getPiwikHost() { 66 | return piwikHost; 67 | } 68 | 69 | public String getPiwikSiteId() { 70 | return piwikSiteId; 71 | } 72 | 73 | public String getPluginVersion() { 74 | return pluginVersion; 75 | } 76 | 77 | public String getUserId() { 78 | return userId; 79 | } 80 | 81 | public AnalyticsDTO installedPluginId(final String installedPluginId) { 82 | this.installedPluginId = installedPluginId; 83 | return this; 84 | } 85 | 86 | public boolean isAnalyticsCheck() { 87 | return analyticsCheck; 88 | } 89 | 90 | public AnalyticsDTO jiraVersion(final String jiraVersion) { 91 | this.jiraVersion = jiraVersion; 92 | return this; 93 | } 94 | 95 | public AnalyticsDTO piwikHost(final String piwikHost) { 96 | this.piwikHost = piwikHost; 97 | return this; 98 | } 99 | 100 | public AnalyticsDTO piwikSiteId(final String piwikSiteId) { 101 | this.piwikSiteId = piwikSiteId; 102 | return this; 103 | } 104 | 105 | public AnalyticsDTO pluginVersion(final String pluginVersion) { 106 | this.pluginVersion = pluginVersion; 107 | return this; 108 | } 109 | 110 | public AnalyticsDTO userId(final String userId) { 111 | this.userId = userId; 112 | return this; 113 | } 114 | 115 | } 116 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/analytics/AnalyticsSender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.analytics; 17 | 18 | import org.everit.jira.analytics.event.AnalyticsEvent; 19 | 20 | /** 21 | * The AnalyticsSender interface. 22 | */ 23 | public interface AnalyticsSender { 24 | 25 | /** 26 | * Send analytics event to Analytics application. 27 | * 28 | * @param analyticsEvent 29 | * the {@link AnalyticsEvent}. 30 | */ 31 | void send(AnalyticsEvent analyticsEvent); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/analytics/AnalyticsSenderImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.analytics; 17 | 18 | import java.io.IOException; 19 | import java.util.concurrent.ExecutorService; 20 | import java.util.concurrent.Executors; 21 | 22 | import org.apache.commons.httpclient.HttpClient; 23 | import org.apache.commons.httpclient.methods.GetMethod; 24 | import org.everit.jira.analytics.event.AnalyticsEvent; 25 | import org.springframework.beans.factory.DisposableBean; 26 | import org.springframework.beans.factory.InitializingBean; 27 | 28 | /** 29 | * Implementation of {@link AnalyticsSender}. 30 | */ 31 | public class AnalyticsSenderImpl implements InitializingBean, DisposableBean, AnalyticsSender { 32 | 33 | /** 34 | * Sender command that send event to analytics application. 35 | */ 36 | private static class Command implements Runnable { 37 | 38 | private final AnalyticsEvent analyticsEvent; 39 | 40 | Command(final AnalyticsEvent analyticsEvent) { 41 | this.analyticsEvent = analyticsEvent; 42 | } 43 | 44 | @Override 45 | public void run() { 46 | try { 47 | HttpClient httpClient = new HttpClient(); 48 | String url = analyticsEvent.getUrl(); 49 | GetMethod getMethod = new GetMethod(url); 50 | httpClient.executeMethod(getMethod); 51 | } catch (IOException e) { 52 | // do nothing 53 | } 54 | } 55 | } 56 | 57 | private static final int MAX_THREAD = 4; 58 | 59 | private ExecutorService executorService; 60 | 61 | @Override 62 | public void afterPropertiesSet() throws Exception { 63 | executorService = Executors.newFixedThreadPool(MAX_THREAD); 64 | } 65 | 66 | @Override 67 | public void destroy() throws Exception { 68 | executorService.shutdown(); 69 | } 70 | 71 | @Override 72 | public void send(final AnalyticsEvent analyticsEvent) { 73 | executorService.execute(new Command(analyticsEvent)); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/analytics/UserSelection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.analytics; 17 | 18 | /** 19 | * The user selections in search. 20 | */ 21 | public enum UserSelection { 22 | 23 | GROUP, 24 | 25 | ONLY_OWN, 26 | 27 | USER; 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/analytics/event/ActiveFieldDurationChangedEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.analytics.event; 17 | 18 | import java.util.Objects; 19 | 20 | import org.everit.jira.analytics.PiwikUrlBuilder; 21 | import org.everit.jira.timetracker.plugin.JiraTimetrackerAnalytics; 22 | import org.everit.jira.timetracker.plugin.util.PiwikPropertiesUtil; 23 | 24 | /** 25 | * Progress indicator appearance changed (daily/summary) event. 26 | */ 27 | public class ActiveFieldDurationChangedEvent implements AnalyticsEvent { 28 | 29 | private static final String ACTION_URL = 30 | "http://customer.jira.com/secure/TimetrackerUserSettingsWebAction!default.jspa"; 31 | 32 | private static final String EVENT_ACTION = "EndTimeOrDur"; 33 | 34 | private static final String EVENT_CATEGORY = "User"; 35 | 36 | private static final String EVENT_NAME_DURATION = "duration"; 37 | 38 | private static final String EVENT_NAME_ENDTIME = "endTime"; 39 | 40 | private final boolean activeFieldDuration; 41 | 42 | private final String hashUserId; 43 | 44 | private final String pluginId; 45 | 46 | /** 47 | * Simple constructor. 48 | * 49 | * @param pluginId 50 | * the installed plugin id. 51 | * @param activeFieldDuration 52 | * the status of active duration field is duration or not.. 53 | */ 54 | public ActiveFieldDurationChangedEvent(final String pluginId, 55 | final boolean activeFieldDuration) { 56 | this.pluginId = Objects.requireNonNull(pluginId); 57 | this.activeFieldDuration = activeFieldDuration; 58 | hashUserId = JiraTimetrackerAnalytics.getUserId(); 59 | } 60 | 61 | @Override 62 | public String getUrl() { 63 | return new PiwikUrlBuilder(ACTION_URL, PiwikPropertiesUtil.PIWIK_USERSETTINGS_SITEID, 64 | pluginId, hashUserId) 65 | .addEventCategory(EVENT_CATEGORY) 66 | .addEventAction(EVENT_ACTION) 67 | .addEventName(activeFieldDuration 68 | ? EVENT_NAME_DURATION 69 | : EVENT_NAME_ENDTIME) 70 | .buildUrl(); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/analytics/event/AnalyticsEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.analytics.event; 17 | 18 | /** 19 | * Describe analytics event. 20 | */ 21 | public interface AnalyticsEvent { 22 | 23 | /** 24 | * Gets analytics application url that contains all analytics information. 25 | */ 26 | String getUrl(); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/analytics/event/AnalyticsStatusChangedEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.analytics.event; 17 | 18 | import java.util.Objects; 19 | 20 | import org.everit.jira.analytics.PiwikUrlBuilder; 21 | import org.everit.jira.timetracker.plugin.JiraTimetrackerAnalytics; 22 | import org.everit.jira.timetracker.plugin.util.PiwikPropertiesUtil; 23 | 24 | /** 25 | * Analytics status changed (disable/enable) event. 26 | */ 27 | public class AnalyticsStatusChangedEvent implements AnalyticsEvent { 28 | 29 | private static final String ACTION_URL = 30 | "http://customer.jira.com/secure/admin/TimetrackerAdminSettingsWebAction!default.jspa"; 31 | 32 | private static final String EVENT_ACTION = "Change"; 33 | 34 | private static final String EVENT_CATEGORY = "Analytics Status"; 35 | 36 | private static final String EVENT_NAME_DISABLED = "disabled"; 37 | 38 | private static final String EVENT_NAME_ENABLED = "enabled"; 39 | 40 | private final String hashUserId; 41 | 42 | private final String pluginId; 43 | 44 | private final boolean status; 45 | 46 | /** 47 | * Simple constructor. 48 | * 49 | * @param pluginId 50 | * the installed plugin id. 51 | * @param status 52 | * the status of analytics (enabled (true) or disabled (false)). 53 | */ 54 | public AnalyticsStatusChangedEvent(final String pluginId, final boolean status) { 55 | this.pluginId = Objects.requireNonNull(pluginId); 56 | this.status = status; 57 | hashUserId = JiraTimetrackerAnalytics.getUserId(); 58 | } 59 | 60 | @Override 61 | public String getUrl() { 62 | return new PiwikUrlBuilder(ACTION_URL, PiwikPropertiesUtil.PIWIK_ADMINISTRATION_SITEID, 63 | pluginId, hashUserId) 64 | .addEventCategory(EVENT_CATEGORY) 65 | .addEventAction(EVENT_ACTION) 66 | .addEventName(status 67 | ? EVENT_NAME_ENABLED 68 | : EVENT_NAME_DISABLED) 69 | .buildUrl(); 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/analytics/event/ExportSummaryReportEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.analytics.event; 17 | 18 | import java.util.Objects; 19 | 20 | import org.everit.jira.analytics.PiwikUrlBuilder; 21 | import org.everit.jira.timetracker.plugin.JiraTimetrackerAnalytics; 22 | import org.everit.jira.timetracker.plugin.util.PiwikPropertiesUtil; 23 | 24 | /** 25 | * Export summary report event. 26 | */ 27 | public class ExportSummaryReportEvent implements AnalyticsEvent { 28 | 29 | private static final String ACTION_URL = 30 | "http://customer.jira.com/secure/ReportingWebAction!default.jspa"; 31 | 32 | public static final String EVENT_ACTION_CSV = "Export Summary CSV"; 33 | 34 | public static final String EVENT_ACTION_EXCEL = "Export Summary"; 35 | 36 | private static final String EVENT_CATEGORY = "Reporting"; 37 | 38 | private final String eventAction; 39 | 40 | private final String hashUserId; 41 | 42 | private final String pluginId; 43 | 44 | /** 45 | * Simple constructor. 46 | * 47 | * @param pluginId 48 | * the installed plugin id. 49 | */ 50 | public ExportSummaryReportEvent(final String pluginId, final String eventAction) { 51 | this.pluginId = Objects.requireNonNull(pluginId); 52 | hashUserId = JiraTimetrackerAnalytics.getUserId(); 53 | this.eventAction = eventAction; 54 | } 55 | 56 | @Override 57 | public String getUrl() { 58 | return new PiwikUrlBuilder(ACTION_URL, PiwikPropertiesUtil.PIWIK_REPORTING_SITEID, 59 | pluginId, hashUserId) 60 | .addEventCategory(EVENT_CATEGORY) 61 | .addEventAction(eventAction) 62 | .buildUrl(); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/analytics/event/ExportWorklogDetailsReportEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.analytics.event; 17 | 18 | import java.util.Objects; 19 | 20 | import org.everit.jira.analytics.PiwikUrlBuilder; 21 | import org.everit.jira.timetracker.plugin.JiraTimetrackerAnalytics; 22 | import org.everit.jira.timetracker.plugin.util.PiwikPropertiesUtil; 23 | 24 | /** 25 | * Export worklog details report event. 26 | */ 27 | public class ExportWorklogDetailsReportEvent implements AnalyticsEvent { 28 | /** 29 | * Enumeration of work log details export analytics event names. 30 | */ 31 | public enum WorkLogDetailsExportFormat { 32 | CSV { 33 | @Override 34 | public String decideAnalyticsEvenName(final boolean allColumns) { 35 | return allColumns ? EVENT_NAME_ALL_FIELDS_CSV : EVENT_NAME_CUSTOM_FIELDS_CSV; 36 | } 37 | }, 38 | EXCEL { 39 | @Override 40 | public String decideAnalyticsEvenName(final boolean allColumns) { 41 | return allColumns ? EVENT_NAME_ALL_FIELDS : EVENT_NAME_CUSTOM_FIELDS; 42 | } 43 | }; 44 | public abstract String decideAnalyticsEvenName(boolean allColumns); 45 | } 46 | 47 | private static final String ACTION_URL = 48 | "http://customer.jira.com/secure/ReportingWebAction!default.jspa"; 49 | 50 | private static final String EVENT_ACTION = "Export Worklog Details"; 51 | 52 | private static final String EVENT_CATEGORY = "Reporting"; 53 | 54 | private static final String EVENT_NAME_ALL_FIELDS = "all-fields"; 55 | 56 | private static final String EVENT_NAME_ALL_FIELDS_CSV = "all-fields-csv"; 57 | 58 | private static final String EVENT_NAME_CUSTOM_FIELDS = "custom-fields"; 59 | 60 | private static final String EVENT_NAME_CUSTOM_FIELDS_CSV = "custom-fields-csv"; 61 | 62 | private final boolean allColumns; 63 | 64 | private WorkLogDetailsExportFormat exportFormat; 65 | 66 | private final String hashUserId; 67 | 68 | private final String pluginId; 69 | 70 | /** 71 | * Simple constructor. 72 | * 73 | * @param pluginId 74 | * the installed plugin id. 75 | * @param allColumns 76 | * selected all columns or not. 77 | */ 78 | public ExportWorklogDetailsReportEvent(final String pluginId, final boolean allColumns, 79 | final WorkLogDetailsExportFormat exportFormat) { 80 | this.pluginId = Objects.requireNonNull(pluginId); 81 | hashUserId = JiraTimetrackerAnalytics.getUserId(); 82 | this.allColumns = allColumns; 83 | this.exportFormat = exportFormat; 84 | } 85 | 86 | @Override 87 | public String getUrl() { 88 | return new PiwikUrlBuilder(ACTION_URL, PiwikPropertiesUtil.PIWIK_REPORTING_SITEID, 89 | pluginId, hashUserId) 90 | .addEventCategory(EVENT_CATEGORY) 91 | .addEventAction(EVENT_ACTION) 92 | .addEventName(exportFormat.decideAnalyticsEvenName(allColumns)) 93 | .buildUrl(); 94 | } 95 | 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/analytics/event/NonWorkingUsageEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.analytics.event; 17 | 18 | import java.util.Objects; 19 | 20 | import org.everit.jira.analytics.PiwikUrlBuilder; 21 | import org.everit.jira.timetracker.plugin.JiraTimetrackerAnalytics; 22 | import org.everit.jira.timetracker.plugin.util.PiwikPropertiesUtil; 23 | 24 | /** 25 | * Event for Non-working issues field usage analytics. 26 | */ 27 | public class NonWorkingUsageEvent implements AnalyticsEvent { 28 | 29 | private static final String ACTION_URL = 30 | "http://customer.jira.com/secure/admin/TimetrackerAdminSettingsWebAction!default.jspa"; 31 | 32 | private static final String EVENT_ACTION_NAME = "noWorkUsage"; 33 | 34 | private static final String EVENT_CATEGORY_NAME = "Non-working usage"; 35 | 36 | private final String hashUserId; 37 | 38 | private final boolean nonWorkIsEmpty; 39 | 40 | private final String pluginId; 41 | 42 | /** 43 | * Simple constructor. 44 | * 45 | * @param pluginId 46 | * the installed plugin id. 47 | * @param nonWorkingIsEmpty 48 | * the Non-working issues input filed is empty or not. 49 | */ 50 | public NonWorkingUsageEvent(final String pluginId, 51 | final boolean nonWorkingIsEmpty) { 52 | this(pluginId, nonWorkingIsEmpty, JiraTimetrackerAnalytics.getUserId()); 53 | } 54 | 55 | /** 56 | * Simple constructor. 57 | * 58 | * @param pluginId 59 | * the installed plugin id. 60 | * @param nonWorkingIsEmpty 61 | * the Non-working issues input filed is empty or not. 62 | * @param hashUserId 63 | * the user hash id 64 | */ 65 | public NonWorkingUsageEvent(final String pluginId, 66 | final boolean nonWorkingIsEmpty, final String hashUserId) { 67 | this.pluginId = Objects.requireNonNull(pluginId); 68 | this.hashUserId = hashUserId; 69 | nonWorkIsEmpty = nonWorkingIsEmpty; 70 | } 71 | 72 | @Override 73 | public String getUrl() { 74 | return new PiwikUrlBuilder(ACTION_URL, PiwikPropertiesUtil.PIWIK_ADMINISTRATION_SITEID, 75 | pluginId, hashUserId) 76 | .addEventAction(EVENT_ACTION_NAME) 77 | .addEventName(String.valueOf(!nonWorkIsEmpty)) 78 | .addEventCategory(EVENT_CATEGORY_NAME) 79 | .buildUrl(); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/analytics/event/ProgressIndicatorChangedEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.analytics.event; 17 | 18 | import java.util.Objects; 19 | 20 | import org.everit.jira.analytics.PiwikUrlBuilder; 21 | import org.everit.jira.timetracker.plugin.JiraTimetrackerAnalytics; 22 | import org.everit.jira.timetracker.plugin.util.PiwikPropertiesUtil; 23 | 24 | /** 25 | * Progress indicator appearance changed (daily/summary) event. 26 | */ 27 | public class ProgressIndicatorChangedEvent implements AnalyticsEvent { 28 | 29 | private static final String ACTION_URL = 30 | "http://customer.jira.com/secure/TimetrackerUserSettingsWebAction!default.jspa"; 31 | 32 | private static final String EVENT_ACTION = "IndicatorChange"; 33 | 34 | private static final String EVENT_CATEGORY = "User"; 35 | 36 | private static final String EVENT_NAME_DAILY = "dailyInd"; 37 | 38 | private static final String EVENT_NAME_SUMMARY = "summaryInd"; 39 | 40 | private final String hashUserId; 41 | 42 | private final String pluginId; 43 | 44 | private final boolean status; 45 | 46 | /** 47 | * Simple constructor. 48 | * 49 | * @param pluginId 50 | * the installed plugin id. 51 | * @param status 52 | * the status of indicator (daily (true) or summary (false)). 53 | */ 54 | public ProgressIndicatorChangedEvent(final String pluginId, final boolean status) { 55 | this.pluginId = Objects.requireNonNull(pluginId); 56 | this.status = status; 57 | hashUserId = JiraTimetrackerAnalytics.getUserId(); 58 | } 59 | 60 | @Override 61 | public String getUrl() { 62 | return new PiwikUrlBuilder(ACTION_URL, PiwikPropertiesUtil.PIWIK_USERSETTINGS_SITEID, 63 | pluginId, hashUserId) 64 | .addEventCategory(EVENT_CATEGORY) 65 | .addEventAction(EVENT_ACTION) 66 | .addEventName(status 67 | ? EVENT_NAME_DAILY 68 | : EVENT_NAME_SUMMARY) 69 | .buildUrl(); 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/analytics/event/ShowFutureLogWarningChangedEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.analytics.event; 17 | 18 | import java.util.Objects; 19 | 20 | import org.everit.jira.analytics.PiwikUrlBuilder; 21 | import org.everit.jira.timetracker.plugin.JiraTimetrackerAnalytics; 22 | import org.everit.jira.timetracker.plugin.util.PiwikPropertiesUtil; 23 | 24 | /** 25 | * Progress indicator appearance changed (daily/summary) event. 26 | */ 27 | public class ShowFutureLogWarningChangedEvent implements AnalyticsEvent { 28 | 29 | private static final String ACTION_URL = 30 | "http://customer.jira.com/secure/TimetrackerUserSettingsWebAction!default.jspa"; 31 | 32 | private static final String EVENT_ACTION = "FutureNotif"; 33 | 34 | private static final String EVENT_CATEGORY = "User"; 35 | 36 | private static final String EVENT_NAME_OFF = "futureNotifOff"; 37 | 38 | private static final String EVENT_NAME_ON = "futureNotifOn"; 39 | 40 | private final String hashUserId; 41 | 42 | private final String pluginId; 43 | 44 | private final boolean showFutureLogWarning; 45 | 46 | /** 47 | * Simple constructor. 48 | * 49 | * @param pluginId 50 | * the installed plugin id. 51 | * @param showFutureLogWarning 52 | * the status of show future log warning or not. 53 | */ 54 | public ShowFutureLogWarningChangedEvent(final String pluginId, 55 | final boolean showFutureLogWarning) { 56 | this.pluginId = Objects.requireNonNull(pluginId); 57 | this.showFutureLogWarning = showFutureLogWarning; 58 | hashUserId = JiraTimetrackerAnalytics.getUserId(); 59 | } 60 | 61 | @Override 62 | public String getUrl() { 63 | return new PiwikUrlBuilder(ACTION_URL, PiwikPropertiesUtil.PIWIK_USERSETTINGS_SITEID, 64 | pluginId, hashUserId) 65 | .addEventCategory(EVENT_CATEGORY) 66 | .addEventAction(EVENT_ACTION) 67 | .addEventName(showFutureLogWarning 68 | ? EVENT_NAME_ON 69 | : EVENT_NAME_OFF) 70 | .buildUrl(); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/analytics/event/ShowIssueSummaryChangedEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.analytics.event; 17 | 18 | import java.util.Objects; 19 | 20 | import org.everit.jira.analytics.PiwikUrlBuilder; 21 | import org.everit.jira.timetracker.plugin.JiraTimetrackerAnalytics; 22 | import org.everit.jira.timetracker.plugin.util.PiwikPropertiesUtil; 23 | 24 | /** 25 | * Progress indicator appearance changed (daily/summary) event. 26 | */ 27 | public class ShowIssueSummaryChangedEvent implements AnalyticsEvent { 28 | 29 | private static final String ACTION_URL = 30 | "http://customer.jira.com/secure/TimetrackerUserSettingsWebAction!default.jspa"; 31 | 32 | private static final String EVENT_ACTION = "KeyOrSummary"; 33 | 34 | private static final String EVENT_CATEGORY = "User"; 35 | 36 | private static final String EVENT_NAME_KEY = "issueKey"; 37 | 38 | private static final String EVENT_NAME_SUMMARY = "issueSummary"; 39 | 40 | private final String hashUserId; 41 | 42 | private final String pluginId; 43 | 44 | private final boolean showIssueSummary; 45 | 46 | /** 47 | * Simple constructor. 48 | * 49 | * @param pluginId 50 | * the installed plugin id. 51 | * @param showIssueSummary 52 | * the status of show issue summary or not. 53 | */ 54 | public ShowIssueSummaryChangedEvent(final String pluginId, final boolean showIssueSummary) { 55 | this.pluginId = Objects.requireNonNull(pluginId); 56 | this.showIssueSummary = showIssueSummary; 57 | hashUserId = JiraTimetrackerAnalytics.getUserId(); 58 | } 59 | 60 | @Override 61 | public String getUrl() { 62 | return new PiwikUrlBuilder(ACTION_URL, PiwikPropertiesUtil.PIWIK_USERSETTINGS_SITEID, 63 | pluginId, hashUserId) 64 | .addEventCategory(EVENT_CATEGORY) 65 | .addEventAction(EVENT_ACTION) 66 | .addEventName(showIssueSummary 67 | ? EVENT_NAME_SUMMARY 68 | : EVENT_NAME_KEY) 69 | .buildUrl(); 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/analytics/event/ShowRemaningEstimateChangedEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.analytics.event; 17 | 18 | import java.util.Objects; 19 | 20 | import org.everit.jira.analytics.PiwikUrlBuilder; 21 | import org.everit.jira.timetracker.plugin.JiraTimetrackerAnalytics; 22 | import org.everit.jira.timetracker.plugin.util.PiwikPropertiesUtil; 23 | 24 | /** 25 | * Progress indicator appearance changed (daily/summary) event. 26 | */ 27 | public class ShowRemaningEstimateChangedEvent implements AnalyticsEvent { 28 | 29 | private static final String ACTION_URL = 30 | "http://customer.jira.com/secure/TimetrackerUserSettingsWebAction!default.jspa"; 31 | 32 | private static final String EVENT_ACTION = "RemEstUsage"; 33 | 34 | private static final String EVENT_CATEGORY = "User"; 35 | 36 | private static final String EVENT_NAME_OFF = "remEstOff"; 37 | 38 | private static final String EVENT_NAME_ON = "remEstOn"; 39 | 40 | private final String hashUserId; 41 | 42 | private final String pluginId; 43 | 44 | private final boolean showRemaningEstimate; 45 | 46 | /** 47 | * Simple constructor. 48 | * 49 | * @param pluginId 50 | * the installed plugin id. 51 | * @param showRemaningEstimate 52 | * the status of remaining estimate options or not.. 53 | */ 54 | public ShowRemaningEstimateChangedEvent(final String pluginId, 55 | final boolean showRemaningEstimate) { 56 | this.pluginId = Objects.requireNonNull(pluginId); 57 | this.showRemaningEstimate = showRemaningEstimate; 58 | hashUserId = JiraTimetrackerAnalytics.getUserId(); 59 | } 60 | 61 | @Override 62 | public String getUrl() { 63 | return new PiwikUrlBuilder(ACTION_URL, PiwikPropertiesUtil.PIWIK_USERSETTINGS_SITEID, 64 | pluginId, hashUserId) 65 | .addEventCategory(EVENT_CATEGORY) 66 | .addEventAction(EVENT_ACTION) 67 | .addEventName(showRemaningEstimate 68 | ? EVENT_NAME_ON 69 | : EVENT_NAME_OFF) 70 | .buildUrl(); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/analytics/event/TimeZoneUsageChangedEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.analytics.event; 17 | 18 | import java.util.Objects; 19 | 20 | import org.everit.jira.analytics.PiwikUrlBuilder; 21 | import org.everit.jira.settings.dto.TimeZoneTypes; 22 | import org.everit.jira.timetracker.plugin.JiraTimetrackerAnalytics; 23 | import org.everit.jira.timetracker.plugin.util.PiwikPropertiesUtil; 24 | 25 | /** 26 | * TimeZone usage changed event. 27 | */ 28 | public class TimeZoneUsageChangedEvent implements AnalyticsEvent { 29 | 30 | private static final String ACTION_URL = 31 | "http://customer.jira.com/secure/admin/TimetrackerAdminSettingsWebAction!default.jspa"; 32 | 33 | private static final String EVENT_ACTION = "timeZone"; 34 | 35 | private static final String EVENT_CATEGORY = "TimeZone usage"; 36 | 37 | private final String hashUserId; 38 | 39 | private final String pluginId; 40 | 41 | private final TimeZoneTypes status; 42 | 43 | /** 44 | * Simple constructor. 45 | * 46 | * @param pluginId 47 | * the installed plugin id. 48 | * @param status 49 | * the status of analytics (enabled (true) or disabled (false)). 50 | */ 51 | public TimeZoneUsageChangedEvent(final String pluginId, final TimeZoneTypes status) { 52 | this.pluginId = Objects.requireNonNull(pluginId); 53 | this.status = status; 54 | hashUserId = JiraTimetrackerAnalytics.getUserId(); 55 | } 56 | 57 | @Override 58 | public String getUrl() { 59 | return new PiwikUrlBuilder(ACTION_URL, PiwikPropertiesUtil.PIWIK_ADMINISTRATION_SITEID, 60 | pluginId, hashUserId) 61 | .addEventCategory(EVENT_CATEGORY) 62 | .addEventAction(EVENT_ACTION) 63 | .addEventName(status.getValue()) 64 | .buildUrl(); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/core/SupportManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.core; 17 | 18 | import java.util.Date; 19 | import java.util.List; 20 | import java.util.regex.Pattern; 21 | 22 | import org.everit.jira.core.impl.DateTimeServer; 23 | import org.everit.jira.reporting.plugin.dto.MissingsWorklogsDTO; 24 | import org.everit.jira.settings.dto.TimeTrackerGlobalSettings; 25 | import org.ofbiz.core.entity.GenericEntityException; 26 | 27 | /** 28 | * Provides common used methods for support about the plugin. 29 | */ 30 | public interface SupportManager { 31 | 32 | /** 33 | * Create a query and give back the list of dates where are no worklogs. The query examine the 34 | * days between the user creation date and the current date. The method not examine the weekends 35 | * and the properties file exclude dates but check the properties file include dates. 36 | * 37 | * @param from 38 | * The query from parameter, the date in user's TimeZone. 39 | * @param to 40 | * The query to parameter, the date in user's TimeZone. 41 | * @param workingHours 42 | * The report have to check the spent time or not. 43 | * @param nonWorking 44 | * Exclude or not the non-working issues. 45 | * @param settings 46 | * TODO 47 | * @return The list of the MissingsWorklogsDTO. 48 | * @throws GenericEntityException 49 | * If GenericEntity Exception. 50 | */ 51 | List getDates(DateTimeServer from, DateTimeServer to, boolean workingHours, 52 | boolean nonWorking, TimeTrackerGlobalSettings settings) throws GenericEntityException; 53 | 54 | /** 55 | * Give back the Projects. 56 | * 57 | * @return whit Projects. 58 | */ 59 | List getProjectsId(); 60 | 61 | /** 62 | * Give back the all worklogs spent time between the two date. 63 | * 64 | * @param startSummary 65 | * The start date. 66 | * @param finishSummary 67 | * The finish date. 68 | * @param issueIds 69 | * The filtered issues ids. If null or empty then don't make filtered summary. 70 | * @return The summary spent time in seconds. 71 | */ 72 | long summary(Date startSummary, Date finishSummary, List issueIds); 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/core/TimetrackerManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.core; 17 | 18 | import java.text.ParseException; 19 | import java.util.List; 20 | import java.util.Set; 21 | 22 | import org.everit.jira.core.impl.DateTimeServer; 23 | import org.everit.jira.timetracker.plugin.dto.EveritWorklog; 24 | import org.joda.time.DateTime; 25 | 26 | /** 27 | * Provides information for timetracker. 28 | */ 29 | public interface TimetrackerManager { 30 | 31 | /** 32 | * Count the real work days in a week. 33 | * 34 | * @param weekDaysAsString 35 | * the days of the week in yyyy-hh-mm format. 36 | * 37 | * @return the counted real work days number. 38 | */ 39 | double countRealWorkDaysInWeek(final List weekDaysAsString, 40 | final Set exludeDates, final Set includeDates); 41 | 42 | /** 43 | * Give back the date of the first day where missing worklogs. Use the properties files includes 44 | * and excludes date settings. 45 | * 46 | * @param currentDay 47 | * Represent the current day. 48 | * @param exludeDates 49 | * the excluded dates. 50 | * @param includeDates 51 | * the included dates. 52 | * 53 | * @return The Date representation of the day. 54 | */ 55 | DateTime firstMissingWorklogsDate(final Set excludeDatesSet, 56 | final Set includeDatesSet, DateTime currentDay); 57 | 58 | /** 59 | * The method find the exclude dates of the given date month. 60 | * 61 | * @param date 62 | * The date in User TimeZone. 63 | * @param exludeDates 64 | * the excluded dates. 65 | * @return The list of the days in String format. (Eg. ["12","15"]) 66 | */ 67 | List getExcludeDaysOfTheMonth(DateTime date, Set exludeDates); 68 | 69 | /** 70 | * The method find the include dates of the given date month. 71 | * 72 | * @param dateTime 73 | * The date in User TimeZone. 74 | * @param includeDates 75 | * the include dates. 76 | * @return The list of the days in String format. (Eg. ["12","15"]) 77 | */ 78 | List getIncludeDaysOfTheMonth(DateTime dateTime, Set includeDates); 79 | 80 | /** 81 | * The method find the logged days of the given date month. 82 | * 83 | * @param date 84 | * The date in DateTime with User Time Zone. 85 | * @return The list of the days in String format. (Eg. ["12","15"]) 86 | */ 87 | List getLoggedDaysOfTheMonth(DateTimeServer date); 88 | 89 | /** 90 | * Give back the biggest end time of the date after worklogs method. Or give back 08:00. 91 | * 92 | * @param worklogs 93 | * The worklogs. 94 | * @return The last end time. 95 | * @throws ParseException 96 | * When can't parse the worklog date. 97 | */ 98 | String lastEndTime(List worklogs) throws ParseException; 99 | } 100 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/core/dto/WorklogParameter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.core.dto; 17 | 18 | import org.everit.jira.core.RemainingEstimateType; 19 | import org.everit.jira.core.impl.DateTimeServer; 20 | 21 | /** 22 | * Contains information of worklog to create or edit process. 23 | */ 24 | public class WorklogParameter { 25 | 26 | private final String comment; 27 | 28 | private final DateTimeServer date; 29 | 30 | private final String issueKey; 31 | 32 | private final String optinalValue; 33 | 34 | private final RemainingEstimateType remainingEstimateType; 35 | 36 | private final String timeSpent; 37 | 38 | /** 39 | * Simple constructor. 40 | * 41 | * @param issueKey 42 | * the key of the issue. 43 | * @param comment 44 | * the note of the worklog. 45 | * @param date 46 | * the date of the worklog. 47 | * @param timeSpent 48 | * the spent time in the worklog (JIRA format: 1h 30m). 49 | * @param optinalValue 50 | * the optional value of the remaining estimate type. Example: newEstimate or 51 | * adjustEstimate value. 52 | * @param remainingEstimateType 53 | * the type of the remaining estimate. 54 | */ 55 | public WorklogParameter(final String issueKey, final String comment, final DateTimeServer date, 56 | final String timeSpent, final String optinalValue, 57 | final RemainingEstimateType remainingEstimateType) { 58 | this.issueKey = issueKey; 59 | this.comment = comment; 60 | this.date = date; 61 | this.timeSpent = timeSpent; 62 | this.optinalValue = optinalValue; 63 | this.remainingEstimateType = remainingEstimateType; 64 | } 65 | 66 | public String getComment() { 67 | return comment; 68 | } 69 | 70 | public DateTimeServer getDate() { 71 | return date != null ? date : null; 72 | } 73 | 74 | public String getIssueKey() { 75 | return issueKey; 76 | } 77 | 78 | public String getOptinalValue() { 79 | return optinalValue; 80 | } 81 | 82 | public RemainingEstimateType getRemainingEstimateType() { 83 | return remainingEstimateType; 84 | } 85 | 86 | public String getTimeSpent() { 87 | return timeSpent; 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/ReportingCondition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin; 17 | 18 | import java.util.Collection; 19 | import java.util.List; 20 | 21 | import org.everit.jira.settings.TimeTrackerSettingsHelper; 22 | 23 | import com.atlassian.jira.component.ComponentAccessor; 24 | import com.atlassian.jira.plugin.webfragment.conditions.AbstractWebCondition; 25 | import com.atlassian.jira.plugin.webfragment.model.JiraHelper; 26 | import com.atlassian.jira.user.ApplicationUser; 27 | 28 | /** 29 | * The reporting JTTP function condition class. You can set the reporting user groups at JTTP 30 | * Reporting admin site. The setted groups stored at jira settings. If no group is setted everybody 31 | * can use the reporting. 32 | */ 33 | public class ReportingCondition extends AbstractWebCondition { 34 | 35 | private TimeTrackerSettingsHelper settingsHelper; 36 | 37 | public ReportingCondition(final TimeTrackerSettingsHelper settingsHelper) { 38 | this.settingsHelper = settingsHelper; 39 | } 40 | 41 | @Override 42 | public boolean shouldDisplay(final ApplicationUser user, final JiraHelper jiraHelper) { 43 | List reportingGroups = 44 | settingsHelper.loadReportingGlobalSettings().getReportingGroups(); 45 | if (reportingGroups.isEmpty()) { 46 | return true; 47 | } 48 | Collection groupNamesForUser = 49 | ComponentAccessor.getGroupManager().getGroupNamesForUser(user); 50 | for (String reportingGroup : reportingGroups) { 51 | if (groupNamesForUser.contains(reportingGroup)) { 52 | return true; 53 | } 54 | } 55 | return false; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/ReportingPlugin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin; 17 | 18 | import org.everit.jira.reporting.plugin.dto.IssueSummaryReportDTO; 19 | import org.everit.jira.reporting.plugin.dto.OrderBy; 20 | import org.everit.jira.reporting.plugin.dto.ProjectSummaryReportDTO; 21 | import org.everit.jira.reporting.plugin.dto.ReportSearchParam; 22 | import org.everit.jira.reporting.plugin.dto.UserSummaryReportDTO; 23 | import org.everit.jira.reporting.plugin.dto.WorklogDetailsReportDTO; 24 | 25 | /** 26 | * The ReportingPlugin interface. 27 | */ 28 | public interface ReportingPlugin { 29 | 30 | IssueSummaryReportDTO getIssueSummaryReport(ReportSearchParam reportSearchParam); 31 | 32 | ProjectSummaryReportDTO getProjectSummaryReport(ReportSearchParam reportSearchParam); 33 | 34 | UserSummaryReportDTO getUserSummaryReport(ReportSearchParam reportSearchParam); 35 | 36 | WorklogDetailsReportDTO getWorklogDetailsReport(ReportSearchParam reportSearchParam, 37 | OrderBy orderBy); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/SearcherValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin; 17 | 18 | /** 19 | * The searcher values. 20 | */ 21 | public enum SearcherValue { 22 | 23 | BASIC("basic"), 24 | 25 | FILTER("filter"); 26 | 27 | public final String lowerCaseValue; 28 | 29 | SearcherValue(final String lowerCaseValue) { 30 | this.lowerCaseValue = lowerCaseValue; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/column/IssueSummaryColumns.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.column; 17 | 18 | /** 19 | * Define Issue Summary report columns. 20 | */ 21 | public final class IssueSummaryColumns { 22 | 23 | public static final String ASSIGNEE = "jtrp_col_assignee"; 24 | 25 | public static final String ESTIMATED = "jtrp_col_estimated"; 26 | 27 | public static final String EXPECTED = "jtrp_col_expected"; 28 | 29 | public static final String ISSUE = "jtrp_col_issue"; 30 | 31 | public static final String ISSUE_SUMMARY = "jtrp_col_issueSummary"; 32 | 33 | public static final String PRIORITY = "jtrp_col_priority"; 34 | 35 | public static final String REMAINING = "jtrp_col_remaining"; 36 | 37 | public static final String STATUS = "jtrp_col_status"; 38 | 39 | public static final String TOTAL_LOGGED = "jtrp_col_totalLogged"; 40 | 41 | public static final String TYPE = "jtrp_col_type"; 42 | 43 | private IssueSummaryColumns() { 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/column/ProjectSummaryColumns.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.column; 17 | 18 | /** 19 | * Define Project Summary report columns. 20 | */ 21 | public final class ProjectSummaryColumns { 22 | 23 | public static final String ESTIMATED = "jtrp_col_estimated"; 24 | 25 | public static final String EXPECTED_TOTAL = "jtrp_col_expectedTotal"; 26 | 27 | public static final String PROJECT = "jtrp_col_project"; 28 | 29 | public static final String PROJECT_KEY = "jtrp_col_projectKey"; 30 | 31 | public static final String REMAINING = "jtrp_col_remaining"; 32 | 33 | public static final String TOTAL_LOGGED = "jtrp_col_totalLogged"; 34 | 35 | private ProjectSummaryColumns() { 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/column/UserSummaryColumns.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.column; 17 | 18 | /** 19 | * Define User Summary report columns. 20 | */ 21 | public final class UserSummaryColumns { 22 | 23 | public static final String TOTAL_LOGGED = "jtrp_col_totalLogged"; 24 | 25 | public static final String USER = "jtrp_col_user"; 26 | 27 | private UserSummaryColumns() { 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/dto/ConvertedSearchParam.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.dto; 17 | 18 | import java.util.List; 19 | 20 | /** 21 | * Representation the converted search params. 22 | */ 23 | public class ConvertedSearchParam { 24 | 25 | public List notBrowsableProjectKeys; 26 | 27 | public ReportSearchParam reportSearchParam; 28 | 29 | public ConvertedSearchParam notBrowsableProjectKeys(final List notBrowsableProjectKeys) { 30 | this.notBrowsableProjectKeys = notBrowsableProjectKeys; 31 | return this; 32 | } 33 | 34 | public ConvertedSearchParam reportSearchParam(final ReportSearchParam reportSearchParam) { 35 | this.reportSearchParam = reportSearchParam; 36 | return this; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/dto/DownloadWorklogDetailsParam.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.dto; 17 | 18 | import java.util.List; 19 | 20 | import javax.xml.bind.annotation.XmlElement; 21 | import javax.xml.bind.annotation.XmlRootElement; 22 | 23 | import org.everit.jira.reporting.plugin.column.WorklogDetailsColumns; 24 | 25 | /** 26 | * Download worklog details parameter that containt the filter condition and the showable columns. 27 | */ 28 | @XmlRootElement 29 | public class DownloadWorklogDetailsParam { 30 | 31 | @XmlElement 32 | public FilterCondition filterCondition = new FilterCondition(); 33 | 34 | @XmlElement 35 | public List selectedWorklogDetailsColumns = WorklogDetailsColumns.ALL_COLUMNS; 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/dto/IssueSummaryReportDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.dto; 17 | 18 | import java.util.Collections; 19 | import java.util.List; 20 | 21 | /** 22 | * Contains information to issue summary report table. 23 | */ 24 | public class IssueSummaryReportDTO { 25 | 26 | private List issueSummaries = Collections.emptyList(); 27 | 28 | private Long issueSummaryCount = 0L; 29 | 30 | private PagingDTO paging = new PagingDTO(); 31 | 32 | public List getIssueSummaries() { 33 | return issueSummaries; 34 | } 35 | 36 | public Long getIssueSummaryCount() { 37 | return issueSummaryCount; 38 | } 39 | 40 | public PagingDTO getPaging() { 41 | return paging; 42 | } 43 | 44 | public IssueSummaryReportDTO issueSummaries(final List issueSummaries) { 45 | this.issueSummaries = issueSummaries; 46 | return this; 47 | } 48 | 49 | public IssueSummaryReportDTO issueSummaryCount(final Long issueSummaryCount) { 50 | this.issueSummaryCount = issueSummaryCount; 51 | return this; 52 | } 53 | 54 | public IssueSummaryReportDTO paging(final PagingDTO paging) { 55 | this.paging = paging; 56 | return this; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/dto/MissingsPageingDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.dto; 17 | 18 | /** 19 | * Contains information to missings paging. 20 | */ 21 | public class MissingsPageingDTO { 22 | 23 | private Integer actPageNumber = 1; 24 | 25 | private Integer end = 0; 26 | 27 | private Integer maxPageNumber = null; 28 | 29 | private Integer resultSize = 0; 30 | 31 | private Integer start = 0; 32 | 33 | public MissingsPageingDTO actPageNumber(final Integer actPageNumber) { 34 | this.actPageNumber = actPageNumber; 35 | return this; 36 | } 37 | 38 | public MissingsPageingDTO end(final Integer end) { 39 | this.end = end; 40 | return this; 41 | } 42 | 43 | public Integer getActPageNumber() { 44 | return actPageNumber; 45 | } 46 | 47 | public Integer getEnd() { 48 | return end; 49 | } 50 | 51 | public Integer getMaxPageNumber() { 52 | return maxPageNumber; 53 | } 54 | 55 | public Integer getResultSize() { 56 | return resultSize; 57 | } 58 | 59 | public Integer getStart() { 60 | return start; 61 | } 62 | 63 | public MissingsPageingDTO maxPageNumber(final Integer maxPageNumber) { 64 | this.maxPageNumber = maxPageNumber; 65 | return this; 66 | } 67 | 68 | public MissingsPageingDTO resultSize(final Integer resultSize) { 69 | this.resultSize = resultSize; 70 | return this; 71 | } 72 | 73 | public MissingsPageingDTO start(final Integer start) { 74 | this.start = start; 75 | return this; 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/dto/MissingsWorklogsDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.dto; 17 | 18 | import java.io.Serializable; 19 | import java.util.Date; 20 | 21 | /** 22 | * Missings Worklogs data hodler. 23 | */ 24 | public class MissingsWorklogsDTO implements Serializable { 25 | 26 | /** 27 | * Serial Version UID. 28 | */ 29 | private static final long serialVersionUID = 3330484579876043764L; 30 | 31 | private Date date; 32 | 33 | private String hour; 34 | 35 | /** 36 | * Constructor for a MissingsWorklogsDTO. 37 | * 38 | * @param date 39 | * The missings day date. 40 | * @param hour 41 | * The amount of missings hours 42 | */ 43 | public MissingsWorklogsDTO(final Date date, final String hour) { 44 | super(); 45 | this.date = date; 46 | this.hour = hour; 47 | } 48 | 49 | public Date getDate() { 50 | return (Date) date.clone(); 51 | } 52 | 53 | public String getHour() { 54 | return hour; 55 | } 56 | 57 | public void setDate(final Date date) { 58 | this.date = date; 59 | } 60 | 61 | public void setHour(final String hour) { 62 | this.hour = hour; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/dto/OrderBy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.dto; 17 | 18 | import org.everit.jira.reporting.plugin.column.WorklogDetailsColumns; 19 | 20 | /** 21 | * Represents the ordering of the a search query. 22 | */ 23 | public class OrderBy { 24 | 25 | public static final OrderBy DEFAULT; 26 | 27 | static { 28 | DEFAULT = new OrderBy() 29 | .columnName(WorklogDetailsColumns.ISSUE_KEY) 30 | .order("ASC") 31 | .asc(true); 32 | } 33 | 34 | public boolean asc; 35 | 36 | public String columnName; 37 | 38 | public String order; 39 | 40 | public OrderBy asc(final boolean asc) { 41 | this.asc = asc; 42 | return this; 43 | } 44 | 45 | public OrderBy columnName(final String columnName) { 46 | this.columnName = columnName; 47 | return this; 48 | } 49 | 50 | public OrderBy order(final String order) { 51 | this.order = order; 52 | return this; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/dto/PagingDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.dto; 17 | 18 | /** 19 | * Contains information to paging. 20 | */ 21 | public class PagingDTO { 22 | 23 | private Integer actPageNumber = 1; 24 | 25 | private Long end = 0L; 26 | 27 | private Integer maxPageNumber = null; 28 | 29 | private Long start = 0L; 30 | 31 | public PagingDTO actPageNumber(final Integer actPageNumber) { 32 | this.actPageNumber = actPageNumber; 33 | return this; 34 | } 35 | 36 | public PagingDTO end(final Long end) { 37 | this.end = end; 38 | return this; 39 | } 40 | 41 | public Integer getActPageNumber() { 42 | return actPageNumber; 43 | } 44 | 45 | public Long getEnd() { 46 | return end; 47 | } 48 | 49 | public Integer getMaxPageNumber() { 50 | return maxPageNumber; 51 | } 52 | 53 | public Long getStart() { 54 | return start; 55 | } 56 | 57 | public PagingDTO maxPageNumber(final Integer maxPageNumber) { 58 | this.maxPageNumber = maxPageNumber; 59 | return this; 60 | } 61 | 62 | public PagingDTO start(final Long start) { 63 | this.start = start; 64 | return this; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/dto/PickerComponentDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.dto; 17 | 18 | import javax.xml.bind.annotation.XmlElement; 19 | import javax.xml.bind.annotation.XmlRootElement; 20 | 21 | import org.everit.jira.core.util.TimetrackerUtil; 22 | 23 | /** 24 | * Representation of component to picker. 25 | */ 26 | @XmlRootElement 27 | public class PickerComponentDTO { 28 | 29 | /** 30 | * Alias names to projections. 31 | */ 32 | public static final class AliasNames { 33 | 34 | public static final String COMPONENT_NAME = "name"; 35 | 36 | private AliasNames() { 37 | } 38 | } 39 | 40 | public static final String NO_COMPONENT = "jtrp.picker.no.componenet.value"; 41 | 42 | /** 43 | * Create no component {@link PickerComponentDTO}. 44 | */ 45 | public static PickerComponentDTO createNoComponent() { 46 | PickerComponentDTO nocomponent = new PickerComponentDTO(); 47 | nocomponent.setName(TimetrackerUtil.getI18nText(NO_COMPONENT)); 48 | return nocomponent; 49 | } 50 | 51 | @XmlElement 52 | private String name; 53 | 54 | public String getName() { 55 | return name; 56 | } 57 | 58 | public void setName(final String name) { 59 | this.name = name; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/dto/PickerEpicLinkDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.dto; 17 | 18 | import javax.xml.bind.annotation.XmlElement; 19 | import javax.xml.bind.annotation.XmlRootElement; 20 | 21 | /** 22 | * Representation of label to picker. 23 | */ 24 | @XmlRootElement 25 | public class PickerEpicLinkDTO { 26 | 27 | /** 28 | * Alias names to projections. 29 | */ 30 | public static final class AliasNames { 31 | 32 | public static final String EPIC_LINK_ID = "epicLinkId"; 33 | 34 | public static final String EPIC_NAME = "epicName"; 35 | 36 | public static final String ISSUE_KEY = "issueKey"; 37 | 38 | private AliasNames() { 39 | } 40 | } 41 | 42 | @XmlElement 43 | private Long epicLinkId; 44 | 45 | @XmlElement 46 | private String epicName; 47 | 48 | @XmlElement 49 | private String issueKey; 50 | 51 | public Long getEpicLinkId() { 52 | return epicLinkId; 53 | } 54 | 55 | public String getEpicName() { 56 | return epicName; 57 | } 58 | 59 | public String getIssueKey() { 60 | return issueKey; 61 | } 62 | 63 | public void setEpicLinkId(final Long epicLinkId) { 64 | this.epicLinkId = epicLinkId; 65 | } 66 | 67 | public void setEpicName(final String name) { 68 | epicName = name; 69 | } 70 | 71 | public void setIssueKey(final String issueKey) { 72 | this.issueKey = issueKey; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/dto/PickerLabelDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.dto; 17 | 18 | import javax.xml.bind.annotation.XmlElement; 19 | import javax.xml.bind.annotation.XmlRootElement; 20 | 21 | /** 22 | * Representation of label to picker. 23 | */ 24 | @XmlRootElement 25 | public class PickerLabelDTO { 26 | 27 | /** 28 | * Alias names to projections. 29 | */ 30 | public static final class AliasNames { 31 | 32 | public static final String LABEL_NAME = "name"; 33 | 34 | private AliasNames() { 35 | } 36 | } 37 | 38 | @XmlElement 39 | private String name; 40 | 41 | public String getName() { 42 | return name; 43 | } 44 | 45 | public void setName(final String name) { 46 | this.name = name; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/dto/PickerVersionDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.dto; 17 | 18 | import javax.xml.bind.annotation.XmlElement; 19 | import javax.xml.bind.annotation.XmlRootElement; 20 | 21 | import org.everit.jira.core.util.TimetrackerUtil; 22 | 23 | /** 24 | * Representation of version to picker. 25 | */ 26 | @XmlRootElement 27 | public class PickerVersionDTO { 28 | 29 | /** 30 | * Alias names to projections. 31 | */ 32 | public static final class AliasNames { 33 | 34 | public static final String VERSION_NAME = "name"; 35 | 36 | private AliasNames() { 37 | } 38 | } 39 | 40 | public static final String NO_VERSION = "jtrp.picker.no.version.value"; 41 | 42 | public static final String RELEASED_VERSION = "jtrp.picker.released.version.value"; 43 | 44 | public static final String UNRELEASED_VERSION = "jtrp.picker.unreleased.version.value"; 45 | 46 | /** 47 | * Create no version {@link PickerVersionDTO}. 48 | */ 49 | public static PickerVersionDTO createNoVersion() { 50 | PickerVersionDTO noversion = new PickerVersionDTO(); 51 | noversion.setName(TimetrackerUtil.getI18nText(NO_VERSION)); 52 | return noversion; 53 | } 54 | 55 | /** 56 | * Create released version {@link PickerVersionDTO}. 57 | */ 58 | public static PickerVersionDTO createReleasedVersion() { 59 | PickerVersionDTO releasedVersion = new PickerVersionDTO(); 60 | releasedVersion.setName(TimetrackerUtil.getI18nText(RELEASED_VERSION)); 61 | return releasedVersion; 62 | } 63 | 64 | /** 65 | * Create unreleased version {@link PickerVersionDTO}. 66 | */ 67 | public static PickerVersionDTO createUnReleasedVersion() { 68 | PickerVersionDTO unreleasedVersion = new PickerVersionDTO(); 69 | unreleasedVersion.setName(TimetrackerUtil.getI18nText(UNRELEASED_VERSION)); 70 | return unreleasedVersion; 71 | } 72 | 73 | @XmlElement 74 | private String name; 75 | 76 | public String getName() { 77 | return name; 78 | } 79 | 80 | public void setName(final String name) { 81 | this.name = name; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/dto/ProjectSummaryDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.dto; 17 | 18 | /** 19 | * Representation of the project summary query result. 20 | */ 21 | public class ProjectSummaryDTO { 22 | 23 | /** 24 | * Alias names to projections. 25 | */ 26 | public static final class AliasNames { 27 | 28 | public static final String ISSUE_TIME_ESTIMATE_SUM = "issuesReaminingTimeSum"; 29 | 30 | public static final String ISSUE_TIME_ORIGINAL_ESTIMATE_SUM = "issuesOrginalEstimatedSum"; 31 | 32 | public static final String PROJECT_KEY = "projectKey"; 33 | 34 | public static final String PROJECT_NAME = "projectName"; 35 | 36 | public static final String WORKLOGGED_TIME_SUM = "workloggedTimeSum"; 37 | 38 | private AliasNames() { 39 | } 40 | } 41 | 42 | private long expectedTotal; 43 | 44 | private long issuesOrginalEstimatedSum; 45 | 46 | private long issuesReaminingTimeSum; 47 | 48 | private String projectKey; 49 | 50 | private String projectName; 51 | 52 | private long workloggedTimeSum; 53 | 54 | public long getExpectedTotal() { 55 | expectedTotal = getWorkloggedTimeSum() + getIssuesReaminingTimeSum(); 56 | return expectedTotal; 57 | } 58 | 59 | public long getIssuesOrginalEstimatedSum() { 60 | return issuesOrginalEstimatedSum; 61 | } 62 | 63 | public long getIssuesReaminingTimeSum() { 64 | return issuesReaminingTimeSum; 65 | } 66 | 67 | public String getProjectKey() { 68 | return projectKey; 69 | } 70 | 71 | public String getProjectName() { 72 | return projectName; 73 | } 74 | 75 | public long getWorkloggedTimeSum() { 76 | return workloggedTimeSum; 77 | } 78 | 79 | public void setIssuesOrginalEstimatedSum(final long issuesOrginalEstimatedSum) { 80 | this.issuesOrginalEstimatedSum = issuesOrginalEstimatedSum; 81 | } 82 | 83 | public void setIssuesReaminingTimeSum(final long issuesReaminingTimeSum) { 84 | this.issuesReaminingTimeSum = issuesReaminingTimeSum; 85 | } 86 | 87 | public void setProjectKey(final String projectKey) { 88 | this.projectKey = projectKey; 89 | } 90 | 91 | public void setProjectName(final String projectName) { 92 | this.projectName = projectName; 93 | } 94 | 95 | public void setWorkloggedTimeSum(final long issuesTimespentSum) { 96 | workloggedTimeSum = issuesTimespentSum; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/dto/ProjectSummaryReportDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.dto; 17 | 18 | import java.util.Collections; 19 | import java.util.List; 20 | 21 | /** 22 | * Contains information to project summary report table. 23 | */ 24 | public class ProjectSummaryReportDTO { 25 | 26 | private PagingDTO paging = new PagingDTO(); 27 | 28 | private List projectSummaries = Collections.emptyList(); 29 | 30 | private Long projectSummaryCount = 0L; 31 | 32 | public PagingDTO getPaging() { 33 | return paging; 34 | } 35 | 36 | public List getProjectSummaries() { 37 | return projectSummaries; 38 | } 39 | 40 | public Long getProjectSummaryCount() { 41 | return projectSummaryCount; 42 | } 43 | 44 | public ProjectSummaryReportDTO paging(final PagingDTO paging) { 45 | this.paging = paging; 46 | return this; 47 | } 48 | 49 | public ProjectSummaryReportDTO projectSummaries(final List projectSummaries) { 50 | this.projectSummaries = projectSummaries; 51 | return this; 52 | } 53 | 54 | public ProjectSummaryReportDTO projectSummaryCount(final Long projectSummaryCount) { 55 | this.projectSummaryCount = projectSummaryCount; 56 | return this; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/dto/ReportingSessionData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.dto; 17 | 18 | import java.io.Serializable; 19 | 20 | /** 21 | * Session data for the reporting page. 22 | */ 23 | public class ReportingSessionData implements Serializable { 24 | 25 | /** 26 | * Serial Version UID. 27 | */ 28 | private static final long serialVersionUID = 6059112912342079835L; 29 | 30 | public String collapsedDetailsModuleVal; 31 | 32 | public String collapsedSummaryModuleVal; 33 | 34 | public String filterConditionJson; 35 | 36 | public String selectedActiveTab; 37 | 38 | public String selectedMoreJson; 39 | 40 | public String selectedWorklogDetailsColumnsJson; 41 | 42 | public ReportingSessionData collapsedDetailsModuleVal(final String collapsedDetailsModuleVal) { 43 | this.collapsedDetailsModuleVal = collapsedDetailsModuleVal; 44 | return this; 45 | } 46 | 47 | public ReportingSessionData collapsedSummaryModuleVal(final String collapsedSummaryModuleVal) { 48 | this.collapsedSummaryModuleVal = collapsedSummaryModuleVal; 49 | return this; 50 | } 51 | 52 | public ReportingSessionData filterConditionJson(final String filterConditionJson) { 53 | this.filterConditionJson = filterConditionJson; 54 | return this; 55 | } 56 | 57 | public ReportingSessionData selectedActiveTab(final String selectedActiveTab) { 58 | this.selectedActiveTab = selectedActiveTab; 59 | return this; 60 | } 61 | 62 | public ReportingSessionData selectedMoreJson(final String selectedMoreJson) { 63 | this.selectedMoreJson = selectedMoreJson; 64 | return this; 65 | } 66 | 67 | public ReportingSessionData selectedWorklogDetailsColumnsJson( 68 | final String selectedWorklogDetailsColumnsJson) { 69 | this.selectedWorklogDetailsColumnsJson = selectedWorklogDetailsColumnsJson; 70 | return this; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/dto/UserForPickerDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.dto; 17 | 18 | /** 19 | * User information for picker. 20 | */ 21 | public class UserForPickerDTO { 22 | 23 | public static final String CURRENT_USER_DISPLAY_NAME = "jtrp.picker.current.user.value"; 24 | 25 | public static final String CURRENT_USER_KEY = "currentUser"; 26 | 27 | public static final String NONE_DISPLAY_NAME = "jtrp.picker.value.none"; 28 | 29 | public static final String NONE_USER_KEY = "none"; 30 | 31 | public static final String UNASSIGNED_DISPLAY_NAME = "jtrp.picker.unassigned.value"; 32 | 33 | public static final String UNASSIGNED_USER_KEY = "empty"; 34 | 35 | private String avatarURL; 36 | 37 | private String displayName; 38 | 39 | private String userKey; 40 | 41 | /** 42 | * Simple constructor. 43 | */ 44 | public UserForPickerDTO(final String avatarURL, final String displayName, final String userKey) { 45 | this.avatarURL = avatarURL; 46 | this.displayName = displayName; 47 | this.userKey = userKey; 48 | } 49 | 50 | public String getAvatarURL() { 51 | return avatarURL; 52 | } 53 | 54 | public String getDisplayName() { 55 | return displayName; 56 | } 57 | 58 | public String getUserKey() { 59 | return userKey; 60 | } 61 | 62 | public void setAvatarURL(final String avatarURL) { 63 | this.avatarURL = avatarURL; 64 | } 65 | 66 | public void setDisplayName(final String displayName) { 67 | this.displayName = displayName; 68 | } 69 | 70 | public void setUserKey(final String userKey) { 71 | this.userKey = userKey; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/dto/UserPickerContainerDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.dto; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | 21 | /** 22 | * The container for user picker to GUI. Contains the selected, or suggested user for the different 23 | * user pickers. 24 | */ 25 | public class UserPickerContainerDTO { 26 | 27 | private UserForPickerDTO currentUser; 28 | 29 | private List issueAssignees = new ArrayList<>(); 30 | 31 | private List issueReporters = new ArrayList<>(); 32 | 33 | private UserForPickerDTO noneUser; 34 | 35 | private List suggestedUsers = new ArrayList<>(); 36 | 37 | private UserForPickerDTO unassigedUser; 38 | 39 | private List users = new ArrayList<>(); 40 | 41 | public UserForPickerDTO getCurrentUser() { 42 | return currentUser; 43 | } 44 | 45 | public List getIssueAssignees() { 46 | return issueAssignees; 47 | } 48 | 49 | public List getIssueReporters() { 50 | return issueReporters; 51 | } 52 | 53 | public UserForPickerDTO getNoneUser() { 54 | return noneUser; 55 | } 56 | 57 | public List getSuggestedUsers() { 58 | return suggestedUsers; 59 | } 60 | 61 | public UserForPickerDTO getUnassigedUser() { 62 | return unassigedUser; 63 | } 64 | 65 | public List getUsers() { 66 | return users; 67 | } 68 | 69 | public void setCurrentUser(final UserForPickerDTO currentUser) { 70 | this.currentUser = currentUser; 71 | } 72 | 73 | public void setIssueAssignees(final List issueAssignees) { 74 | this.issueAssignees = issueAssignees; 75 | } 76 | 77 | public void setIssueReporters(final List issueReporters) { 78 | this.issueReporters = issueReporters; 79 | } 80 | 81 | public void setNoneUser(final UserForPickerDTO noneUser) { 82 | this.noneUser = noneUser; 83 | } 84 | 85 | public void setSuggestedUsers(final List suggestedUsers) { 86 | this.suggestedUsers = suggestedUsers; 87 | } 88 | 89 | public void setUnassigedUser(final UserForPickerDTO unassigedUser) { 90 | this.unassigedUser = unassigedUser; 91 | } 92 | 93 | public void setUsers(final List users) { 94 | this.users = users; 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/dto/UserSummaryDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.dto; 17 | 18 | /** 19 | * Representation of the user summary query result. 20 | */ 21 | public class UserSummaryDTO { 22 | 23 | /** 24 | * Alias names to projections. 25 | */ 26 | public static final class AliasNames { 27 | 28 | public static final String USER_DISPLAY_NAME = "userDisplayName"; 29 | 30 | public static final String WORKLOGGED_TIME_SUM = "workloggedTimeSum"; 31 | 32 | private AliasNames() { 33 | } 34 | } 35 | 36 | private String userDisplayName; 37 | 38 | private long workloggedTimeSum; 39 | 40 | public String getUserDisplayName() { 41 | return userDisplayName; 42 | } 43 | 44 | public long getWorkloggedTimeSum() { 45 | return workloggedTimeSum; 46 | } 47 | 48 | public void setUserDisplayName(final String userDisplayName) { 49 | this.userDisplayName = userDisplayName; 50 | } 51 | 52 | public void setWorkloggedTimeSum(final long workloggedTimeSum) { 53 | this.workloggedTimeSum = workloggedTimeSum; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/dto/UserSummaryReportDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.dto; 17 | 18 | import java.util.Collections; 19 | import java.util.List; 20 | 21 | /** 22 | * Contains information to user summary report table. 23 | */ 24 | public class UserSummaryReportDTO { 25 | 26 | private PagingDTO paging = new PagingDTO(); 27 | 28 | private List userSummaries = Collections.emptyList(); 29 | 30 | private Long userSummaryCount = 0L; 31 | 32 | public PagingDTO getPaging() { 33 | return paging; 34 | } 35 | 36 | public List getUserSummaries() { 37 | return userSummaries; 38 | } 39 | 40 | public Long getUserSummaryCount() { 41 | return userSummaryCount; 42 | } 43 | 44 | public UserSummaryReportDTO paging(final PagingDTO paging) { 45 | this.paging = paging; 46 | return this; 47 | } 48 | 49 | public UserSummaryReportDTO userSummaries(final List userSummaries) { 50 | this.userSummaries = userSummaries; 51 | return this; 52 | } 53 | 54 | public UserSummaryReportDTO userSummaryCount(final Long userSummaryCount) { 55 | this.userSummaryCount = userSummaryCount; 56 | return this; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/dto/WorklogDetailsReportDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.dto; 17 | 18 | import java.util.Collections; 19 | import java.util.List; 20 | 21 | /** 22 | * Contains information to worklog details report table. 23 | */ 24 | public class WorklogDetailsReportDTO { 25 | 26 | private Long grandTotal = 0L; 27 | 28 | private PagingDTO paging = new PagingDTO(); 29 | 30 | private List worklogDetails = Collections.emptyList(); 31 | 32 | private Long worklogDetailsCount = 0L; 33 | 34 | public Long getGrandTotal() { 35 | return grandTotal; 36 | } 37 | 38 | public PagingDTO getPaging() { 39 | return paging; 40 | } 41 | 42 | public List getWorklogDetails() { 43 | return worklogDetails; 44 | } 45 | 46 | public Long getWorklogDetailsCount() { 47 | return worklogDetailsCount; 48 | } 49 | 50 | public WorklogDetailsReportDTO grandTotal(final Long grandTotal) { 51 | this.grandTotal = grandTotal; 52 | return this; 53 | } 54 | 55 | public WorklogDetailsReportDTO paging(final PagingDTO paging) { 56 | this.paging = paging; 57 | return this; 58 | } 59 | 60 | public WorklogDetailsReportDTO worklogDetails(final List worklogDetails) { 61 | this.worklogDetails = worklogDetails; 62 | return this; 63 | } 64 | 65 | public WorklogDetailsReportDTO worklogDetailsCount(final Long worklogDetailsCount) { 66 | this.worklogDetailsCount = worklogDetailsCount; 67 | return this; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/exception/JTRPException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.exception; 17 | 18 | /** 19 | * Reporting exception. 20 | */ 21 | public class JTRPException extends RuntimeException { 22 | 23 | private static final long serialVersionUID = 3267914704266213736L; 24 | 25 | public JTRPException(final String errorMsgKey) { 26 | super(errorMsgKey); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/query/PickerComponentQuery.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.query; 17 | 18 | import java.sql.Connection; 19 | import java.sql.SQLException; 20 | import java.util.List; 21 | 22 | import org.everit.jira.querydsl.schema.QComponent; 23 | import org.everit.jira.querydsl.support.QuerydslCallable; 24 | import org.everit.jira.reporting.plugin.dto.PickerComponentDTO; 25 | 26 | import com.querydsl.core.types.Projections; 27 | import com.querydsl.sql.Configuration; 28 | import com.querydsl.sql.SQLQuery; 29 | 30 | /** 31 | * Query for gets versions to picker. 32 | */ 33 | public class PickerComponentQuery implements QuerydslCallable> { 34 | 35 | private QComponent qComponent; 36 | 37 | public PickerComponentQuery() { 38 | qComponent = new QComponent("component"); 39 | } 40 | 41 | @Override 42 | public List call(final Connection connection, 43 | final Configuration configuration) 44 | throws SQLException { 45 | 46 | List result = new SQLQuery(connection, configuration) 47 | .select(Projections.bean(PickerComponentDTO.class, 48 | qComponent.cname.as(PickerComponentDTO.AliasNames.COMPONENT_NAME))) 49 | .from(qComponent) 50 | .groupBy(qComponent.cname) 51 | .orderBy(qComponent.cname.asc()) 52 | .fetch(); 53 | 54 | result.add(0, PickerComponentDTO.createNoComponent()); 55 | 56 | return result; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/query/PickerLabelQuery.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.query; 17 | 18 | import java.sql.Connection; 19 | import java.sql.SQLException; 20 | import java.util.List; 21 | 22 | import org.everit.jira.querydsl.schema.QLabel; 23 | import org.everit.jira.querydsl.support.QuerydslCallable; 24 | import org.everit.jira.reporting.plugin.dto.PickerLabelDTO; 25 | 26 | import com.querydsl.core.types.Projections; 27 | import com.querydsl.sql.Configuration; 28 | import com.querydsl.sql.SQLQuery; 29 | 30 | /** 31 | * Query for gets labels to picker. 32 | */ 33 | public class PickerLabelQuery implements QuerydslCallable> { 34 | 35 | private QLabel qLabel; 36 | 37 | public PickerLabelQuery() { 38 | qLabel = new QLabel("label"); 39 | } 40 | 41 | @Override 42 | public List call(final Connection connection, final Configuration configuration) 43 | throws SQLException { 44 | 45 | List result = new SQLQuery(connection, configuration) 46 | .select(Projections.bean(PickerLabelDTO.class, 47 | qLabel.label.as(PickerLabelDTO.AliasNames.LABEL_NAME))) 48 | .from(qLabel) 49 | .groupBy(qLabel.label) 50 | .orderBy(qLabel.label.asc()) 51 | .fetch(); 52 | 53 | return result; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/query/PickerVersionQuery.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.query; 17 | 18 | import java.sql.Connection; 19 | import java.sql.SQLException; 20 | import java.util.List; 21 | 22 | import org.everit.jira.querydsl.schema.QProjectversion; 23 | import org.everit.jira.querydsl.support.QuerydslCallable; 24 | import org.everit.jira.reporting.plugin.dto.PickerVersionDTO; 25 | 26 | import com.querydsl.core.types.Projections; 27 | import com.querydsl.sql.Configuration; 28 | import com.querydsl.sql.SQLQuery; 29 | 30 | /** 31 | * Query for gets versions to picker. 32 | */ 33 | public class PickerVersionQuery implements QuerydslCallable> { 34 | 35 | /** 36 | * Type of picker user query. 37 | */ 38 | public enum PickerVersionQueryType { 39 | 40 | AFFECTED_VERSION, 41 | 42 | DEFAULT, 43 | 44 | FIX_VERSION; 45 | 46 | private static final PickerVersionQueryType[] PICKER_VERSION_QUERY_TYPES = 47 | PickerVersionQueryType.values(); 48 | 49 | /** 50 | * Gets picker version query type based on name. 51 | */ 52 | public static PickerVersionQueryType getPickerVersionQueryType( 53 | final String pickerVersionQueryType) { 54 | for (PickerVersionQueryType type : PICKER_VERSION_QUERY_TYPES) { 55 | if (type.name().equals(pickerVersionQueryType)) { 56 | return type; 57 | } 58 | } 59 | return DEFAULT; 60 | } 61 | } 62 | 63 | private PickerVersionQueryType pickerVersionQueryType; 64 | 65 | private QProjectversion qProjectversion; 66 | 67 | public PickerVersionQuery(final PickerVersionQueryType pickerVersionQueryType) { 68 | qProjectversion = new QProjectversion("p_version"); 69 | this.pickerVersionQueryType = pickerVersionQueryType; 70 | } 71 | 72 | @Override 73 | public List call(final Connection connection, final Configuration configuration) 74 | throws SQLException { 75 | 76 | List result = new SQLQuery(connection, configuration) 77 | .select(Projections.bean(PickerVersionDTO.class, 78 | qProjectversion.vname.as(PickerVersionDTO.AliasNames.VERSION_NAME))) 79 | .from(qProjectversion) 80 | .groupBy(qProjectversion.vname) 81 | .orderBy(qProjectversion.vname.asc()) 82 | .fetch(); 83 | 84 | if (PickerVersionQueryType.AFFECTED_VERSION.equals(pickerVersionQueryType)) { 85 | result.add(0, PickerVersionDTO.createNoVersion()); 86 | } else if (PickerVersionQueryType.FIX_VERSION.equals(pickerVersionQueryType)) { 87 | result.add(0, PickerVersionDTO.createUnReleasedVersion()); 88 | result.add(0, PickerVersionDTO.createReleasedVersion()); 89 | result.add(0, PickerVersionDTO.createNoVersion()); 90 | } 91 | return result; 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/reporting/plugin/util/PermissionUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.reporting.plugin.util; 17 | 18 | import java.util.Collection; 19 | import java.util.List; 20 | 21 | import org.everit.jira.settings.TimeTrackerSettingsHelper; 22 | 23 | import com.atlassian.jira.component.ComponentAccessor; 24 | import com.atlassian.jira.user.ApplicationUser; 25 | 26 | /** 27 | * Reporting permissions check handler Util. 28 | */ 29 | public final class PermissionUtil { 30 | 31 | /** 32 | * Check the user has permission set to browse other useres worklogs. 33 | * 34 | * @param user 35 | * The checked user. 36 | * @return True if has permission otherwise false. 37 | */ 38 | public static boolean hasBrowseUserPermission(final ApplicationUser user, 39 | final TimeTrackerSettingsHelper settingsHelper) { 40 | List browseGroups = settingsHelper.loadReportingGlobalSettings().getBrowseGroups(); 41 | if (browseGroups.isEmpty()) { 42 | return true; 43 | } 44 | Collection groupNamesForUser = 45 | ComponentAccessor.getGroupManager().getGroupNamesForUser(user); 46 | for (String browseGroup : browseGroups) { 47 | if (groupNamesForUser.contains(browseGroup)) { 48 | return true; 49 | } 50 | } 51 | return false; 52 | } 53 | 54 | private PermissionUtil() { 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/settings/TimeTrackerSettingsHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.settings; 17 | 18 | import org.everit.jira.settings.dto.ReportingGlobalSettings; 19 | import org.everit.jira.settings.dto.TimeTrackerGlobalSettings; 20 | import org.everit.jira.settings.dto.TimeTrackerUserSettings; 21 | 22 | /** 23 | * The time tracker plugin configuration helper class. Provides save and load methods for the 24 | * configurations. 25 | */ 26 | public interface TimeTrackerSettingsHelper { 27 | /** 28 | * Load all timetracker global configuration from the 29 | * {@link com.atlassian.sal.api.pluginsettings.PluginSettings}. 30 | * 31 | * @return the timetracker settings. 32 | */ 33 | TimeTrackerGlobalSettings loadGlobalSettings(); 34 | 35 | /** 36 | * Load all reporting global configuration from the 37 | * {@link com.atlassian.sal.api.pluginsettings.PluginSettings}. 38 | * 39 | * @return the timetracker settings. 40 | */ 41 | ReportingGlobalSettings loadReportingGlobalSettings(); 42 | 43 | /** 44 | * Load all user configuration from the 45 | * {@link com.atlassian.sal.api.pluginsettings.PluginSettings}. 46 | * 47 | * @return the timetracker settings. 48 | */ 49 | TimeTrackerUserSettings loadUserSettings(); 50 | 51 | /** 52 | * Save all specified settings from the {@link TimeTrackerGlobalSettings} into 53 | * {@link com.atlassian.sal.api.pluginsettings.PluginSettings}. 54 | * 55 | * @param settings 56 | * the timetracker global settings. 57 | */ 58 | void saveGlobalSettings(TimeTrackerGlobalSettings settings); 59 | 60 | /** 61 | * Save all specified settings from the {@link ReportingGlobalSettings} into 62 | * {@link com.atlassian.sal.api.pluginsettings.PluginSettings}. 63 | * 64 | * @param settings 65 | * the reporting settings. 66 | */ 67 | void saveReportingGlobalSettings(ReportingGlobalSettings settings); 68 | 69 | /** 70 | * Save all specified settings from the {@link TimeTrackerUserSettings} into 71 | * {@link com.atlassian.sal.api.pluginsettings.PluginSettings}. 72 | * 73 | * @param settings 74 | * the timetracker user settings. 75 | */ 76 | void saveUserSettings(TimeTrackerUserSettings userSettings); 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/settings/dto/GlobalSettingsKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.settings.dto; 17 | 18 | /** 19 | * The timetracker global settings key enumeration. 20 | */ 21 | public enum GlobalSettingsKey implements SettingsMapper { 22 | ANALYTICS_CHECK_CHANGE { 23 | 24 | @Override 25 | public String getSettingsKey() { 26 | return JTTPSettingsKey.JTTP_PLUGIN_SETTINGS_ANALYTICS_CHECK_CHANGE; 27 | } 28 | 29 | }, 30 | EXCLUDE_DATES { 31 | 32 | @Override 33 | public String getSettingsKey() { 34 | return JTTPSettingsKey.JTTP_PLUGIN_SETTINGS_EXCLUDE_DATES; 35 | } 36 | 37 | }, 38 | INCLUDE_DATES { 39 | 40 | @Override 41 | public String getSettingsKey() { 42 | return JTTPSettingsKey.JTTP_PLUGIN_SETTINGS_INCLUDE_DATES; 43 | } 44 | 45 | }, 46 | NON_ESTIMATED_ISSUES { 47 | 48 | @Override 49 | public String getSettingsKey() { 50 | return JTTPSettingsKey.JTTP_PLUGIN_SETTINGS_NON_ESTIMATED_ISSUES; 51 | } 52 | 53 | }, 54 | PLUGIN_PERMISSION { 55 | 56 | @Override 57 | public String getSettingsKey() { 58 | return JTTPSettingsKey.JTTP_PLUGIN_SETTINGS_PLUGIN_PERMISSION; 59 | } 60 | 61 | }, 62 | PLUGIN_UUID { 63 | 64 | @Override 65 | public String getSettingsKey() { 66 | return JTTPSettingsKey.JTTP_PLUGIN_UUID; 67 | } 68 | 69 | }, 70 | SUMMARY_FILTERS { 71 | 72 | @Override 73 | public String getSettingsKey() { 74 | return JTTPSettingsKey.JTTP_PLUGIN_SETTINGS_SUMMARY_FILTERS; 75 | } 76 | 77 | }, 78 | TIME_ZONE { 79 | 80 | @Override 81 | public String getSettingsKey() { 82 | return JTTPSettingsKey.JTTP_PLUGIN_SETTINGS_TIME_ZONE; 83 | } 84 | 85 | }, 86 | TIMETRACKER_PERMISSION { 87 | 88 | @Override 89 | public String getSettingsKey() { 90 | return JTTPSettingsKey.JTTP_PLUGIN_SETTINGS_TIMETRACKER_PERMISSION; 91 | } 92 | }, 93 | UPDATE_NOTIFIER_LAST_UPDATE { 94 | 95 | @Override 96 | public String getSettingsKey() { 97 | return JTTPSettingsKey.JTTP_UPDATE_NOTIFIER_LAST_UPDATE; 98 | } 99 | }, 100 | UPDATE_NOTIFIER_LATEST_VERSION { 101 | 102 | @Override 103 | public String getSettingsKey() { 104 | return JTTPSettingsKey.JTTP_UPDATE_NOTIFIER_LATEST_VERSION; 105 | } 106 | }; 107 | } 108 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/settings/dto/ReportingGlobalSettings.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.settings.dto; 17 | 18 | import java.util.ArrayList; 19 | import java.util.HashMap; 20 | import java.util.List; 21 | import java.util.Map; 22 | 23 | /** 24 | * Mapping and converter class for the reporting global settings. 25 | */ 26 | public class ReportingGlobalSettings { 27 | 28 | private Map pluginSettingsKeyValues = new HashMap<>(); 29 | 30 | public ReportingGlobalSettings() { 31 | } 32 | 33 | public ReportingGlobalSettings browseGroups(final List browseGroups) { 34 | pluginSettingsKeyValues.put(ReportingSettingKey.BROWSE_GROUPS, browseGroups); 35 | return this; 36 | } 37 | 38 | /** 39 | * Convert and get the browse groups. Default is empty list. 40 | */ 41 | public List getBrowseGroups() { 42 | List browseGroupsNames = (List) pluginSettingsKeyValues 43 | .get(ReportingSettingKey.BROWSE_GROUPS); 44 | List browseGroups = new ArrayList<>(); 45 | if (browseGroupsNames != null) { 46 | browseGroups = browseGroupsNames; 47 | } 48 | return browseGroups; 49 | } 50 | 51 | public Map getPluginSettingsKeyValues() { 52 | return pluginSettingsKeyValues; 53 | } 54 | 55 | /** 56 | * Convert and get the reporting groups. Default is empty list. 57 | */ 58 | public List getReportingGroups() { 59 | List reportingGroupsNames = (List) pluginSettingsKeyValues 60 | .get(ReportingSettingKey.GROUPS); 61 | List reportingGroups = new ArrayList<>(); 62 | if (reportingGroupsNames != null) { 63 | reportingGroups = reportingGroupsNames; 64 | } 65 | return reportingGroups; 66 | } 67 | 68 | public void putSettings(final ReportingSettingKey reportingSettingsKey, final Object object) { 69 | pluginSettingsKeyValues.put(reportingSettingsKey, object); 70 | 71 | } 72 | 73 | public ReportingGlobalSettings reportingGroups(final List reportingGroups) { 74 | pluginSettingsKeyValues.put(ReportingSettingKey.GROUPS, reportingGroups); 75 | return this; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/settings/dto/ReportingSettingKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.settings.dto; 17 | 18 | /** 19 | * The reporting global settings key enumeration. 20 | */ 21 | public enum ReportingSettingKey implements SettingsMapper { 22 | BROWSE_GROUPS { 23 | 24 | @Override 25 | public String getSettingsKey() { 26 | return JTTPSettingsKey.JTTP_PLUGIN_REPORTING_SETTINGS_BROWSE_GROUPS; 27 | } 28 | 29 | }, 30 | GROUPS { 31 | 32 | @Override 33 | public String getSettingsKey() { 34 | return JTTPSettingsKey.JTTP_PLUGIN_REPORTING_SETTINGS_GROUPS; 35 | } 36 | 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/settings/dto/SettingsMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.settings.dto; 17 | 18 | /** 19 | * 20 | * Interface for the settings keys enumerations to map the enum instance to a JTTP settings key. 21 | * 22 | */ 23 | public interface SettingsMapper { 24 | /** 25 | * Get the JTTP settings key without prefix. 26 | */ 27 | String getSettingsKey(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/settings/dto/TimeZoneTypes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.settings.dto; 17 | 18 | /** 19 | * The Time Zone usage type enumeration. 20 | */ 21 | public enum TimeZoneTypes { 22 | 23 | SYSTEM("system"), USER("user"); 24 | 25 | private final String value; 26 | 27 | TimeZoneTypes(final String value) { 28 | this.value = value; 29 | } 30 | 31 | public String getValue() { 32 | return value; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/timetracker/plugin/PluginCondition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.timetracker.plugin; 17 | 18 | import java.util.Collection; 19 | import java.util.List; 20 | 21 | import org.everit.jira.settings.TimeTrackerSettingsHelper; 22 | 23 | import com.atlassian.jira.component.ComponentAccessor; 24 | import com.atlassian.jira.plugin.webfragment.conditions.AbstractWebCondition; 25 | import com.atlassian.jira.plugin.webfragment.model.JiraHelper; 26 | import com.atlassian.jira.user.ApplicationUser; 27 | 28 | /** 29 | * The JTTP Plugin condition class. You can set the plugin user groups at JTTP Global Settings admin 30 | * site. The setted groups stored at jira settings. If no group is setted everybody can use the 31 | * plugin. 32 | */ 33 | public class PluginCondition extends AbstractWebCondition { 34 | 35 | private TimeTrackerSettingsHelper settingsHelper; 36 | 37 | public PluginCondition(final TimeTrackerSettingsHelper settingsHelper) { 38 | this.settingsHelper = settingsHelper; 39 | } 40 | 41 | @Override 42 | public boolean shouldDisplay(final ApplicationUser user, final JiraHelper jiraHelper) { 43 | List pluginGroups = settingsHelper.loadGlobalSettings().getPluginGroups(); 44 | if (pluginGroups.isEmpty()) { 45 | return true; 46 | } 47 | Collection groupNamesForUser = 48 | ComponentAccessor.getGroupManager().getGroupNamesForUser(user); 49 | for (String pluginGroup : pluginGroups) { 50 | if (groupNamesForUser.contains(pluginGroup)) { 51 | return true; 52 | } 53 | } 54 | return false; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/timetracker/plugin/TimetrackerCondition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.timetracker.plugin; 17 | 18 | import java.util.Collection; 19 | import java.util.List; 20 | 21 | import org.everit.jira.settings.TimeTrackerSettingsHelper; 22 | 23 | import com.atlassian.jira.component.ComponentAccessor; 24 | import com.atlassian.jira.plugin.webfragment.conditions.AbstractWebCondition; 25 | import com.atlassian.jira.plugin.webfragment.model.JiraHelper; 26 | import com.atlassian.jira.user.ApplicationUser; 27 | 28 | /** 29 | * The JTTP Timetracking function condition class. You can set the timetracker user groups at JTTP 30 | * Global Settings admin site. The setted groups stored at jira settings. If no group is setted 31 | * everybody can use the timetracking. 32 | */ 33 | public class TimetrackerCondition extends AbstractWebCondition { 34 | 35 | private TimeTrackerSettingsHelper settingsHelper; 36 | 37 | public TimetrackerCondition(final TimeTrackerSettingsHelper settingsHelper) { 38 | this.settingsHelper = settingsHelper; 39 | } 40 | 41 | @Override 42 | public boolean shouldDisplay(final ApplicationUser user, final JiraHelper jiraHelper) { 43 | List timetrackingGroups = settingsHelper.loadGlobalSettings().getTimetrackerGroups(); 44 | if (timetrackingGroups.isEmpty()) { 45 | return true; 46 | } 47 | Collection groupNamesForUser = 48 | ComponentAccessor.getGroupManager().getGroupNamesForUser(user); 49 | for (String timetrackingGroup : timetrackingGroups) { 50 | if (groupNamesForUser.contains(timetrackingGroup)) { 51 | return true; 52 | } 53 | } 54 | return false; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/timetracker/plugin/dto/ChartData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.timetracker.plugin.dto; 17 | 18 | import java.io.Serializable; 19 | 20 | /** 21 | * Data holder for a chart. 22 | */ 23 | public class ChartData implements Serializable { 24 | 25 | private static final long serialVersionUID = 21551301923003314L; 26 | 27 | private Long duration; 28 | 29 | private String projectId; 30 | 31 | /** 32 | * Constructor for a chart data. 33 | * 34 | * @param projectId 35 | * Id of the current project 36 | * @param duration 37 | * Duration 38 | */ 39 | public ChartData(final String projectId, final Long duration) { 40 | super(); 41 | this.projectId = projectId; 42 | this.duration = duration; 43 | } 44 | 45 | public Long getDuration() { 46 | return duration; 47 | } 48 | 49 | public String getProjectId() { 50 | return projectId; 51 | } 52 | 53 | public void setDuration(final Long duration) { 54 | this.duration = duration; 55 | } 56 | 57 | public void setProjectId(final String projectId) { 58 | this.projectId = projectId; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/timetracker/plugin/dto/EveritWorklogComparator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.timetracker.plugin.dto; 17 | 18 | import java.io.Serializable; 19 | import java.util.Comparator; 20 | import java.util.Date; 21 | 22 | import org.everit.jira.timetracker.plugin.util.DateTimeConverterUtil; 23 | 24 | /** 25 | * The comparator of the {@link EveritWorklog}. 26 | */ 27 | public final class EveritWorklogComparator implements Comparator, Serializable { 28 | 29 | public static final EveritWorklogComparator INSTANCE = new EveritWorklogComparator(); 30 | 31 | /** 32 | * Serial version UID. 33 | */ 34 | private static final long serialVersionUID = -4563970131275373338L; 35 | 36 | /** 37 | * Empty private constructor. 38 | */ 39 | private EveritWorklogComparator() { 40 | } 41 | 42 | /** 43 | * Compare by start and end Date. 44 | */ 45 | @Override 46 | public int compare(final EveritWorklog o1, final EveritWorklog o2) { 47 | Date o1StartDate = null; 48 | Date o2StartDate = null; 49 | try { 50 | o1StartDate = DateTimeConverterUtil.stringTimeToDateTime(o1.getStartTime()); 51 | o2StartDate = DateTimeConverterUtil.stringTimeToDateTime(o2.getStartTime()); 52 | } catch (IllegalArgumentException e) { 53 | throw new IllegalArgumentException("Faild to convert startDate to Date", e); 54 | } 55 | int result = o1StartDate.compareTo(o2StartDate); 56 | if (result != 0) { 57 | return result; 58 | } 59 | Date o1EndDate = null; 60 | Date o2EndDate = null; 61 | try { 62 | o1EndDate = DateTimeConverterUtil.stringTimeToDateTime(o1.getEndTime()); 63 | o2EndDate = DateTimeConverterUtil.stringTimeToDateTime(o2.getEndTime()); 64 | } catch (IllegalArgumentException e) { 65 | throw new IllegalArgumentException("Faild to convert endDate to Date", e); 66 | } 67 | return o1EndDate.compareTo(o2EndDate); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/timetracker/plugin/dto/PluginSettingsValues.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.timetracker.plugin.dto; 17 | 18 | import java.io.Serializable; 19 | import java.util.List; 20 | import java.util.Set; 21 | import java.util.regex.Pattern; 22 | 23 | /** 24 | * PluginSettingsValues class contains the result of the JiraTimetrackerPlugin's loadPluginSetting 25 | * method. 26 | */ 27 | public class PluginSettingsValues implements Serializable { 28 | 29 | private static final long serialVersionUID = 4176034622671140618L; 30 | 31 | /** 32 | * Plugin analytics set. 33 | */ 34 | public boolean analyticsCheck; 35 | 36 | /** 37 | * The collector issues pattern list. 38 | */ 39 | public List collectorIssues; 40 | 41 | /** 42 | * Exclude dates. 43 | */ 44 | public Set excludeDates; 45 | 46 | /** 47 | * The non working issues list. 48 | */ 49 | public List filteredSummaryIssues; 50 | 51 | /** 52 | * Include dates. 53 | */ 54 | public Set includeDates; 55 | 56 | /** 57 | * The plugin groups. 58 | */ 59 | public List pluginGroups; 60 | 61 | /** 62 | * The plugin UUID. 63 | */ 64 | public String pluginUUID; 65 | 66 | /** 67 | * The timetarckning groups. 68 | */ 69 | public List timetrackingGroups; 70 | 71 | public PluginSettingsValues() { 72 | } 73 | 74 | public PluginSettingsValues analyticsCheck(final boolean analyticsCheck) { 75 | this.analyticsCheck = analyticsCheck; 76 | return this; 77 | } 78 | 79 | public PluginSettingsValues collectorIssues(final List collectorIssues) { 80 | this.collectorIssues = collectorIssues; 81 | return this; 82 | } 83 | 84 | public PluginSettingsValues excludeDates(final Set excludeDates) { 85 | this.excludeDates = excludeDates; 86 | return this; 87 | } 88 | 89 | public PluginSettingsValues filteredSummaryIssues( 90 | final List filteredSummaryIssues) { 91 | this.filteredSummaryIssues = filteredSummaryIssues; 92 | return this; 93 | } 94 | 95 | public PluginSettingsValues includeDates(final Set includeDates) { 96 | this.includeDates = includeDates; 97 | return this; 98 | } 99 | 100 | public PluginSettingsValues pluginGroups(final List pluginGroups) { 101 | this.pluginGroups = pluginGroups; 102 | return this; 103 | } 104 | 105 | public PluginSettingsValues pluginUUID(final String pluginUUID) { 106 | this.pluginUUID = pluginUUID; 107 | return this; 108 | } 109 | 110 | public PluginSettingsValues timetrackingGroups(final List timetrackingGroups) { 111 | this.timetrackingGroups = timetrackingGroups; 112 | return this; 113 | } 114 | 115 | } 116 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/timetracker/plugin/dto/ReportingSettingsValues.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.timetracker.plugin.dto; 17 | 18 | import java.io.Serializable; 19 | import java.util.List; 20 | 21 | /** 22 | * ReportingSettingsValues class contains the result of the JiraTimetrackerPlugin's 23 | * loadReportingSetting method. 24 | */ 25 | public class ReportingSettingsValues implements Serializable { 26 | 27 | /** 28 | * Serial Version UID. 29 | */ 30 | private static final long serialVersionUID = -9056110737937671869L; 31 | 32 | /** 33 | * The browse users groups. 34 | */ 35 | public List browseGroups; 36 | 37 | /** 38 | * The reporting groups. 39 | */ 40 | public List reportingGroups; 41 | 42 | public ReportingSettingsValues() { 43 | } 44 | 45 | public ReportingSettingsValues browseGroups(final List browseGroups) { 46 | this.browseGroups = browseGroups; 47 | return this; 48 | } 49 | 50 | public ReportingSettingsValues reportingGroups(final List reportingGroups) { 51 | this.reportingGroups = reportingGroups; 52 | return this; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/timetracker/plugin/dto/SummaryUnitDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.timetracker.plugin.dto; 17 | 18 | /** 19 | * Information of unit summary. 20 | */ 21 | public class SummaryUnitDTO { 22 | 23 | private double filteredNonWorkIndicatorPrecent; 24 | 25 | private double filteredPercent; 26 | 27 | private double filteredRealWorkIndicatorPrecent; 28 | 29 | private String filteredSummary; 30 | 31 | private String formattedExpectedWorkTime; 32 | 33 | private String formattedNonWorkTime; 34 | 35 | private double indicatorPrecent; 36 | 37 | private String summary; 38 | 39 | /** 40 | * Simple constructor. 41 | */ 42 | public SummaryUnitDTO() { 43 | } 44 | 45 | public SummaryUnitDTO filteredNonWorkIndicatorPrecent( 46 | final double filteredNonWorkIndicatorPrecent) { 47 | this.filteredNonWorkIndicatorPrecent = filteredNonWorkIndicatorPrecent; 48 | return this; 49 | } 50 | 51 | public SummaryUnitDTO filteredPercent(final double filteredPercent) { 52 | this.filteredPercent = filteredPercent; 53 | return this; 54 | } 55 | 56 | public SummaryUnitDTO filteredRealWorkIndicatorPrecent( 57 | final double filteredRealWorkIndicatorPrecent) { 58 | this.filteredRealWorkIndicatorPrecent = filteredRealWorkIndicatorPrecent; 59 | return this; 60 | } 61 | 62 | public SummaryUnitDTO filteredSummary(final String filteredSummary) { 63 | this.filteredSummary = filteredSummary; 64 | return this; 65 | } 66 | 67 | public SummaryUnitDTO formattedExpectedWorkTime(final String formattedExpectedWorkTime) { 68 | this.formattedExpectedWorkTime = formattedExpectedWorkTime; 69 | return this; 70 | } 71 | 72 | public SummaryUnitDTO formattedNonWorkTime(final String formattedNonWorkTime) { 73 | this.formattedNonWorkTime = formattedNonWorkTime; 74 | return this; 75 | } 76 | 77 | public double getFilteredNonWorkIndicatorPrecent() { 78 | return filteredNonWorkIndicatorPrecent; 79 | } 80 | 81 | public double getFilteredPercent() { 82 | return filteredPercent; 83 | } 84 | 85 | public double getFilteredRealWorkIndicatorPrecent() { 86 | return filteredRealWorkIndicatorPrecent; 87 | } 88 | 89 | public String getFilteredSummary() { 90 | return filteredSummary; 91 | } 92 | 93 | public String getFormattedExpectedWorkTime() { 94 | return formattedExpectedWorkTime; 95 | } 96 | 97 | public String getFormattedNonWorkTime() { 98 | return formattedNonWorkTime; 99 | } 100 | 101 | public double getIndicatorPrecent() { 102 | return indicatorPrecent; 103 | } 104 | 105 | public String getSummary() { 106 | return summary; 107 | } 108 | 109 | public SummaryUnitDTO indicatorPrecent(final double indicatorPrecent) { 110 | this.indicatorPrecent = indicatorPrecent; 111 | return this; 112 | } 113 | 114 | public SummaryUnitDTO summary(final String summary) { 115 | this.summary = summary; 116 | return this; 117 | } 118 | 119 | } 120 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/timetracker/plugin/dto/TimetrackerReportsSessionData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.timetracker.plugin.dto; 17 | 18 | import java.io.Serializable; 19 | 20 | /** 21 | * Session data for the reports. 22 | */ 23 | public class TimetrackerReportsSessionData implements Serializable { 24 | 25 | private static final long serialVersionUID = 7694409127990223607L; 26 | 27 | public String currentUser; 28 | 29 | public Long dateFrom; 30 | 31 | public Long dateTo; 32 | 33 | public TimetrackerReportsSessionData currentUser(final String currentUser) { 34 | this.currentUser = currentUser; 35 | return this; 36 | } 37 | 38 | public TimetrackerReportsSessionData dateFrom(final Long dateFrom) { 39 | this.dateFrom = dateFrom; 40 | return this; 41 | } 42 | 43 | public TimetrackerReportsSessionData dateTo(final Long dateTo) { 44 | this.dateTo = dateTo; 45 | return this; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/timetracker/plugin/dto/WorklogValues.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.timetracker.plugin.dto; 17 | 18 | import javax.xml.bind.annotation.XmlElement; 19 | import javax.xml.bind.annotation.XmlRootElement; 20 | 21 | /** 22 | * Represent the Timetracker worklog input parameters. 23 | */ 24 | @XmlRootElement 25 | public class WorklogValues { 26 | 27 | @XmlElement 28 | private String adjustmentAmount = ""; 29 | 30 | @XmlElement 31 | private String comment = ""; 32 | 33 | public String commentForActions = ""; 34 | 35 | @XmlElement 36 | private String durationTime = ""; 37 | 38 | @XmlElement 39 | private String endTime; 40 | 41 | @XmlElement 42 | private Boolean isDuration = Boolean.FALSE; 43 | 44 | @XmlElement 45 | private String issueKey = ""; 46 | 47 | @XmlElement 48 | private String newEstimate = ""; 49 | 50 | @XmlElement 51 | private String remainingEstimateType; 52 | 53 | @XmlElement 54 | private String startTime; 55 | 56 | public String getAdjustmentAmount() { 57 | return adjustmentAmount; 58 | } 59 | 60 | @XmlElement 61 | public String getComment() { 62 | return comment; 63 | } 64 | 65 | public String getCommentForActions() { 66 | return commentForActions; 67 | } 68 | 69 | public String getDurationTime() { 70 | return durationTime; 71 | } 72 | 73 | public String getEndTime() { 74 | return endTime; 75 | } 76 | 77 | public String getIssueKey() { 78 | return issueKey; 79 | } 80 | 81 | public String getNewEstimate() { 82 | return newEstimate; 83 | } 84 | 85 | public String getRemainingEstimateType() { 86 | return remainingEstimateType; 87 | } 88 | 89 | public String getStartTime() { 90 | return startTime; 91 | } 92 | 93 | public Boolean isDuration() { 94 | return isDuration; 95 | } 96 | 97 | public void setAdjustmentAmount(final String adjustmentAmount) { 98 | this.adjustmentAmount = adjustmentAmount; 99 | } 100 | 101 | public void setComment(final String comment) { 102 | this.comment = comment; 103 | } 104 | 105 | public void setCommentForActions(final String commentForActions) { 106 | this.commentForActions = commentForActions; 107 | } 108 | 109 | public void setDurationTime(final String durationTime) { 110 | this.durationTime = durationTime; 111 | } 112 | 113 | public void setEndTime(final String endTime) { 114 | this.endTime = endTime; 115 | } 116 | 117 | public void setIsDuration(final Boolean isDuration) { 118 | this.isDuration = isDuration; 119 | } 120 | 121 | public void setIssueKey(final String issueKey) { 122 | this.issueKey = issueKey; 123 | } 124 | 125 | public void setNewEstimate(final String newEstimate) { 126 | this.newEstimate = newEstimate; 127 | } 128 | 129 | public void setRemainingEstimateType(final String remainingEstimateType) { 130 | this.remainingEstimateType = remainingEstimateType; 131 | } 132 | 133 | public void setStartTime(final String startTime) { 134 | this.startTime = startTime; 135 | } 136 | 137 | } 138 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/timetracker/plugin/exception/WorklogException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.timetracker.plugin.exception; 17 | 18 | /** 19 | * Exception class for worklog problems. 20 | */ 21 | public class WorklogException extends RuntimeException { 22 | 23 | private static final long serialVersionUID = 4562531805678393874L; 24 | 25 | public String messageParameter = ""; 26 | 27 | public WorklogException(final String errorMsgKey) { 28 | super(errorMsgKey); 29 | } 30 | 31 | public WorklogException(final String errorMsgKey, final String messageParameter) { 32 | this(errorMsgKey); 33 | this.messageParameter = messageParameter; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/timetracker/plugin/util/ExceptionUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.timetracker.plugin.util; 17 | 18 | import java.io.PrintWriter; 19 | import java.io.StringWriter; 20 | 21 | /** 22 | * Utility class for Exception handle. 23 | */ 24 | public final class ExceptionUtil { 25 | 26 | /** 27 | * Gets readable stacktrace. 28 | */ 29 | public static String getStacktrace(final Throwable e) { 30 | if (e == null) { 31 | return ""; 32 | } 33 | 34 | StringWriter sw = new StringWriter(); 35 | PrintWriter pw = new PrintWriter(sw); 36 | e.printStackTrace(pw); 37 | 38 | return sw.toString(); 39 | } 40 | 41 | private ExceptionUtil() { 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/timetracker/plugin/util/HashUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.timetracker.plugin.util; 17 | 18 | import java.io.UnsupportedEncodingException; 19 | import java.security.MessageDigest; 20 | import java.security.NoSuchAlgorithmException; 21 | 22 | /** 23 | * The hash class. It hashes a string. Include a method converts byte array to hex string and an 24 | * encrypt method. 25 | */ 26 | public final class HashUtil { 27 | 28 | private static final int HEX_0X0F = 0x0F; 29 | 30 | private static final int SHIFT_4 = 4; 31 | 32 | private static final int HEX_0X_FF = 0xFF; 33 | 34 | /** 35 | * Converts byte array to hex String. 36 | * 37 | * @param bytes 38 | * The byte array. 39 | * @return The hex value in string. 40 | */ 41 | private static String bytesToHex(final byte[] bytes) { 42 | char[] hexArray = { '0', '1', '2', '3', '4', '5', '6', '7', '8', 43 | '9', 'A', 'B', 'C', 'D', 'E', 'F' }; 44 | char[] hexChars = new char[bytes.length * 2]; 45 | int v; 46 | for (int j = 0; j < bytes.length; j++) { 47 | v = bytes[j] & HEX_0X_FF; 48 | hexChars[j * 2] = hexArray[v >>> SHIFT_4]; 49 | hexChars[(j * 2) + 1] = hexArray[v & HEX_0X0F]; 50 | } 51 | return new String(hexChars); 52 | } 53 | 54 | /** 55 | * The encrypt method. Encode a string to a hex string with the SHA-1 cryptographic hash function. 56 | * 57 | * @param string 58 | * The string you would like to encode. 59 | * @return The encrypted hex string. 60 | * @throws NoSuchAlgorithmException 61 | * If no Provider supports a MessageDigestSpi implementation for the specified 62 | * algorithm. 63 | * @throws UnsupportedEncodingException 64 | * If the named charset is not supported. 65 | */ 66 | public static String encryptString(final String string) 67 | throws NoSuchAlgorithmException, UnsupportedEncodingException { 68 | MessageDigest crypt = MessageDigest.getInstance("SHA-1"); 69 | crypt.reset(); 70 | crypt.update(string.getBytes("UTF-8")); 71 | String sha1 = bytesToHex(crypt.digest()); 72 | return sha1; 73 | } 74 | 75 | private HashUtil() { 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/timetracker/plugin/util/PiwikPropertiesUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.timetracker.plugin.util; 17 | 18 | /** 19 | * The util class for Piwik constats and helper methods. 20 | */ 21 | public final class PiwikPropertiesUtil { 22 | 23 | public static final String PIWIK_ACTIVE_FILTER_CONDITION_CUSTOM_DIMENSION_INDEX = 24 | "PIWIK_ACTIVE_FILTER_CONDITION_CUSTOM_DIMENSION_INDEX"; 25 | 26 | public static final String PIWIK_ADMINISTRATION_SITEID = "PIWIK_ADMINISTRATION_SITEID"; 27 | 28 | public static final String PIWIK_CHART_SITEID = "PIWIK_CHART_SITEID"; 29 | 30 | public static final String PIWIK_HOST = "PIWIK_HOST"; 31 | 32 | public static final String PIWIK_REPORTING_SITEID = "PIWIK_REPORTING_SITEID"; 33 | 34 | public static final String PIWIK_SEARCHER_VALUE_CUSTOM_DIMENSION_INDEX = 35 | "PIWIK_SEARCHER_VALUE_CUSTOM_DIMENSION_INDEX"; 36 | 37 | public static final String PIWIK_SELECTED_ACTIVE_TAB_CUSTOM_DIMENSION_INDEX = 38 | "PIWIK_SELECTED_ACTIVE_TAB_CUSTOM_DIMENSION_INDEX"; 39 | 40 | public static final String PIWIK_SELECTED_WORKLOG_DETAIL_COLUMNS_CUSTOM_DIMENSION_INDEX = 41 | "PIWIK_SELECTED_WORKLOG_DETAIL_COLUMNS_CUSTOM_DIMENSION_INDEX"; 42 | 43 | public static final String PIWIK_TABLE_SITEID = "PIWIK_TABLE_SITEID"; 44 | 45 | public static final String PIWIK_TIMETRACKER_SITEID = "PIWIK_TIMETRACKER_SITEID"; 46 | 47 | public static final String PIWIK_USER_SELECTION_CUSTOM_DIMENSION_INDEX = 48 | "PIWIK_USER_SELECTION_CUSTOM_DIMENSION_INDEX"; 49 | 50 | public static final String PIWIK_USERSETTINGS_SITEID = "PIWIK_USERSETTINGS_SITEID"; 51 | 52 | public static final String PIWIK_WORKLOGS_SITEID = "PIWIK_WORKLOGS_SITEID"; 53 | 54 | private PiwikPropertiesUtil() { 55 | 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/timetracker/plugin/util/PropertiesUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.timetracker.plugin.util; 17 | 18 | import java.io.File; 19 | import java.io.FileInputStream; 20 | import java.io.IOException; 21 | import java.io.InputStream; 22 | import java.net.URL; 23 | import java.util.Properties; 24 | 25 | import com.atlassian.plugin.util.ClassLoaderUtils; 26 | 27 | /** 28 | * Utility class to load properties files. 29 | */ 30 | public final class PropertiesUtil { 31 | 32 | /** 33 | * The Issue Collector jttp_build.porperties key. 34 | */ 35 | public static final String ISSUE_COLLECTOR_SRC = "ISSUE_COLLECTOR_SRC"; 36 | 37 | private static final String JTTP_PROPERTIES = "jttp_build.properties"; 38 | 39 | /** 40 | * Gets jttp_buil.properties. 41 | * 42 | */ 43 | public static Properties getJttpBuildProperties() { 44 | InputStream inputStream = null; 45 | Properties properties = new Properties(); 46 | try { 47 | 48 | inputStream = ClassLoaderUtils.getResourceAsStream(JTTP_PROPERTIES, PropertiesUtil.class); 49 | 50 | if (inputStream == null) { 51 | URL resource = ClassLoaderUtils.getResource(JTTP_PROPERTIES, PropertiesUtil.class); 52 | File propertiesFile = new File(resource.getFile()); 53 | inputStream = new FileInputStream(propertiesFile); 54 | } 55 | 56 | properties.load(inputStream); 57 | 58 | } catch (IOException e) { 59 | return new Properties(); 60 | } finally { 61 | if (inputStream != null) { 62 | try { 63 | inputStream.close(); 64 | } catch (IOException e) { 65 | // do nothing 66 | } 67 | } 68 | } 69 | return properties; 70 | } 71 | 72 | private PropertiesUtil() { 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/timetracker/plugin/util/TimeAutoCompleteUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.timetracker.plugin.util; 17 | 18 | import java.util.ArrayList; 19 | import java.util.Calendar; 20 | import java.util.List; 21 | 22 | /** 23 | * Util class for time input fields autocomplet function. 24 | */ 25 | public final class TimeAutoCompleteUtil { 26 | 27 | /** 28 | * Generate the auto complete time list. The list elements are formatted by jira 29 | * DateTimeStyle.TIME value. 30 | * 31 | * @return The generated autocomplete list. 32 | */ 33 | public static List generateAutoCompleteList() { 34 | Calendar timeCalendar = Calendar.getInstance(); 35 | List result = new ArrayList(); 36 | for (int hour = 0; hour < DateTimeConverterUtil.HOURS_IN_DAY; hour++) { 37 | for (int quater = 0; quater < DateTimeConverterUtil.QUATERS_IN_HOUR; quater++) { 38 | timeCalendar.set(Calendar.HOUR_OF_DAY, hour); 39 | timeCalendar.set(Calendar.MINUTE, quater * DateTimeConverterUtil.MINS_IN_QUATER); 40 | String timeString = DateTimeConverterUtil.dateTimeToString(timeCalendar.getTime()); 41 | if (!result.contains(timeString)) { 42 | result.add(timeString); 43 | } 44 | } 45 | } 46 | return result; 47 | } 48 | 49 | private TimeAutoCompleteUtil() { 50 | 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/timetracker/plugin/util/VersionComperatorUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.timetracker.plugin.util; 17 | 18 | /** 19 | * The Jira Timetracker plugin Version comperator utils class. 20 | */ 21 | public final class VersionComperatorUtil { 22 | 23 | /** 24 | * Remove the not numerical part of the vesion. Expects the following version format 25 | * (3.0.1-SNAPSHOT). The method cut down the -SNAPSHOT part. 26 | * 27 | * @param version 28 | * The oroginal version. 29 | * @return Only the numerical part of the original version. 30 | */ 31 | private static String removeNotNumericVersionParts(final String version) { 32 | int numericEnds = version.indexOf("-"); 33 | if (numericEnds != -1) { 34 | return version.substring(0, numericEnds); 35 | } 36 | return version; 37 | } 38 | 39 | /** 40 | * Compare the two String version. Ignor string part version like -SNAPSHOT. 41 | * 42 | * @param str1 43 | * a string of ordinal numbers separated by decimal points. 44 | * @param str2 45 | * a string of ordinal numbers separated by decimal points. 46 | * @return The result is a negative integer if str1 is _numerically_ less than str2. The result is 47 | * a positive integer if str1 is _numerically_ greater than str2. The result is zero if 48 | * the strings are _numerically_ equal. 49 | */ 50 | public static int versionCompare(final String str1, final String str2) { 51 | // Check empty Strign and null 52 | if ((str1 == null) || str1.isEmpty()) { 53 | return -1; 54 | } 55 | if ((str2 == null) || str2.isEmpty()) { 56 | return 1; 57 | } 58 | // remove not numeric version parts. we dont works with them 59 | String version1 = removeNotNumericVersionParts(str1); 60 | String version2 = removeNotNumericVersionParts(str2); 61 | 62 | String[] vals1 = version1.split("\\."); 63 | String[] vals2 = version2.split("\\."); 64 | int i = 0; 65 | // set index to first non-equal ordinal or length of shortest version string 66 | while ((i < vals1.length) && (i < vals2.length) && vals1[i].equals(vals2[i])) { 67 | i++; 68 | } 69 | // compare first non-equal ordinal number 70 | if ((i < vals1.length) && (i < vals2.length)) { 71 | int diff = Integer.valueOf(vals1[i]).compareTo(Integer.valueOf(vals2[i])); 72 | return Integer.signum(diff); 73 | } 74 | // the strings are equal or one string is a substring of the other 75 | // e.g. "1.2.3" = "1.2.3" or "1.2.3" < "1.2.3.4" 76 | return Integer.signum(vals1.length - vals2.length); 77 | } 78 | 79 | private VersionComperatorUtil() { 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/updatenotifier/exception/UpdateException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.updatenotifier.exception; 17 | 18 | /** 19 | * Exception class for the update notifier. 20 | */ 21 | public class UpdateException extends RuntimeException { 22 | 23 | private static final long serialVersionUID = 8850188346830010117L; 24 | 25 | public UpdateException(final String message) { 26 | super(message); 27 | } 28 | 29 | public UpdateException(final String message, final Throwable cause) { 30 | super(message, cause); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/updatenotifier/json/Embedded.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.everit.jira.updatenotifier.json; 18 | 19 | /** 20 | * DTO for the Jira JSON format used in the marketplace REST interface. 21 | */ 22 | public class Embedded { 23 | 24 | private Version version; 25 | 26 | public Version getVersion() { 27 | return version; 28 | } 29 | 30 | public void setVersion(final Version version) { 31 | this.version = version; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/updatenotifier/json/JiraMarketplaceJSONDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.everit.jira.updatenotifier.json; 18 | 19 | import com.google.gson.annotations.Expose; 20 | import com.google.gson.annotations.SerializedName; 21 | 22 | /** 23 | * DTO for the Jira JSON format used in the marketplace REST interface. 24 | */ 25 | public class JiraMarketplaceJSONDTO { 26 | 27 | @SerializedName("_embedded") 28 | @Expose 29 | private Embedded embedded; 30 | 31 | public Embedded getEmbedded() { 32 | return embedded; 33 | } 34 | 35 | public void setEmbedded(final Embedded embedded) { 36 | this.embedded = embedded; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/updatenotifier/json/Version.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.everit.jira.updatenotifier.json; 18 | 19 | /** 20 | * DTO for the Jira JSON format used in the marketplace REST interface.. 21 | */ 22 | public class Version { 23 | 24 | private String name; 25 | 26 | public String getName() { 27 | return name; 28 | } 29 | 30 | public void setName(final String name) { 31 | this.name = name; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/everit/jira/updatenotifier/rest/UpdateNotifierRest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.updatenotifier.rest; 17 | 18 | import javax.ws.rs.GET; 19 | import javax.ws.rs.Path; 20 | import javax.ws.rs.Produces; 21 | import javax.ws.rs.core.MediaType; 22 | import javax.ws.rs.core.Response; 23 | 24 | import org.everit.jira.settings.TimeTrackerSettingsHelper; 25 | import org.everit.jira.updatenotifier.UpdateNotifier; 26 | 27 | /** 28 | * Rest for the Update notifier. 29 | */ 30 | @Path("/update-notifier") 31 | public class UpdateNotifierRest { 32 | 33 | private TimeTrackerSettingsHelper settingsHelper; 34 | 35 | public UpdateNotifierRest(final TimeTrackerSettingsHelper settingsHelper) { 36 | this.settingsHelper = settingsHelper; 37 | } 38 | 39 | /** 40 | * Save the current version in the user properties. 41 | */ 42 | @GET 43 | @Produces(MediaType.TEXT_HTML) 44 | @Path("/cancel-update") 45 | public Response saveCancel() { 46 | UpdateNotifier updateNotifierSettingsHelper = new UpdateNotifier(settingsHelper); 47 | updateNotifierSettingsHelper.putDisableNotifierForVersion(); 48 | return Response.ok().build(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/resources/css/admin_settings.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | form.aui div.description { 17 | clear: none; 18 | } 19 | 20 | form.aui div.field-group textarea { 21 | max-width: 500px; 22 | width: 100%; 23 | } 24 | 25 | .red-text { 26 | color: red; 27 | } 28 | 29 | .everit_logo{ 30 | background-image:url(E_logo.png); 31 | background-size: 48px 48px; 32 | height: 48px; 33 | } 34 | #reveal-text-content { 35 | min-height: 1.5em; 36 | } 37 | form.aui.rightMargin{ 38 | margin-right: 10rem; 39 | } 40 | .jttpDatePickerCollector{ 41 | border: 1px solid #ccc; 42 | padding: 10px; 43 | width: 65%; 44 | float: left; 45 | margin-right: 20px; 46 | min-height: 50px; 47 | } 48 | .jttpDataPickerAddButton{ 49 | margin-top: 10px; 50 | } -------------------------------------------------------------------------------- /src/main/resources/css/jtrp-aui-table-sortable.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | .jttp-aui-table-sortable .jttp-tablesorter-header { 17 | cursor: pointer; 18 | } 19 | 20 | .jttp-aui-table-sortable .jttp-tablesorter-header.jttp-aui-table-column-unsortable { 21 | cursor: default; 22 | } 23 | 24 | .jttp-aui-table-sortable .jttp-tablesorter-header.jttp-aui-table-column-unsortable:hover { 25 | background-color: inherit; 26 | color: inherit; 27 | } 28 | 29 | .jttp-aui-table-sortable .jttp-tablesorter-header:hover, .jttp-aui-table-sortable .jttp-tablesorter-headerDesc, .jttp-aui-table-sortable .jttp-tablesorter-headerAsc { 30 | background-color: #f5f5f5; 31 | color: #333; 32 | } 33 | 34 | .jttp-aui-table-sortable .jttp-aui-table-header-content:after { 35 | border: 4px solid transparent; 36 | content: ""; 37 | display: inline-block; 38 | margin-left: 5px; 39 | position: relative; 40 | width: 0; 41 | } 42 | 43 | .jttp-aui-table-sortable .jttp-tablesorter-header:hover .jttp-aui-table-header-content:after { 44 | border-top-color: #333; 45 | border-bottom-color: transparent; 46 | opacity: 0.5; 47 | top: 2px; 48 | } 49 | 50 | .jttp-aui-table-sortable .jttp-tablesorter-headerDesc .jttp-aui-table-header-content:after, .jttp-aui-table-sortable .jttp-tablesorter-headerDesc:hover .jttp-aui-table-header-content:after { 51 | border-top-color: #333; 52 | border-bottom-color: transparent; 53 | opacity: 1; 54 | top: 2px; 55 | } 56 | 57 | .jttp-aui-table-sortable .jttp-tablesorter-headerAsc .jttp-aui-table-header-content:after, .jttp-aui-table-sortable .jttp-tablesorter-headerAsc:hover .jttp-aui-table-header-content:after { 58 | border-top-color: transparent; 59 | border-bottom-color: #333; 60 | opacity: 1; 61 | top: -2px; 62 | } -------------------------------------------------------------------------------- /src/main/resources/css/news_popup.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | .tabImage{ 17 | padding-top: 10px; 18 | border: 0; 19 | width: 660px; 20 | height: 300px; 21 | } 22 | 23 | 24 | .tab1-img{ 25 | background-image: url(timezone.png); 26 | background-position-x: 90%; 27 | background-position-y: 10%; 28 | background-size: 85%; 29 | background-repeat-x: no-repeat; 30 | background-repeat-y: no-repeat; 31 | 32 | } 33 | 34 | .tab2-img{ 35 | background-image: url(remain.png); 36 | background-position-x: 90%; 37 | background-position-y: 10%; 38 | background-size: 85%; 39 | background-repeat-x: no-repeat; 40 | background-repeat-y: no-repeat; 41 | } 42 | 43 | .tab3-img{ 44 | background-image: url(additional.png); 45 | background-position-x: 90%; 46 | background-position-y: 10%; 47 | background-size: 85%; 48 | background-repeat-x: no-repeat; 49 | background-repeat-y: no-repeat; 50 | 51 | } 52 | 53 | -------------------------------------------------------------------------------- /src/main/resources/css/update_notifier.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | .update-notification-banner { 17 | background-color: #ebad11; 18 | text-align: center; 19 | color: white; 20 | } 21 | 22 | .update-notification-banner span { 23 | padding-right: 0.5rem; 24 | } 25 | 26 | .update-notification-banner-content { 27 | padding: 0.3rem 0rem; 28 | } 29 | 30 | .version-link { 31 | color: white; 32 | cursor: pointer; 33 | } 34 | 35 | .close-update-banner { 36 | float: right; 37 | cursor: pointer; 38 | } 39 | -------------------------------------------------------------------------------- /src/main/resources/css/user_settings.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | form.aui div.description { 17 | clear: none; 18 | } 19 | 20 | form.aui div.field-group textarea { 21 | max-width: 500px; 22 | width: 100%; 23 | } 24 | 25 | .red-text { 26 | color: red; 27 | } 28 | 29 | #error_message{ 30 | color: white; 31 | text-align: center; 32 | border: 1px solid; 33 | border-color: #d04437; 34 | border-radius: 3px; 35 | background-color: #d04437; 36 | } 37 | 38 | .everit_logo{ 39 | background-image:url(E_logo.png); 40 | background-size: 48px 48px; 41 | height: 48px; 42 | } 43 | 44 | .installed-version { 45 | color: #707070; 46 | } 47 | -------------------------------------------------------------------------------- /src/main/resources/icons/E_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/everit-org/jira-timetracker-plugin/55c1f169e5495e3b697355f70eb2bd27d48c2d92/src/main/resources/icons/E_logo.png -------------------------------------------------------------------------------- /src/main/resources/icons/e_logo16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/everit-org/jira-timetracker-plugin/55c1f169e5495e3b697355f70eb2bd27d48c2d92/src/main/resources/icons/e_logo16.png -------------------------------------------------------------------------------- /src/main/resources/icons/e_logo72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/everit-org/jira-timetracker-plugin/55c1f169e5495e3b697355f70eb2bd27d48c2d92/src/main/resources/icons/e_logo72.png -------------------------------------------------------------------------------- /src/main/resources/icons/jttp144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/everit-org/jira-timetracker-plugin/55c1f169e5495e3b697355f70eb2bd27d48c2d92/src/main/resources/icons/jttp144.png -------------------------------------------------------------------------------- /src/main/resources/icons/jttp16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/everit-org/jira-timetracker-plugin/55c1f169e5495e3b697355f70eb2bd27d48c2d92/src/main/resources/icons/jttp16.png -------------------------------------------------------------------------------- /src/main/resources/images/additional.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/everit-org/jira-timetracker-plugin/55c1f169e5495e3b697355f70eb2bd27d48c2d92/src/main/resources/images/additional.png -------------------------------------------------------------------------------- /src/main/resources/images/remain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/everit-org/jira-timetracker-plugin/55c1f169e5495e3b697355f70eb2bd27d48c2d92/src/main/resources/images/remain.png -------------------------------------------------------------------------------- /src/main/resources/images/timezone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/everit-org/jira-timetracker-plugin/55c1f169e5495e3b697355f70eb2bd27d48c2d92/src/main/resources/images/timezone.png -------------------------------------------------------------------------------- /src/main/resources/js/chart_report.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | window.everit = window.everit || {}; 18 | everit.jttp = everit.jttp || {}; 19 | everit.jttp.chart_report = everit.jttp.chart_report || {}; 20 | 21 | (function(jttp, jQuery) { 22 | 23 | jQuery(document).ready(function() { 24 | google.load('visualization', '1', { 25 | packages : [ 'controls' ], 26 | callback : drawChart 27 | }); 28 | }); 29 | 30 | 31 | function drawChart() { 32 | var dataArray = new Array(); 33 | dataArray.push([ 'id', 'duration' ]); 34 | var initState = { 35 | selectedValues : [] 36 | }; 37 | var chartDataList = jttp.options.chartDataList; 38 | for (index = 0; index < chartDataList.length; index++) { 39 | var chartData = chartDataList[index]; 40 | var projectId = new String(chartData.projectId); 41 | var duration = new Number(chartData.duration); 42 | duration = duration / (1000 * 60 * 60); 43 | duration = +duration.toFixed(2); 44 | dataArray.push([ projectId.toString(), duration ]); 45 | initState.selectedValues.push(projectId.toString()); 46 | } 47 | 48 | var data = google.visualization.arrayToDataTable(dataArray); 49 | 50 | var control = new google.visualization.ControlWrapper({ 51 | containerId : 'control_div', 52 | controlType : 'CategoryFilter', 53 | options : { 54 | filterColumnIndex : 0, 55 | ui : { 56 | 'label' : '', 57 | 'selectedValuesLayout' : 'belowStacked' 58 | } 59 | }, 60 | state : initState 61 | }); 62 | 63 | var chart = new google.visualization.ChartWrapper({ 64 | containerId : 'chart_div', 65 | chartType : 'PieChart', 66 | options : { 67 | height : 500, 68 | width : 700, 69 | backgroundColor : 'transparent', 70 | pieSliceText : 'value', 71 | title : 'Hours worked by projects', 72 | legend : { 73 | position : 'right', 74 | alignment : 'center' 75 | } 76 | }, 77 | view : { 78 | columns : [ 0, 1 ] 79 | } 80 | }); 81 | 82 | var dashboard = new google.visualization.Dashboard(document.querySelector('#dashboard')); 83 | 84 | dashboard.bind([ control ], [ chart ]); 85 | dashboard.draw(data); 86 | } 87 | 88 | })(everit.jttp.chart_report, AJS.$); 89 | -------------------------------------------------------------------------------- /src/main/resources/js/popup/survey-dialog.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | window.everit = window.everit || {}; 17 | everit.survey = everit.survey || {}; 18 | everit.survey.main = everit.survey.main || {}; 19 | 20 | function isOnline(yes) { 21 | var xhr = XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHttp'); 22 | xhr.onload = function() { 23 | if (yes instanceof Function) { 24 | yes(); 25 | } 26 | } 27 | xhr.onerror = function() { 28 | // do nothing 29 | } 30 | xhr.open("GET", "anypage.php", true); 31 | xhr.send(); 32 | } 33 | 34 | AJS.$(function() { 35 | setTimeout(isOnline(function() { 36 | var surveyDialogUrl = everit.survey.main.options.contextPath 37 | + "/secure/SurveyDialogWebAction!default.jspa?decorator=dialog&inline=true"; 38 | 39 | AJS.$.get(surveyDialogUrl, function(data) { 40 | 41 | var $data = AJS.$(data); 42 | var surveyScriptUrl = $data.find('#surveyScriptUrl').val(); 43 | 44 | AJS.$.getScript(surveyScriptUrl, function() { 45 | if (!showSurvey()) { 46 | return false; 47 | } 48 | 49 | var lastSavedSurveyDate = $data.find('#lastSavedSurveyDate').val(); 50 | if (lastSavedSurveyDate == "" 51 | || new Date(lastSavedSurveyDate).getTime() < getSurveyStartDate().getTime()) { 52 | AJS.$('body').append(data); 53 | AJS.dialog2('#jttp-survey-dialog').show(); 54 | AJS.$('#survey-frame-spinner').spin('large'); 55 | } 56 | }); 57 | }); 58 | }), 0); 59 | }); 60 | 61 | (function(survey, jQuery) { 62 | 63 | survey.finishSurvey = function() { 64 | var checked = jQuery('#finishSurvey_dns').attr('checked'); 65 | if(checked){ 66 | var surveyDialogUrl = everit.survey.main.options.contextPath 67 | + "/secure/SurveyDialogWebAction.jspa?action=save"; 68 | AJS.$.get(surveyDialogUrl, function(data) { 69 | // do nothing 70 | }); 71 | } 72 | AJS.dialog2('#jttp-survey-dialog').hide(); 73 | return true; 74 | } 75 | 76 | })(everit.survey.main, jQuery); 77 | -------------------------------------------------------------------------------- /src/main/resources/js/reporting_user_settings.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | window.everit = window.everit || {}; 18 | everit.jttp = everit.jttp || {}; 19 | everit.jttp.reporting_admin = everit.jttp.reporting_admin || {}; 20 | 21 | (function(jttp, jQuery) { 22 | 23 | jQuery(document).ready(function() { 24 | 25 | jQuery("#pagesize-dropdown2-checkbox-radio-interactive").find("a.aui-dropdown2-radio").each(function() { 26 | this.onclick = function(){ 27 | updatePageSizeButtonText(this); 28 | }; 29 | }); 30 | 31 | jQuery("#pages_" + jttp.options.pageSize).addClass("checked aui-dropdown2-checked"); 32 | updatePageSizeButtonText(jQuery("#pages_" + jttp.options.pageSize)[0]); 33 | 34 | }); 35 | 36 | updatePageSizeButtonText = function(element){ 37 | jQuery("#pageSizeInput").val(element.text); 38 | jQuery("#pageSizeButton").text(element.text); 39 | }; 40 | 41 | 42 | })(everit.jttp.reporting_admin, jQuery); -------------------------------------------------------------------------------- /src/main/resources/js/update_notifier.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | function callUpdateNotifierRest() { 17 | jQuery.ajax({ 18 | async : true, 19 | type : 'GET', 20 | url : contextPath + "/rest/jttp-rest/1/update-notifier/cancel-update", 21 | data : [], 22 | success : function(result) { 23 | jQuery(".update-notification-banner").remove(); 24 | }, 25 | error : function(XMLHttpRequest, status, error) { 26 | } 27 | }); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/jttp_build.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # The feedback email to 18 | PIWIK_HOST=${jttp.piwik.host} 19 | PIWIK_TIMETRACKER_SITEID=${jttp.piwik.timetracker.siteid} 20 | PIWIK_WORKLOGS_SITEID=${jttp.piwik.worklogs.siteid} 21 | PIWIK_CHART_SITEID=${jttp.piwik.chart.siteid} 22 | PIWIK_TABLE_SITEID=${jttp.piwik.table.siteid} 23 | PIWIK_ADMINISTRATION_SITEID=${jttp.piwik.administration.siteid} 24 | ISSUE_COLLECTOR_SRC=${jtrp.issue.collectore.src} 25 | PIWIK_REPORTING_SITEID=${jttp.piwik.reporting.siteid} 26 | PIWIK_USERSETTINGS_SITEID=${jttp.piwik.usersettings.siteid} 27 | PIWIK_SEARCHER_VALUE_CUSTOM_DIMENSION_INDEX=1 28 | PIWIK_ACTIVE_FILTER_CONDITION_CUSTOM_DIMENSION_INDEX=2 29 | PIWIK_USER_SELECTION_CUSTOM_DIMENSION_INDEX=3 30 | PIWIK_SELECTED_WORKLOG_DETAIL_COLUMNS_CUSTOM_DIMENSION_INDEX=4 31 | PIWIK_SELECTED_ACTIVE_TAB_CUSTOM_DIMENSION_INDEX=5 32 | SURVEY_SCRIPT_URL=${jttp.popup.survey.script.url} 33 | SURVEY_FORM_URL=${jttp.popup.survey.form.url} 34 | -------------------------------------------------------------------------------- /src/main/resources/templates/common/analytics.vm: -------------------------------------------------------------------------------- 1 | #* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *# 16 | 17 | 39 | 40 | -------------------------------------------------------------------------------- /src/main/resources/templates/common/error.vm: -------------------------------------------------------------------------------- 1 | #* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *# 16 | 17 | 18 | $i18n.getText("jttp.error.title") 19 | 20 | 21 | $webResourceManager.requireResourcesForContext("org.everit.jira.timetracker.plugin.jttp-resources") 22 |
23 |

24 | $i18n.getText("jttp.error.message.title") 25 |

26 |
27 |

$i18n.getText("jttp.error.message.detials")

28 | #if(!$stacktrace.equals('')) 29 |

30 | $i18n.getText("jttp.error.message.technical.detials") 31 |

32 |
33 |
34 |
$stacktrace
35 |
36 |
37 | 42 | $i18n.getText("jttp.error.show.more") 43 | 44 | 49 | #end 50 |
51 |
52 | 53 | -------------------------------------------------------------------------------- /src/main/resources/templates/common/timeselect.vm: -------------------------------------------------------------------------------- 1 | #* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *# 16 | 17 | #foreach ($time in $generateAutoCompleteList) 18 | -------------------------------------------------------------------------------- /src/main/resources/templates/common/updatenotifier.vm: -------------------------------------------------------------------------------- 1 | #* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *# 16 | $webResourceManager.requireResourcesForContext("org.everit.jira.timetracker.plugin.update_notifier-resources") 17 | #if($renderUpdateNotifier) 18 |
19 |
20 | There is a new version of Timetracker available. See what's new in the latest version here! 21 |
22 | 23 |
24 |
25 |
26 | #end 27 | -------------------------------------------------------------------------------- /src/main/resources/templates/popup/survey-dialog.vm: -------------------------------------------------------------------------------- 1 | #* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *# 16 | 43 | -------------------------------------------------------------------------------- /src/main/resources/templates/reporting/reporting_result.vm: -------------------------------------------------------------------------------- 1 | #* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *# 16 |
17 |
18 |
19 |
20 | 21 | #parse("templates/reporting/reporting_result_worklog_details.vm") 22 | 23 | #parse("templates/reporting/reporting_result_summaries.vm") 24 |
25 |
26 |
27 | -------------------------------------------------------------------------------- /src/test/java/org/everit/jira/tests/core/DummyDateTimeFromatter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.tests.core; 17 | 18 | import java.text.ParseException; 19 | import java.text.SimpleDateFormat; 20 | import java.util.Date; 21 | import java.util.Locale; 22 | import java.util.TimeZone; 23 | 24 | import com.atlassian.crowd.embedded.api.User; 25 | import com.atlassian.jira.datetime.DateTimeFormatter; 26 | import com.atlassian.jira.datetime.DateTimeStyle; 27 | 28 | public class DummyDateTimeFromatter implements DateTimeFormatter { 29 | 30 | @Override 31 | public DateTimeFormatter forLoggedInUser() { 32 | return this; 33 | } 34 | 35 | @Override 36 | public String format(final Date arg0) { 37 | SimpleDateFormat sdf = new SimpleDateFormat(getFormatHint()); 38 | return sdf.format(arg0); 39 | } 40 | 41 | @Override 42 | public DateTimeFormatter forUser(final User arg0) { 43 | return this; 44 | } 45 | 46 | @Override 47 | public String getFormatHint() { 48 | return "HH:mm"; 49 | } 50 | 51 | @Override 52 | public Locale getLocale() { 53 | return Locale.ENGLISH; 54 | } 55 | 56 | @Override 57 | public DateTimeStyle getStyle() { 58 | return DateTimeStyle.TIME; 59 | } 60 | 61 | @Override 62 | public TimeZone getZone() { 63 | return TimeZone.getDefault(); 64 | } 65 | 66 | @Override 67 | public Date parse(final String arg0) 68 | throws IllegalArgumentException, UnsupportedOperationException { 69 | SimpleDateFormat sdf = new SimpleDateFormat(getFormatHint()); 70 | try { 71 | return sdf.parse(arg0); 72 | } catch (ParseException e) { 73 | throw new IllegalArgumentException(); 74 | } 75 | } 76 | 77 | @Override 78 | public DateTimeFormatter withDefaultLocale() { 79 | return this; 80 | } 81 | 82 | @Override 83 | public DateTimeFormatter withDefaultZone() { 84 | return this; 85 | } 86 | 87 | @Override 88 | public DateTimeFormatter withLocale(final Locale arg0) { 89 | return this; 90 | } 91 | 92 | @Override 93 | public DateTimeFormatter withStyle(final DateTimeStyle arg0) { 94 | return this; 95 | } 96 | 97 | @Override 98 | public DateTimeFormatter withSystemZone() { 99 | return this; 100 | } 101 | 102 | @Override 103 | public DateTimeFormatter withZone(final TimeZone arg0) { 104 | return this; 105 | } 106 | 107 | } 108 | -------------------------------------------------------------------------------- /src/test/java/org/everit/jira/tests/core/impl/supportmanager/GetProjectIdsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.tests.core.impl.supportmanager; 17 | 18 | import java.util.ArrayList; 19 | import java.util.Arrays; 20 | import java.util.Collections; 21 | import java.util.HashMap; 22 | import java.util.List; 23 | import java.util.Map; 24 | 25 | import org.everit.jira.core.SupportManager; 26 | import org.everit.jira.core.impl.SupportComponent; 27 | import org.junit.Assert; 28 | import org.junit.Test; 29 | import org.mockito.Matchers; 30 | import org.mockito.Mockito; 31 | import org.ofbiz.core.entity.GenericValue; 32 | import org.ofbiz.core.entity.model.ModelEntity; 33 | 34 | import com.atlassian.jira.mock.component.MockComponentWorker; 35 | import com.atlassian.jira.ofbiz.OfBizDelegator; 36 | 37 | public class GetProjectIdsTest { 38 | 39 | static class DummyGenericValue extends GenericValue { 40 | private static final long serialVersionUID = 3415063923321743460L; 41 | 42 | private final Map values; 43 | 44 | @SuppressWarnings("deprecation") 45 | public DummyGenericValue(final Map values) { 46 | super(new ModelEntity()); 47 | this.values = Collections.unmodifiableMap(new HashMap<>(values)); 48 | } 49 | 50 | @Override 51 | public Long getLong(final String key) { 52 | Object object = values.get(key); 53 | if (object == null) { 54 | return null; 55 | } 56 | return Long.valueOf(object.toString()); 57 | } 58 | 59 | @Override 60 | public String getString(final String key) { 61 | Object object = values.get(key); 62 | if (object == null) { 63 | return null; 64 | } 65 | return String.valueOf(object); 66 | } 67 | } 68 | 69 | private GenericValue createDummyGenericValue(final int projectId) { 70 | HashMap values = new HashMap<>(); 71 | values.put("id", projectId); 72 | return new DummyGenericValue(values); 73 | } 74 | 75 | private void initMockComponentWorker() { 76 | MockComponentWorker mockComponentWorker = new MockComponentWorker(); 77 | 78 | OfBizDelegator ofBizDelegator = Mockito.mock(OfBizDelegator.class, Mockito.RETURNS_DEEP_STUBS); 79 | Mockito.when(ofBizDelegator.findAll(Matchers.eq("Project"))) 80 | .thenReturn(new ArrayList<>( 81 | Arrays.asList( 82 | createDummyGenericValue(1), 83 | createDummyGenericValue(2)))); 84 | 85 | mockComponentWorker.addMock(OfBizDelegator.class, ofBizDelegator) 86 | .init(); 87 | } 88 | 89 | @Test 90 | public void testGetProjectIds() { 91 | initMockComponentWorker(); 92 | 93 | SupportManager supportManager = new SupportComponent(null); 94 | 95 | List projectsId = supportManager.getProjectsId(); 96 | Assert.assertEquals(2, projectsId.size()); 97 | Assert.assertEquals("1", projectsId.get(0)); 98 | Assert.assertEquals("2", projectsId.get(1)); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/test/java/org/everit/jira/tests/core/util/DateTImeConverterUtilTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.tests.core.util; 17 | 18 | import org.everit.jira.timetracker.plugin.util.DateTimeConverterUtil; 19 | import org.joda.time.DateTime; 20 | import org.joda.time.DateTimeZone; 21 | import org.junit.Assert; 22 | import org.junit.Test; 23 | 24 | public class DateTImeConverterUtilTest { 25 | 26 | @Test 27 | public void setDayBeginingTest() { 28 | DateTime dayStart = 29 | DateTimeConverterUtil.setDateToDayStart(new DateTime(1483236000000L, DateTimeZone.UTC)); 30 | Assert.assertEquals(1483228800000L, dayStart.getMillis()); 31 | 32 | dayStart = 33 | DateTimeConverterUtil 34 | .setDateToDayStart(new DateTime(1483236000000L, DateTimeZone.forID("Etc/GMT+3"))); 35 | Assert.assertEquals(1483153200000L, dayStart.getMillis()); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/test/java/org/everit/jira/tests/settings/DummyPluginSettings.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.tests.settings; 17 | 18 | import java.util.HashMap; 19 | import java.util.Map; 20 | 21 | import org.everit.jira.settings.dto.JTTPSettingsKey; 22 | import org.everit.jira.settings.dto.SettingsMapper; 23 | import org.everit.jira.settings.dto.UserSettingKey; 24 | 25 | import com.atlassian.sal.api.pluginsettings.PluginSettings; 26 | 27 | public class DummyPluginSettings implements PluginSettings { 28 | 29 | private final Map map = new HashMap<>(); 30 | 31 | @Override 32 | public Object get(final String key) { 33 | return map.get(key); 34 | } 35 | 36 | public Object getGlobalSetting(final SettingsMapper settingsKey) { 37 | return map.get(JTTPSettingsKey.JTTP_PLUGIN_SETTINGS_KEY_PREFIX + settingsKey.getSettingsKey()); 38 | 39 | } 40 | 41 | public Map getMap() { 42 | return map; 43 | } 44 | 45 | @Override 46 | public Object put(final String key, final Object value) { 47 | return map.put(key, value); 48 | } 49 | 50 | public void putGlobalSetting(final SettingsMapper settingsKey, final Object value) { 51 | map.put(JTTPSettingsKey.JTTP_PLUGIN_SETTINGS_KEY_PREFIX + settingsKey.getSettingsKey(), 52 | value); 53 | } 54 | 55 | public void putUserSetting(final UserSettingKey key, final String value) { 56 | map.put(key.getSettingsKey(), 57 | value); 58 | 59 | } 60 | 61 | @Override 62 | public Object remove(final String key) { 63 | return map.remove(key); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/test/java/org/everit/jira/tests/timetracker/plugin/DurationBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.tests.timetracker.plugin; 17 | 18 | /** 19 | * Fluent API for building durations represented in seconds. 20 | */ 21 | public class DurationBuilder { 22 | 23 | private static final int HOUR; 24 | 25 | private static final int MINUTE = 60; 26 | 27 | static { 28 | HOUR = MINUTE * 60; 29 | } 30 | 31 | private final double dayConstant; 32 | 33 | private int days; 34 | 35 | private int hours; 36 | 37 | private int minutes; 38 | 39 | private final double weekConstant; 40 | 41 | private int weeks; 42 | 43 | public DurationBuilder(final double hoursPerDay, final double daysPerWeek) { 44 | dayConstant = HOUR * hoursPerDay; 45 | weekConstant = dayConstant * daysPerWeek; 46 | } 47 | 48 | public DurationBuilder day(final int dayCount) { 49 | days = dayCount; 50 | return this; 51 | } 52 | 53 | public DurationBuilder hour(final int hourCount) { 54 | hours = hourCount; 55 | return this; 56 | } 57 | 58 | public DurationBuilder min(final int minuteCount) { 59 | minutes = minuteCount; 60 | return this; 61 | } 62 | 63 | public int toSeconds() { 64 | return (int) (weeks * weekConstant) + (int) (days * dayConstant) + (hours * HOUR) 65 | + (minutes * MINUTE); 66 | } 67 | 68 | public DurationBuilder week(final int weekCount) { 69 | weeks = weekCount; 70 | return this; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/test/java/org/everit/jira/tests/timetracker/plugin/VersionComperatorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.tests.timetracker.plugin; 17 | 18 | import java.util.Arrays; 19 | import java.util.List; 20 | 21 | import org.everit.jira.timetracker.plugin.util.VersionComperatorUtil; 22 | import org.junit.Assert; 23 | import org.junit.Test; 24 | import org.junit.runner.RunWith; 25 | import org.junit.runners.Parameterized; 26 | import org.junit.runners.Parameterized.Parameters; 27 | 28 | @RunWith(Parameterized.class) 29 | public class VersionComperatorTest { 30 | 31 | @Parameters 32 | public static List params() { 33 | return Arrays.asList( 34 | new Object[] { "1.1.1", "1.1.1", 0 }, 35 | new Object[] { "1.1.1", "1.1.2", -1 }, 36 | new Object[] { "1.1.2", "1.1.1", 1 }, 37 | new Object[] { "1.1.1", "1.1.1-SNAPSHOT", 0 }, 38 | new Object[] { "1.2.1", "1.1.1-SNAPSHOT", 1 }, 39 | new Object[] { "1.2.1", "1.2.2-SNAPSHOT", -1 }, 40 | new Object[] { "2.0.1", "2.1.0-SNAPSHOT", -1 }, 41 | new Object[] { "3.0.0-RC", "2.1.0-SNAPSHOT", 1 }, 42 | new Object[] { "", "2.1.0-SNAPSHOT", -1 }, 43 | new Object[] { "1.2.0", "", 1 }); 44 | } 45 | 46 | private final int expectedResult; 47 | 48 | private final String version1; 49 | 50 | private final String version2; 51 | 52 | public VersionComperatorTest(final String version1, 53 | final String version2, final int expectedResult) { 54 | super(); 55 | this.version1 = version1; 56 | this.version2 = version2; 57 | this.expectedResult = expectedResult; 58 | } 59 | 60 | @Test 61 | public void testVersionComperator() { 62 | int versionCompare = VersionComperatorUtil.versionCompare(version1, version2); 63 | Assert.assertEquals(expectedResult, versionCompare); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/test/java/org/everit/jira/tests/updatenotifier/UpdateNotifierTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.tests.updatenotifier; 17 | 18 | import org.everit.jira.updatenotifier.TimetrackerVersionUpdater; 19 | import org.everit.jira.updatenotifier.UpdateNotifier; 20 | import org.everit.jira.updatenotifier.exception.UpdateException; 21 | import org.junit.Assert; 22 | import org.junit.Test; 23 | import org.mockito.Matchers; 24 | import org.mockito.Mockito; 25 | 26 | import com.atlassian.jira.mock.component.MockComponentWorker; 27 | import com.atlassian.jira.util.BuildUtilsInfo; 28 | 29 | public class UpdateNotifierTest { 30 | 31 | private static final long TWO_MINUTE_IN_MILISEC = 120000; 32 | 33 | private void initMockComponentWorker(final Integer buildNumber) { 34 | MockComponentWorker mockComponentWorker = new MockComponentWorker(); 35 | 36 | BuildUtilsInfo buildUtilsInfo = Mockito.mock(BuildUtilsInfo.class, Mockito.RETURNS_DEEP_STUBS); 37 | Mockito.when(buildUtilsInfo.getApplicationBuildNumber()) 38 | .thenReturn(buildNumber); 39 | 40 | mockComponentWorker.addMock(BuildUtilsInfo.class, buildUtilsInfo) 41 | .init(); 42 | } 43 | 44 | @Test 45 | public void testNotUpdateVersion() { 46 | initMockComponentWorker(725); 47 | UpdateNotifier mock = Mockito.mock(UpdateNotifier.class); 48 | TimetrackerVersionUpdater jttpVersionUpdater = new TimetrackerVersionUpdater(mock); 49 | Mockito.when(mock.getLastUpdateTime()) 50 | .thenReturn(System.currentTimeMillis() - TWO_MINUTE_IN_MILISEC); 51 | jttpVersionUpdater.updateLatestVersion(); 52 | Mockito.verify(mock).getLastUpdateTime(); 53 | } 54 | 55 | @Test 56 | public void testUpdateFail() { 57 | initMockComponentWorker(711); 58 | UpdateNotifier mock = Mockito.mock(UpdateNotifier.class); 59 | TimetrackerVersionUpdater jttpVersionUpdater = new TimetrackerVersionUpdater(mock); 60 | Mockito.when(mock.getLastUpdateTime()).thenReturn(2L); 61 | Mockito.doNothing().when(mock).putLastUpdateTime(org.easymock.EasyMock.anyLong()); 62 | Mockito.doNothing().when(mock).putLatestVersion(Matchers.anyString()); 63 | try { 64 | jttpVersionUpdater.updateLatestVersion(); 65 | Assert.fail(); 66 | } catch (UpdateException e) { 67 | } 68 | Mockito.verify(mock, Mockito.times(2)).getLastUpdateTime(); 69 | Mockito.verify(mock).putLastUpdateTime(Matchers.anyLong()); 70 | } 71 | 72 | @Test 73 | public void testUpdateVersion() { 74 | initMockComponentWorker(725); 75 | UpdateNotifier mock = Mockito.mock(UpdateNotifier.class); 76 | TimetrackerVersionUpdater jttpVersionUpdater = new TimetrackerVersionUpdater(mock); 77 | Mockito.when(mock.getLastUpdateTime()).thenReturn(2L); 78 | Mockito.doNothing().when(mock).putLastUpdateTime(org.easymock.EasyMock.anyLong()); 79 | Mockito.doNothing().when(mock).putLatestVersion(Matchers.anyString()); 80 | jttpVersionUpdater.updateLatestVersion(); 81 | Mockito.verify(mock, Mockito.times(2)).getLastUpdateTime(); 82 | Mockito.verify(mock).putLastUpdateTime(Matchers.anyLong()); 83 | Mockito.verify(mock).putLatestVersion(Matchers.eq("1.4.3")); 84 | } 85 | 86 | } 87 | -------------------------------------------------------------------------------- /src/test/java/org/everit/jira/tests/util/converterUtilForTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Everit Kft. (http://www.everit.org) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.everit.jira.tests.util; 17 | 18 | import java.text.ParseException; 19 | import java.util.Date; 20 | 21 | import org.everit.jira.timetracker.plugin.util.DateTimeConverterUtil; 22 | import org.joda.time.DateTime; 23 | import org.joda.time.DateTimeZone; 24 | 25 | public class converterUtilForTests { 26 | 27 | public static DateTime fixFormatStringToUTCDateTime(final String dateString) 28 | throws ParseException { 29 | Date fixFormatStringToDate = DateTimeConverterUtil.fixFormatStringToDate(dateString); 30 | return new DateTime(fixFormatStringToDate.getTime(), DateTimeZone.UTC); 31 | } 32 | 33 | } 34 | --------------------------------------------------------------------------------