Project

General

Profile

Wiki » History » Version 28

Soh Keong, 11/30/2023 03:36 PM

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