Subversion Repositories SmartDukaan

Rev

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

Rev 2733 Rev 2768
Line 1... Line 1...
1
package in.shop2020.metamodel.util;
1
package in.shop2020.metamodel.util;
2
 
2
 
-
 
3
import in.shop2020.metamodel.core.Brand;
3
import in.shop2020.metamodel.core.Entity;
4
import in.shop2020.metamodel.core.Entity;
4
import in.shop2020.metamodel.core.EntityState;
5
import in.shop2020.metamodel.core.EntityState;
5
import in.shop2020.metamodel.core.Feature;
6
import in.shop2020.metamodel.core.Feature;
6
import in.shop2020.metamodel.core.Helpdoc;
7
import in.shop2020.metamodel.core.Helpdoc;
7
import in.shop2020.metamodel.core.Slide;
8
import in.shop2020.metamodel.core.Slide;
Line 36... Line 37...
36
	private static final String INCONSISTENT_ENTITIES = "INCONSISTENT_ENTITIES";
37
	private static final String INCONSISTENT_ENTITIES = "INCONSISTENT_ENTITIES";
37
	private static final String HELPDOC_ENTITYIDS = "HELPDOC_ENTITYIDS";
38
	private static final String HELPDOC_ENTITYIDS = "HELPDOC_ENTITYIDS";
38
	private static final String RELATED_ACCESSORIES = "RELATED_ACCESSORIES";
39
	private static final String RELATED_ACCESSORIES = "RELATED_ACCESSORIES";
39
	private static final String COMPARISON_STATS = "COMPARISON_STATS";
40
	private static final String COMPARISON_STATS = "COMPARISON_STATS";
40
	private static long helpDocId;
41
	private static long helpDocId;
-
 
42
    private static long brandId;
41
 
43
 
42
	/**
44
	/**
43
	 * 
45
	 * 
44
	 * @param aThrowable
46
	 * @param aThrowable
45
	 * @return
47
	 * @return
Line 679... Line 681...
679
			e.printStackTrace();
681
			e.printStackTrace();
680
		}
682
		}
681
		return categoryID;
683
		return categoryID;
682
	}
684
	}
683
 
685
 
-
 
686
	/**
-
 
687
	 * Brand ids start from 300000. Here, we pick the last one used and return
-
 
688
     * a value one more than it.
-
 
689
	 */
-
 
690
    public static long getNewBrandId() {
-
 
691
        if (brandId == 0) {
-
 
692
            brandId = 300000;
-
 
693
            Map<Long, Brand> brands = StorageManager.getStorageManager().getBrands();
-
 
694
            if (brands != null) {
-
 
695
                for (long id : StorageManager.getStorageManager().getBrands().keySet()) {
-
 
696
                    if (brandId <= id) {
-
 
697
                        brandId = id;
-
 
698
                    }
-
 
699
                }
-
 
700
            }
-
 
701
        }
-
 
702
 
-
 
703
        return ++brandId;
-
 
704
    }
-
 
705
 
-
 
706
    /**
-
 
707
     * Updates a given brand object in database.
-
 
708
     */
-
 
709
    public static void storeBrand(Brand brand) {
-
 
710
        StorageManager.getStorageManager().updateBrand(brand);        
-
 
711
    }
-
 
712
 
-
 
713
    /**
-
 
714
     * Looks up a brand object given its Id from database and returns the same.
-
 
715
     */
-
 
716
    public static Brand getBrand(long brandId) {
-
 
717
        return StorageManager.getStorageManager().getBrand(brandId);
-
 
718
    }
-
 
719
 
-
 
720
    /**
-
 
721
     * Returns all brands in the database.
-
 
722
     */
-
 
723
    public static Map<Long, Brand> getBrands() {
-
 
724
        return StorageManager.getStorageManager().getBrands();
-
 
725
    }
684
}
726
}