Subversion Repositories SmartDukaan

Rev

Rev 2298 | Rev 3123 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2298 Rev 2551
Line 32... Line 32...
32
	        Client client = catalogServiceClient.getClient();
32
	        Client client = catalogServiceClient.getClient();
33
	        List<Category> t_categories =  client.getAllCategories();
33
	        List<Category> t_categories =  client.getAllCategories();
34
	        for(Category category: t_categories){
34
	        for(Category category: t_categories){
35
	            categories.put(category.getId(), category);
35
	            categories.put(category.getId(), category);
36
	        }
36
	        }
-
 
37
	        System.out.println(categories);
37
	        for(Category category: t_categories){
38
	        for(Category category: t_categories){
38
	            if(category.getParent_category_id() != 0){
39
	            if(category.getParent_category_id() != 0){
39
	                if(category.getParent_category_id()!=0){
-
 
40
	                    List<Long> childCats = categories.get(category.getParent_category_id()).getChildren_category_ids();
40
                    List<Long> childCats = categories.get(category.getParent_category_id()).getChildren_category_ids();
41
	                    if(childCats==null){
41
                    if(childCats==null){
42
	                        childCats = new ArrayList<Long>();
42
                        childCats = new ArrayList<Long>();
-
 
43
                        categories.get(category.getParent_category_id()).setChildren_category_ids(childCats);
43
	                    }
44
                    }
44
	                    childCats.add(category.getId());
45
                    childCats.add(category.getId());
45
	                }
-
 
46
	             }
46
	             }
47
            }
47
            }
-
 
48
	        System.out.println(categories);
48
		} catch (Exception e) {
49
		} catch (Exception e) {
49
			Logger.log("Unable to load categories from Catalog.", this);
50
			Logger.log("Unable to load categories from Catalog.", this);
50
			
51
			
51
			categories = null;
52
			categories = null;
52
			e.printStackTrace();
53
			e.printStackTrace();