Rev 1061 | Blame | Compare with Previous | Last modification | View Log | RSS feed
/****/package in.shop2020.metamodel.util;import in.shop2020.metamodel.definitions.BulletDefinition;import in.shop2020.metamodel.definitions.Catalog;import in.shop2020.metamodel.definitions.DefinitionsContainer;import in.shop2020.metamodel.definitions.FeatureDefinition;import in.shop2020.metamodel.definitions.HelpDocDefinition;import in.shop2020.metamodel.definitions.RuleDefinition;/*** Utility class that supports FeatureDefinition class. All related* objects are fetched from database and aggregated here.** @author naveen**/public class ExpandedFeatureDefinition extends FeatureDefinition {/****/private static final long serialVersionUID = 1L;/*** Expanded from BulletDefinition ID*/private ExpandedBulletDefinition expandedBulletDefinition;/*** Expanded from Normalization Rule Definition ID*/private RuleDefinition normalizationRuleDefinition;/*** Expanded of helpDocDefinition*/private HelpDocDefinition helpDocDefinition;/*** Takes FeatureDefinition object as input and converts all references* into corresponding detail objects** @param featureDefintion Feature Definition object* @throws Exception*/public ExpandedFeatureDefinition(FeatureDefinition featureDefinition)throws Exception {super(featureDefinition.getID(), featureDefinition.getLabel());// Copy rest of the propertiesthis.setAllowsBlank(featureDefinition.allowsBlank());this.setDescription(featureDefinition.getDescription());this.setBulletDefinition(featureDefinition.getBulletDefinition());this.setNormalizationRuleDefinitionID(featureDefinition.getNormalizationRuleDefinitionID());this.setHelpDocDefinitionID(featureDefinition.getHelpDocDefinitionID());DefinitionsContainer defs =Catalog.getInstance().getDefinitionsContainer();// Expand BulletDefinitionBulletDefinition bulletDef = featureDefinition.getBulletDefinition();// Expand normalization rule definition IDlong ruleDefinitionID =featureDefinition.getNormalizationRuleDefinitionID();if(ruleDefinitionID != 0L) {this.normalizationRuleDefinition =defs.getNormalizationRuleDefinition(ruleDefinitionID);}this.expandedBulletDefinition = new ExpandedBulletDefinition(bulletDef);// Expand help doc definition IDlong helpDocDefinitionID = featureDefinition.getHelpDocDefinitionID();if(helpDocDefinitionID != 0L) {this.helpDocDefinition =defs.getHelpDocDefinition(helpDocDefinitionID);}}/*** @return the expandedBulletDefinition ExpandedBulletDefinition object*/public ExpandedBulletDefinition getExpandedBulletDefinition() {return expandedBulletDefinition;}/*** @return the normalizationRuleDefinition*/public RuleDefinition getNormalizationRuleDefinition() {return normalizationRuleDefinition;}/*** @param helpDocDefinition the helpDocDefinition to set*/public void setHelpDocDefinition(HelpDocDefinition helpDocDefinition) {this.helpDocDefinition = helpDocDefinition;}/*** @return the helpDocDefinition*/public HelpDocDefinition getHelpDocDefinition() {return helpDocDefinition;}/* (non-Javadoc)* @see java.lang.Object#toString()*/@Overridepublic String toString() {return "ExpandedFeatureDefinition [expandedBulletDefinition="+ expandedBulletDefinition + ", normalizationRuleDefinition="+ normalizationRuleDefinition + ", allowsBlank()="+ allowsBlank() + ", getBulletDefinition()="+ getBulletDefinition() + ", getDescription()="+ getDescription() + ", getLabel()=" + getLabel()+ ", getNormalizationRuleDefinitionID()="+ getNormalizationRuleDefinitionID() + ", toString()="+ super.toString() + ", getID()=" + getID() + "]";}}