Subversion Repositories SmartDukaan

Rev

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

Rev 51 Rev 102
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.metamodel.definitions.BulletDefinition;
6
import in.shop2020.metamodel.definitions.BulletDefinition;
-
 
7
import in.shop2020.metamodel.definitions.Catalog;
-
 
8
import in.shop2020.metamodel.definitions.DefinitionsContainer;
7
import in.shop2020.metamodel.definitions.FeatureDefinition;
9
import in.shop2020.metamodel.definitions.FeatureDefinition;
-
 
10
import in.shop2020.metamodel.definitions.RuleDefinition;
8
 
11
 
9
/**
12
/**
10
 * Utility class that supports FeatureDefinition class. All related 
13
 * Utility class that supports FeatureDefinition class. All related 
11
 * objects are fetched from database and aggregated here.
14
 * objects are fetched from database and aggregated here.
12
 * 
15
 * 
Line 24... Line 27...
24
	 * Expanded from BulletDefinition ID
27
	 * Expanded from BulletDefinition ID
25
	 */
28
	 */
26
	private ExpandedBulletDefinition expandedBulletDefinition;
29
	private ExpandedBulletDefinition expandedBulletDefinition;
27
	
30
	
28
	/**
31
	/**
-
 
32
	 * Expanded from Normalization Rule Definition ID
-
 
33
	 */
-
 
34
	private RuleDefinition normalizationRuleDefinition;
-
 
35
	
-
 
36
	/**
29
	 * Takes FeatureDefinition object as input and converts all references 
37
	 * Takes FeatureDefinition object as input and converts all references 
30
	 * into corresponding detail objects
38
	 * into corresponding detail objects
31
	 * 
39
	 * 
32
	 * @param featureDefintion Feature Definition object
40
	 * @param featureDefintion Feature Definition object
33
	 * @throws Exception 
41
	 * @throws Exception 
Line 38... Line 46...
38
		
46
		
39
		// Copy rest of the properties
47
		// Copy rest of the properties
40
		this.setAllowsBlank(featureDefinition.allowsBlank());
48
		this.setAllowsBlank(featureDefinition.allowsBlank());
41
		this.setDescription(featureDefinition.getDescription());
49
		this.setDescription(featureDefinition.getDescription());
42
		this.setBulletDefinition(featureDefinition.getBulletDefinition());
50
		this.setBulletDefinition(featureDefinition.getBulletDefinition());
-
 
51
		this.setNormalizationRuleDefinitionID(
-
 
52
				featureDefinition.getNormalizationRuleDefinitionID());
-
 
53
		
-
 
54
		DefinitionsContainer defs = 
-
 
55
			Catalog.getInstance().getDefinitionsContainer();
43
		
56
		
44
		// Expand BulletDefinition
57
		// Expand BulletDefinition
45
		BulletDefinition bulletDef = featureDefinition.getBulletDefinition();
58
		BulletDefinition bulletDef = featureDefinition.getBulletDefinition();
46
		
59
		
-
 
60
		// Expand normalization rule definition ID
-
 
61
		long ruleDefinitionID = 
-
 
62
			featureDefinition.getNormalizationRuleDefinitionID();
-
 
63
		
-
 
64
		if(ruleDefinitionID != 0L) {
-
 
65
			this.normalizationRuleDefinition  = 
-
 
66
				defs.getNormalizationRuleDefinition(ruleDefinitionID);
-
 
67
		}
-
 
68
		
47
		this.expandedBulletDefinition = new ExpandedBulletDefinition(bulletDef);
69
		this.expandedBulletDefinition = new ExpandedBulletDefinition(bulletDef);
48
	}
70
	}
49
 
71
 
50
	/**
72
	/**
51
	 * @return the expandedBulletDefinition ExpandedBulletDefinition object
73
	 * @return the expandedBulletDefinition ExpandedBulletDefinition object
52
	 */
74
	 */
53
	public ExpandedBulletDefinition getExpandedBulletDefinition() {
75
	public ExpandedBulletDefinition getExpandedBulletDefinition() {
54
		return expandedBulletDefinition;
76
		return expandedBulletDefinition;
55
	}
77
	}
56
 
78
 
-
 
79
	/**
-
 
80
	 * @return the normalizationRuleDefinition
-
 
81
	 */
-
 
82
	public RuleDefinition getNormalizationRuleDefinition() {
-
 
83
		return normalizationRuleDefinition;
-
 
84
	}
-
 
85
 
57
	/* (non-Javadoc)
86
	/* (non-Javadoc)
58
	 * @see java.lang.Object#toString()
87
	 * @see java.lang.Object#toString()
59
	 */
88
	 */
60
	@Override
89
	@Override
61
	public String toString() {
90
	public String toString() {
62
		return "ExpandedFeatureDefinition [expandedBulletDefinition="
91
		return "ExpandedFeatureDefinition [expandedBulletDefinition="
63
				+ expandedBulletDefinition + ", allowsBlank()=" + allowsBlank()
92
				+ expandedBulletDefinition + ", normalizationRuleDefinition="
64
				+ ", getBulletDefinition()=" + getBulletDefinition()
-
 
65
				+ ", getDescription()=" + getDescription() + ", getLabel()="
-
 
66
				+ getLabel() + ", getID()=" + getID() + "]";
93
				+ normalizationRuleDefinition + "]";
67
	}
94
	}
68
 
95
 
69
}
96
}