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

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

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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,147 views 13 19
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot