01: package com.bostechcorp.cbesb.common.util.runtimedb;
02:
03: import java.sql.Timestamp;
04: import java.util.ArrayList;
05: import java.util.List;
06:
07: import com.bostechcorp.cbesb.common.util.runtimedb.vo.EndpointSettingVO;
08:
09: public class EndpointSettingDB extends AbstractRuntimeDB {
10: public static void saveEndpointSettings(String saName,
11: String suName, String endpointName, String type,
12: String[][] propertyObjects) throws Exception {
13: List<EndpointSettingVO> voList = new ArrayList<EndpointSettingVO>();
14:
15: for (int i = 0; i < propertyObjects.length; i++) {
16: String[] object = propertyObjects[i];
17: if (object[0] == null)
18: continue;
19: EndpointSettingVO vo = new EndpointSettingVO();
20: String propertyName = object[0];
21: String propertyValue = object[1];
22: vo.setSaName(saName);
23: vo.setSuName(suName);
24: vo.setEndpointName(endpointName);
25: vo.setType(type);
26: vo.setPropertyName(propertyName);
27: vo.setPropertyValue(propertyValue);
28: vo
29: .setLastUpdated(new Timestamp(System
30: .currentTimeMillis()));
31: voList.add(vo);
32: }
33: for (EndpointSettingVO settingVO : voList) {
34: List list = sqlMap.queryForList(
35: "queryEndpointSettingForUpdate", settingVO);
36: if (list.size() == 0) {
37: sqlMap.insert("insertEndpointSetting", settingVO);
38: } else {
39: sqlMap.update("updateEndpointSetting", settingVO);
40: }
41: }
42:
43: }
44:
45: public static void deleteEndpointSettings(String saName,
46: String suName, String endpointName, String type)
47: throws Exception {
48: EndpointSettingVO settingVO = new EndpointSettingVO();
49: settingVO.setSaName(saName);
50: settingVO.setSuName(suName);
51: settingVO.setEndpointName(endpointName);
52: settingVO.setType(type);
53: sqlMap.delete("deleteEndpointSetting", settingVO);
54: }
55: }
|