Skip to content

Instantly share code, notes, and snippets.

View leonardinius's full-sized avatar

Leonids Maslovs leonardinius

View GitHub Profile
@leonardinius
leonardinius / IssueCrudOperations.java
Created December 18, 2010 23:40
Issue Crud Operation interface
public interface IssueCrudOperations
{
/**
* Used to create new Issue instance
* <p/>
* PS: Do not stores issue in the database (launch workflow Create action).
* <p/>
* Use {@link #storeNewIssue(com.opensymphony.user.User, com.atlassian.jira.issue.MutableIssue)} to store object.
import com.atlassian.jira.ComponentManager;
import com.atlassian.plugin.webresource.WebResourceManager;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import org.apache.commons.lang.StringUtils;
import javax.servlet.*;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
// this code is copied and modified from dialogs.js
(function(){
var chainedonload = function(callback){
var old = window.onload;
window.onload = function(){
if(typeof old == 'function') old.apply(this, arguments);
if(typeof callback == 'function') callback.apply(this, arguments);
};
};
<webwork1 key="xyz-actions" name="XYZ Action" class="java.lang.Object">
<actions>
<action name="xxx.yyy.MyWebAction" alias="MyWebAction">
<view name="input">/templates/mywebaction/render.vm</view>
</action>
</webwork1>
xxx.yyy.getTopLevelWindow = function($w)
{
var w = $w || window;
while (w.parent && w.parent !== w) w = w.parent;
return w;
};
xxx.yyy.getArgument = function(argumentName)
{
var topWindow = xxx.yyy.getTopLevelWindow() || window;
<web-item key="xxx.yyy.issue-operation" i18n-name-key="xxx.yyy.operation"
name="XYZ Operation"
section="operations-top-level" weight="100">
<!--section="operations-top-level" will make it appear on the top level, instead of other actions-->
<!--weight="100" relative weight: wil make it appear in the end of the list-->
<label key="xxx.yyy.operation"/> <!-- i18n resource label text key -->
<tooltip key="xxx.yyy.tooltip"/> <!-- i18n resource tooltip text key -->
<link linkId="xxx.yyy.myId"> <!-- link value, id will be needed later on -->
package xxx.yyy;
import com.atlassian.gadgets.*;
import com.atlassian.gadgets.view.GadgetViewFactory;
import com.atlassian.gadgets.view.View;
import com.atlassian.jira.security.xsrf.RequiresXsrfCheck;
import com.atlassian.jira.util.collect.MapBuilder;
import com.atlassian.jira.web.action.issue.AbstractIssueSelectAction;
import org.apache.commons.lang.StringEscapeUtils;
import org.slf4j.Logger;
<component-import key="xyz-GadgetRequestContextFactory" name="Gadget RequestContext Factory"
interface="com.atlassian.gadgets.GadgetRequestContextFactory"/>
<component-import key="xyz-GadgetViewFactory" name="Gadget View Factory"
interface="com.atlassian.gadgets.view.GadgetViewFactory"/>
#macro(h $text)$action.htmlEncode($text)#end
#macro(jh $text)$action.jsEncode($text)#end
#set($ajs="AJS.$")
#if ($action.hasAnyErrors())
<table class="jiraform maxWidth">
<tbody>
<tr>
<td colspan="2" class="formErrors">
<div class="errorArea">
We couldn’t find that file to show.