How to retrieve all items of a given itemtype
Hi,
is there an easy way to retrieve all items from a given class from the
repository?
For instance, if I want to get all elements of type "MyType" (which inherits
from SimpleIem), the tutorials suggest to do something like
MyTypeQueryModel queryModel =
BaseMyTypeMapQueryModel.MyTypeQueryModel.ROOT;
IItemQuery itemQuery = IItemQuery.FACTORY.newInstance(queryModel);
IItemQueryPage itemQueryPage = null;
try {
itemQueryPage = queryService.queryItems(itemQuery,
IQueryService.EMPTY_PARAMETERS,
IQueryService.ITEM_QUERY_MAX_PAGE_SIZE);
} catch (TeamRepositoryException e) {
e.printStackTrace();
}
List handles = itemQueryPage.getItemHandles());
The codegen tool however only generates MyTypeQueryModel .java and
BaseMyTypeQueryModel.java if the storage model includes an queryableProperty
annotation for an attribute of the class MyType.
In my case, I do not need to query for a specifc value -- I always want to
get all items of this type from the repository.
Is there a way to get this without introducing a dummy attribute with an
queryableProperty annotation?
Many thanks,
--Tim
is there an easy way to retrieve all items from a given class from the
repository?
For instance, if I want to get all elements of type "MyType" (which inherits
from SimpleIem), the tutorials suggest to do something like
MyTypeQueryModel queryModel =
BaseMyTypeMapQueryModel.MyTypeQueryModel.ROOT;
IItemQuery itemQuery = IItemQuery.FACTORY.newInstance(queryModel);
IItemQueryPage itemQueryPage = null;
try {
itemQueryPage = queryService.queryItems(itemQuery,
IQueryService.EMPTY_PARAMETERS,
IQueryService.ITEM_QUERY_MAX_PAGE_SIZE);
} catch (TeamRepositoryException e) {
e.printStackTrace();
}
List handles = itemQueryPage.getItemHandles());
The codegen tool however only generates MyTypeQueryModel .java and
BaseMyTypeQueryModel.java if the storage model includes an queryableProperty
annotation for an attribute of the class MyType.
In my case, I do not need to query for a specifc value -- I always want to
get all items of this type from the repository.
Is there a way to get this without introducing a dummy attribute with an
queryableProperty annotation?
Many thanks,
--Tim
One answer
Tim Schumann wrote:
Hi Tim,
I tried this and see the same behavior as you describe. You may want to
open a workitem for us to create a query model even if there are no
queryableProperties. A workaround, as you mention, is to apply
queryableProperty to some attribute or reference in the class.
--
Chris Daly
Jazz Component Development Team
Hi,
is there an easy way to retrieve all items from a given class from the
repository?
For instance, if I want to get all elements of type "MyType" (which inherits
from SimpleIem), the tutorials suggest to do something like
MyTypeQueryModel queryModel =
BaseMyTypeMapQueryModel.MyTypeQueryModel.ROOT;
IItemQuery itemQuery = IItemQuery.FACTORY.newInstance(queryModel);
IItemQueryPage itemQueryPage = null;
try {
itemQueryPage = queryService.queryItems(itemQuery,
IQueryService.EMPTY_PARAMETERS,
IQueryService.ITEM_QUERY_MAX_PAGE_SIZE);
} catch (TeamRepositoryException e) {
e.printStackTrace();
}
List handles = itemQueryPage.getItemHandles());
The codegen tool however only generates MyTypeQueryModel .java and
BaseMyTypeQueryModel.java if the storage model includes an queryableProperty
annotation for an attribute of the class MyType.
In my case, I do not need to query for a specifc value -- I always want to
get all items of this type from the repository.
Is there a way to get this without introducing a dummy attribute with an
queryableProperty annotation?
Many thanks,
--Tim
Hi Tim,
I tried this and see the same behavior as you describe. You may want to
open a workitem for us to create a query model even if there are no
queryableProperties. A workaround, as you mention, is to apply
queryableProperty to some attribute or reference in the class.
--
Chris Daly
Jazz Component Development Team