Subversion Repositories SmartDukaan

Rev

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

Rev 70 Rev 81
Line 5... Line 5...
5
 
5
 
6
import in.shop2020.metamodel.definitions.FeatureDefinition;
6
import in.shop2020.metamodel.definitions.FeatureDefinition;
7
import in.shop2020.metamodel.definitions.RuleDefinition;
7
import in.shop2020.metamodel.definitions.RuleDefinition;
8
import in.shop2020.metamodel.definitions.SlideDefinition;
8
import in.shop2020.metamodel.definitions.SlideDefinition;
9
import in.shop2020.metamodel.util.ExpandedEntity;
9
import in.shop2020.metamodel.util.ExpandedEntity;
10
import in.shop2020.metamodel.util.ExpandedFacetDefinition;
10
import in.shop2020.metamodel.util.ExpandedFacetRuleDefinition;
11
import in.shop2020.metamodel.util.ExpandedFeature;
11
import in.shop2020.metamodel.util.ExpandedFeature;
12
import in.shop2020.metamodel.util.ExpandedSlide;
12
import in.shop2020.metamodel.util.ExpandedSlide;
13
 
13
 
14
import java.util.List;
14
import java.util.List;
15
 
15
 
Line 20... Line 20...
20
 * Wrapper around Jython for Information Retrieval Python scripts
20
 * Wrapper around Jython for Information Retrieval Python scripts
21
 * 
21
 * 
22
 * @author naveen
22
 * @author naveen
23
 *
23
 *
24
 */
24
 */
25
public class IRJythonWrapper extends JythonWrapper {
25
public class IRDataJythonWrapper extends JythonWrapper {
26
	
26
	
27
	/**
27
	/**
28
	 * Local instance of Facet Definition - Used to pick script to execute
28
	 * Local instance of Facet Rule Definition - Used to pick script to execute
29
	 */
29
	 */
30
	private ExpandedFacetDefinition expandedFacetDefinition = null;
30
	private ExpandedFacetRuleDefinition expandedFacetRuleDefinition = null;
31
	
31
	
32
	/**
32
	/**
33
	 * Resets current PythonInterpreter instance
33
	 * Resets current PythonInterpreter instance
34
	 */
34
	 */
35
	public void reset() {
35
	public void reset() {
36
		super.reset();
36
		super.reset();
37
		this.expandedFacetDefinition = null;
37
		this.expandedFacetRuleDefinition = null;
38
	}
38
	}
39
	
39
	
40
	/**
40
	/**
41
	 * 
41
	 * 
42
	 * @param expandedFacetDefinition
42
	 * @param expandedFacetDefinition
43
	 */
43
	 */
44
	public void setExpandedFacetDefinition(
44
	public void setExpandedFacetDefinition(
45
			ExpandedFacetDefinition expandedFacetDefinition) {
45
			ExpandedFacetRuleDefinition expandedFacetRuleDefinition) {
46
		this.initialize();
46
		this.initialize();
47
		
47
		
48
		this.expandedFacetDefinition = expandedFacetDefinition;
48
		this.expandedFacetRuleDefinition = expandedFacetRuleDefinition;
49
		this.py.set("expFacetDef", expandedFacetDefinition);
49
		this.py.set("expFacetRuleDef", expandedFacetRuleDefinition);
50
	}
50
	}
51
	
51
	
52
	/**
52
	/**
53
	 * 
53
	 * 
54
	 * @param entity
54
	 * @param entity
Line 101... Line 101...
101
	
101
	
102
	/**
102
	/**
103
	 * Executes IR Data rule from ExpandedFacetDefinition instance
103
	 * Executes IR Data rule from ExpandedFacetDefinition instance
104
	 */
104
	 */
105
	public void execIRDataRule() {
105
	public void execIRDataRule() {
106
		if(this.py == null || this.expandedFacetDefinition == null) {
106
		if(this.py == null || this.expandedFacetRuleDefinition == null) {
107
			throw new IllegalStateException(
107
			throw new IllegalStateException(
108
					"Not initialized properly");
108
					"Not initialized properly");
109
		}
109
		}
110
		
110
		
111
		RuleDefinition irdataRuleDef = 
111
		RuleDefinition irdataRuleDef = 
112
			this.expandedFacetDefinition.getIrdataRuleDefinition();
112
			this.expandedFacetRuleDefinition.getIRDataRuleDefinition();
113
		
113
		
114
		String pyScript = irdataRuleDef.getScript();
114
		String pyScript = irdataRuleDef.getScript();
115
		String scriptFullPath = Utils.JYTHON_SRC_PATH + "irdatarules/" + pyScript;
115
		String scriptFullPath = Utils.JYTHON_SRC_PATH + "irdatarules/" + 
-
 
116
			pyScript;
-
 
117
		
116
		Utils.info("irdataRuleDef.getID()=" + irdataRuleDef.getID());
118
		Utils.info("irdataRuleDef.getID()=" + irdataRuleDef.getID());
117
		Utils.info("scriptFullPath=" + scriptFullPath);
119
		Utils.info("scriptFullPath=" + scriptFullPath);
118
		
120
		
119
		this.exec(scriptFullPath);
121
		this.exec(scriptFullPath);
120
	}
122
	}