0 Replies - 817 Views - Last Post: 19 March 2013 - 06:59 PM Rate Topic: -----

#1 raihan26  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 47
  • Joined: 04-February 10

Compare columnsList data with attributes object and its success

Posted 19 March 2013 - 06:59 PM

I am working on a project in which I need to generate `random columns` and that will be in a list format and then store them in `columnsList` and after that use those `columnsList` to make a call to `getAttributes method`.
After that, `attributes` list will have some response. And those `attributes` list will have list of `attributes` object.

Meaning if `columnsList` size is 10. Then `attributes` list will have `10 objects`.

Below is my code-

    final List<String> columnsList = getColumns(service.getColumns());
    List<Attribute<?>> attributes = beClient.getAttributes(columnsList);
    List<String> colData = new ArrayList<String>(columnsList.size());
    boolean foundData = true;
    if(attributes.size() != columnsList.size()) {
    	LOG.error("Size of attributes does not match with columnsList size");
    for (String column : columnsList) {
    	for(Attribute<?> be : attributes) {
    		if(!be.getName().equals(column) && !be.getStatus().equals("SUCCESS")) {
    		}  else if(be.getName().equals(column) && be.getStatus().equals("SUCCESS")) {

**Problem Statement:-**

Now `attributes` will have `10 objects` as the `columnsList` size is 10.

1) Now I need to check whether the columns that I have in `columnsList` came back successfully in `attributes object` or not. So if any of the `columns` in `columnsList` object are not present in `attributes` object and If it is present but it's `status` is not success then I need to make `boolean foundData` as `false`.

2) Secondly, if all the `columns` from `columnsList` object are present in `attributes` object and status is success then I need to increase the count `count_success` by 1.

I believe I have messed up the above two logic in my code. What wrong I am doing here? Thanks for the help.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1