private void handle(APISearchL3NetworkMsg msg) { SearchQuery<L3NetworkInventory> sq = SearchQuery.create(msg, L3NetworkInventory.class); String content = sq.listAsString(); APISearchL3NetworkReply reply = new APISearchL3NetworkReply(); reply.setContent(content); bus.reply(msg, reply); }
private void handle(APIGetImageMsg msg) { SearchQuery<ImageInventory> sq = new SearchQuery(ImageInventory.class); sq.addAccountAsAnd(msg); sq.add("uuid", SearchOp.AND_EQ, msg.getUuid()); List<ImageInventory> invs = sq.list(); APIGetImageReply reply = new APIGetImageReply(); if (!invs.isEmpty()) { reply.setInventory(JSONObjectUtil.toJsonString(invs.get(0))); } bus.reply(msg, reply); }
public String listAsString() { if (fields.length == 0) { return gson.toJson(list()); } else { List<ESTuple> tuples = listTuple(); List<Map<String, String>> lst = new ArrayList<Map<String, String>>(tuples.size()); for (ESTuple t : tuples) { lst.add(t.getKeyValuePairs()); } return gson.toJson(lst); } }
private void handle(APISearchInstanceOfferingMsg msg) { SearchQuery<InstanceOfferingInventory> query = SearchQuery.create(msg, InstanceOfferingInventory.class); query.add("visible", SearchOp.AND_EQ, Boolean.TRUE.toString()); String content = query.listAsString(); APISearchInstanceOfferingReply reply = new APISearchInstanceOfferingReply(); reply.setContent(content); bus.reply(msg, reply); }
private void handle(APISearchImageMsg msg) { SearchQuery<ImageInventory> sq = SearchQuery.create(msg, ImageInventory.class); sq.addAccountAsAnd(msg); String content = sq.listAsString(); APISearchImageReply reply = new APISearchImageReply(); reply.setContent(content); bus.reply(msg, reply); }
public static <K> SearchQuery<K> create(APISearchMessage msg, Class<K> invClass) { SearchQuery<K> query = new SearchQuery<K>(invClass); if (!msg.getFields().isEmpty()) { query.select(msg.getFields().toArray(new String[msg.getFields().size()])); } for (APISearchMessage.NOVTriple t : msg.getNameOpValueTriples()) { query.add(t.getName(), SearchOp.valueOf(t.getOp()), t.getVal()); } for (APISearchMessage.NOLTriple tl : msg.getNameOpListTriples()) { query.add(tl.getName(), SearchOp.valueOf(tl.getOp()), tl.getVals()); } if (msg.getStart() > 0) { query.setFrom(msg.getStart()); } if (msg.getSize() > 0) { query.setSize(msg.getSize()); } else { query.setSize(USE_DEFAULT_SIZE); } return query; }
public class SearchActivity extends SherlockFragmentActivity{ @Override protected void onCreate(Bundle savedInstanceState) { Log.d(TAG, "This is the search view activity"); // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.search_result_layout); } private void handleIntent(Intent intent){ if(Intent.ACTION_SEARCH.equals(intent.getAction())){ searcdhQuery = intent.getStringExtra(SearchManager.QUERY); //here we shall do e search.. Log.d(TAG, "This is the search query:" + searcdhQuery); //This is the asynctask query to connect to the database... String[] value = {searcdhQuery}; SearchQuery searchQuery = new SearchQuery(); searchQuery.execute(value); } } @Override protected void onNewIntent(Intent intent) { // TODO Auto-generated method stub super.onNewIntent(intent); handleIntent(intent); } }
public void addAccountAsAnd(APIMessage msg) { if (!msg.getSession().getAccountUuid().equals(AccountConstant.INITIAL_SYSTEM_ADMIN_UUID)) { this.add("accountUuid", SearchOp.AND_EQ, msg.getSession().getAccountUuid()); } } }
public T find() { if (fields.length > 0) { throw new IllegalArgumentException(String.format("You have called SearchQuery.find(), call SearchQuery.findTuple() instead of SearchQuery.find()")); } List<T> lst = list(); if (lst.size() > 1) { throw new IllegalArgumentException(String.format("more than one result found")); } else if (lst.size() == 0) { return null; } return lst.get(0); }
Auth auth = new Auth("username", "password"); SearchQuery fsq = new SearchQuery ("param1","param2","param3"); Model_SearchService service = new Model_SearchServiceLoc(); SearchRequest freq = new SearchRequest(auth, fsq); Result r[] = service.getSearchPort().method(freq); for(int i=0; i<r.length; i++){ System.out.println(i+" "+r[i].getInfo()[0].toString()); }
private void handle(APISearchVolumeMsg msg) { SearchQuery<VolumeInventory> q = SearchQuery.create(msg, VolumeInventory.class); q.addAccountAsAnd(msg); String res = q.listAsString(); APISearchVolumeReply reply = new APISearchVolumeReply(); reply.setContent(res); bus.reply(msg, reply); }
private void handle(APISearchSftpBackupStorageMsg msg) { SearchQuery<SftpBackupStorageInventory> sq = SearchQuery.create(msg, SftpBackupStorageInventory.class); String content = sq.listAsString(); APISearchSftpBackupStorageReply reply = new APISearchSftpBackupStorageReply(); reply.setContent(content); bus.reply(msg, reply); }
private void handle(APIGetVmInstanceMsg msg) { SearchQuery<VmInstanceInventory> query = new SearchQuery(VmInstanceInventory.class); query.addAccountAsAnd(msg); query.add("uuid", SearchOp.AND_EQ, msg.getUuid()); List<VmInstanceInventory> invs = query.list(); APIGetVmInstanceReply reply = new APIGetVmInstanceReply(); if (!invs.isEmpty()) { reply.setInventory(JSONObjectUtil.toJsonString(invs.get(0))); } bus.reply(msg, reply); }
private void handle(APISearchVmInstanceMsg msg) { SearchQuery<VmInstanceInventory> query = SearchQuery.create(msg, VmInstanceInventory.class); query.addAccountAsAnd(msg); String content = query.listAsString(); APISearchVmInstanceReply reply = new APISearchVmInstanceReply(); reply.setContent(content); bus.reply(msg, reply); }
private void handle(APISearchL2VlanNetworkMsg msg) { SearchQuery<L2VlanNetworkInventory> sq = SearchQuery.create(msg, L2VlanNetworkInventory.class); String content = sq.listAsString(); APISearchL2VlanNetworkReply reply = new APISearchL2VlanNetworkReply(); reply.setContent(content); bus.reply(msg, reply); }
private void handle(APIGetVolumeMsg msg) { SearchQuery<VolumeInventory> q = new SearchQuery(VolumeInventory.class); q.addAccountAsAnd(msg); q.add("uuid", SearchOp.AND_EQ, msg.getUuid()); List<VolumeInventory> invs = q.list(); APIGetVolumeReply reply = new APIGetVolumeReply(); if (!invs.isEmpty()) { reply.setInventory(JSONObjectUtil.toJsonString(invs.get(0))); } bus.reply(msg, reply); }
private void handle(APISearchNetworkServiceProviderMsg msg) { SearchQuery<NetworkServiceProviderInventory> q = SearchQuery.create(msg, NetworkServiceProviderInventory.class); APISearchNetworkServiceProviderReply reply = new APISearchNetworkServiceProviderReply(); String res = q.listAsString(); reply.setContent(res); bus.reply(msg, reply); }
private void handle(APISearchClusterMsg msg) { SearchQuery<ClusterInventory> query = SearchQuery.create(msg, ClusterInventory.class); String ret = query.listAsString(); APISearchClusterReply reply = new APISearchClusterReply(); reply.setContent(ret); bus.reply(msg, reply); }
private void handle(APISearchL2NetworkMsg msg) { SearchQuery<L2NetworkInventory> sq = SearchQuery.create(msg, L2NetworkInventory.class); String content = sq.listAsString(); APISearchL2NetworkReply reply = new APISearchL2NetworkReply(); reply.setContent(content); bus.reply(msg, reply); }
private void handle(APISearchDiskOfferingMsg msg) { SearchQuery<DiskOfferingInventory> query = SearchQuery.create(msg, DiskOfferingInventory.class); String content = query.listAsString(); APISearchDiskOfferingReply reply = new APISearchDiskOfferingReply(); reply.setContent(content); bus.reply(msg, reply); }