// determine whether create-named-window
boolean isCreateWindow = statementDesc != null && statementDesc.getStatement().getStatementSpec().getCreateWindowDesc() != null;
if (!isCreateWindow) {
for (FilterSpecCompiled filtersSpec : filtersSpecs) {
ContextDetailHashItem foundPartition = findHashItemSpec(hashSpec, filtersSpec);
if (foundPartition == null) {
continue;
}
List<FilterValueSetParam> addendumFilters = new ArrayList<FilterValueSetParam>();
addendumFilters.addAll(Arrays.asList(foundPartition.getParametersCompiled()));
FilterValueSetParam filter = new FilterValueSetParamImpl(foundPartition.getLookupable(), FilterOperator.EQUAL, agentInstanceId);
addendumFilters.add(filter);
FilterValueSetParam[] existing = addendums.get(filtersSpec);
if (existing == null) {
addendums.put(filtersSpec, addendumFilters.toArray(new FilterValueSetParam[addendumFilters.size()]));
}
else {
existing = (FilterValueSetParam[]) CollectionUtil.arrayExpandAddElements(existing, addendumFilters);
addendums.put(filtersSpec, existing);
}
}
}
// handle segmented context for create-window
else {
String declaredAsName = statementDesc.getStatement().getStatementSpec().getCreateWindowDesc().getAsEventTypeName();
if (declaredAsName != null) {
for (FilterSpecCompiled filterSpec : filtersSpecs) {
ContextDetailHashItem foundPartition = null;
for (ContextDetailHashItem partitionItem : hashSpec.getItems()) {
if (partitionItem.getFilterSpecCompiled().getFilterForEventType().getName().equals(declaredAsName)) {
foundPartition = partitionItem;
break;
}
}
if (foundPartition == null) {
continue;
}
FilterValueSetParam filter = new FilterValueSetParamImpl(foundPartition.getLookupable(), FilterOperator.EQUAL, agentInstanceId);
FilterValueSetParam[] existing = addendums.get(filterSpec);
if (existing == null) {
addendums.put(filterSpec, new FilterValueSetParam[] {filter});
}