osdir.com
mailing list archive F.A.Q. -since 2001!



Subject: Add user to multi-user picker custom field with
Java API - msg#00190

List: java.jira.devel

java.jira.devel Navigation:
Date: Prev Next Date Index Thread: Prev Next Thread Index

Hi,

I'm trying to implement a workaround for
[JRA-7663|http://63.246.22.60/browse/JRA-7663] , granting permissions for
watchers to browse the issues they are associated with.

Since I can't grant permissions to watchers, I was planning to add a custom
field that essentially duplicates the watchers list. The problem is, I can't
figure out how to use the Java API to add a user to a multi-user picker custom
field with the Java API.

Here's the code I've put together so far:

MutableIssue thisIssue =
ComponentManager.getInstance().getIssueFactory().getIssue(issue);

CustomField targetCF =
ManagerFactory.getCustomFieldManager().getCustomFieldObjectByName("Watchers");

Object value = thisIssue.getCustomFieldValue(sourceCF);

// Do something to change the value.....

FieldLayout fieldLayout =
ComponentManager.getInstance().getFieldLayoutManager().getFieldLayout(thisIssue.getGenericValue());
FieldLayoutItem fieldLayoutItem =
fieldLayout.getFieldLayoutItem(targetCF.getId());
targetCF.updateValue( fieldLayoutItem, thisIssue, new ModifiedValue(
thisIssue.getCustomFieldValue(targetCF), value), new
DefaultIssueChangeHolder());


As you can see, the problem is that I have no idea what kind of Object
"getCustomFieldObjectByName" is giving me.

Can anybody offer any pointers (or a better solution?)

I'm using JIRA 3.12.3, by the way.

Thanks in advance!

-Nick
--
Post by nickum - online at:
http://forums.atlassian.com/thread.jspa?forumID=100&threadID=29439


Thread at a glance:

Previous Message by Date:

Show comments on the edit screen

Hi togeher, I have not so much experiences with Jira. I should extend the edit screen to show all available comments of the issue. (I know that the comments are all on the issueview, but we want them also on the edit screen) I think that I have to edit the editissue.jsp page. There is a jsp include to show the updateissue_comment.jsp. <jsp:include page="/includes/panels/updateissue_comment.jsp" /> I thought that I can inlcude the summary.jsp of the comments like this: <jsp:include page="/includes/panels/comment/summary.jsp" /> But it didn't work. Has anyone some tips or tricks on this topic? Regards Jenny -- Post by jmarienfeld - online at: http://forums.atlassian.com/thread.jspa?forumID=100&threadID=29430

Next Message by Date:

Creating a plugin for JIRA

Hi, I want to create a plugin for JIRA. I have read http://confluence.atlassian.com/display/DEVNET/How+to+Build+an+Atlassian+Plugin and started following the instructions, however I am stuck on the settings.xml section. I have filled out the following section as follows (any private info has been replaced with 'something'): <settings> <localRepository>C:\Documents and Settings\nelsonl\.m2\repository</localRepository> <interactiveMode>true</interactiveMode> <offline>false</offline> <proxies> <proxy> <id>optional</id> <active>true</active> <protocol>http</protocol> <username>something</username> <password>something</password> <host>proxy.something</host> <port>8080</port> <nonProxyHosts></nonProxyHosts> </proxy> </proxies> The above seems to work, however the web site says to use these settings as well (http://confluence.atlassian.com/display/DEVNET/Example+settings.xml): <servers> <!-- If you need to deploy your code to our the Atlassian Maven Repositories, you must be a Committer. You can request commit rights by emailing developer-relations-YrDk4eUcT3JUhl+GOn+dtA@xxxxxxxxxxxxxxxx If you have commit access, use Atlassian Developer Network username and password. --> <server> <id>atlassian-contrib</id> <username>yourusername</username> <password>yourpassword</password> </server> <server> <id>atlassian-contrib-snapshot</id> <username>yourusername</username> <password>yourpassword</password> </server> </servers> <profiles> <profile> <id>jnolen-devnet-profile</id> <activation> <activeByDefault>true</activeByDefault> </activation> <repositories> <repository> <id>atlassian-public</id> <url>https://maven.atlassian.com/repository/public</url> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </repository> <repository> <id>atlassian-m1-repository</id> <url>https://maven.atlassian.com/maven1</url> <layout>legacy</layout> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>atlassian-public</id> <url>https://maven.atlassian.com/repository/public</url> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </pluginRepository> </pluginRepositories> <properties> <downloadSources>true</downloadSources> <downloadJavadocs>true</downloadJavadocs> <!-- Uncomment this and specify the location on your file system where your clover license is located. <clover.licenseLocation>/path/to/clover/license</clover.licenseLocation> --> <atlassian.pdk.server.url>http://localhost:1990/confluence/</atlassian.pdk.server.url> <atlassian.pdk.server.username>admin</atlassian.pdk.server.username> <atlassian.pdk.server.password>admin</atlassian.pdk.server.password> </properties> </profile> </profiles> My questions are: 1. Do I need server section at all? I don't want deploy my code to the Atlassian Maven Repositories. 2. Do I really need a profile section? All help is much appreciated. -- Post by nelsonl - online at: http://forums.atlassian.com/thread.jspa?forumID=100&threadID=29450

Previous Message by Thread:

Show comments on the edit screen

Hi togeher, I have not so much experiences with Jira. I should extend the edit screen to show all available comments of the issue. (I know that the comments are all on the issueview, but we want them also on the edit screen) I think that I have to edit the editissue.jsp page. There is a jsp include to show the updateissue_comment.jsp. <jsp:include page="/includes/panels/updateissue_comment.jsp" /> I thought that I can inlcude the summary.jsp of the comments like this: <jsp:include page="/includes/panels/comment/summary.jsp" /> But it didn't work. Has anyone some tips or tricks on this topic? Regards Jenny -- Post by jmarienfeld - online at: http://forums.atlassian.com/thread.jspa?forumID=100&threadID=29430

Next Message by Thread:

Creating a plugin for JIRA

Hi, I want to create a plugin for JIRA. I have read http://confluence.atlassian.com/display/DEVNET/How+to+Build+an+Atlassian+Plugin and started following the instructions, however I am stuck on the settings.xml section. I have filled out the following section as follows (any private info has been replaced with 'something'): <settings> <localRepository>C:\Documents and Settings\nelsonl\.m2\repository</localRepository> <interactiveMode>true</interactiveMode> <offline>false</offline> <proxies> <proxy> <id>optional</id> <active>true</active> <protocol>http</protocol> <username>something</username> <password>something</password> <host>proxy.something</host> <port>8080</port> <nonProxyHosts></nonProxyHosts> </proxy> </proxies> The above seems to work, however the web site says to use these settings as well (http://confluence.atlassian.com/display/DEVNET/Example+settings.xml): <servers> <!-- If you need to deploy your code to our the Atlassian Maven Repositories, you must be a Committer. You can request commit rights by emailing developer-relations-YrDk4eUcT3JUhl+GOn+dtA@xxxxxxxxxxxxxxxx If you have commit access, use Atlassian Developer Network username and password. --> <server> <id>atlassian-contrib</id> <username>yourusername</username> <password>yourpassword</password> </server> <server> <id>atlassian-contrib-snapshot</id> <username>yourusername</username> <password>yourpassword</password> </server> </servers> <profiles> <profile> <id>jnolen-devnet-profile</id> <activation> <activeByDefault>true</activeByDefault> </activation> <repositories> <repository> <id>atlassian-public</id> <url>https://maven.atlassian.com/repository/public</url> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </repository> <repository> <id>atlassian-m1-repository</id> <url>https://maven.atlassian.com/maven1</url> <layout>legacy</layout> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>atlassian-public</id> <url>https://maven.atlassian.com/repository/public</url> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </pluginRepository> </pluginRepositories> <properties> <downloadSources>true</downloadSources> <downloadJavadocs>true</downloadJavadocs> <!-- Uncomment this and specify the location on your file system where your clover license is located. <clover.licenseLocation>/path/to/clover/license</clover.licenseLocation> --> <atlassian.pdk.server.url>http://localhost:1990/confluence/</atlassian.pdk.server.url> <atlassian.pdk.server.username>admin</atlassian.pdk.server.username> <atlassian.pdk.server.password>admin</atlassian.pdk.server.password> </properties> </profile> </profiles> My questions are: 1. Do I need server section at all? I don't want deploy my code to the Atlassian Maven Repositories. 2. Do I really need a profile section? All help is much appreciated. -- Post by nelsonl - online at: http://forums.atlassian.com/thread.jspa?forumID=100&threadID=29450
blog comments powered by Disqus

Home | News | Sitemap | FAQ | advertise | OSDir is an Inevitable website. GBiz is too!