Rev 163 | Rev 1061 | Go to most recent revision | 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.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;/*** 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());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);}/*** @return the expandedBulletDefinition ExpandedBulletDefinition object*/public ExpandedBulletDefinition getExpandedBulletDefinition() {return expandedBulletDefinition;}/*** @return the normalizationRuleDefinition*/public RuleDefinition getNormalizationRuleDefinition() {return normalizationRuleDefinition;}/* (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() + "]";}}