Commits

Mary Anthony  committed 82f07df

empty

  • Participants
  • Parent commits 2877e00

Comments (0)

Files changed (11)

File LICENSE

-To avoid future confusion, we recommend that you include a license with your plugin.
-This file is simply a reminder.
-
-For a template license you can have a look at: http://www.opensource.org/licenses/
-
-Atlassian releases most of its modules under a BSD license: http://www.opensource.org/licenses/bsd-license.php

File README

-This is the source code for the 'Adding Content to the JIRA View Issue Page' JIRA Plugin Tutorial, which is available at:
-
-https://developer.atlassian.com/display/JIRADEV/Plugin+Tutorial+-+Adding+Content+to+the+JIRA+View+Issue+Page
-
-
-To start using the Atlassian Plugin SDK, here are some SDK commands you'll be able to use immediately:
-
-* atlas-run   -- installs this plugin into JIRA and starts it on http://localhost:2990/jira
-* atlas-debug -- same as atlas-run, but allows a debugger to attach at port 5005
-* atlas-cli   -- after atlas-run or atlas-debug, opens a Maven command line window:
-                 - 'pi' reinstalls the plugin into the running JIRA instance
-* atlas-help  -- prints description for all commands in the SDK
-
-Full Atlassian Plugin SDK documentation is always available at:
-
-http://confluence.atlassian.com/display/DEVNET/Developing+your+Plugin+using+the+Atlassian+Plugin+SDK

File pom.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>com.example.plugins.tutorial</groupId>
-  <artifactId>tutorial-jira-add-content-to-view-issue-screen</artifactId>
-  <packaging>atlassian-plugin</packaging>
-  <name>Due Date Indicator on the 'View Issue' Page</name>
-  <version>1.0-SNAPSHOT</version>
-  <description>This is plugin demonstrates how to add custom content (a web panel) to JIRA's 'View Issue' page and display content based on the value of a the issue's Due Date system field.</description>
-  <organization>
-    <name>Example Company</name>
-  </organization>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>com.atlassian.maven.plugins</groupId>
-        <artifactId>maven-jira-plugin</artifactId>
-        <version>3.7</version>
-        <extensions>true</extensions>
-        <configuration>
-          <productVersion>${jira.version}</productVersion>
-          <productDataVersion>${jira.version}</productDataVersion>
-        </configuration>
-      </plugin>
-      <plugin>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <configuration>
-          <source>1.6</source>
-          <target>1.6</target>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-  <dependencies>
-    <dependency>
-      <groupId>com.atlassian.jira</groupId>
-      <artifactId>jira-api</artifactId>
-      <version>${jira.version}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.8.1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.atlassian.jira</groupId>
-      <artifactId>jira-tests</artifactId>
-      <version>${jira.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.atlassian.jira</groupId>
-      <artifactId>jira-func-tests</artifactId>
-      <version>${jira.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.mockito</groupId>
-      <artifactId>mockito-all</artifactId>
-      <version>1.8.5</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-  <properties>
-    <amps.version>3.7</amps.version>
-    <jira.version>5.0-beta1</jira.version>
-  </properties>
-</project>
-

File src/main/java/com/example/plugins/tutorial/DueDateIndicator.java

-package com.example.plugins.tutorial;
-
-import com.atlassian.crowd.embedded.api.User;
-import com.atlassian.jira.issue.Issue;
-import com.atlassian.jira.plugin.webfragment.contextproviders.AbstractJiraContextProvider;
-import com.atlassian.jira.plugin.webfragment.model.JiraHelper;
-
-import java.sql.Timestamp;
-import java.util.HashMap;
-import java.util.Map;
-
-public class DueDateIndicator extends AbstractJiraContextProvider
-{
-    private static final int MILLIS_IN_DAY = 24 * 60 * 60 * 1000;
-
-    @Override
-    public Map getContextMap(User user, JiraHelper jiraHelper) {
-        Map contextMap = new HashMap();
-        Issue currentIssue = (Issue) jiraHelper.getContextParams().get("issue");
-        Timestamp dueDate = currentIssue.getDueDate();
-        if (dueDate != null)
-        {
-            int currentTimeInDays = (int) (System.currentTimeMillis() / MILLIS_IN_DAY);
-            int dueDateTimeInDays = (int) (dueDate.getTime() / MILLIS_IN_DAY);
-            int daysAwayFromDueDateCalc = dueDateTimeInDays - currentTimeInDays + 1;
-            contextMap.put("daysAwayFromDueDate", daysAwayFromDueDateCalc);
-        }
-        return contextMap;
-    }
-}
-

File src/main/resources/atlassian-plugin.properties

-#
-#Wed Nov 09 17:03:27 EST 2011
-due-date-indicator.name=DueDateIndicator
-due-date-indicator.description=The DueDateIndicator Plugin
-due-date-indicator.title=Due Date Indicator

File src/main/resources/atlassian-plugin.xml

-<?xml version="1.0" encoding="UTF-8"?>
-
-<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2">
-  <plugin-info>
-    <description>${project.description}</description>
-    <version>${project.version}</version>
-    <vendor name="${project.organization.name}" url="${project.organization.url}"/>
-  </plugin-info>
-  <web-panel name="DueDateIndicator" i18n-name-key="due-date-indicator.name" key="due-date-indicator" location="atl.jira.view.issue.right.context" weight="1000">
-    <description key="due-date-indicator.description">The DueDateIndicator Plugin</description>
-    <context-provider class="com.example.plugins.tutorial.DueDateIndicator"/>
-    <resource name="view" type="velocity" location="due-date-indicator.vm"/>
-    <label key="due-date-indicator.title"/>
-  </web-panel>
-  <resource type="i18n" name="i18n" location="atlassian-plugin"/>
-</atlassian-plugin>

File src/main/resources/due-date-indicator.vm

-#set ($overdueDays = $daysAwayFromDueDate * -1)
-#if ($daysAwayFromDueDate > 1)
-    <span style="font-weight: bold; color: green;">This issue is due in $daysAwayFromDueDate days.</span>
-#elseif ($daysAwayFromDueDate == 1)
-    <span style="font-weight: bold; color: blue;">This is issue is due tomorrow.</span>
-#elseif ($daysAwayFromDueDate == 0)
-    <span style="font-weight: bold; color: purple;">This issue is due today.</span>
-#elseif ($daysAwayFromDueDate == -1)
-    <span style="font-weight: bold; color: #ff4500;">This issue was due yesterday!</span>
-#elseif ($daysAwayFromDueDate < -1)
-    <span style="font-weight: bold; color: red;">This issue is overdue by $overdueDays days!</span>
-#end

File src/test/java/com/example/plugins/tutorial/DueDateIndicatorTest.java

-package com.example.plugins.tutorial;
-
-import org.junit.Test;
-
-public class DueDateIndicatorTest
-{
-    @Test
-    public void testSomething()
-    {
-    }
-}

File src/test/java/it/DueDateIndicatorTest.java

-package it;
-
-import org.junit.Test;
-
-public class DueDateIndicatorTest
-{
-    @Test
-    public void integrationTest()
-    {
-    }
-}

File src/test/resources/TEST_RESOURCES_README

-Create any of the test resources you might need in this directory.
-
-Please remove this file before releasing your plugin.

File src/test/xml/TEST_XML_RESOURCES_README

-Create all XML test resources here - these might be needed for populating JIRA instance at the integration-test phase with test data.
-
-Please remove this file before releasing your plugin.