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 java.util.ArrayList;
7
import java.util.List;
8
 
9
import in.shop2020.metamodel.core.Bullet;
10
import in.shop2020.metamodel.core.Feature;
11
import in.shop2020.metamodel.definitions.Catalog;
12
import in.shop2020.metamodel.definitions.DefinitionsContainer;
13
import in.shop2020.metamodel.definitions.FeatureDefinition;
14
 
15
/**
16
 * @author naveen
17
 *
18
 */
19
public class ExpandedFeature extends Feature {
20
	/**
21
	 * 
22
	 */
23
	private static final long serialVersionUID = 1L;
24
	private FeatureDefinition featureDefinition;
25
	private List<ExpandedBullet> expandedBullets;
26
 
27
	/**
28
	 * @param featureDefinitionID
29
	 * @throws Exception 
30
	 */
31
	public ExpandedFeature(Feature feature) throws Exception {
32
		super(feature.getFeatureDefinitionID());
33
 
34
		// Copy rest of the properties
35
		super.setBullets(feature.getBullets());
36
		super.setFreeformContent(feature.getFreeformContent());
37
 
38
		// Expand feature definition id
39
		DefinitionsContainer defs = 
40
			Catalog.getInstance().getDefinitionsContainer();
41
 
42
		this.featureDefinition = 
43
			defs.getFeatureDefinition(feature.getFeatureDefinitionID());
44
 
45
		// Expand bullets
46
		if(this.getBullets() != null) {
47
			this.expandedBullets = new ArrayList<ExpandedBullet>();
48
 
49
			for(Bullet bullet : this.getBullets()) {
50
				ExpandedBullet expBullet = new ExpandedBullet(bullet, 
51
						this.featureDefinition.getBulletDefinition());
52
 
53
				this.expandedBullets.add(expBullet);
54
			}
55
		}
56
	}
57
 
58
	/**
59
	 * @return the featureDefinition
60
	 */
61
	public FeatureDefinition getFeatureDefinition() {
62
		return featureDefinition;
63
	}
64
 
65
	/**
66
	 * @return the expandedBullets
67
	 */
68
	public List<ExpandedBullet> getExpandedBullets() {
69
		return expandedBullets;
70
	}
71
 
72
}