Gemini Community Support Site

This Gemini community support site can be used to find solutions to product issues. You can log in using Open Id, Google Profile and even Facebook. Feel free to ask a question or browse FAQs and documentation. Product tour videos are also available along with how-to videos demonstrating key Gemini capabilities.




Get issues by custom field

api

Hi,

could you advise how i should contruct IssuesFilterEN (format of CustomFields or SavedCustomFields) to fetch all issues (using Web Services SDK/Java), which

1) belong to one of several projects; 2) assigned to specific user (no matter open or not); 3) have text custom field 'A' that contains 'B' in its value

(i'm a bit confused about item 3 now)

ShL77
· 1
ShL77
Replies (19)
helpful
0
not helpful

PS I use v3.7.2 Build 2784


ShL77
· 1
ShL77
helpful
0
not helpful

There you go:
 ServiceManager sm = new ServiceManager("http://localhost/gemini", "manager", "manager", "", false);
           
            IssuesFilterEN filter = new IssuesFilterEN();
            filter.UserID = sm.UsersService.WhoAmI().UserID;
            filter.ProjectID = "19|20|"; // Project ids seperated by pipe
            filter.Resources = string.Format("{0}|", sm.UsersService.WhoAmI().UserID); // User ids seperated by pipe.
            filter.SystemFilter = IssuesFilterEN.SystemFilterTypes.NoType;
            filter.ExcludeClosed = false;
            int customFieldId = 1; // This is the id of the custom field you are searching
            GenericEN[] custs = new GenericEN[1];
            custs[0] = new GenericEN(customFieldId.ToString(), "B"); // "B" is the value we are searching for.
            filter.CustomFields = custs;

            IssueEN[] issues = sm.IssuesService.GetFilteredIssues(filter);


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

Hi,

Thanks for the answer, but my environment is Java, so i wonder what is the right way to define IssuesFilterEN class for use with services (i'm checking http://api.countersoft.com/Schema.aspx?entity=IssuesFilterEN and the data types are not quite clear ).

Based on your reply, i assume CustomFields should be the array of CustomFieldEN, correct?


ShL77
· 1
ShL77
helpful
0
not helpful

Most of the types are strings excpet of:

  • UserID - int
  • ExcludeClosed - bool
  • CustomFields - Array of GenericEN (2 string properties - GenericKey and GenericValue)


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

Hi,

I get 500 error when trying to get results and based on error log (below), it looks like some mandatory field is not set.

Could you advise?

could not resolve property: null of: CounterSoft.Gemini.Commons.Entity.IssueEN at NHibernate.Persister.Entity.AbstractPropertyMapping.ToType(String propertyName) at NHibernate.Persister.Entity.AbstractEntityPersister.GetSubclassPropertyTableNumber(String propertyPath) at NHibernate.Persister.Entity.BasicEntityPropertyMapping.ToColumns(String alias, String propertyName) at NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetColumns(String propertyName, ICriteria subcriteria) at NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetColumnAliasesUsingProjection(ICriteria subcriteria, String propertyName) at NHibernate.Criterion.Order.ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery) at NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetOrderBy() at NHibernate.Loader.Criteria.CriteriaJoinWalker..ctor(IOuterJoinLoadable persister, CriteriaQueryTranslator translator, ISessionFactoryImplementor factory, ICriteria criteria, String rootEntityName, IDictionary2 enabledFilters) at NHibernate.Loader.Criteria.CriteriaLoader..ctor(IOuterJoinLoadable persister, ISessionFactoryImplementor factory, CriteriaImpl rootCriteria, String rootEntityName, IDictionary2 enabledFilters) at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results) at NHibernate.Impl.CriteriaImpl.List(IList results) at NHibernate.Impl.CriteriaImpl.List() at CounterSoft.Gemini.DataProvider.xc0186e148e957052.x3ea65f25dee0cd51(IssuesFilterEN x24b748b5be295dcb, Int32[] xbcd492679797b57e, UserEN xfd92dbe2fa4bcb5a, ArrayList x858fc38c4382ab28, Object[] x41e32780e09d58f5) at CounterSoft.Gemini.Business.x95da312ae9372c2e.x3ea65f25dee0cd51(IssuesFilterEN x24b748b5be295dcb, ArrayList x41ed9424bcef4dac, UserEN xfd92dbe2fa4bcb5a) at CounterSoft.Gemini.Presenter.IssuePresenter.GetFilteredIssues(IssuesFilterEN filter) at CounterSoft.Gemini.Web.Api.IssuesRestHandler.IssueFilter(RequestDetails rd)


ShL77
· 1
ShL77
helpful
0
not helpful

Can you please post the XML you are posting?


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

Hi,

Looks like i've figured out the problem. Had to initialize fields to empty strings ("null" value caused this issue)


ShL77
· 1
ShL77
helpful
0
not helpful

Hi,

One more question: is there any way to make sure both COMMENTS and HISTORY is loaded for all items that are returned by the mentioned '/filters' request?

It looks like comments are not part of the response and one should request comments for each issue explicitly, the same with history.

My goal is to apply some filtering on historical information and retrieve the last comment done by specific user for each issue that is a part of the response.


ShL77
· 1
ShL77
helpful
0
not helpful

The comments should be part of the returned result. Are you sure they are not?

To get all results including history call the Get Paged Filtered Issues method.


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

Hi!

Thanks for the tip! I've tried http://geminihost/api/issues.ashx/issues/startpage/1/pagesize/1000/includeatt achments/0/pagedissues

but it returns 500 with the following errors logged on server side

Object reference not set to an instance of an object. at CounterSoft.Gemini.Presenter.IssuePresenter.CreateIssue(IssueEN issue) at CounterSoft.Gemini.Web.Api.IssuesRestHandler.IssueCreate(RequestDetails rd)  

Exception has been thrown by the target of an invocation. at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at CounterSoft.Gemini.Web.Api.RestHandler.GetResponse(RequestDetails rd, MethodInfo method)


ShL77
· 1
ShL77
helpful
0
not helpful

The api reference seems to be wrong, the url should be:
..../api/issues.ashx/paged?startpage=1&pagesize=1000&includeattachments=0


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

Thanks, will check it out. PS wrong api URL was taken from http://api.countersoft.com/ApiIssues.aspx#Filtered


ShL77
· 1
ShL77
helpful
0
not helpful

For /api/issues.ashx/paged?startpage=1&pagesize=1000&includeattachments=0

i got (NOTE: the same request w/o paging works fine) could not resolve property: of: CounterSoft.Gemini.Commons.Entity.IssueEN at NHibernate.Persister.Entity.AbstractPropertyMapping.ToType(String propertyName) at NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetType(ICriteria subcriteria, String propertyName) at NHibernate.Criterion.PropertyProjection.GetTypes(ICriteria criteria, ICriteriaQuery criteriaQuery) at NHibernate.Criterion.ProjectionList.GetTypes(ICriteria criteria, ICriteriaQuery criteriaQuery) at NHibernate.Criterion.Distinct.GetTypes(ICriteria criteria, ICriteriaQuery criteriaQuery) at NHibernate.Loader.Criteria.CriteriaJoinWalker..ctor(IOuterJoinLoadable persister, CriteriaQueryTranslator translator, ISessionFactoryImplementor factory, ICriteria criteria, String rootEntityName, IDictionary2 enabledFilters) at NHibernate.Loader.Criteria.CriteriaLoader..ctor(IOuterJoinLoadable persister, ISessionFactoryImplementor factory, CriteriaImpl rootCriteria, String rootEntityName, IDictionary2 enabledFilters) at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results) at NHibernate.Impl.CriteriaImpl.List(IList results) at NHibernate.Impl.CriteriaImpl.List() at CounterSoft.Gemini.DataProvider.xc0186e148e957052.x6940d9d755137ae5(IssuesFilterEN x24b748b5be295dcb, Int32[] xbcd492679797b57e, UserEN xfd92dbe2fa4bcb5a, ArrayList x858fc38c4382ab28) at CounterSoft.Gemini.Business.x95da312ae9372c2e.x6940d9d755137ae5(IssuesFilterEN x24b748b5be295dcb, ArrayList x41ed9424bcef4dac, UserEN xfd92dbe2fa4bcb5a) at CounterSoft.Gemini.Business.x95da312ae9372c2e.xa91f976c95cc24f6(IssuesFilterEN x24b748b5be295dcb, Int32 x6085dd2d6dae9673, Int32 x870a8f396af517a1, Int32& x42a948eff01be1b6, Int32& x8c5725b36c3fef30, Int32& x93a2c901eb10cf80, UserEN xfd92dbe2fa4bcb5a) at CounterSoft.Gemini.Business.x95da312ae9372c2e.xa91f976c95cc24f6(IssuesFilterEN xb0f684c47236959a, Int32 xac5137055166e071, Int32 x1e9480f13fb31614, UserEN xfd92dbe2fa4bcb5a) at CounterSoft.Gemini.Presenter.IssuePresenter.GetPagedFilteredIssues(IssuesFilterEN filter, Int32 startPage, Int32 pageSize, Boolean includeAttachments) at CounterSoft.Gemini.Web.Api.IssuesRestHandler.PagedFilterIssues(RequestDetails rd)

Error Gemini Exception has been thrown by the target of an invocation. at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at CounterSoft.Gemini.Web.Api.RestHandler.GetResponse(RequestDetails rd, MethodInfo method)


ShL77
· 1
ShL77
helpful
0
not helpful

Can you please post the XML you are posting?


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

The xml is

<IssuesFilterEN><Resources>87|</Resources><ProjectID>33|</ProjectID><UserID>87</UserID><CustomFields><GenericEN><GenericKey>10</GenericKey><GenericValue>2010/53
</GenericValue><TimeStamp></TimeStamp><DateCreated>3800-02-01T12:00:00</DateCreated></GenericEN></CustomFields><ExcludeClosed>false</ExcludeClosed><SortField></
SortField><SearchKeywords></SearchKeywords><SystemFilter>NoType</SystemFilter><TimeStamp></TimeStamp><DateCreated>2011-01-03T02:49:06</DateCreated></IssuesFilterEN>


ShL77
· 1
ShL77
helpful
0
not helpful

You need to set the sort field of the filter:
<SortField>IssueID</SortField>


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

Hi!

Thanks, it's helped!


ShL77
· 1
ShL77
helpful
0
not helpful

Hi,

I've just noticed that the IssueHistory is ONLY filled for the first item of such "paged" response.

Can you advise?


ShL77
· 1
ShL77
helpful
0
not helpful
ANSWER

This is a bug: http://gemini.countersoft.com/Default.aspx?p=2&i=4269 which will be fixed in 4.0.
It will work if you include attachments.


Saar Cohen
· 5000
Saar Cohen