30 Nisan 2013 Salı

Delete issues from JIRA


  • Go to issue navigator
  • Under tools at the right hand side, bulk operations
  • choose the issues you want to delete
  • Confirm the deletion


27 Kasım 2012 Salı

JIRA REST API - Updating Status

You can change a status with executing the transition.

  • You should give the transition id. "{transition\": {\"id\": \"61\"}"
  • The url should be :  "http://localhost:8080/rest/api/2/issue/TAI-39/transitions?expand=transitions.fields" SElect the issue that you want to update.
  • You shoul use "POST"
  • Here is the curl command: curl -D- -X POST -H "Authorization: Basic YWRtaW46SDF0MXQ=" --data "{\"transition\": {\"id\": \"81\"}}" -H "Content-Type: application/json" "http://localhost:8080/rest/api/2/issue/TAI-39/transitions?expand=transitions.fields"
  • Here is the java implementation:          
  •                                                                
    public static String httpGet() throws IOException {         
    URL url = new URL("http://localhost:8080/rest/api/2/issue/TAI-39/transitions?expand=transitions.fields");         
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();  
    conn.setDoOutput(true);         
    conn.setDoInput(true);                 
    String credentials = "username" + ":" + "password";        
     String encoding = Base64Converter.encode(credentials.getBytes("UTF-8"));   
    conn.setRequestProperty("Authorization", String.format("Basic %s", encoding));  
    conn.setRequestMethod("POST"); 
    conn.setRequestProperty("Content-Type", "application/json");    
      conn.connect();                  
     String st = "{\"transition\": {\"id\": \"91\"}}";    
     System.out.println(st);      
      byte[] outputBytes = st.getBytes("UTF-8");     
     OutputStream os = conn.getOutputStream();  
    BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));        
     StringBuilder sb = new StringBuilder();        
     String line;         
    while ((line = rd.readLine()) != null) {           
    sb.append(line);         
    }         
    rd.close();             
    conn.disconnect();        
    System.out.println("sb: "+ sb.toString());         
    return sb.toString();     
    }

JIRA REST API - Edit Issues


  • When you want to update a field with JIRA REST API, first write it i json format.  Ex: I want to update the summary of an issue.        
  • {"fields": {"summary":{"name":"bahar"}}}
  •  You can try it with curl commant whether it works or not.
  •   curl -D- -X PUT -H "Authorization: Basic YWRtaW46SDF0MXQ=" --data "{\"fields\":{\"summary\":\"bahar\"}}"   -H "Content-Type: application/json" "http://localhost:8080/rest/api/2/issue/TAI-9"
  •  You should use PUT for updating.
  • Don't forget to add "\" backslash  before the double quotes.
  • You should encode your username:password with base 64 encode.
  • encoder 
  • write your username:password, and the output will be "YWRtaW46SDF0MXQ= " something like this. Write the output to the authorization. 
  • Ex: "Authorization: Basic YWRtaW46SDF0MXQ="  
  • "http://localhost:8080/rest/api/2/issue/TAI-9" is the issue that you want to update.
  •   You can do the same thing with java code.Here is the method:   
     public static String updateSummary() throws IOException {
     
        URL url = new URL("http://localhost:8080/rest/api/2/issue/TAI-9");
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setDoOutput(true);
        conn.setDoInput(true);

        String credentials = "username" + ":" + "password";
        String encoding = Base64Converter.encode(credentials.getBytes("UTF-8"));
        conn.setRequestProperty("Authorization", String.format("Basic %s", encoding));
       
        conn.setRequestMethod("PUT");
        conn.setRequestProperty("Content-Type", "application/json");
       
        conn.connect();
      
        String st="{\"fields\":{\"summary\":\"bahar\"}}"

        byte[] outputBytes = st.getBytes("UTF-8");
        OutputStream os = conn.getOutputStream();
        os.write(outputBytes);
        os.flush();
       
        BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        StringBuilder sb = new StringBuilder();
        String line;
        while ((line = rd.readLine()) != null) {
          sb.append(line);
        }
        rd.close();

        conn.disconnect();
        return sb.toString();

    }                                                                                                                               

  • you can use Base64Convertor.java class. Download
  • Here is the atlassian documentation for updating issue via JIRA REST API. atlassian

8 Kasım 2012 Perşembe

JIRA - Create Custom Fields with Code

You can automatically create custom fields with code within your plugin for JIRA.
Here is an  example method to do this. This method creates four custom fields.

public void createAllCustomFields(){
        CustomFieldType fieldType = customFieldManager.getCustomFieldType("com.atlassian.jira.plugin.system.customfieldtypes:textfield");
        try {
            CustomField contactName = customFieldManager.createCustomField("Contact Name", "Name of the contact", fieldType , null, null, null);
            customFieldManager.createCustomField("Contact Surname", "Surname of the contact", fieldType , null, null, null);
            customFieldManager.createCustomField("Contact Phone", "Phone number of the contact", fieldType , null, null, null);
            customFieldManager.createCustomField("Contact Email", "Email address of the contact", fieldType , null, null, null);
        } catch (GenericEntityException e) {
       
            e.printStackTrace();
        }
        System.out.println("createAllCustomFields is called !!!!!!!!!!!!!!!!!!!!!");
    }

Plugin Development Tips


2 Kasım 2012 Cuma

Create some marketing materials












 
 plugin logo














A plugin logo that is a 72x72px PNG/JPG/GIF image. Atlassian strongly recommends a chiclet-style background for the logo (check out this free Photoshop template). This format works best with upcoming changes to the user interfaces of UPM and the Atlassian Marketplace.
plugin icon The plugin icon that is a 16x16px PNG/JPG/GIF pixel version of your plugin logo or an appropriate derivation of it.
banner

Currently, UPM 2.0 does not display banners but later versions will. Moreover, a banner is required by the Atlassian Marketplace. So, since ArfX's functionality (nothing really) is likely to work in future versions of both JIRA and UPM, this example adds a banner to show up when the software supports it. 

Here is how to add it to your plugin

Plugin Metadata Files used by UPM and Marketplace


Velocity Guide

Velocity is a Java-based template engine. It permits web page designers to reference methods defined in Java code. Web designers can work in parallel with Java programmers to develop web sites according to the Model-View-Controller (MVC) model, meaning that web page designers can focus solely on creating a well-designed site, and programmers can focus solely on writing top-notch code. Velocity separates Java code from the web pages, making the web site more maintainable over the long run and providing a viable alternative to JSPs.

Velocity - Guide

<HTML>
<BODY>
Hello $customer.Name!
<table>
#foreach( $mud in $mudsOnSpecial )
   #if ( $customer.hasPurchased($mud) )
      <tr>
        <td>
          $flogger.getPromo( $mud )
        </td>
      </tr>
   #end
#end
</table>

1 Kasım 2012 Perşembe

Reusing the configurations in each run

Suppose you added some data on to virtual JIRA, how do you retain it when you clean start-up JIRA next time?
This is where a new SDK command comes to our rescue.
After the atlas-run is finished, that is, after you pressed Ctrl + C, execute the following command:
atlas-create-home-zip
This will generate a file named generated-test-resources.zip under the target folder.
Copy this file to the /src/test/resources folder or any other known locations. Now modify the pom.xml to add the following entry under configurations in the maven-jira-plugin:
<productDataPath>${basedir}/src/test/resources/generated-test-
resources.zip</productDataPath>

Modify the path accordingly. This will reuse the configurations the next time you run
atlas-run.

13 Eylül 2012 Perşembe

Confluence Increase Maximum Heap Size


You can only view Maximum Heap Size  from Confluence > Administration > System Information.

To Edit:

Do not set your memory using CATALINA_OPTS this is overridden by JAVA_OPTS.
On Linux
  • In the unpacked Confluence standalone directory, edit the file bin/setenv.sh
  • Edit the line beginning with JAVA_OPTS= substituting new values for -Xms (starting memory) and -Xmx (maximum memory)
  • Leave the rest of the options in that line unchanged
An example of a minimal setting for a large system - max heap size is set to 1Gb :
JAVA_OPTS="-Xmx1024m $JAVA_OPTS -Djava.awt.headless=true "

Reference

FishEye Upgrade Guide


1. Download Fisheye
2. Extract the new FishEye archive into a directory such as <New FishEye home directory>.
3. Shut down the old FishEye instance if it is running.
4. Copy <FishEye home directory>/config.xml to <New FishEye home directory>.
5. Copy  the <FishEye home directory>/var directory to <New FishEye home directory>/var.
6. Copy the <FishEye home directory>/cache directory to <New FishEye home directory>/cache.
7. Start FishEye from the new installation by running <New FishEye home directory>/bin/run.sh.

linux commands:

wget -c http://www.atlassian.com/software/fisheye/downloads/binary/fisheye-2.8.0.zip

unzip fisheye-2.8.0.zip

<FishEye home directory>/bin ./stop.sh

cp <FishEye home directory>/config.xml <New FishEye home directory>/config.xml

<New FishEye home directory> rm -rf var

<New FishEye home directory> mkdir var

cp <FishEye home directory>/var/* <New FishEye home directory>/var/*

<New FishEye home directory> mkdir cache

cp <FishEye home directory>/cache/* <New FishEye home directory>/cache/*

<New FishEye home directory>/bin ./run.sh

Go to your fisheye 2.8, ex: http://localhost:8060/

12 Eylül 2012 Çarşamba

'java.sql.SQLException Got error 28 from storage engine' Error when Viewing a Page

Symptoms:

Viewing a page fails with this stack trace found in the atlassian-confluence.log:
...
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Could not execute query; uncategorized SQLException for SQL []; SQL state [HY000]; error code [1030]; Got error 28 from storage engine; nested exception is java.sql.SQLException: Got error 28 from storage engine
Caused by: java.sql.SQLException: Got error 28 from storage engine
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1072)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3563)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3495)
...
Cause:

MySQL database server has no space left to work in its tmp directory.
Resolution:

Verify whether there is sufficient disk space on the MySQL database server.

Reference

30 new and updated Confluence tutorials



We now have 11 new and 19 updated Confluence tutorials – a great resource for plugin developers, nicely timed with the release of Confluence 4.3.
New Confluence tutorials:

Working with the Tasks REST API in Confluence

Sending Emails in a Plugin

Posting notifications in Confluence

Preformatted Table – Example of a User Macro

Panel Preformatted with Specific Colours – Example of a User Macro

Adding an Option to the Editor Insert Menu

Adding Keyboard Shortcuts to Confluence

Writing Integration Tests for your Plugin (to be published after review)

Altering Confluence page output using a Pipeline Transformer module (to be published after completion, some time in October)

Writing Soy Templates (to be published after review)

Defining a Pluggable Service in a Confluence Plugin (to be published after completion, some time in September)

Updated Confluence tutorials:

Extending Autoconvert

Adding Menu Items to Confluence

Creating a Cross-Platform Admin Configuration Form

Writing Macros for pre-4.0 versions of Confluence

Preventing XSS issues with macros in Confluence 4.0

Creating a new Confluence Macro

Extending the Macro Property Panel

Writing a Confluence Theme

Writing Unit Tests for your Plugin

Writing a Macro Using JSON

Developing Technical Documentation on Confluence Wiki

Developing a Knowledge Base on Confluence Wiki

Searching using the V2 Search API (in progress)

Writing a search result renderer (in progress)

Adding a Custom Action to Confluence (to be published after review)




11 Eylül 2012 Salı

confluence suddenly unusable -- java error

System Error
A system error has occurred — our apologies!
For immediate troubleshooting, consult our knowledge base for a solution.
If you would like to receive support from Atlassian's support team, ask your Confluence administrator to create a support issue on Atlassian's support system with the following information:
a description of your problem and what you were doing at the time it occurred
a copy of the error and system information found below
a copy of the application logs (if possible).
Your Confluence administrator can use the support request form to create a support ticket which will include this information.
We will respond as promptly as possible.
Thank you!
Return to site homepage…
The SystemInformationService could not be retrieved from the container. Therefore very limited information is available in this error report.
The SystemInformationService could not be retrieved due to the following error: java.lang.NullPointerException
Cause
com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.NullPointerException
at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:152)
caused by: java.lang.NullPointerException
at com.atlassian.spring.container.ContainerManager.getComponent(ContainerManager.java:33)

If you get this error message, permission error may cause this error.
To solve it,
1. Go to your confluence home directory
2. list all items with ls -al

testwww1:/usr/local/confluence-data# ls -al
total 152
drwx--S---  19 confluence confluence  4096 2012-08-20 10:27
(...)
drwxr-sr-x   2 root       confluence  4096 2012-07-10 15:41 plugins-cache

3. Then, (Our) Confluence is running with confluence user, so permissions were wrong (without writing for group). When I changed owner with:

chown -R confluence:confluence confluence
chown -R confluence:confluence confluence-data
 and restarted Confluence with
/etc/init.d/confluence restart
 it raised up and is working. Hope you will find it useful :)

4 Eylül 2012 Salı

How to add a facebook like button in a Confluence page?

1. You should create the code from the facebook developers' page for the page that you want to like.

          http://developers.facebook.com/docs/reference/plugins/like/


















2. Copy the generated code.
3. Create a confluence page or open editing for an existing one. Add a html-include macro.
4. Paste the copied code into it, and save the page.







5. Here it is!






Similiarly, you can add twitter follow button.

https://twitter.com/about/resources/buttons


31 Ağustos 2012 Cuma

Confluence - Enabling the html-include Macro

By default, the HTML macros are disabled. You should only turn on these macros if you trust all your users not to attempt to exploit them.


(info) You need to have System Administrator permissions in order to perform this function. 
To enable the HTML macros,
  1. Choose Browse > Confluence Admin.
  2. Select 'Plugins' in the left-hand panel. This will display the installed plugins active for this Confluence installation.
  3. Click' 'HTML macros', then click 'Enable Plugin'.

To embed an external page,
Use the following syntax:
{html-include:url=http://www.example.com}



29 Ağustos 2012 Çarşamba

Confluence Plugin - Business Dictionary (BuDict)



BuDict is used for displaying an information bubble above selected words in Confluence. The information bubble is displayed only when the mouse cursor is over the word, as shown in the next picture. This bubble includes an explanation or other specified text for the marked words (investment).










Budict manual 4.0 EN

marketplace

Upgrading Confluence on Linux









  1. Download the appropriate Confluence 'Linux 64-bit / 32-bit Installer' (.bin) file that suits your operating system (for the new version of Confluence) from the Confluence Download Center.
  2. Open a Linux console and change directory (cd) to the '.bin' file's directory.
    If the '.bin' file is not executable after downloading it, make it executable, for example:
    chmod a+x atlassian-confluence-X.Y.bin
    (where X.Y represents your version of Confluence)
  3. Execute the '.bin' file to start the upgrade wizard.
  4. When prompted to choose between creating a new Confluence installation or upgrading an existing installation, choose the 'Upgrade an existing Confluence installation' option.


16 Ağustos 2012 Perşembe

El Altı Notları

Çok unutkan oldum bugünlerde herşeyi unutuyorum ne yapmak lazım bu durumda herşeyi yazmak lazım :)


1. Connect Server with SSH (Mac/Linux)
Copy .PEM file to the machine from which you are going to connect.
Make sure permissions on .PEM file are appropriate (chmod 600 file.pem)
Connect with ssh command: ssh vcloud@ipaddress –i privkey.pem

2. Find Folder Command in Linux

find / -name 'httpdocs' -type d

3. Zip a Folder in Linux

zip -9 -r zip file folder name

4. Delete Non-empty Folder in Linux

rm -rf folder/

5. Creates new JAR (Java Archive) file named Project1.jar, compresses and stores Project1 directory and all its contents (including both data files and subdirectories).

jar cf Project1.jar Project1


6. Jar file in Linux

jar xf

7. How to Unzip Over an Existing Directory in Linux

Read more: How to Unzip Over an Existing Directory in Linux

unzip -o filename.zip -d dir

8. If it’s available a ssh access on the servers, using scp to transfer file from and to the server could be a very good option.



scp /localdir/localfilename.txt remoteuser@www.remotehost.com:/remotedir/remotefilename.txt

9. Wget is one of the powerful tools available there to download stuff from internet. You can do a lot of things using wget. Basic use is to download files from internet.

wget -c http://your-link-to/file



9 Ağustos 2012 Perşembe

JIRA Workflow Sharing Plugin

The JIRA Workflow Sharing Plugin enables sharing of workflows across JIRA instances.

The plugin allows JIRA administrators to export or import workflows in a zipped "workflow bundle" format.

Exported workflow bundles can be shared with any JIRA instance with little or no manual setup required.

JIRA Workflow Sharing Plugin

JIRA: Is it possible to set issue assignee based on "Issue Type" automatically?

Create separate workflows for each issueType.
Create a workflow scheme for your project mapping those workflows to the specific issueTypes.
Then (in the workflows) using the stock post function "Update Issue Field", set your Assignee field to the desired user for each individual issue type in the "Create" transition.

3 things to note: 1.) To get to the "Create" transition, click on the "Open" step and "Create" should be one of the Incoming Transitions. 2.) When adding the post function, be sure to place it after the "creates issue originally" function or you will get some nasty errors. 3.) Be sure to delete the post function "Assign the issue to the reporter" otherwise your issue will get re-routed to the reporter.