Project

General

Profile

Wiki » History » Version 27

Soh Keong, 08/16/2023 10:20 AM

1 1 Soh Keong
{{toc}}
2
3
h1. Specification
4
5 2 Soh Keong
6
h1. Programming Guide
7
8
h2. Jar version 
9
10 27 Soh Keong
|_. version |_. Description          |
11
| 1.0       | Init                   |
12
| 1.3       | Fixed Connection issue |
13 1 Soh Keong
14 2 Soh Keong
h2. Jar File Download
15
16 27 Soh Keong
"Jar":/redmine/attachments/download/772/keyword-1.3.jar
17 1 Soh Keong
"Lib":/redmine/attachments/download/602/lib.rar
18 6 Soh Keong
19
h3. Test Link
20
21
https://202.129.164.38:9093/TestPage/page/keyword/addKeyword
22
23 22 Soh Keong
h3. Diagram 
24
25
!FlowChart.jpg!
26
27 2 Soh Keong
28
h2. Database Table
29
30
<pre>
31
CREATE TABLE KEYWORD_PRODUCT (
32
	KEYWORD_REF_NO INTEGER NOT NULL,
33
	KEYWORD VARCHAR(50) NOT NULL,
34
	STATUS VARCHAR(2) DEFAULT 'A', 
35 16 Soh Keong
	CREATE_BY VARCHAR(15) NOT NULL,
36 2 Soh Keong
	CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
37 16 Soh Keong
	MODIFY_BY VARCHAR(15),
38 2 Soh Keong
	MODIFY_DATETIME TIMESTAMP,
39
	PRIMARY KEY (KEYWORD_REF_NO))
40 1 Soh Keong
41 2 Soh Keong
CREATE UNIQUE INDEX UI_PROD_KEYWORD ON KEYWORD_PRODUCT(KEYWORD)
42
</pre>
43
44
<pre>
45
CREATE TABLE KEYWORD_PRODUCT_PATTERN (
46 1 Soh Keong
	PRODUCT_REF_NO INTEGER NOT NULL,
47
	KEYWORD_REF_NO INTEGER NOT NULL,
48 21 Soh Keong
	PRIORITY INTEGER NOT NULL,
49 1 Soh Keong
	STATUS VARCHAR(2) DEFAULT 'A', 
50 21 Soh Keong
	CREATE_BY VARCHAR(15) NOT NULL,
51 19 Soh Keong
	CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
52 21 Soh Keong
	MODIFY_BY VARCHAR(15),
53 1 Soh Keong
	MODIFY_DATETIME TIMESTAMP,
54 21 Soh Keong
	PRIMARY KEY (PRODUCT_REF_NO,KEYWORD_REF_NO,PRIORITY))
55 1 Soh Keong
	
56
CREATE INDEX IX_KEYWORD_PRODUCT_PATTERN_STATUS ON KEYWORD_PRODUCT_PATTERN(STATUS)
57
</pre>
58
59
<pre>
60 21 Soh Keong
CREATE TABLE KEYWORD_PRODUCT_PATTERN_AUDIT (
61
	PRODUCT_REF_NO INTEGER NOT NULL,
62
	KEYWORD_REF_NO INTEGER NOT NULL,
63
	PRIORITY INTEGER NOT NULL,
64
	STATUS VARCHAR(2) DEFAULT 'A', 
65
	CREATE_BY VARCHAR(15) NOT NULL,
66
	CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
67
	MODIFY_BY VARCHAR(15),
68
	MODIFY_DATETIME TIMESTAMP,
69
	PRIMARY KEY (PRODUCT_REF_NO,KEYWORD_REF_NO,PRIORITY))
70
</pre>
71
72
<pre>
73 2 Soh Keong
CREATE TABLE KEYWORD_SEARCH_PRODUCT (
74
	PRODUCT_REF_NO INTEGER NOT NULL,
75 9 Soh Keong
	SHOPPER_REF_NO INTEGER NOT NULL,
76 2 Soh Keong
	SEARCH_TYPE VARCHAR(5) NOT NULL, 
77
	CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
78 21 Soh Keong
	MODIFY_DATETIME TIMESTAMP,
79 2 Soh Keong
	PRIMARY KEY (PRODUCT_REF_NO,SHOPPER_REF_NO,SEARCH_TYPE))
80 1 Soh Keong
	
81 2 Soh Keong
CREATE INDEX IX_KEYWORD_SEARCH_PRODUCT_MODI ON KEYWORD_SEARCH_PRODUCT(MODIFY_DATETIME)
82 26 Soh Keong
CREATE INDEX IX_KEYWORD_SEARCH_PRODUCT_ ON KEYWORD_SEARCH_PRODUCT(SHOPPER_REF_NO,SEARCH_TYPE)
83 2 Soh Keong
</pre>
84
85
<pre>
86
CREATE TABLE KEYWORD_SEARCH_PATTERN (
87
	SHOPPER_REF_NO INTEGER NOT NULL,
88
	KEYWORD_REF_NO INTEGER NOT NULL,
89 9 Soh Keong
	PRIORITY INTEGER NOT NULL,
90 2 Soh Keong
	CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
91 21 Soh Keong
	MODIFY_DATETIME TIMESTAMP,
92 2 Soh Keong
	PRIMARY KEY (SHOPPER_REF_NO, KEYWORD_REF_NO, PRIORITY))
93 1 Soh Keong
</pre>
94
95 18 Soh Keong
h1. Methods
96 3 Soh Keong
97 18 Soh Keong
h2. Keyword
98 3 Soh Keong
99 1 Soh Keong
<pre>
100 3 Soh Keong
com.cosway.keyword.service.KeywordService service = new com.cosway.keyword.service.KeywordService();
101
</pre>
102 12 Soh Keong
103 16 Soh Keong
boolean added      = service.addProductKeyword(Connection conn, KeywordBean keywordBean)
104
boolean updated    = service.updateKeywordByRefNo(Connection conn, KeywordBean keywordBean)
105 1 Soh Keong
106 17 Soh Keong
*KeywordBean*
107 16 Soh Keong
> * *Keyword* - 
108
> * *Status*  - 
109
> * *User*    - Who perform the action
110
111 1 Soh Keong
112 17 Soh Keong
boolean updated    = service.updateKeywordStatus(Connection conn, int keywordRefNo, String status)
113 1 Soh Keong
114 17 Soh Keong
KeywordBean = service.getKeywordBeanByRefNo();
115
116
int totalRecord = service.getKeywordActiveTotal(Connection conn)
117 1 Soh Keong
int totalRecord = service.getTotalKeywordInActive(Connection conn)
118
int totalRecord = service.getTotalKeywordAll(Connection conn)
119
int totalRecord = service.getTotalKeywordPrefix(Connection conn, String search)
120
int totalRecord = service.getTotalKeywordwildcard(Connection conn, String search)
121
122 17 Soh Keong
List<KeywordBean> keywordList = getKeywordActiveList(Connection conn, *int startFrom, int totalRecord* )
123
List<KeywordBean> keywordList = service.getKeywordAInActiveList(Connection conn, *int startFrom, int totalRecord* )
124
List<KeywordBean> keywordList = service.getKeywordAllList(Connection conn, *int startFrom, int totalRecord* )
125 3 Soh Keong
List<KeywordBean> keywordList = service.getKeywordPrefixList(Connection conn, String search, *int startFrom, int totalRecord* )
126 1 Soh Keong
List<KeywordBean> keywordList = service.getKeywordwildcardList(Connection conn, String search, *int startFrom, int totalRecord* )
127 16 Soh Keong
128 1 Soh Keong
*NOTE :* startFrom & totalRecord are optional field
129
130
131 3 Soh Keong
132 5 Soh Keong
133 1 Soh Keong
134
h2. Product
135 5 Soh Keong
136 1 Soh Keong
<pre>
137
com.cosway.keyword.service.ProductService service = new com.cosway.keyword.service.ProductService();
138
</pre>
139
140 12 Soh Keong
141 20 Soh Keong
boolean added      = service.addProductKeyword(Connection conn, KeywordBean keyword)
142 21 Soh Keong
boolean updated    = service.updateProductStatus(Connection conn, int productRefNo, String status, String user)
143
boolean updated    = service.updateProductStatus(Connection conn, int[] productRefNo, String status, String user)
144
boolean updated    = service.updateAddProductKeywordByProductAndPriority(Connection conn, List<KeywordBean> beanList)
145 20 Soh Keong
146
*KeywordBean*
147
> * *productRefNo*  - 
148
> * *keywordRefNo*  - 
149
> * *priority*      - 
150
> * *User*          - Who perform the action
151 14 Soh Keong
152 21 Soh Keong
int                              totalRecord = service.getTotalProductKeyword(Connection conn)
153
int                              totalRecord = service.getTotalProductSetByStatus(Connection conn, String status)
154 15 Soh Keong
155 21 Soh Keong
Vector<KeywordBean>               productSet = service.getProductKeywordSetByProductRefNo(Connection conn, int productRefNo)
156 15 Soh Keong
157 21 Soh Keong
Map<Integer, Vector<KeywordBean>> productMap = service.getProductKeywordMap(Connection conn, *int startFrom, int totalRecord* )
158
Vector<Integer>                   productSet = service.getProductSetByStatus(Connection conn, String status, *int startFrom, int totalRecord* )
159 13 Soh Keong
160 5 Soh Keong
*NOTE :* startFrom & totalRecord are optional field
161 7 Soh Keong
162
> * *productRefNo* - 
163 1 Soh Keong
> * *keywordRefNo* - 
164
> * *priority*     - 
165 20 Soh Keong
166
167
168
169
170 18 Soh Keong
171 5 Soh Keong
h2. Add product Keyword
172 4 Soh Keong
173
<pre>
174 5 Soh Keong
com.cosway.keyword.service.PurchaseService service = new com.cosway.keyword.service.PurchaseService();
175
</pre>
176
177 7 Soh Keong
boolean added = service.addProductPattern(Connection conn, PurchaseBean bean)
178
179 1 Soh Keong
> * *productRefNo* - 
180 23 Soh Keong
> * *searchType*   - com.cosway.keyword.constant.SearchType [A("All"), P("Purchase"), V("View"), C("Cart"), S("Search"), F("Favourite")]
181 20 Soh Keong
> * *shopperRefNo* - 
182
183
184
185
186 4 Soh Keong
187 18 Soh Keong
188 5 Soh Keong
h2. Search
189
190
<pre>
191
com.cosway.keyword.service.SearchService service = new com.cosway.keyword.service.SearchService();
192 1 Soh Keong
</pre>
193 11 Soh Keong
194 1 Soh Keong
Set<Integer>          productSet = service.getProductListByType(Connection conn, SearchBean searchBean)
195 14 Soh Keong
Set<Integer>          productSet = service.getProductListByProduct(Connection conn, SearchBean searchBean)
196
197 1 Soh Keong
Map<Integer, Integer> productMap = service.getProductRefNoByLevel(Connection conn, SearchBean searchBean)
198 11 Soh Keong
199
> By Type
200
> * *shopperRefNo* - 
201
> * *noOfRecords*  - 
202 23 Soh Keong
> * *searchType*   - com.cosway.keyword.constant.SearchType [A("All"), P("Purchase"), V("View"), C("Cart"), S("Search"), F("Favourite")]
203 11 Soh Keong
204
> By Level 
205
> * *shopperRefNo* - 
206
> * *noOfRecords*  - 
207
> * *level*        - 
208
209 7 Soh Keong
> By Product
210
> * *productRefNo* - 
211 11 Soh Keong
> * *noOfRecords*  - 
212 1 Soh Keong
> * *level*        - (By Level & Product only)