i am developing report plugin for jira where i need to get assignee for given duration.it could be diffrent than current assignee in given duration.
now i am building my query in report like below.
JqlQueryBuilder queryBuilder = JqlQueryBuilder.newBuilder();
query = queryBuilder.where().updatedBetween(stdate,endDate).and().assignee() in(status_val).buildQuery();
return searchProvider.searchCount(query, remoteUser);
i want to get the count for prior assigned issues for given duration.
please let me know how i can use Was clause with assignee and updatedbetween dates.
regards,
tousif shaikh.
Try reading this answer. In short, you'll need to define a new clause and use it in your query, like this:
JqlQueryBuilder builder = JqlQueryBuilder.newBuilder();
WasClauseImpl wasClause = new WasClauseImpl("status", Operator.WAS, new SingleValueOperand("Resolved"), new TerminalHistoryPredicate(Operator.AFTER, new SingleValueOperand(3500000L)));
JqlClauseBuilder clauseBuilder = JqlQueryBuilder.newClauseBuilder(wasClause);
Query query = clauseBuilder.buildQuery();
Related
I am using the Microsoft.Graph.Beta/5.14.0-preview SDK to query calendar events and I am migration from an 4.22 version of the SDK. Some of my queries uses $expand and $filter on expanded properties, but for some reason I can't figure out how to re-write these queryes in the new SDK where the query builder is moved to a configuration on the get part.
My old setup looks like this:
client
.Users[userId]
.CalendarView
.Request(queryOptions)
.Filter(filterQuery)
.Expand(expandOptions)
.Select(SelectQuery)
.GetAsync()
And the re-written looks like this:
client
.Users[userId]
.CalendarView
.GetAsync(cfg =>
{
cfg.QueryParameters.StartDateTime = from;
cfg.QueryParameters.EndDateTime = to;
cfg.QueryParameters.Filter = filterQuery;
cfg.QueryParameters.Select = SelectQuery;
})
But I can't find any option to expand anymore in the new SDK - I also tried just til filter on the nested objects and then look up the event ids, but I can't filter on nested objects without expanding them.
My query that don't work look like this:
https://graph.microsoft.com/beta/me/calendarView?startDateTime=2022-12-01T00:00:00&endDateTime=2022-12-31T00:00:00&$select=id&$filter=SingleValueExtendedProperties/any(c: c/Id eq 'String {543ec2fa-e468-4b54-be8e-787c70d4a79f} Name ParentEventId' and c/Value eq 'AAMkADJiZWQxZDVmLTViNDAtNGVjOS1hZjdkLWRlMjVlNTQwYzkzOABGAAAAAADJmx9CKBiKQoBAarsrrol5BwAZTSoj4SE7Rbx0wxVE_m1BAAAAAAENAAAZTSoj4SE7Rbx0wxVE_m1BAAADk9fzAAA=')
While the one that works, and does the expand and filter correctly looks like this:
https://graph.microsoft.com/beta/me/calendarView?startDateTime=2022-12-01T00:00:00&endDateTime=2022-12-31T00:00:00&$select=id&$filter=SingleValueExtendedProperties/any(c: c/Id eq 'String {543ec2fa-e468-4b54-be8e-787c70d4a79f} Name ParentEventId' and c/Value eq 'AAMkADJiZWQxZDVmLTViNDAtNGVjOS1hZjdkLWRlMjVlNTQwYzkzOABGAAAAAADJmx9CKBiKQoBAarsrrol5BwAZTSoj4SE7Rbx0wxVE_m1BAAAAAAENAAAZTSoj4SE7Rbx0wxVE_m1BAAADk9fzAAA=')&$expand=singleValueExtendedProperties($filter=id eq 'String {543ec2fa-e468-4b54-be8e-787c70d4a79f} Name ParentEventId')
I am not sure if this is the best way of querying SingleValueExtendedProperties but the old setup works - and i can't figure out how to migrate it in the new SDK.
We have been using spring-data-elasticsearch for 4.1.13 until recently for querying from elastic search. For grouping something we used aggregations
Consider a index of books. For each book there can be one or multipe authors
To get count of books by author we used TermsAggregationbuilder to get this grouping as shown below
SearchSourceBuilder builder = this.getQuery(filter, false);
String aggregationName = "group_by_author_id";
TermsAggregationBuilder aggregationBuilders =
AggregationBuilders.terms(aggregationName).field("authors");
var query =
new NativeSearchQueryBuilder()
.withQuery(builder.query())
.addAggregation(aggregationBuilders)
.build();
var result = elasticsearchOperations.search(query, EsBook.class, ALIAS_COORDS);
if (!result.hasAggregations()) {
throw new IllegalStateException("No aggregations found after query with aggregations!");
}
Terms groupById = result.getAggregations().get(aggregationName);
var buckets = groupById.getBuckets();
Map<Long, Integer> booksCount = new HashMap<>();
buckets.forEach(
bucket ->
booksCount.put(
bucket.getKeyAsNumber().longValue(), Math.toIntExact(bucket.getDocCount())));
return booksCount ;
We recently upgraded to spring-data-elasticsearch 4.4.2 and saw that there are some breaking changes.
First .addAggregations were replaced by withAggregations
Second unlike before I cant seem to directly get Terms and buckets after querying as
result.getAggregations().get(aggregationName); is no more possible and only other option I see is result.getAggregations().aggregations(). So am wondering if anyone has done the same. The documentation itself is so poor in Elastic search.
First .addAggregations were replaced by withAggregations
addAggregation(AbstractAggregationBuilder<?>) has been deprecated and should be replaced by withAggregations. This is not a breaking change.
The change in the returned value for SearchHits.getAggregations() is documented in the migration guides from 4.2 to 4.3 "Removal of org.elasticsearch classes from the API."
So from 4.3 on result.getAggregations().aggregations() returns the same that previously result.getAggregations() returned.
Trying to know all the mandatory fields for an issue type Testcase in JIRA using the below statement
defined params as list with items projectIds, IssueType = Testcase, IssueType Id =
"jira._get_json('issue/createmeta', params)".
But i am not able to retrieve the fields
output is alist with
projects
issuetypes,
subtask,
description,
avatarUrls,
key,
Self,
expand
Let me know is there any issue with statement I used or please post a way to retrieve all the mandatory fields for specific issue type using jira python
The way I have been doing this for specific fields:
issue = jira.issue(TestCase)
issue_type_name = issue.fields.issuetype.name
issue_type_id = issue.fields.issuetype.id
Another way to do this getting all the meta is:
issue = jira.issue(TestCase)
print(issue.raw)
or
jira.createmeta(projectKeys='TestCaseProject', projectIds=['TestCase'],expand=None)
Source: http://pythonhosted.org/jira/
I got a domain like this:
ZZPartAndTeam
String parts
String team
Parts may have many team.
For ex: part:part1 team:10
part:part1 team:20
part:part2 team:30
How can I query in the domain that get all parts which have multi team?
result:part:part1 team:10
part:part1 team:20
Thanks.
The HAVING clause is not supported by Hibernate Criteria. A way around is to use DetachedCriteria.
import org.hibernate.criterion.DetachedCriteria as HDetachedCriteria
query: { builder, params ->
// This query counts the number of teams per part
HDetachedCriteria innerQry = HDetachedCriteria.forClass(ZZPartAndTeam.class)
innerQry.setProjection(Projections.projectionList()
.add(Projections.count('team').as('teamCount'))
)
innerQry.add(HRestrictions.eqProperty('part', 'outer.part')
// Using innerQuery, this criteria returns the parts having more than one team.
HDetachedCriteria outerQry = HDetachedCriteria.forClass(ZZPartAndTeam.class, 'outer')
outerQry.setProjection(Projections.projectionList()
.add(Projections.distinct(Projections.property('part').as('part')))
)
outerQry.add(Subqueries.gt(1, innerQry))
builder.addToCriteria(Property.forName('part').in(outerQry))
}
Hi I'm new to rails and developing an application to pull results from database in preparation for charting. I have the following code in my controller:
#statistic = OutstandingWorkIndex.find_by_sql ["SELECT Result_Set.Set_Code, Request.Specimen_Number ,
DATEDIFF('hh',Result_Set.Date_Time_Booked_In,current_timestamp) as HrsIn FROM iLabTP.Outstanding_Work_Index, iLabTP.Result_Set Result_Set, iLabTP.Request
WHERE Outstanding_Work_Index.Request_Row_ID = Result_Set.Request_Row_ID and Outstanding_Work_Index.Request_Row_ID = Request.Request_Row_ID and Result_Set.Set_code=?
order by Result_Set.Date_Time_Booked_In DESC", params[:set_code].upcase]
What I'd like to do is count the number of records returned in addition to the object from above which I then use to create and XML stream of paired values or use the google charts java script api in the view.
Do I need to issue commands like:
#statistic = OutstandingWorkIndex.find_by_sql ["SELECT Result_Set.Set_Code, Request.Specimen_Number ,
DATEDIFF('hh',Result_Set.Date_Time_Booked_In,current_timestamp) as HrsIn
FROM iLabTP.Outstanding_Work_Index, iLabTP.Result_Set Result_Set, iLabTP.Request
WHERE Outstanding_Work_Index.Request_Row_ID = Result_Set.Request_Row_ID and Outstanding_Work_Index.Request_Row_ID = Request.Request_Row_ID and Result_Set.Set_code=?
order by Result_Set.Date_Time_Booked_In DESC", params[:set_code].upcase].**count**
And if so does this result in the query being reissued?
Thanks
You should do:
#size = #statistic.size
It's well explained here.