Java API question

I create a new UCMDB Java API program(MyQueryViewSample.java, pls refer to the below program) based on the OOB example.

 In this program, "cmb_eth_view" is a pattern view defined in uCMDB. The print result of getAllCIs is correct, while the print result of getCIsByName is wrong("cnt=0"). How to solve this problem? BTW, how to query topoloy from a template.

 

 

package com.hp.ucmdb;
import com.hp.ucmdb.api.UcmdbService;
import com.hp.ucmdb.api.topology.*;
import com.hp.ucmdb.api.types.TopologyCI;
import com.hp.ucmdb.api.types.TopologyRelation;
import com.hp.ucmdb.api.view.ViewService;
import com.hp.ucmdb.api.view.ViewWithFoldingDefinition;
import com.hp.ucmdb.api.view.foldingdefinition.FoldingDefinition;
import com.hp.ucmdb.api.view.foldingdefinition.FoldingDefinitionNodesFactory;
import com.hp.ucmdb.api.view.result.ViewResult;
import com.hp.ucmdb.api.view.result.ViewResultTreeNode;

import java.util.Collection;
import java.util.List;
/**
*
* This is a sample of creating and executing a view.
* This sample:
* - Creates a query for searching nodes with at least two IPs.
* - Creates a view definition in order to create a folded results of the the query.
* The folding rule in use will be: for each Node, fold its IPs as its children.
* - Print the results by traversing the tree result
*
*
*/
public class MyQueryViewSample {
public static void main(String[] args) throws Exception{
System.out.print("====== Start ============\n");
// Create a connection
UcmdbService ucmdbService = CreateSDKConnectionSample.createSDKConnection();
TopologyQueryService queryService = ucmdbService.getTopologyQueryService();

// Create the query which is going to be executed by the view
// ExecutableQuery query = createQueryForView(ucmdbService);
ExecutableQuery query= queryService.createExecutableQuery("cmb_eth_view");
// query.queryParameters().addValue("id", "06E7A9P-3-en3");
Topology topology = queryService.executeQuery(query);
System.out.print("TopologyEmpty:" topology.isEmpty() "\n");

String topCIT="eth_virtual_adapter"; // "eth_interface";

Collection<TopologyCI> nodes = topology.getCIsByName(topCIT);
System.out.print("cnt=" nodes.toArray().length);
// Go over the nodes and print its related IPs
for (TopologyCI nodeCI : nodes) {
System.out.print("Node " nodeCI.getPropertyValue("display_label") " ");
// Get related IPs from the node
for (TopologyRelation relation : nodeCI.getOutgoingRelations()) {
System.out.print(relation.getEnd2CI().getPropertyValue("display_label") " ");
}
// Break line
System.out.print("\n");
}

System.out.print("\n\n---------------------------\n\n\n");

Collection<TopologyCI> tcs=topology.getAllCIs();
for (TopologyCI tc:tcs) {
System.out.print("CI Type=" tc.getType() ", label=" tc.getPropertyValue("display_label") "\n");
}


System.out.print("====== End ============\n");
}

}