Is there a Project Area Id? (PlainJavaAPI)
I failed to find a function named "findProjectAreaById()" on PlainJavaAPI, so I decide to make one. If it already exists please read no further and just tell me where I get it :)
So, I'm trying to build a dynamic query, which I think it's faster (Am I right?). I build this piece of code:
I call it on something like
Where areaId is a string previously obtained with:
ProjectArea.getItemId().getUuidValue();
But I get "Incorrectly typed parameter submitted to query; Parameter 0 was class java.lang.String but com.ibm.team.repository.common.UUID was expected"
How is the UUID calculated?
I didn't found a way to convert com.ibm.team.repository.common.UUID into something standard and back to com.ibm.team.repository.common.UUID. Is the UUID generated from ProjectArea name?
I have found an ProjectAreaQueryModel.ROOT.uniqueName() that I could use on query, but I didn't found the associated IProjectArea property id.
Resuming, how can I store an unique identifier for a ProjectArea, and later recover that ProjectArea based on that unique identifier?
So, I'm trying to build a dynamic query, which I think it's faster (Am I right?). I build this piece of code:
private IProjectAreaHandle findProjectAreaById(UUID id) throws TeamRepositoryException {
ProjectAreaQueryModel pArea = ProjectAreaQueryModel.ROOT;
IItemQuery query = IItemQuery.FACTORY.newInstance(pArea);
IPredicate predicate = pArea.itemId()._eq(query.newUUIDArg());
query.filter(predicate);
Object[] parameters= new Object[] { IProjectArea.ITEM_ID_PROPERTY, id };
ItemQueryIterator<IProjectAreaHandle> iterator = new ItemQueryIterator<IProjectAreaHandle>(getAuditableCommon(), query, parameters);
if (iterator.hasNext(null)) {
return iterator.next(null);
} else {
return null;
}
}
I call it on something like
IProjectAreaHandle projectHandler = findProjectAreaById(UUID.valueOf(areaId));
Where areaId is a string previously obtained with:
ProjectArea.getItemId().getUuidValue();
But I get "Incorrectly typed parameter submitted to query; Parameter 0 was class java.lang.String but com.ibm.team.repository.common.UUID was expected"
How is the UUID calculated?
I didn't found a way to convert com.ibm.team.repository.common.UUID into something standard and back to com.ibm.team.repository.common.UUID. Is the UUID generated from ProjectArea name?
I have found an ProjectAreaQueryModel.ROOT.uniqueName() that I could use on query, but I didn't found the associated IProjectArea property id.
5 answers
Also, please note that any classes in a package with "internal" in the name are not API. The code snippet posted above is referencing the ProjectAreaQueryModel, which is just such a class.
This class is an internal implementation detail of the Process runtime and should not be accessed by third parties.
Jonathan's suggested path of using the IItemManager or IRepositoryItemService is the correct route.
- Jared
This class is an internal implementation detail of the Process runtime and should not be accessed by third parties.
Jonathan's suggested path of using the IItemManager or IRepositoryItemService is the correct route.
- Jared
Also, please note that any classes in a package with "internal" in the name are not API. The code snippet posted above is referencing the ProjectAreaQueryModel, which is just such a class.
This class is an internal implementation detail of the Process runtime and should not be accessed by third parties.
Jonathan's suggested path of using the IItemManager or IRepositoryItemService is the correct route.
- Jared
If these type of query isn't API, why in jazz Wiki, "Developer's Guide to Querying Work Items https://jazz.net/wiki/bin/view/Main/QueryDevGuide". The JazzTeam says: "To illustrate
Not only that but there they also said: "The dynamic query model is aimed at those occasions where a query needs to be created dynamically at runtime and only the attribute identifiers are known."
Which is exactly my case, once I only know the attribute identifier ItemID, but not the parameter.
The documentation isn't that great already, and if we couldn't trust what is written... Then we have troubles...