Subversion Repositories SmartDukaan

Rev

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

Rev 33 Rev 45
Line 3... Line 3...
3
 */
3
 */
4
package in.shop2020.metamodel.util;
4
package in.shop2020.metamodel.util;
5
 
5
 
6
import in.shop2020.metamodel.definitions.BulletDefinition;
6
import in.shop2020.metamodel.definitions.BulletDefinition;
7
import in.shop2020.metamodel.definitions.Catalog;
7
import in.shop2020.metamodel.definitions.Catalog;
-
 
8
import in.shop2020.metamodel.definitions.CompositeDefinition;
8
import in.shop2020.metamodel.definitions.DatatypeDefinition;
9
import in.shop2020.metamodel.definitions.DatatypeDefinition;
9
import in.shop2020.metamodel.definitions.DefinitionsContainer;
10
import in.shop2020.metamodel.definitions.DefinitionsContainer;
-
 
11
import in.shop2020.metamodel.definitions.EnumDefinition;
10
import in.shop2020.metamodel.definitions.Unit;
12
import in.shop2020.metamodel.definitions.Unit;
11
import in.shop2020.util.Utils;
13
import in.shop2020.util.Utils;
12
 
14
 
13
/**
15
/**
14
 * @author naveen
16
 * @author naveen
Line 21... Line 23...
21
	 */
23
	 */
22
	private static final long serialVersionUID = 1L;
24
	private static final long serialVersionUID = 1L;
23
	
25
	
24
	private DatatypeDefinition datatypeDefinition ; 
26
	private DatatypeDefinition datatypeDefinition ; 
25
	private Unit unit;
27
	private Unit unit;
-
 
28
	private boolean isComposite;
-
 
29
	private boolean isEnumerated;
26
 
30
	
27
	/**
31
	/**
-
 
32
	 * 
28
	 * @param datatypeDefinitionID
33
	 * @param bulletDefinition
29
	 * @throws Exception 
34
	 * @throws Exception
30
	 */
35
	 */
31
	public ExpandedBulletDefinition(BulletDefinition bulletDefinition) 
36
	public ExpandedBulletDefinition(BulletDefinition bulletDefinition) 
32
		throws Exception {
37
		throws Exception {
33
		super(bulletDefinition.getDatatypeDefinitionID());
38
		super(bulletDefinition.getDatatypeDefinitionID());
34
		
39
		
Line 41... Line 46...
41
		
46
		
42
		// Expand data type definition id
47
		// Expand data type definition id
43
		this.datatypeDefinition = defs.getDatatypeDefinition(
48
		this.datatypeDefinition = defs.getDatatypeDefinition(
44
				bulletDefinition.getDatatypeDefinitionID());
49
				bulletDefinition.getDatatypeDefinitionID());
45
		
50
		
-
 
51
		
46
		Utils.logger.info("datatypeDefinition.getClass().getName=" + 
52
		Utils.logger.info("datatypeDefinition.getClass().getName=" + 
47
				this.datatypeDefinition.getClass().getName());
53
				this.datatypeDefinition.getClass().getName());
48
		
54
		
-
 
55
		if(this.datatypeDefinition instanceof CompositeDefinition) {
-
 
56
			this.isComposite = true;
-
 
57
		}
-
 
58
		else if(this.datatypeDefinition instanceof EnumDefinition) {
-
 
59
			this.isEnumerated = true;
-
 
60
		}
-
 
61
		
49
		// Expand unit id
62
		// Expand unit id
50
		if(bulletDefinition.getUnitID() != 0L) {
63
		if(bulletDefinition.getUnitID() != 0L) {
51
			this.unit = defs.getUnit(bulletDefinition.getUnitID());
64
			this.unit = defs.getUnit(bulletDefinition.getUnitID());
52
		}
65
		}
53
	}
66
	}
Line 64... Line 77...
64
	 */
77
	 */
65
	public Unit getUnit() {
78
	public Unit getUnit() {
66
		return this.unit;
79
		return this.unit;
67
	}
80
	}
68
 
81
 
-
 
82
	/**
-
 
83
	 * @return the isComposite
-
 
84
	 */
-
 
85
	public boolean isComposite() {
-
 
86
		return isComposite;
-
 
87
	}
-
 
88
 
-
 
89
	/**
-
 
90
	 * @return the isEnum
-
 
91
	 */
-
 
92
	public boolean isEnumerated() {
-
 
93
		return isEnumerated;
-
 
94
	}
-
 
95
 
69
	/* (non-Javadoc)
96
	/* (non-Javadoc)
70
	 * @see java.lang.Object#toString()
97
	 * @see java.lang.Object#toString()
71
	 */
98
	 */
72
	@Override
99
	@Override
73
	public String toString() {
100
	public String toString() {
74
		return "ExpandedBulletDefinition [datatypeDefinition="
101
		return "ExpandedBulletDefinition [datatypeDefinition="
75
				+ datatypeDefinition + ", unit=" + unit + ", toString()="
102
				+ datatypeDefinition + ", isComposite=" + isComposite
-
 
103
				+ ", isEnumerated=" + isEnumerated + ", unit=" + unit
-
 
104
				+ ", getDatatypeDefinitionID()=" + getDatatypeDefinitionID()
-
 
105
				+ ", getDescription()=" + getDescription() + ", getUnitID()="
-
 
106
				+ getUnitID() + ", isLearned()=" + isLearned()
76
				+ super.toString() + "]";
107
				+ ", isMultivalue()=" + isMultivalue() + "]";
77
	}
108
	}
78
 
109
 
79
}
110
}