Profields 4.3.0 Java API

Hello,

I'm trying to get a list of Project objects with a given Profield value using Profield Java API (see method 

getProjectList) in example below.

For example, the list of project whose Profield called "country" is equals to "Brasil".

 

Has anybody implemented any feature using Java API?

I have some problems configuring my pom.xml because of some required dependecies from profields-4.3.0.jar

Thank you,

Alejandro

 

import com.atlassian.jira.project.Project;
import com.atlassian.jira.user.ApplicationUser;
import com.deiser.jira.profields.api.projectfilter.ProjectQuery;
import com.deiser.jira.profields.api.projectfilter.QueryExpressionBuilderFactory;
import com.deiser.jira.profields.api.projectvalue.ProfieldsFieldValue;
import com.deiser.jira.profields.api.projectvalue.ProjectValueService;
import com.deiser.jira.profields.search.projectquery.expression.QueryExpressionBuilder;
import com.deiser.jira.profields.search.projectquery.expression.element.QueryExpressionClause;
public class TestImpl  {
	private ProjectValueService projectValueService;
	private QueryExpressionBuilderFactory queryExpressionBuilderFactory;
	public ProjectRoleAssignerImpl(ProjectValueService projectValueService,
	        QueryExpressionBuilderFactory queryExpressionBuilderFactory) {
		this.projectValueService = projectValueService;
		this.queryExpressionBuilderFactory = queryExpressionBuilderFactory;
	}

	public void getProjectList(String pql, ApplicationUser user) {
		QueryExpressionBuilder queryExprBuilder = queryExpressionBuilderFactory.getBuilder();
		queryExprBuilder.fromPql(user, pql);
		ProjectQuery projectQuery = queryExprBuilder.getQuery(user);
		QueryExpressionClause query = null;
		List<ProfieldsFieldValue> projectValues = projectValueService.getProjectsByQuery(projectQuery);
		for (ProfieldsFieldValue projectValue : projectValues) {
			Project project = projectValue.getProject();
			System.out.println("ProjectRoleAssignerImpl.getProjectList():Project=" + project.getKey());
		}
	}
}

 

 

2 answers

This widget could not be displayed.
Vasiliy Zverev Community Champion Dec 16, 2015

I also get an empty collection for projectValueService.getValuesForProject(). I create a ticket on deiser issue tracker.

This widget could not be displayed.
Vasiliy Zverev Community Champion Feb 25, 2016

This bug was fied into version 4.3.4.

How did u resolved this please let me know

geting below error 

[ERROR] Failed to execute goal on project synch-onejira-plugin: Could not resolve dependencies for project com.go2group.jira.plugin:synch-onejira-plugin:atlassian-plugin:2.0.0: Could not find artifact com.deiser:profields:jar:4.1.3 in atlassian-public (https://maven.atlassian.com/repository/public)

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

137 views 2 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you