It's all about the answers!

Ask a question

What is the meaning of these parameters?


wang lu (5664) | asked Nov 07 '10, 9:30 p.m.
IQueryDescriptor queryDescriptor = queryClient.findSharedQueries(arg0, arg1, arg2, arg3, arg4);
What is the meaning of these parameters? or where can I find QueryAPI?

11 answers



permanent link
Patrick Streule (4.9k21) | answered Nov 08 '10, 6:53 a.m.
JAZZ DEVELOPER
On 11/8/10 3:38 AM, liumawang wrote:
IQueryDescriptor queryDescriptor = queryClient.findSharedQueries(arg0,
arg1, arg2, arg3, arg4);
What is the meaning of these parameters? or where can I find
QueryAPI?


List<IQueryDescriptor> findSharedQueries(IProjectAreaHandle
projectAreaHandle, List<extends> sharingTargets,
String queryType, ItemProfile<IQueryDescriptor> profile,
IProgressMonitor monitor) throws TeamRepositoryException;

sharingTargets: the list of team areas or project areas that you are
interested in

queryType: Currently always 'QueryTypes.WORK_ITEM_QUERY'

--
Regards,
Patrick
RTC Work Item Component Lead

permanent link
wang lu (5664) | answered Nov 08 '10, 9:07 p.m.
On 11/8/10 3:38 AM, liumawang wrote:
IQueryDescriptor queryDescriptor = queryClient.findSharedQueries(arg0,
arg1, arg2, arg3, arg4);
What is the meaning of these parameters? or where can I find
QueryAPI?


List<IQueryDescriptor> findSharedQueries(IProjectAreaHandle
projectAreaHandle, List<extends> sharingTargets,
String queryType, ItemProfile<IQueryDescriptor> profile,
IProgressMonitor monitor) throws TeamRepositoryException;

sharingTargets: the list of team areas or project areas that you are
interested in

queryType: Currently always 'QueryTypes.WORK_ITEM_QUERY'

--
Regards,
Patrick
RTC Work Item Component Lead
OK, I got it thank you!

permanent link
wang lu (5664) | answered Nov 09 '10, 4:26 a.m.
On 11/8/10 3:38 AM, liumawang wrote:
IQueryDescriptor queryDescriptor = queryClient.findSharedQueries(arg0,
arg1, arg2, arg3, arg4);
What is the meaning of these parameters? or where can I find
QueryAPI?


List<IQueryDescriptor> findSharedQueries(IProjectAreaHandle
projectAreaHandle, List<extends> sharingTargets,
String queryType, ItemProfile<IQueryDescriptor> profile,
IProgressMonitor monitor) throws TeamRepositoryException;

sharingTargets: the list of team areas or project areas that you are
interested in

queryType: Currently always 'QueryTypes.WORK_ITEM_QUERY'

--
Regards,
Patrick
RTC Work Item Component Lead
Your replay has very help for me,but I'm still amazing about "ItemProfile<IQueryDescriptor> profile",how can I get this parameters,can you say more about that?Thank you for your help!

permanent link
Patrick Streule (4.9k21) | answered Nov 09 '10, 5:53 a.m.
JAZZ DEVELOPER
On 11/9/10 10:38 AM, liumawang wrote:
Your replay has very help for me,but I'm still amazing about
"ItemProfile<IQueryDescriptor> profile",how can I get
this parameters,can you say more about that?Thank you for your help!

The profile indicates which properties you need from the query. To get
all properties, you can pass in

com.ibm.team.workitem.common.query.IQueryDescriptor.FULL_PROFILE

If you only want to show a label of the query, you may want to consider
using:

com.ibm.team.workitem.common.query.IQueryDescriptor.SMALL_PROFILE

--
Regards,
Patrick
RTC Work Item Component Lead

permanent link
wang lu (5664) | answered Nov 10 '10, 4:41 a.m.
On 11/9/10 10:38 AM, liumawang wrote:
Your replay has very help for me,but I'm still amazing about
"ItemProfile<IQueryDescriptor> profile",how can I get
this parameters,can you say more about that?Thank you for your help!

The profile indicates which properties you need from the query. To get
all properties, you can pass in

com.ibm.team.workitem.common.query.IQueryDescriptor.FULL_PROFILE

If you only want to show a label of the query, you may want to consider
using:

com.ibm.team.workitem.common.query.IQueryDescriptor.SMALL_PROFILE

--
Regards,
Patrick
RTC Work Item Component Leadthank you for your replay,I still amazing ahout that ,can you tell me more about the code:
IProjectAreaHandle projectAreaHandle=?
ItemProfile profile=?
IProgressMonitor monitor=?
Thank you for your time

permanent link
Patrick Streule (4.9k21) | answered Nov 10 '10, 4:53 a.m.
JAZZ DEVELOPER
Can you tell me what is the mean about projectAreaHandle and how can I
get it?
just like IProjectAreaHandle projectAreaHandle=...; can you tell me
the whole coding?

It depends on the context your code runs in and what you are trying to
do. If you don't have any project area context at all, you may want to
take a look at:

com.ibm.team.process.rcp.ui.teamnavigator.ConnectedProjectAreaRegistry.getConnectedProjectAreas(ITeamRepository,
boolean)

--
Regards,
Patrick
RTC Work Item Component Lead

permanent link
wang lu (5664) | answered Nov 10 '10, 5:50 a.m.
Can you tell me what is the mean about projectAreaHandle and how can I
get it?
just like IProjectAreaHandle projectAreaHandle=...; can you tell me
the whole coding?

It depends on the context your code runs in and what you are trying to
do. If you don't have any project area context at all, you may want to
take a look at:

com.ibm.team.process.rcp.ui.teamnavigator.ConnectedProjectAreaRegistry.getConnectedProjectAreas(ITeamRepository,
boolean)

--
Regards,
Patrick
RTC Work Item Component Lead
Thank you for your replay,I still amazing ahout that ,we want to get query message of exist query,and we just login in RTC and have not other context, can you tell me more about the code:
IProjectAreaHandle projectAreaHandle=?
ItemProfile profile=?
IProgressMonitor monitor=?
Thank you for your time

permanent link
Patrick Streule (4.9k21) | answered Nov 11 '10, 6:08 a.m.
JAZZ DEVELOPER
Thank you for your replay,I still amazing ahout that ,we want to get
query message of exist query,and we just login in RTC and have not
other context, can you tell me more about the code:
IProjectAreaHandle projectAreaHandle=?
ItemProfile profile=?
IProgressMonitor monitor=?

Here's an example for the UI

final IProjectAreaHandle projectArea=
ProjectAreaPicker.showDialog(shell, false);
final ITeamRepository repo= (ITeamRepository) projectArea.getOrigin();
final IQueryClient queryClient= (IQueryClient)
repo.getClientLibrary(IQueryClient.class);
final List<ITeamArea> teamAreas= ...;

UIUpdaterJob job= new UIUpdaterJob("Resolving Queries") { //$NON-NLS-1$
private List<IQueryDescriptor> fQueries;

@Override
public IStatus runInBackground(IProgressMonitor monitor) {
try {
fQueries= queryClient.findSharedQueries(projectArea, teamAreas,
QueryTypes.WORK_ITEM_QUERY, IQueryDescriptor.FULL_PROFILE, monitor);
} catch (TeamRepositoryException e) {
// TODO Handle exception
}
return super.runInBackground(monitor);
}

@Override
public IStatus runInUI(IProgressMonitor monitor) {
// TODO Do something with fQueries in the UI
return super.runInUI(monitor);
}
};

--
Regards,
Patrick
RTC Work Item Component Lead

permanent link
wang lu (5664) | answered Nov 12 '10, 1:09 a.m.
Hi Patrick,

Thanks for your reply, I just tried your method and I have passed compiling.

But the findSharedQuery method returns 0 query. I'm sure I have find a lot of shared queries in my team area. Would you please help to look at my code and execution result


import java.net.URI;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.eclipse.core.runtime.IProgressMonitor;

import snippets.SysoutProgressMonitor;

import com.ibm.team.foundation.common.text.XMLString;
import com.ibm.team.process.client.IProcessClientService;
import com.ibm.team.process.client.IProcessItemService;
import com.ibm.team.process.common.IProjectArea;
import com.ibm.team.process.common.IProjectAreaHandle;
import com.ibm.team.process.common.ITeamArea;
import com.ibm.team.repository.client.ITeamRepository;
import com.ibm.team.repository.client.TeamPlatform;
import com.ibm.team.repository.client.ITeamRepository.ILoginHandler;
import com.ibm.team.repository.client.ITeamRepository.ILoginHandler.ILoginInfo;
import com.ibm.team.repository.common.TeamRepositoryException;
import com.ibm.team.workitem.client.IAuditableClient;
import com.ibm.team.workitem.client.IQueryClient;
import com.ibm.team.workitem.client.IWorkItemClient;
import com.ibm.team.workitem.client.WorkItemOperation;
import com.ibm.team.workitem.client.WorkItemWorkingCopy;
import com.ibm.team.workitem.common.model.ICategoryHandle;
import com.ibm.team.workitem.common.model.IWorkItem;
import com.ibm.team.workitem.common.model.IWorkItemHandle;
import com.ibm.team.workitem.common.model.IWorkItemType;
import com.ibm.team.workitem.common.model.ItemProfile;
import com.ibm.team.workitem.common.query.IQueryDescriptor;
import com.ibm.team.workitem.common.query.IQueryResult;
import com.ibm.team.workitem.common.query.QueryTypes;



public class CreateWorkItem {

private static class LoginHandler implements ILoginHandler, ILoginInfo {

private String fUserId;
private String fPassword;

private LoginHandler(String userId, String password) {
fUserId= userId;
fPassword= password;
}

public String getUserId() {
return fUserId;
}

public String getPassword() {
return fPassword;
}

public ILoginInfo challenge(ITeamRepository repository) {
return this;
}
}

private static class WorkItemInitialization extends WorkItemOperation {

private String fSummary;
private ICategoryHandle fCategory;

public WorkItemInitialization(String summary, ICategoryHandle category) {
super("Initializing Work Item");
fSummary= summary;
fCategory= category;
}

@Override
protected void execute(WorkItemWorkingCopy workingCopy, IProgressMonitor monitor) throws TeamRepositoryException {
IWorkItem workItem= workingCopy.getWorkItem();
workItem.setHTMLSummary(XMLString.createFromPlainText(fSummary));
workItem.setCategory(fCategory);
}
}

public static void main(String[] args) {

boolean result;
TeamPlatform.startup();
try {
result= run(args);
} catch (TeamRepositoryException x) {
x.printStackTrace();
result= false;
} finally {
TeamPlatform.shutdown();
}
if (!result)
System.exit(1);

}

private static boolean run(String[] args) throws TeamRepositoryException {

if (args.length != 7) {
System.out.println("Usage: CreateWorkItem <repositoryURI> <userId> <password> <projectArea> <workItemType> <summary> <category>");
return false;
}

String repositoryURI= args[0];
String userId= args[1];
String password= args[2];
String projectAreaName= args[3];
String typeIdentifier= args[4];//defect type
String summary= args[5];
String categoryName= args[6];



ITeamRepository teamRepository= TeamPlatform.getTeamRepositoryService().getTeamRepository(repositoryURI);
teamRepository.registerLoginHandler(new LoginHandler(userId, password));
teamRepository.login(null);

IProcessClientService processClient= (IProcessClientService) teamRepository.getClientLibrary(IProcessClientService.class);
IAuditableClient auditableClient= (IAuditableClient) teamRepository.getClientLibrary(IAuditableClient.class);
IWorkItemClient workItemClient= (IWorkItemClient) teamRepository.getClientLibrary(IWorkItemClient.class);


URI uri= URI.create(projectAreaName.replaceAll(" ", "%20"));
IProjectArea projectArea= (IProjectArea) processClient.findProcessArea(uri, null, null);
if (projectArea == null) {
System.out.println("Project area not found.");
return false;
}

IProgressMonitor monitor = new SysoutProgressMonitor();

List<ITeamArea> sharingTargets = new ArrayList<ITeamArea>();

IProcessItemService service= (IProcessItemService) teamRepository.getClientLibrary(IProcessItemService.class);

ITeamArea acmTeamArea = service.createTeamArea();
acmTeamArea.setName(projectAreaName);
acmTeamArea.addMember(teamRepository.loggedInContributor());
acmTeamArea.setProjectArea(projectArea);

sharingTargets.add(acmTeamArea);

IProjectAreaHandle projectAreaHandle = acmTeamArea.getProjectArea();


IQueryClient queryClient = (IQueryClient)teamRepository.getClientLibrary(IQueryClient.class);//workItemClient.getQueryClient();


List<IQueryDescriptor> sharedQueryList = queryClient.findSharedQueries(projectAreaHandle,sharingTargets,QueryTypes.WORK_ITEM_QUERY, IQueryDescriptor.FULL_PROFILE, monitor);
// ATTENTION: This sharedQueryList is a empty list after execution.


IQueryDescriptor queryDescriptor = sharedQueryList.get(0);

IQueryResult queryResult = queryClient.getQueryResults(queryDescriptor);

System.out.print("query result: " + queryResult.toString());


teamRepository.logout();

return true;
}

}


I can send you my screen shot for shared queries in my project area.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`


Thank you for your replay,I still amazing ahout that ,we want to get
query message of exist query,and we just login in RTC and have not
other context, can you tell me more about the code:
IProjectAreaHandle projectAreaHandle=?
ItemProfile profile=?
IProgressMonitor monitor=?

Here's an example for the UI

final IProjectAreaHandle projectArea=
ProjectAreaPicker.showDialog(shell, false);
final ITeamRepository repo= (ITeamRepository) projectArea.getOrigin();
final IQueryClient queryClient= (IQueryClient)
repo.getClientLibrary(IQueryClient.class);
final List<ITeamArea> teamAreas= ...;

UIUpdaterJob job= new UIUpdaterJob("Resolving Queries") { //$NON-NLS-1$
private List<IQueryDescriptor> fQueries;

@Override
public IStatus runInBackground(IProgressMonitor monitor) {
try {
fQueries= queryClient.findSharedQueries(projectArea, teamAreas,
QueryTypes.WORK_ITEM_QUERY, IQueryDescriptor.FULL_PROFILE, monitor);
} catch (TeamRepositoryException e) {
// TODO Handle exception
}
return super.runInBackground(monitor);
}

@Override
public IStatus runInUI(IProgressMonitor monitor) {
// TODO Do something with fQueries in the UI
return super.runInUI(monitor);
}
};

--
Regards,
Patrick
RTC Work Item Component Lead
[img][/img]

permanent link
wang lu (5664) | answered Nov 16 '10, 5:02 a.m.
Thank you for your replay,I still amazing ahout that ,we want to get
query message of exist query,and we just login in RTC and have not
other context, can you tell me more about the code:
IProjectAreaHandle projectAreaHandle=?
ItemProfile profile=?
IProgressMonitor monitor=?

Here's an example for the UI

final IProjectAreaHandle projectArea=
ProjectAreaPicker.showDialog(shell, false);
final ITeamRepository repo= (ITeamRepository) projectArea.getOrigin();
final IQueryClient queryClient= (IQueryClient)
repo.getClientLibrary(IQueryClient.class);
final List<ITeamArea> teamAreas= ...;

UIUpdaterJob job= new UIUpdaterJob("Resolving Queries") { //$NON-NLS-1$
private List<IQueryDescriptor> fQueries;

@Override
public IStatus runInBackground(IProgressMonitor monitor) {
try {
fQueries= queryClient.findSharedQueries(projectArea, teamAreas,
QueryTypes.WORK_ITEM_QUERY, IQueryDescriptor.FULL_PROFILE, monitor);
} catch (TeamRepositoryException e) {
// TODO Handle exception
}
return super.runInBackground(monitor);
}

@Override
public IStatus runInUI(IProgressMonitor monitor) {
// TODO Do something with fQueries in the UI
return super.runInUI(monitor);
}
};

--
Regards,
Patrick
RTC Work Item Component Lead
I encountered another question:

I have retrieve workitem list by executing a query. This query returns some defects, but IWorkItem interface only have limited method to get basic information. I did not find method to get defect priority, severity, defect id...

Would you please help on this? Thanks a lot!

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.