Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
24 naveen 1
/**
2
 * 
3
 */
4
package in.shop2020.metamodel.util;
5
 
6
import in.shop2020.metamodel.definitions.BulletDefinition;
7
import in.shop2020.metamodel.definitions.Catalog;
8
import in.shop2020.metamodel.definitions.DatatypeDefinition;
9
import in.shop2020.metamodel.definitions.DefinitionsContainer;
10
import in.shop2020.metamodel.definitions.Unit;
25 naveen 11
import in.shop2020.util.Utils;
24 naveen 12
 
13
/**
14
 * @author naveen
15
 *
16
 */
17
public class ExpandedBulletDefinition extends BulletDefinition {
18
 
19
	/**
20
	 * 
21
	 */
22
	private static final long serialVersionUID = 1L;
23
 
24
	private DatatypeDefinition datatypeDefinition ; 
25
	private Unit unit;
26
 
27
	/**
28
	 * @param datatypeDefinitionID
29
	 * @throws Exception 
30
	 */
31
	public ExpandedBulletDefinition(BulletDefinition bulletDefinition) 
32
		throws Exception {
33
		super(bulletDefinition.getDatatypeDefinitionID());
34
 
35
		// Copy rest of the properties
36
		this.setDescription(bulletDefinition.getDescription());
37
		this.setUnitID(bulletDefinition.getUnitID());
38
 
39
		DefinitionsContainer defs = 
40
			Catalog.getInstance().getDefinitionsContainer();
41
 
42
		// Expand data type definition id
43
		this.datatypeDefinition = defs.getDatatypeDefinition(
44
				bulletDefinition.getDatatypeDefinitionID());
45
 
25 naveen 46
		Utils.logger.info("datatypeDefinition.getClass().getName=" + 
47
				this.datatypeDefinition.getClass().getName());
48
 
24 naveen 49
		// Expand unit id
25 naveen 50
		if(bulletDefinition.getUnitID() != 0L) {
51
			this.unit = defs.getUnit(bulletDefinition.getUnitID());
52
		}
24 naveen 53
	}
54
 
55
	/**
56
	 * @return the datatypeDefinition
57
	 */
58
	public DatatypeDefinition getDatatypeDefinition() {
25 naveen 59
		return this.datatypeDefinition;
24 naveen 60
	}
61
 
62
	/**
63
	 * @return the unit
64
	 */
65
	public Unit getUnit() {
25 naveen 66
		return this.unit;
24 naveen 67
	}
68
 
33 naveen 69
	/* (non-Javadoc)
70
	 * @see java.lang.Object#toString()
71
	 */
72
	@Override
73
	public String toString() {
74
		return "ExpandedBulletDefinition [datatypeDefinition="
75
				+ datatypeDefinition + ", unit=" + unit + ", toString()="
76
				+ super.toString() + "]";
77
	}
78
 
24 naveen 79
}