Subversion Repositories SmartDukaan

Rev

Rev 64 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 64 Rev 80
Line 2... Line 2...
2
 * 
2
 * 
3
 */
3
 */
4
package in.shop2020.metamodel.util;
4
package in.shop2020.metamodel.util;
5
 
5
 
6
import in.shop2020.util.DBUtils;
6
import in.shop2020.util.DBUtils;
-
 
7
import in.shop2020.util.Utils;
7
 
8
 
8
import java.io.Serializable;
9
import java.io.Serializable;
9
import java.util.Arrays;
10
import java.util.Arrays;
10
 
11
 
11
/**
12
/**
Line 33... Line 34...
33
	 * @return 	SequenceGenerator 	instance of SequenceGenerator
34
	 * @return 	SequenceGenerator 	instance of SequenceGenerator
34
	 * @throws Exception 
35
	 * @throws Exception 
35
	 */
36
	 */
36
	public static final SequenceGenerator getInstance() throws Exception {
37
	public static final SequenceGenerator getInstance() throws Exception {
37
		// De-serialize
38
		// De-serialize
38
		String dbFile = CN.CONTENT_DB_PATH + "sequence" + ".ser";
39
		String dbFile = Utils.ENTITIES_DB_PATH + "sequence.ser";
39
		
40
		
40
		SequenceGenerator sequenceGenerator = 
41
		SequenceGenerator sequenceGenerator = 
41
			(SequenceGenerator) DBUtils.read(dbFile);
42
			(SequenceGenerator) DBUtils.read(dbFile);
42
		
43
		
43
		if(sequenceGenerator == null) {
44
		if(sequenceGenerator == null) {
Line 75... Line 76...
75
	public long getNextSequence(int index) throws Exception {
76
	public long getNextSequence(int index) throws Exception {
76
		// Increment
77
		// Increment
77
		this.currentCounts[index]++;
78
		this.currentCounts[index]++;
78
		
79
		
79
		// Store back
80
		// Store back
80
		String dbFile = CN.CONTENT_DB_PATH + "sequence" + ".ser";
81
		String dbFile = Utils.ENTITIES_DB_PATH + "sequence.ser";
81
		DBUtils.store(this, dbFile);
82
		DBUtils.store(this, dbFile);
82
		
83
		
83
		return this.currentCounts[index];
84
		return this.currentCounts[index];
84
	}
85
	}
85
 
86