Skip to content

Commit 1a65a70

Browse files
committed
Added ENUM Data
1 parent f5e637f commit 1a65a70

4 files changed

Lines changed: 135 additions & 5 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
*
3+
*/
4+
package com.acminds.acuteauto.ui;
5+
6+
import javax.faces.bean.ApplicationScoped;
7+
import javax.faces.bean.ManagedBean;
8+
9+
/**
10+
* @author Mansur
11+
*
12+
*/
13+
@ManagedBean(eager=true, name="uiTypes")
14+
@ApplicationScoped
15+
public class UITypes {
16+
17+
}

JavaSource/com/acminds/acuteauto/ui/controller/HomePageController.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import com.acminds.acuteauto.persistence.dto.Vehicle;
1212
import com.acminds.acuteauto.service.InventoryService;
1313
import com.acminds.acuteauto.ui.BaseController;
14+
import com.acminds.acuteauto.utils.Utils;
1415

1516
/**
1617
* @author Mansur
@@ -20,17 +21,32 @@
2021
@ApplicationScoped
2122
public class HomePageController extends BaseController{
2223
private InventoryService service = new InventoryService();
24+
private List<Vehicle> carsForBanner;
25+
private List<Vehicle> featuredCars;
26+
private List<Vehicle> carsForAdvertisement;
2327

2428
public List<Vehicle> getCarsForBanner() {
25-
return service.getCarsForBanner();
29+
if(Utils.isEmpty(carsForBanner))
30+
carsForBanner = service.getCarsForBanner();
31+
return carsForBanner;
2632
}
2733

2834
public List<Vehicle> getFeaturedCars() {
29-
return service.getCarsByCategory(0, "FEATURED");
35+
if(Utils.isEmpty(featuredCars))
36+
featuredCars = service.getCarsByCategory(0, "FEATURED");
37+
return featuredCars;
3038
}
3139

3240
public List<Vehicle> getCarsForAdvertisement() {
33-
return service.getCarsForAdvertisement();
41+
if(Utils.isEmpty(carsForAdvertisement))
42+
carsForAdvertisement = service.getCarsForAdvertisement();
43+
return carsForAdvertisement;
3444
}
3545

46+
public String reset() {
47+
this.carsForBanner = null;
48+
this.featuredCars = null;
49+
this.carsForAdvertisement = null;
50+
return null;
51+
}
3652
}

JavaSource/sql/db-data.sql

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,101 @@ INSERT INTO RL_ROLE_PRIVILEGE VALUES ('1', '31');
7676
INSERT INTO ROLE VALUES ('1', 'Application Administrator', 'Can edit all');
7777
INSERT INTO ROLE VALUES ('2', 'Store Administrator', 'Can edit everything in his store');
7878
INSERT INTO ROLE VALUES ('3', 'Employee', 'Employee who attends to the customer');
79-
INSERT INTO ROLE VALUES ('4', 'Customer', 'Customer who registers into our system');
79+
INSERT INTO ROLE VALUES ('4', 'Customer', 'Customer who registers into our system');
80+
81+
82+
-- ----------------------------
83+
-- Records for "ENUM_TYPE"
84+
-- ----------------------------
85+
INSERT INTO ENUM_TYPE VALUES ('1', 'USER_TYPE', 'Type of User', null);
86+
INSERT INTO ENUM_TYPE VALUES ('2', 'USER_STATUS', 'Status of User', null);
87+
INSERT INTO ENUM_TYPE VALUES ('3', 'LOCATION_TYPE', 'Type of Location', null);
88+
INSERT INTO ENUM_TYPE VALUES ('4', 'STYLE_TYPE', 'Style of a Car : Trim/Package', null);
89+
INSERT INTO ENUM_TYPE VALUES ('5', 'BODY_TYPE', 'Body type of a Vehicle', null);
90+
INSERT INTO ENUM_TYPE VALUES ('6', 'CATEGORY_TYPE', 'Type of User', null);
91+
INSERT INTO ENUM_TYPE VALUES ('7', 'FUEL_TYPE', 'Type of Fuel used for the car', null);
92+
INSERT INTO ENUM_TYPE VALUES ('8', 'WARRANTY_TYPE', 'Type of Warranty', null);
93+
INSERT INTO ENUM_TYPE VALUES ('9', 'VEHICLE_STATUS', 'Status of a car', null);
94+
INSERT INTO ENUM_TYPE VALUES ('10', 'CONDITION', 'Condition of a car', null);
95+
INSERT INTO ENUM_TYPE VALUES ('11', 'DISPLAY_TYPE', 'Type of Display', null);
96+
INSERT INTO ENUM_TYPE VALUES ('12', 'IMAGE_TYPE', 'Type of Photo for the car', null);
97+
INSERT INTO ENUM_TYPE VALUES ('13', 'AD_STATUS', 'Status of Advertisement', null);
98+
INSERT INTO ENUM_TYPE VALUES ('14', 'AD_UNITS', 'Unit of Advertisement', null);
99+
INSERT INTO ENUM_TYPE VALUES ('15', 'LOAN_STATUS', 'Status of Loan', null);
100+
INSERT INTO ENUM_TYPE VALUES ('16', 'FINANCE_TYPE', 'Type of Finance', null);
101+
INSERT INTO ENUM_TYPE VALUES ('17', 'ACCOUNT_TYPE', 'Type of Account', null);
102+
INSERT INTO ENUM_TYPE VALUES ('18', 'INQUIRY_TYPE', 'Type of Inquiry', null);
103+
104+
-- ----------------------------
105+
-- Records for "ENUM"
106+
-- ----------------------------
107+
-- USER_TYPE
108+
INSERT INTO ENUM VALUES ('1', '1', 'Client', null, null);
109+
INSERT INTO ENUM VALUES ('2', '1', 'Customer', null, null);
110+
-- USER_STATUS
111+
INSERT INTO ENUM VALUES ('10', '2', 'Active', null, null);
112+
INSERT INTO ENUM VALUES ('11', '2', 'InActive', null, null);
113+
INSERT INTO ENUM VALUES ('12', '2', 'Suspended', null, null);
114+
-- LOCATION_TYPE
115+
INSERT INTO ENUM VALUES ('20', '3', 'Primary', null, null);
116+
INSERT INTO ENUM VALUES ('21', '3', 'Secondary', null, null);
117+
-- STYLE_TYPE
118+
INSERT INTO ENUM VALUES ('30', '4', 'Trim', null, null);
119+
INSERT INTO ENUM VALUES ('31', '4', 'Package', null, null);
120+
-- BODY_TYPE
121+
INSERT INTO ENUM VALUES ('40', '5', 'Sedan', null, null);
122+
INSERT INTO ENUM VALUES ('41', '5', 'Wagon', null, null);
123+
INSERT INTO ENUM VALUES ('42', '5', 'Crossover', null, null);
124+
INSERT INTO ENUM VALUES ('43', '5', 'Luxury', null, null);
125+
INSERT INTO ENUM VALUES ('44', '5', 'Coupe', null, null);
126+
INSERT INTO ENUM VALUES ('45', '5', 'Hatchback', null, null);
127+
INSERT INTO ENUM VALUES ('46', '5', 'SUV', null, null);
128+
INSERT INTO ENUM VALUES ('47', '5', 'Hybrid', null, null);
129+
INSERT INTO ENUM VALUES ('48', '5', 'Convertible', null, null);
130+
INSERT INTO ENUM VALUES ('49', '5', 'Pickup', null, null);
131+
INSERT INTO ENUM VALUES ('50', '5', 'Van/Minivan', null, null);
132+
INSERT INTO ENUM VALUES ('51', '5', 'Truck', null, null);
133+
-- CATEGORY_TYPE
134+
INSERT INTO ENUM VALUES ('60', '6', 'RESERVED', 'Reserved for Future Use', null);
135+
-- FUEL_TYPE
136+
INSERT INTO ENUM VALUES ('70', '7', 'Gasoline', null, null);
137+
INSERT INTO ENUM VALUES ('71', '7', 'Premium Gasoline', null, null);
138+
INSERT INTO ENUM VALUES ('72', '7', 'Diesel', null, null);
139+
-- WARRANTY_TYPE
140+
INSERT INTO ENUM VALUES ('80', '8', 'Standard', null, null);
141+
INSERT INTO ENUM VALUES ('81', '8', 'Extended', null, null);
142+
-- VEHICLE_STATUS
143+
INSERT INTO ENUM VALUES ('90', '9', 'Available', null, null);
144+
INSERT INTO ENUM VALUES ('91', '9', 'Sold', null, null);
145+
INSERT INTO ENUM VALUES ('92', '9', 'OnHold', null, null);
146+
-- CONDITION
147+
INSERT INTO ENUM VALUES ('100', '10', 'New', null, null);
148+
INSERT INTO ENUM VALUES ('101', '10', 'Used', null, null);
149+
INSERT INTO ENUM VALUES ('102', '10', 'Certified', null, null);
150+
-- DISPLAY_TYPE
151+
INSERT INTO ENUM VALUES ('110', '11', 'Select One', null, null);
152+
INSERT INTO ENUM VALUES ('111', '11', 'Select Many', null, null);
153+
-- IMAGE_TYPE
154+
INSERT INTO ENUM VALUES ('120', '12', 'Primary', null, null);
155+
-- AD_STATUS
156+
INSERT INTO ENUM VALUES ('130', '13', 'Active', null, null);
157+
INSERT INTO ENUM VALUES ('131', '13', 'Suspended', null, null);
158+
INSERT INTO ENUM VALUES ('132', '13', 'Expired', null, null);
159+
-- AD_UNITS
160+
INSERT INTO ENUM VALUES ('140', '14', 'Hourly', null, null);
161+
INSERT INTO ENUM VALUES ('141', '14', 'Daily', null, null);
162+
INSERT INTO ENUM VALUES ('142', '14', 'Weekly', null, null);
163+
INSERT INTO ENUM VALUES ('143', '14', 'Monthly', null, null);
164+
INSERT INTO ENUM VALUES ('144', '14', 'Yearly', null, null);
165+
-- LOAN_STATUS
166+
INSERT INTO ENUM VALUES ('150', '15', 'Submitted', null, null);
167+
INSERT INTO ENUM VALUES ('151', '15', 'Under Review', null, null);
168+
INSERT INTO ENUM VALUES ('152', '15', 'Approved', null, null);
169+
-- FINANCE_TYPE
170+
INSERT INTO ENUM VALUES ('160', '16', 'Purchase', null, null);
171+
INSERT INTO ENUM VALUES ('161', '17', 'Lease', null, null);
172+
-- ACCOUNT_TYPE
173+
INSERT INTO ENUM VALUES ('170', '17', 'Checking', null, null);
174+
INSERT INTO ENUM VALUES ('171', '17', 'Savings', null, null);
175+
-- INQUIRY_TYPE
176+
INSERT INTO ENUM VALUES ('180', '18', 'Reserved', 'For future use', null);

JavaSource/sql/db-schema.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ CREATE TABLE INQUIRY (
233233
DROP TABLE FIND_VEHICLE;
234234
CREATE TABLE FIND_VEHICLE (
235235
FIND_VEHICLE_ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
236-
VEHICLE_TYPE INT(3),
236+
BODY_TYPE INT(3), -- SUV, SEDAN ETC.
237237
MODEL_ID INT, -- REFERS THE MODEL_ID COLUMN
238238
MILEAGE INT,
239239
INQUIRY_ID INT NOT NULL -- -- REFERS THE INQUIRY_ID COLUMN

0 commit comments

Comments
 (0)