Project

General

Profile

Wiki » History » Version 24

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