1 /*******************************************************************************
2 * Copyright (c) 2015 hangum.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the GNU Lesser Public License v2.1
5 * which accompanies this distribution, and is available at
6 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9 * hangum - initial API and implementation
10 ******************************************************************************/
11 package com
.hangum
.tadpole
.engine
.query
.dao
.system
.userdb
;
13 import java
.sql
.Timestamp
;
14 import java
.util
.ArrayList
;
15 import java
.util
.HashMap
;
16 import java
.util
.List
;
19 import com
.hangum
.tadpole
.commons
.libs
.core
.define
.PublicTadpoleDefine
;
20 import com
.hangum
.tadpole
.commons
.libs
.core
.define
.PublicTadpoleDefine
.OBJECT_TYPE
;
21 import com
.hangum
.tadpole
.commons
.util
.DateUtil
;
24 * Define Tadpole DB Hub db.
29 public class TDBDBDAO
extends ManagerListViewDAO
{
32 protected boolean _isUseEnable
= true;
33 /** {@code _isUseEnable} 가 false 일 경우 시스템 메시지에서 보여줄 메시지를 기록한다. */
34 protected String _sysMessage
= PublicTadpoleDefine
.AUTH_CODE_DEFINE
.VALID
.name();
37 protected List
<String
> schemas
= new ArrayList
<String
>();
39 /** This variable is schema assist */
40 protected String schemaListSeparator
= "";
41 /** This variable is content assist */
42 protected String tableListSeparator
= null;
43 /** This variable is content assit */
44 protected String viewListSeparator
= null;
45 protected String functionLisstSeparator
= null;
50 * {@code PublicTadpoleDefine#OBJECT_TYPE}, <SchemaName, Object>
52 protected Map
<OBJECT_TYPE
, Map
<String
, List
<?
>>> dbObjectCache
= new HashMap
<OBJECT_TYPE
, Map
<String
, List
<?
>>>();
54 // TadpoleUserDbRoleDAO start ======================================
55 protected int role_seq
;
56 protected String role_id
;
57 protected String access_ip
;
58 protected String is_resource_download
;
59 // default value is 00:00
60 protected Timestamp terms_of_use_starttime
= new Timestamp(System
.currentTimeMillis());
62 // default value is 100 years after
63 protected Timestamp terms_of_use_endtime
= new Timestamp(DateUtil
.afterMonthToMillsMonth(24));
64 // user db role description
65 protected String description
= "";
71 * @return the role_seq
73 public int getRole_seq() {
78 * @param role_seq the role_seq to set
80 public void setRole_seq(int role_seq
) {
81 this.role_seq
= role_seq
;
87 public String
getRole_id() {
92 * @param role_id the role_id to set
94 public void setRole_id(String role_id
) {
95 this.role_id
= role_id
;
99 * @return the access_ip
101 public String
getAccess_ip() {
106 * @param access_ip the access_ip to set
108 public void setAccess_ip(String access_ip
) {
109 this.access_ip
= access_ip
;
113 * @return the is_resource_download
115 public String
getIs_resource_download() {
116 return is_resource_download
;
120 * @return the terms_of_use_starttime
122 public Timestamp
getTerms_of_use_starttime() {
123 return terms_of_use_starttime
;
127 * @param terms_of_use_starttime the terms_of_use_starttime to set
129 public void setTerms_of_use_starttime(Timestamp terms_of_use_starttime
) {
130 this.terms_of_use_starttime
= terms_of_use_starttime
;
134 * @return the terms_of_use_endtime
136 public Timestamp
getTerms_of_use_endtime() {
137 return terms_of_use_endtime
;
141 * @param terms_of_use_endtime the terms_of_use_endtime to set
143 public void setTerms_of_use_endtime(Timestamp terms_of_use_endtime
) {
144 this.terms_of_use_endtime
= terms_of_use_endtime
;
148 * @param is_resource_download the is_resource_download to set
150 public void setIs_resource_download(String is_resource_download
) {
151 this.is_resource_download
= is_resource_download
;
154 public void setDescription(String description
) {
155 this.description
= description
;
158 public String
getDescription() {
161 // ====================================== end
164 * @return the schemaListSeparator
166 public String
getSchemaListSeparator() {
167 return schemaListSeparator
;
171 * @param schemaListSeparator the schemaListSeparator to set
173 public void setSchemaListSeparator(String schemaListSeparator
) {
174 this.schemaListSeparator
= schemaListSeparator
;
178 * @return the viewListSeparator
180 public String
getViewListSeparator() {
181 return viewListSeparator
;
185 * @param viewListSeparator the viewListSeparator to set
187 public void setViewListSeparator(String viewListSeparator
) {
188 this.viewListSeparator
= viewListSeparator
;
192 * @return the tableListSeparator
194 public String
getTableListSeparator() {
195 return tableListSeparator
;
199 * @param tableListSeparator the tableListSeparator to set
201 public void setTableListSeparator(String tableListSeparator
) {
202 this.tableListSeparator
= tableListSeparator
;
212 public List
<?
> getDBObject(OBJECT_TYPE objecType
, String schemaName
) {
213 Map
<String
, List
<?
>> mapDBObject
= dbObjectCache
.get(objecType
);
214 if(mapDBObject
== null) {
215 return new ArrayList();
217 List listObject
= mapDBObject
.get(schemaName
);
218 if(listObject
== null) return new ArrayList();
219 else return listObject
;
230 public void setDBObject(OBJECT_TYPE objecType
, String schemaName
, List objectList
) {
231 Map
<String
, List
<?
>> mapDBObject
= dbObjectCache
.get(objecType
);
232 if(mapDBObject
== null) {
233 Map
<String
, List
<?
>> map
= new HashMap
<String
, List
<?
>>();
234 map
.put(schemaName
, objectList
);
236 dbObjectCache
.put(objecType
, map
);
238 mapDBObject
.put(schemaName
, objectList
);
243 * @return the functionLisstSeparator
245 public String
getFunctionLisstSeparator() {
246 return functionLisstSeparator
;
250 * @param functionLisstSeparator the functionLisstSeparator to set
252 public void setFunctionLisstSeparator(String functionLisstSeparator
) {
253 this.functionLisstSeparator
= functionLisstSeparator
;
260 public List
<String
> getSchemas() {
268 public void setSchemas(List
<String
> schemas
) {
269 this.schemas
= schemas
;
276 public void addSchema(String strSchema
) {
277 this.schemas
.add(strSchema
);
281 * @return the _isUseEnable
283 public boolean is_isUseEnable() {
288 * @param _isUseEnable the _isUseEnable to set
290 public void set_isUseEnable(boolean _isUseEnable
) {
291 this._isUseEnable
= _isUseEnable
;
295 * @return the _sysMessage
297 public String
get_sysMessage() {
302 * @param _sysMessage the _sysMessage to set
304 public void set_sysMessage(String _sysMessage
) {
305 this._sysMessage
= _sysMessage
;