SCM query for custom attribute value supports EQUALS but not CONTAINS?
hi all
When constructing an SCM query for a custom attribute value, it appears that you can do this:
IGenericQueryNode query1 = IGenericQueryNode.FACTORY.newInstance(QueryOperations.OPERATION_EQUALS)
.addChild(customAttrName).addChild(customAttrVal);
.addChild(customAttrName).addChild(customAttrVal);
but not
IGenericQueryNode query1 = IGenericQueryNode.FACTORY.newInstance(QueryOperations.OPERATION_CONTAINS)
.addChild(customAttrName).addChild(customAttrVal);
.addChild(customAttrName).addChild(customAttrVal);
Neither OPERATION_CONTAINS nor OPERATION_MATCHES works.
RTC 6.0.6.1
Thoughts?
One answer
ah. CONTAINS is for tags. That wasn't obvious.
private static class CustomAttributeTableQueryHandler extends AbstractScmQueryHandler<ICustomAttributeHandle, CustomAttributeQueryModel> {
private CustomAttributeTableQueryHandler(ScmTransactionContext rtc, CustomAttributeQueryModel model) {
super(rtc, model);
Map<String, QueryOperationHandler> queryFunctions = new HashMap<String, QueryOperationHandler>();
queryFunctions.put(QueryOperations.OPERATION_AND, ScmQueryOperationLibrary.genericANDOperationHandler);
queryFunctions.put(QueryOperations.OPERATION_OR, ScmQueryOperationLibrary.genericOROperationHandler);
queryFunctions.put(QueryOperations.OPERATION_EQUALS, ScmQueryOperationLibrary.customAttributeEQOperationHandler);
queryFunctions.put(QueryOperations.OPERATION_HAS_ATTRIBUTE, ScmQueryOperationLibrary.customAttributeExistOperationHandler);
queryFunctions.put(QueryOperations.OPERATION_BASELINE, new InBaselineQueryOperation());
queryFunctions.put(QueryOperations.OPERATION_CONTAINS, ScmQueryOperationLibrary.genericTagsContainsOperationHandler);
queryFunctions.put(QueryOperations.OPERATION_HAS_LINK, ScmQueryOperationLibrary.genericHasLinkOperationHandler);
super.setOperationHandlers(queryFunctions);
}