Monthly Archives: May 2016

How to programmatically move attachments from one JIRA issue to another JIRA issue?

The following piece of code when executed, helps us move jira migrate attachments between two issues of same project or different projects in Jira.

Here I have two issues, one of them will be the source issue, where user adds jira copy attachements to another issue will be the target issue, where the user want to move the attachment to.

This functionality is working fine in JIRA in its UI, however, I have tried to accomplish the same functionality through Java code. The following code executes the task of moving an attachment between the issues of both same or different projects.

Continue reading

Posted in J2EE, JAVA, JIRA, JIRA on Demand. Tagged with , , , , .

SILVER BULLET

No matter how terrifying a monster is, humans always try to find the silver bullet, to bring the inexplicability of the monster to a level of comprehension. Software is referred to as such a monster because its ever-expanding level of complexity brings with it, multifarious issues which themselves are monstrous in their own accord.

 

The inherent properties of a modern software system are conformity, changeability, complexity and invisibility. Conformity is a necessary evil and normally has no logic to it but, for organisational restrictions. Changeability again is a constant sword hanging over software systems. Complexity of software systems is rather interesting as it is desired and not accidental and yet constitutes most of the monstrosity of software systems. By invisibility, I refer to the fact that that there isnt any tool that can physically and convincingly represent a software system and this limits us in ways nothing else does.

 

Lets backtrack to when abacus had just been invented, we thought this was definitely an answer to the egregious calculations. As calculations became more and more complicated, seeking an answer led us to the beautiful concept of object oriented programming. It was a moment of celebration for developers all over the world as they thought- finally we have our solution. OOP with its modularity, reusability, reliability, maintainability etc. definitely addressed a lot of issues. However, software is abstract and a conceptual entity and hence visualisation of its impact and its challenges is indefinitely and inherently complex. We have now come a long way and invented supercomputers like IBMSequoia, CrayTitan, NUDTTianhe-2, and yet we are not close to our silver bullet. OOP, however, many would argue, is the closest thing to a silver bullet in the software world.
Continue reading

Posted in Agile, JAVA, MirketaInc. Tagged with , , , , , , , , , .

Time Dependent Workflow Salesforce

Workflow

Time based workflow is an automated process to implement the business logic, that evaluates the record at the time of creation or update. It is one of the most powerful tools of Salesforce.

Why necessary??

Workflow becomes indispensable to organizations for maximizing efficiency in their business processes. It allows tracking of processes.
Continue reading

Posted in Agile, Learn Salesforce, Salesforce, salesforce Tips & Tricks. Tagged with , , , .

jQuery tutorial for beginners

What is jQuery?

jQuery is a lightweight, “write less, do more”, JavaScript library. jQuery is a fast, small, and feature-rich JavaScript library. It makes HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. jQuery is absolutely amazing. It’s cross-browser, easy to learn, and makes adding interactivity to your website a breeze.

How to setup jQuery file with html

Before we can do anything, we need to establish our file and link it to our HTML document. First, we will create our plugin file and put it in the directory of our website. It is traditional to start our filename with jQuery in salesforce, followed by the actual plugin name, so we will call this jquery-hello.
Continue reading

Posted in Agile, CSS, HTML/CSS, Java Script, UI. Tagged with , , , , .

How to design your first Jira Gadget Url?

Jira provide the ability to display information about project/issues/data on a dashboard, through the use of gadgets. Gadgets XML are a big leap in JIRA reporting features.

In this document here I shall give instructions on how to write your first Jira gadget.

Before we start designing the gadget, we should know the key component of Jira gadgets:-

  • GADGET XML is the most important part of a Jira gadget. It holds the specification of the gadget, and includes the following:-
    • Gadget Characteristics: It includes the title, description and author’s name.Screenshot and thumbnail image: This is optional, so we can add it if we want. This is not used within Atlassian containers such as JIRA html gadget or CONFLUENCE.
    • Required features: we include it, to add some features in our Gadgets.
    • User preferences: this will be configured by gadget users.
    • The Gadget content is created using jira HTML gadget and JavaScript.
  • A screenshot and thumbnail image will be used during the preview and while selecting the gadget from the container.
  • An i18n property file is used for internationalization in the gadget.
  • Optional CSS and JavaScript file can be used to render the display in the content section of the gadget.

For writing your first gadget you will initially need to create a skeleton plugin using Atlassian Plugin SDK.

You can create your skeleton plugin by the help of the following link:-

https://developer.atlassian.com/docs/common-coding-tasks/development-cycle/creating-a-plugin-skeleton-with-the-atlassian-sdk
After creating your skeleton plugin you need to perform the following steps to write your first Jira Gadget:-

1.Modify your plugin descriptor with the Gadget module and resources.

-Add the Gadget Module in the plugin descriptor.

<gadget key=”jira gadget url” name=”Jira Gadget” location=”jira-gadget.xml”>
<description>Jira First Gadget</description>
</gadget>

-Add the resources in the plugin descriptor.

<!– add our web resources –>
<web-resource key=”Jira Gadget Url” name=”Jira-Gadget Web Resources”>  

<dependency>com.atlassian.auiplugin:ajs</dependency>
<resource type=”download” name=”Jira-Gadget.css” location=”/css/Jira-Gadget.css”/> <resource type=”download” name=”Jira-Gadget.js” location=”/js/Jira-Gadget.js”/>
<resource type=”download” name=”aui.css” location=”/css/aui.css”/>
<resource type=”download” name=”jquery-1.11.3.min.js” location=”/js/jquery-1.11.3.min.js”/>
<resource type=”download” name=”jquery-ui.js” location=”/js/jquery-ui.js”/>
<resource type=”download” name=”jquery-ui.min.js” location=”/js/jquery-ui.min.js”/> <resource type=”download” name=”images/” location=”/images”/>

<context>Jira-Gadget</context>
</web-resource>

After the modifications, your plugin descriptor will look like this:-

2. To design the Gadget XML file

The Gadget XML has a Module element at the root of the XML. It has mainly three child elements –

-ModulePrefs
-UserPref
-Content.

The entire set of attributes and elements and other details of the gadget specification can be read at https://developer.atlassian.com/display/GADGETS/Creating+your+Gadget+XML+Specification

a. To design the ModulePrefs element
This element holds information about the jira gadget url. It has two child elements

-Require
-Optional

As you can see, it holds information like title, title URL, description, author name and email, height of the gadget, URL, screenshots and thumbnail image.

Anything that starts with __MSG_ and ends with __ is a property that is referred from the i18n properties file. The height of the gadget is optional and 200, by default. The images are referenced using #staticResourceUrl where the first argument is the fully qualified gadget module key and this is of the form ${atlassianplugin- key}:${module-key}. In our example, the plugin key is com.jtricks.gadgets and the module key is hello-gadget.

Add the optional gadget directory feature inside ModulePrefs. This is currently supported only in JIRA:

<Optional feature=”gadget-directory”>

<Param name=”categories”>
Other
</Param>

</Optional>

In the example, we can add the category as Other!

Other values supported for category are: JIRA, Confluence, FishEye, Crucible, Crowd, Clover, Bamboo, Admin, Charts, and External Content.

You can add the gadget to more than one category by adding the categories within the Param element (each in a new line).

Include Required features if there are any under the XML tag <require>. A full list of supported features can be found at

http://confluence.atlassian.com/display/GADGETDEV/Including+Features+into+your+Gadget.

Add the Locale element to point to the i18n properties file:

<Locale messages=”__ATLASSIAN_BASE_URL__/download/resources/com.jtricks.gadgets/i18n/messages.xml/>

Here the property __ATLASSIAN_BASE_URL__ will be automatically substituted with JIRA’s configured base URL when the gadget is rendered. The path to the property file here is __ATLASSIAN_BASE_URL__/download/ resources/com.jira.gadgets, where com.jira.gadgets is the Atlassian plugin key. The path to the XML file /i18n/messages.xml is what is defined in the resource module earlier.

b. Add User Preferences if required, using the UserPref element. We will omit the same in this example as the ‘Jira Gadget’ doesn’t take any inputs from the user.

c. Add the Content for the gadget. This is where the gadget is rendered using HTML and JavaScript.

<Content type=”html” view=”profile”>

<![CDATA[ Write Your Text]]>
</Content>

Our gadget’s XML is now ready and looks like the following block of code:

Now let us deploy your plugin and test it.

How does it work?

After deploying your gadget you need to add your gadget on dashboard screen. Go to the System Icon of Jira (Right top) and click on Add Gadget and search your gadget and add it.

I took help from the given link to write my first Jira Gadget Url:

https://www.packtpub.com/books/content/gadgets-jirahttps://developer.atlassian.com/display/GADGETS/Gadget+Developer+Documentation

For more details you can take help from above the given links.

Posted in JIRA, JIRA on Demand, XML. Tagged with , , , .