Oracle DB support. #PL-1926

This commit is contained in:
Konstantin Krivopustov 2013-03-11 06:55:47 +00:00
parent b87463cb83
commit 840c77ccc7
20 changed files with 1004 additions and 77 deletions

View File

@ -46,7 +46,7 @@ create table SYS_FILE (
--
NAME varchar(500),
EXT varchar(20),
SIZE integer,
FILE_SIZE integer,
CREATE_DATE datetime,
--
primary key nonclustered (ID)
@ -162,7 +162,7 @@ create table SEC_ROLE (
LOC_NAME varchar(255),
DESCRIPTION varchar(1000),
IS_DEFAULT_ROLE tinyint,
TYPE integer,
ROLE_TYPE integer,
--
primary key (ID)
)^
@ -197,7 +197,7 @@ create table SEC_GROUP_HIERARCHY (
--
GROUP_ID uniqueidentifier,
PARENT_ID uniqueidentifier,
LEVEL integer,
HIERARCHY_LEVEL integer,
--
primary key nonclustered (ID),
constraint SEC_GROUP_HIERARCHY_GROUP foreign key (GROUP_ID) references SEC_GROUP(ID),
@ -232,7 +232,6 @@ create table SEC_USER (
GROUP_ID uniqueidentifier,
DEFAULT_SUBSTITUTED_USER_ID uniqueidentifier,
IP_MASK varchar(200),
TYPE varchar(1),
CHANGE_PASSWORD_AT_LOGON tinyint,
--
primary key nonclustered (ID),
@ -280,7 +279,7 @@ create table SEC_PERMISSION (
DELETE_TS datetime,
DELETED_BY varchar(50),
--
TYPE integer,
PERMISSION_TYPE integer,
TARGET varchar(100),
VALUE integer,
ROLE_ID uniqueidentifier,
@ -358,8 +357,6 @@ create table SEC_USER_SETTING (
create clustered index IDX_SEC_USER_SETTING_CREATE_TS on SEC_USER_SETTING (CREATE_TS)^
create index IDX_SEC_USER_SETTING_USER_NAME_CLIENT on SEC_USER_SETTING (USER_ID, NAME, CLIENT_TYPE)^
------------------------------------------------------------------------------------------------------------
create table SEC_USER_SUBSTITUTION (
@ -425,7 +422,7 @@ create table SEC_ENTITY_LOG (
--
EVENT_TS datetime,
USER_ID uniqueidentifier,
TYPE char(1),
CHANGE_TYPE char(1),
ENTITY varchar(100),
ENTITY_ID uniqueidentifier,
CHANGES varchar(max),
@ -496,7 +493,7 @@ create table SYS_FOLDER (
DELETE_TS datetime,
DELETED_BY varchar(50),
--
TYPE char(1),
FOLDER_TYPE char(1),
PARENT_ID uniqueidentifier,
NAME varchar(100),
TAB_NAME varchar(100),
@ -798,14 +795,14 @@ create index IDX_SYS_QUERY_RESULT_SESSION_KEY on SYS_QUERY_RESULT (SESSION_ID, Q
insert into SEC_GROUP (ID, CREATE_TS, VERSION, NAME, PARENT_ID)
values ('0fa2b1a5-1d68-4d69-9fbd-dff348347f93', current_timestamp, 0, 'Company', null)^
insert into SEC_USER (ID, CREATE_TS, VERSION, LOGIN, LOGIN_LC, PASSWORD, NAME, GROUP_ID, ACTIVE, TYPE)
insert into SEC_USER (ID, CREATE_TS, VERSION, LOGIN, LOGIN_LC, PASSWORD, NAME, GROUP_ID, ACTIVE)
values ('60885987-1b61-4247-94c7-dff348347f93', current_timestamp, 0, 'admin', 'admin',
'cc2229d1b8a052423d9e1c9ef0113b850086586a',
'Administrator', '0fa2b1a5-1d68-4d69-9fbd-dff348347f93', 1, 'C')^
'Administrator', '0fa2b1a5-1d68-4d69-9fbd-dff348347f93', 1)^
insert into SEC_USER (ID, CREATE_TS, VERSION, LOGIN, LOGIN_LC, PASSWORD, NAME, GROUP_ID, ACTIVE, TYPE)
insert into SEC_USER (ID, CREATE_TS, VERSION, LOGIN, LOGIN_LC, PASSWORD, NAME, GROUP_ID, ACTIVE)
values ('60885987-1b61-4247-94c7-dff348347f94', current_timestamp, 0, 'emailer', 'emailer', null,
'User for Email sending', '0fa2b1a5-1d68-4d69-9fbd-dff348347f93', 1, 'C')^
'User for Email sending', '0fa2b1a5-1d68-4d69-9fbd-dff348347f93', 1)^
insert into SEC_ROLE (ID, CREATE_TS, VERSION, NAME, TYPE)
values ('0c018061-b26f-4de2-a5be-dff348347f93', current_timestamp, 0, 'Administrators', 10)^

View File

@ -0,0 +1,679 @@
create table SYS_APP_FOLDER (
FOLDER_ID varchar2(32) not null,
FILTER_COMPONENT varchar2(200),
FILTER_XML varchar2(4000),
VISIBILITY_SCRIPT clob,
QUANTITY_SCRIPT clob,
APPLY_DEFAULT char(1),
primary key(FOLDER_ID)
)^
create table SYS_ATTR_VALUE (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
VERSION integer,
UPDATE_TS timestamp,
UPDATED_BY varchar2(50),
DELETE_TS timestamp,
DELETED_BY varchar2(50),
CATEGORY_ATTR_ID varchar2(32),
ENTITY_ID varchar2(32),
STRING_VALUE varchar2(4000),
INTEGER_VALUE integer,
DOUBLE_VALUE numeric,
DATE_VALUE timestamp,
BOOLEAN_VALUE char(1),
ENTITY_VALUE varchar2(32),
primary key(ID)
)^
create index IDX_SYS_ATTR_VALUE_ENTITY on SYS_ATTR_VALUE(ENTITY_ID)^
create table SYS_CATEGORY (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
VERSION integer,
UPDATE_TS timestamp,
UPDATED_BY varchar2(50),
DELETE_TS timestamp,
DELETED_BY varchar2(50),
NAME varchar2(255),
SPECIAL varchar2(50),
ENTITY_TYPE varchar2(30),
IS_DEFAULT char(1),
DISCRIMINATOR integer,
primary key(ID)
)^
create table SYS_CATEGORY_ATTR (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
VERSION integer,
UPDATE_TS timestamp,
UPDATED_BY varchar2(50),
DELETE_TS timestamp,
DELETED_BY varchar2(50),
NAME varchar2(255),
CODE varchar2(50),
CATEGORY_ID varchar2(32),
IS_ENTITY char(1),
DATA_TYPE varchar2(200),
DEFAULT_STRING varchar2(4000),
DEFAULT_INT integer,
DEFAULT_DOUBLE numeric,
DEFAULT_DATE timestamp,
DEFAULT_DATE_IS_CURRENT char(1),
DEFAULT_BOOLEAN char(1),
DEFAULT_ENTITY_VALUE varchar2(32),
ENUMERATION varchar2(500),
ORDER_NO integer,
SCREEN varchar2(255),
REQUIRED char(1),
LOOKUP char(1),
primary key(ID)
)^
create index IDX_SYS_CATEGORY_ATTR_CATEGORY on SYS_CATEGORY_ATTR(CATEGORY_ID)^
create table SYS_CONFIG (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
VERSION integer,
UPDATE_TS timestamp,
UPDATED_BY varchar2(50),
NAME varchar2(255),
VALUE varchar2(1500),
primary key(ID)
)^
create unique index IDX_SYS_CONFIG_UNIQ_NAME on SYS_CONFIG(NAME)^
create table SYS_ENTITY_SNAPSHOT (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
ENTITY_META_CLASS varchar2(50) not null,
ENTITY_ID varchar2(32) not null,
AUTHOR_ID varchar2(32) not null,
VIEW_XML clob not null,
SNAPSHOT_XML clob not null,
SNAPSHOT_DATE timestamp not null,
primary key(ID)
)^
create index IDX_SYS_ENTITY_SNAPSHOT_ENT_ID on SYS_ENTITY_SNAPSHOT(ENTITY_ID)^
create table SYS_ENTITY_STATISTICS (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
UPDATE_TS timestamp,
UPDATED_BY varchar2(50),
NAME varchar2(50),
INSTANCE_COUNT number,
FETCH_UI integer,
MAX_FETCH_UI integer,
LAZY_COLLECTION_THRESHOLD integer,
LOOKUP_SCREEN_THRESHOLD integer,
primary key(ID)
)^
create unique index IDX_SYS_ENTITY_STA_UNI_NAM on SYS_ENTITY_STATISTICS(NAME)^
create table SYS_FILE (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
VERSION integer,
UPDATE_TS timestamp,
UPDATED_BY varchar2(50),
DELETE_TS timestamp,
DELETED_BY varchar2(50),
NAME varchar2(500),
EXT varchar2(20),
FILE_SIZE integer,
CREATE_DATE timestamp,
primary key(ID)
)^
create table SYS_FOLDER (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
VERSION integer,
UPDATE_TS timestamp,
UPDATED_BY varchar2(50),
DELETE_TS timestamp,
DELETED_BY varchar2(50),
FOLDER_TYPE char(1),
PARENT_ID varchar2(32),
NAME varchar2(100),
TAB_NAME varchar2(100),
SORT_ORDER integer,
primary key(ID)
)^
create table SYS_FTS_QUEUE (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
ENTITY_ID varchar2(32),
ENTITY_NAME varchar2(200),
CHANGE_TYPE char(1),
SOURCE_HOST varchar2(100),
primary key(ID)
)^
create index IDX_SYS_FTS_QUEUE_CREATE_TS on SYS_FTS_QUEUE(CREATE_TS)^
create table SYS_JMX_INSTANCE (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
VERSION integer,
UPDATE_TS timestamp,
UPDATED_BY varchar2(50),
DELETE_TS timestamp,
DELETED_BY varchar2(50),
NODE_NAME varchar2(255),
ADDRESS varchar2(500) not null,
LOGIN varchar2(50) not null,
PASSWORD varchar2(255) not null,
primary key(ID)
)^
create table SYS_LOCK_CONFIG (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
NAME varchar2(100),
TIMEOUT_SEC integer,
primary key(ID)
)^
create table SYS_QUERY_RESULT (
ID number not null,
SESSION_ID varchar2(32) not null,
QUERY_KEY integer not null,
ENTITY_ID varchar2(32),
primary key(ID)
)^
create index IDX_SYS_QUERY_RES_ENT_SES_KEY on SYS_QUERY_RESULT(ENTITY_ID, SESSION_ID, QUERY_KEY)^
create index IDX_SYS_QUERY_RESULT_SES_KEY on SYS_QUERY_RESULT(SESSION_ID, QUERY_KEY)^
create table SYS_SCHEDULED_EXECUTION (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
TASK_ID varchar2(32),
SERVER varchar2(50),
START_TIME timestamp,
FINISH_TIME timestamp,
RESULT clob,
primary key(ID)
)^
create index IDX_SYS_SCH_EXE_TAS_STA_TIM on SYS_SCHEDULED_EXECUTION(TASK_ID, START_TIME)^
create table SYS_SCHEDULED_TASK (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
UPDATE_TS timestamp,
UPDATED_BY varchar2(50),
DELETE_TS timestamp,
DELETED_BY varchar2(50),
DEFINED_BY varchar2(1),
CLASS_NAME varchar2(500),
SCRIPT_NAME varchar2(500),
BEAN_NAME varchar2(50),
METHOD_NAME varchar2(50),
METHOD_PARAMS varchar2(1000),
USER_NAME varchar2(50),
IS_SINGLETON char(1),
IS_ACTIVE char(1),
PERIOD integer,
TIMEOUT integer,
START_DATE timestamp,
TIME_FRAME integer,
START_DELAY integer,
PERMITTED_SERVERS varchar2(500),
LOG_START char(1),
LOG_FINISH char(1),
LAST_START_TIME timestamp,
LAST_START_SERVER varchar2(50),
DESCRIPTION varchar2(1000),
primary key(ID)
)^
create unique index IDX_SYS_SCH_TAS_UNI_BEA_MET on SYS_SCHEDULED_TASK(BEAN_NAME, METHOD_NAME, METHOD_PARAMS, DELETE_TS)^
create table SYS_SENDING_ATTACHMENT (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
MESSAGE_ID varchar2(32),
CONTENT blob,
CONTENT_ID varchar2(50),
NAME varchar2(500),
primary key(ID)
)^
create index SYS_SENDING_ATTACHMENT_MES_IDX on SYS_SENDING_ATTACHMENT(MESSAGE_ID)^
create table SYS_SENDING_MESSAGE (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
VERSION integer,
UPDATE_TS timestamp,
UPDATED_BY varchar2(50),
DELETE_TS timestamp,
DELETED_BY varchar2(50),
ADDRESS_TO varchar2(500),
ADDRESS_FROM varchar2(100),
CAPTION varchar2(500),
CONTENT_TEXT clob,
DEADLINE timestamp,
STATUS integer,
DATE_SENT timestamp,
ATTEMPTS_COUNT integer,
ATTEMPTS_MADE integer,
ATTACHMENTS_NAME varchar2(500),
primary key(ID)
)^
create index IDX_SYS_SENDING_MES_DAT_SEN on SYS_SENDING_MESSAGE(DATE_SENT)^
create index IDX_SYS_SENDING_MESSAGE_STATUS on SYS_SENDING_MESSAGE(STATUS)^
create table SYS_SERVER (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
VERSION integer,
UPDATE_TS timestamp,
UPDATED_BY varchar2(50),
DELETE_TS timestamp,
DELETED_BY varchar2(50),
NAME varchar2(255),
ADDRESS varchar2(255),
IS_RUNNING char(1),
primary key(ID)
)^
create table SEC_CONSTRAINT (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
VERSION integer,
UPDATE_TS timestamp,
UPDATED_BY varchar2(50),
DELETE_TS timestamp,
DELETED_BY varchar2(50),
ENTITY_NAME varchar2(50),
JOIN_CLAUSE varchar2(500),
WHERE_CLAUSE varchar2(1000),
GROUP_ID varchar2(32),
primary key(ID)
)^
create index IDX_SEC_CONSTRAINT_GROUP on SEC_CONSTRAINT(GROUP_ID)^
create table SEC_ENTITY_LOG (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
EVENT_TS timestamp,
USER_ID varchar2(32),
CHANGE_TYPE char(1),
ENTITY varchar2(100),
ENTITY_ID varchar2(32),
CHANGES clob,
primary key(ID)
)^
create index IDX_SEC_ENTITY_LOG_ENTITY_ID on SEC_ENTITY_LOG(ENTITY_ID)^
create table SEC_ENTITY_LOG_ATTR (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
ITEM_ID varchar2(32),
NAME varchar2(50),
VALUE varchar2(1500),
VALUE_ID varchar2(32),
MESSAGES_PACK varchar2(200),
primary key(ID)
)^
create index IDX_SEC_ENTITY_LOG_ATTR_ITEM on SEC_ENTITY_LOG_ATTR(ITEM_ID)^
create table SEC_FILTER (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
VERSION integer,
UPDATE_TS timestamp,
UPDATED_BY varchar2(50),
DELETE_TS timestamp,
DELETED_BY varchar2(50),
COMPONENT varchar2(200),
NAME varchar2(255),
CODE varchar2(200),
XML varchar2(4000),
USER_ID varchar2(32),
primary key(ID)
)^
create index IDX_SEC_FILTER_COMPONENT_USER on SEC_FILTER(COMPONENT, USER_ID)^
create table SEC_GROUP (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
VERSION integer,
UPDATE_TS timestamp,
UPDATED_BY varchar2(50),
DELETE_TS timestamp,
DELETED_BY varchar2(50),
NAME varchar2(255),
PARENT_ID varchar2(32),
primary key(ID)
)^
create table SEC_GROUP_HIERARCHY (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
GROUP_ID varchar2(32),
PARENT_ID varchar2(32),
HIERARCHY_LEVEL integer,
primary key(ID)
)^
create table SEC_LOGGED_ATTR (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
ENTITY_ID varchar2(32),
NAME varchar2(50),
primary key(ID)
)^
create unique index SEC_LOGGED_ATTR_UNIQ_NAME on SEC_LOGGED_ATTR(ENTITY_ID, NAME)^
create index IDX_SEC_LOGGED_ATTR_ENTITY on SEC_LOGGED_ATTR(ENTITY_ID)^
create table SEC_LOGGED_ENTITY (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
NAME varchar2(100),
AUTO char(1),
MANUAL char(1),
primary key(ID)
)^
create unique index SEC_LOGGED_ENTITY_UNIQ_NAME on SEC_LOGGED_ENTITY(NAME)^
create table SEC_PERMISSION (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
VERSION integer,
UPDATE_TS timestamp,
UPDATED_BY varchar2(50),
DELETE_TS timestamp,
DELETED_BY varchar2(50),
PERMISSION_TYPE integer,
TARGET varchar2(100),
VALUE integer,
ROLE_ID varchar2(32),
primary key(ID)
)^
create unique index IDX_SEC_PERMISSION_UNIQUE on SEC_PERMISSION(ROLE_ID, PERMISSION_TYPE, TARGET, DELETE_TS)^
create table SEC_PRESENTATION (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
UPDATE_TS timestamp,
UPDATED_BY varchar2(50),
COMPONENT varchar2(200),
NAME varchar2(255),
XML varchar2(4000),
USER_ID varchar2(32),
IS_AUTO_SAVE char(1),
primary key(ID)
)^
create index IDX_SEC_PRESENTATION_COM_USE on SEC_PRESENTATION(COMPONENT, USER_ID)^
create table SEC_ROLE (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
VERSION integer,
UPDATE_TS timestamp,
UPDATED_BY varchar2(50),
DELETE_TS timestamp,
DELETED_BY varchar2(50),
NAME varchar2(255),
LOC_NAME varchar2(255),
DESCRIPTION varchar2(1000),
IS_DEFAULT_ROLE char(1),
ROLE_TYPE integer,
primary key(ID)
)^
create unique index IDX_SEC_ROLE_UNIQ_NAME on SEC_ROLE(NAME, DELETE_TS)^
create table SEC_SCREEN_HISTORY (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
USER_ID varchar2(32),
CAPTION varchar2(255),
URL clob,
ENTITY_ID varchar2(32),
primary key(ID)
)^
create index IDX_SEC_SCREEN_HISTORY_USER on SEC_SCREEN_HISTORY(USER_ID)^
create table SEC_SEARCH_FOLDER (
FOLDER_ID varchar2(32) not null,
FILTER_COMPONENT varchar2(200),
FILTER_XML varchar2(4000),
USER_ID varchar2(32),
PRESENTATION_ID varchar2(32),
APPLY_DEFAULT char(1),
IS_SET char(1),
ENTITY_TYPE varchar2(50),
primary key(FOLDER_ID)
)^
create index IDX_SEC_SEARCH_FOLDER_USER on SEC_SEARCH_FOLDER(USER_ID)^
create table SEC_SESSION_ATTR (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
VERSION integer,
UPDATE_TS timestamp,
UPDATED_BY varchar2(50),
DELETE_TS timestamp,
DELETED_BY varchar2(50),
NAME varchar2(50),
STR_VALUE varchar2(1000),
DATATYPE varchar2(20),
GROUP_ID varchar2(32),
primary key(ID)
)^
create index IDX_SEC_SESSION_ATTR_GROUP on SEC_SESSION_ATTR(GROUP_ID)^
create table SEC_USER (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
VERSION integer,
UPDATE_TS timestamp,
UPDATED_BY varchar2(50),
DELETE_TS timestamp,
DELETED_BY varchar2(50),
LOGIN varchar2(50) not null,
LOGIN_LC varchar2(50) not null,
PASSWORD varchar2(255),
NAME varchar2(255),
FIRST_NAME varchar2(255),
LAST_NAME varchar2(255),
MIDDLE_NAME varchar2(255),
POSITION_ varchar2(255),
EMAIL varchar2(100),
LANGUAGE_ varchar2(20),
ACTIVE char(1),
GROUP_ID varchar2(32),
DEFAULT_SUBSTITUTED_USER_ID varchar2(32),
IP_MASK varchar2(200),
CHANGE_PASSWORD_AT_LOGON char(1),
primary key(ID)
)^
create unique index IDX_SEC_USER_UNIQ_LOGIN on SEC_USER(LOGIN_LC, DELETE_TS)^
create table SEC_USER_ROLE (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
VERSION integer,
UPDATE_TS timestamp,
UPDATED_BY varchar2(50),
DELETE_TS timestamp,
DELETED_BY varchar2(50),
USER_ID varchar2(32),
ROLE_ID varchar2(32),
primary key(ID)
)^
create unique index IDX_SEC_USER_ROLE_UNIQ_ROLE on SEC_USER_ROLE(USER_ID, ROLE_ID, DELETE_TS)^
create table SEC_USER_SETTING (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
USER_ID varchar2(32),
CLIENT_TYPE char(1),
NAME varchar2(255),
VALUE clob,
primary key(ID)
)^
create unique index SEC_USER_SETTING_UNIQ on SEC_USER_SETTING(USER_ID, NAME, CLIENT_TYPE)^
create table SEC_USER_SUBSTITUTION (
ID varchar2(32) not null,
CREATE_TS timestamp,
CREATED_BY varchar2(50),
VERSION integer,
UPDATE_TS timestamp,
UPDATED_BY varchar2(50),
DELETE_TS timestamp,
DELETED_BY varchar2(50),
USER_ID varchar2(32),
SUBSTITUTED_USER_ID varchar2(32),
START_DATE timestamp,
END_DATE timestamp,
primary key(ID)
)^
create index IDX_SEC_USER_SUBSTITUTION_USER on SEC_USER_SUBSTITUTION(USER_ID)^
alter table SYS_APP_FOLDER add constraint FK_SYS_APP_FOLDER_FOLDER foreign key (FOLDER_ID) references SYS_FOLDER(ID)^
alter table SYS_ATTR_VALUE add constraint SYS_ATTR_VALUE_CATEGORY_ATT_ID foreign key (CATEGORY_ATTR_ID) references SYS_CATEGORY_ATTR(ID)^
alter table SYS_CATEGORY_ATTR add constraint SYS_CATEGORY_ATTR_CATEGORY_ID foreign key (CATEGORY_ID) references SYS_CATEGORY(ID)^
alter table SYS_ENTITY_SNAPSHOT add constraint FK_SYS_ENTITY_SNAPSHOT_AUT_ID foreign key (AUTHOR_ID) references SEC_USER(ID)^
alter table SYS_FOLDER add constraint FK_SYS_FOLDER_PARENT foreign key (PARENT_ID) references SYS_FOLDER(ID)^
alter table SYS_SCHEDULED_EXECUTION add constraint SYS_SCHEDULED_EXECUTION_TASK foreign key (TASK_ID) references SYS_SCHEDULED_TASK(ID)^
alter table SYS_SENDING_ATTACHMENT add constraint FK_SYS_SENDING_ATT_SEN_MES foreign key (MESSAGE_ID) references SYS_SENDING_MESSAGE(ID)^
alter table SEC_CONSTRAINT add constraint SEC_CONSTRAINT_GROUP foreign key (GROUP_ID) references SEC_GROUP(ID)^
alter table SEC_ENTITY_LOG add constraint FK_SEC_ENTITY_LOG_USER foreign key (USER_ID) references SEC_USER(ID)^
alter table SEC_ENTITY_LOG_ATTR add constraint FK_SEC_ENTITY_LOG_ATTR_ITEM foreign key (ITEM_ID) references SEC_ENTITY_LOG(ID)^
alter table SEC_FILTER add constraint FK_SEC_FILTER_USER foreign key (USER_ID) references SEC_USER(ID)^
alter table SEC_GROUP add constraint SEC_GROUP_PARENT foreign key (PARENT_ID) references SEC_GROUP(ID)^
alter table SEC_GROUP_HIERARCHY add constraint SEC_GROUP_HIERARCHY_PARENT foreign key (PARENT_ID) references SEC_GROUP(ID)^
alter table SEC_GROUP_HIERARCHY add constraint SEC_GROUP_HIERARCHY_GROUP foreign key (GROUP_ID) references SEC_GROUP(ID)^
alter table SEC_LOGGED_ATTR add constraint FK_SEC_LOGGED_ATTR_ENTITY foreign key (ENTITY_ID) references SEC_LOGGED_ENTITY(ID)^
alter table SEC_PERMISSION add constraint SEC_PERMISSION_ROLE foreign key (ROLE_ID) references SEC_ROLE(ID)^
alter table SEC_PRESENTATION add constraint SEC_PRESENTATION_USER foreign key (USER_ID) references SEC_USER(ID)^
alter table SEC_SCREEN_HISTORY add constraint FK_SEC_HISTORY_USER foreign key (USER_ID) references SEC_USER(ID)^
alter table SEC_SEARCH_FOLDER add constraint FK_SEC_SEARCH_FOLDER_PRE foreign key (PRESENTATION_ID) references SEC_PRESENTATION(ID)^
alter table SEC_SEARCH_FOLDER add constraint FK_SEC_SEARCH_FOLDER_USER foreign key (USER_ID) references SEC_USER(ID)^
alter table SEC_SEARCH_FOLDER add constraint FK_SEC_SEARCH_FOLDER_FOLDER foreign key (FOLDER_ID) references SYS_FOLDER(ID)^
alter table SEC_SESSION_ATTR add constraint SEC_SESSION_ATTR_GROUP foreign key (GROUP_ID) references SEC_GROUP(ID)^
alter table SEC_USER add constraint SEC_USER_GROUP foreign key (GROUP_ID) references SEC_GROUP(ID)^
alter table SEC_USER add constraint SEC_USER_DEFAULT_SUB_USE foreign key (DEFAULT_SUBSTITUTED_USER_ID) references SEC_USER(ID)^
alter table SEC_USER_ROLE add constraint SEC_USER_ROLE_ROLE foreign key (ROLE_ID) references SEC_ROLE(ID)^
alter table SEC_USER_ROLE add constraint SEC_USER_ROLE_PROFILE foreign key (USER_ID) references SEC_USER(ID)^
alter table SEC_USER_SETTING add constraint SEC_USER_SETTING_USER foreign key (USER_ID) references SEC_USER(ID)^
alter table SEC_USER_SUBSTITUTION add constraint FK_SEC_USER_SUB_SUB_USE foreign key (SUBSTITUTED_USER_ID) references SEC_USER(ID)^
alter table SEC_USER_SUBSTITUTION add constraint FK_SEC_USER_SUBSTITUTION_USER foreign key (USER_ID) references SEC_USER(ID)^
--------------------------------------------------------------------------------------------------------------
create or replace function NEWID return varchar2
is
begin
return lower(rawtohex(sys_guid()));
end;
^
--------------------------------------------------------------------------------------------------------------
create or replace procedure SET_SEQ_VAL(seqname varchar2, newvalue number)
as
ln number;
ib number;
begin
select LAST_NUMBER, INCREMENT_BY
into ln, ib
from USER_SEQUENCES
where SEQUENCE_NAME = upper(seqname);
execute immediate 'alter sequence ' || seqname || ' increment by ' || (newvalue - ln);
execute immediate 'select ' || seqname || '.nextval from dual' into ln;
execute immediate 'alter sequence ' || seqname || ' increment by ' || ib;
end;
^
--------------------------------------------------------------------------------------------------------------
insert into SEC_GROUP (ID, CREATE_TS, VERSION, NAME, PARENT_ID)
values ('0fa2b1a51d684d699fbddff348347f93', current_timestamp, 0, 'Company', null)^
insert into SEC_USER (ID, CREATE_TS, VERSION, LOGIN, LOGIN_LC, PASSWORD, NAME, GROUP_ID, ACTIVE)
values ('608859871b61424794c7dff348347f93', current_timestamp, 0, 'admin', 'admin',
'cc2229d1b8a052423d9e1c9ef0113b850086586a',
'Administrator', '0fa2b1a51d684d699fbddff348347f93', 1)^
insert into SEC_USER (ID, CREATE_TS, VERSION, LOGIN, LOGIN_LC, PASSWORD, NAME, GROUP_ID, ACTIVE)
values ('608859871b61424794c7dff348347f94', current_timestamp, 0, 'emailer', 'emailer', null,
'User for Email sending', '0fa2b1a51d684d699fbddff348347f93', 1)^
insert into SEC_ROLE (ID, CREATE_TS, VERSION, NAME, ROLE_TYPE)
values ('0c018061b26f4de2a5bedff348347f93', current_timestamp, 0, 'Administrators', 10)^
insert into SEC_FILTER (ID,CREATE_TS,CREATED_BY,VERSION,COMPONENT,NAME,XML,USER_ID)
values (newid(), current_timestamp, 'admin', 0, '[sec$User.browse].genericFilter', 'Search by role',
'<?xml version="1.0" encoding="UTF-8"?>
<filter>
<and>
<c name="UrMxpkfMGn" class="com.haulmont.cuba.security.entity.Role" type="CUSTOM" locCaption="Role" entityAlias="u" join="join u.userRoles ur">ur.role.id = :component$genericFilter.UrMxpkfMGn32565
<param name="component$genericFilter.UrMxpkfMGn32565">NULL</param>
</c>
</and>
</filter>',
'608859871b61424794c7dff348347f93'
)^

View File

@ -0,0 +1,17 @@
CREATE OR REPLACE PROCEDURE SETVAL(
seqname VARCHAR2,
newvalue NUMBER) AS
ln NUMBER;
ib NUMBER;
BEGIN
SELECT last_number, increment_by
INTO ln, ib
FROM user_sequences
WHERE sequence_name = upper(seqname);
EXECUTE IMMEDIATE 'ALTER SEQUENCE ' || seqname ||
' INCREMENT BY ' || (newvalue - ln);
EXECUTE IMMEDIATE 'SELECT ' || seqname ||
'.NEXTVAL FROM DUAL' INTO ln;
EXECUTE IMMEDIATE 'ALTER SEQUENCE ' || seqname
|| ' INCREMENT BY ' || ib;
END;

View File

@ -48,7 +48,7 @@ create table SYS_FILE (
--
NAME varchar(500),
EXT varchar(20),
SIZE integer,
FILE_SIZE integer,
CREATE_DATE timestamp,
--
primary key (ID)
@ -160,7 +160,7 @@ create table SEC_ROLE (
LOC_NAME varchar(255),
DESCRIPTION varchar(1000),
IS_DEFAULT_ROLE boolean,
TYPE integer,
ROLE_TYPE integer,
--
primary key (ID)
)^
@ -195,7 +195,7 @@ create table SEC_GROUP_HIERARCHY (
--
GROUP_ID uuid,
PARENT_ID uuid,
LEVEL integer,
HIERARCHY_LEVEL integer,
--
primary key (ID),
constraint SEC_GROUP_HIERARCHY_GROUP foreign key (GROUP_ID) references SEC_GROUP(ID),
@ -228,7 +228,6 @@ create table SEC_USER (
GROUP_ID uuid,
DEFAULT_SUBSTITUTED_USER_ID uuid,
IP_MASK varchar(200),
TYPE varchar(1),
CHANGE_PASSWORD_AT_LOGON boolean,
--
primary key (ID),
@ -272,7 +271,7 @@ create table SEC_PERMISSION (
DELETE_TS timestamp,
DELETED_BY varchar(50),
--
TYPE integer,
PERMISSION_TYPE integer,
TARGET varchar(100),
VALUE integer,
ROLE_ID uuid,
@ -281,7 +280,7 @@ create table SEC_PERMISSION (
constraint SEC_PERMISSION_ROLE foreign key (ROLE_ID) references SEC_ROLE(ID)
)^
create unique index IDX_SEC_PERMISSION_UNIQUE on SEC_PERMISSION (ROLE_ID, TYPE, TARGET) where DELETE_TS is null^
create unique index IDX_SEC_PERMISSION_UNIQUE on SEC_PERMISSION (ROLE_ID, PERMISSION_TYPE, TARGET) where DELETE_TS is null^
------------------------------------------------------------------------------------------------------------
@ -346,8 +345,6 @@ create table SEC_USER_SETTING (
constraint SEC_USER_SETTING_UNIQ unique (USER_ID, NAME, CLIENT_TYPE)
)^
create index IDX_SEC_USER_SETTING_USER_NAME_CLIENT on SEC_USER_SETTING (USER_ID, NAME, CLIENT_TYPE)^
------------------------------------------------------------------------------------------------------------
create table SEC_USER_SUBSTITUTION (
@ -413,7 +410,7 @@ create table SEC_ENTITY_LOG (
--
EVENT_TS timestamp,
USER_ID uuid,
TYPE char(1),
CHANGE_TYPE char(1),
ENTITY varchar(100),
ENTITY_ID uuid,
CHANGES text,
@ -479,7 +476,7 @@ create table SYS_FOLDER (
DELETE_TS timestamp,
DELETED_BY varchar(50),
--
TYPE char(1),
FOLDER_TYPE char(1),
PARENT_ID uuid,
NAME varchar(100),
TAB_NAME varchar(100),
@ -777,27 +774,19 @@ volatile strict language c^
insert into SEC_GROUP (ID, CREATE_TS, VERSION, NAME, PARENT_ID)
values ('0fa2b1a5-1d68-4d69-9fbd-dff348347f93', now(), 0, 'Company', null)^
insert into SEC_USER (ID, CREATE_TS, VERSION, LOGIN, LOGIN_LC, PASSWORD, NAME, GROUP_ID, ACTIVE, TYPE)
insert into SEC_USER (ID, CREATE_TS, VERSION, LOGIN, LOGIN_LC, PASSWORD, NAME, GROUP_ID, ACTIVE)
values ('60885987-1b61-4247-94c7-dff348347f93', now(), 0, 'admin', 'admin',
'cc2229d1b8a052423d9e1c9ef0113b850086586a',
'Administrator', '0fa2b1a5-1d68-4d69-9fbd-dff348347f93', true, 'C')^
'Administrator', '0fa2b1a5-1d68-4d69-9fbd-dff348347f93', true)^
insert into SEC_USER (ID, CREATE_TS, VERSION, LOGIN, LOGIN_LC, PASSWORD, NAME, GROUP_ID, ACTIVE, TYPE)
insert into SEC_USER (ID, CREATE_TS, VERSION, LOGIN, LOGIN_LC, PASSWORD, NAME, GROUP_ID, ACTIVE)
values ('60885987-1b61-4247-94c7-dff348347f94', now(), 0, 'emailer', 'emailer', null,
'User for Email sending', '0fa2b1a5-1d68-4d69-9fbd-dff348347f93', true, 'C')^
'User for Email sending', '0fa2b1a5-1d68-4d69-9fbd-dff348347f93', true)^
insert into SEC_ROLE (ID, CREATE_TS, VERSION, NAME, TYPE)
insert into SEC_ROLE (ID, CREATE_TS, VERSION, NAME, ROLE_TYPE)
values ('0c018061-b26f-4de2-a5be-dff348347f93', now(), 0, 'Administrators', 10)^
insert into SEC_FILTER (ID,CREATE_TS,CREATED_BY,VERSION,UPDATE_TS,UPDATED_BY,DELETE_TS,DELETED_BY,COMPONENT,NAME,XML,USER_ID) values
(
'b61d18cb-e79a-46f3-b16d-eaf4aebb10dd',
{ts '2010-03-01 11:14:06.830'},
'admin',2,
{ts '2010-03-01 11:52:53.170'},
'admin',null,null,
'[sec$User.browse].genericFilter',
'Search by role',
insert into SEC_FILTER (ID, CREATE_TS, CREATED_BY, VERSION, COMPONENT, NAME, XML, USER_ID)
values ('b61d18cb-e79a-46f3-b16d-eaf4aebb10dd', now(), 'admin', 0, '[sec$User.browse].genericFilter', 'Search by role',
'<?xml version="1.0" encoding="UTF-8"?>\n<filter>\n <and>\n <c name="UrMxpkfMGn" class="com.haulmont.cuba.security.entity.Role" type="CUSTOM" locCaption="Role" entityAlias="u" join="join u.userRoles ur">ur.role.id = :component$genericFilter.UrMxpkfMGn32565\n <param name="component$genericFilter.UrMxpkfMGn32565">NULL</param>\n </c>\n </and>\n</filter>\n',
'60885987-1b61-4247-94c7-dff348347f93'
)^
'60885987-1b61-4247-94c7-dff348347f93')^

View File

@ -55,7 +55,7 @@ create table SYS_FILE (
--
NAME varchar(500),
EXT varchar(20),
SIZE integer,
FILE_SIZE integer,
CREATE_DATE timestamp,
--
primary key (ID)
@ -164,7 +164,7 @@ create table SEC_ROLE (
LOC_NAME varchar(255),
DESCRIPTION varchar(1000),
IS_DEFAULT_ROLE smallint,
TYPE integer,
ROLE_TYPE integer,
--
primary key (ID)
);
@ -201,7 +201,7 @@ create table SEC_GROUP_HIERARCHY (
--
GROUP_ID varchar(36),
PARENT_ID varchar(36),
LEVEL integer,
HIERARCHY_LEVEL integer,
--
primary key (ID),
constraint SEC_GROUP_HIERARCHY_GROUP foreign key (GROUP_ID) references SEC_GROUP(ID),
@ -238,7 +238,6 @@ create table SEC_USER (
GROUP_ID varchar(36),
DEFAULT_SUBSTITUTED_USER_ID varchar(36),
IP_MASK varchar(200),
TYPE varchar(1),
CHANGE_PASSWORD_AT_LOGON smallint,
--
primary key (ID),
@ -293,7 +292,7 @@ create table SEC_PERMISSION (
DELETE_TS timestamp,
DELETED_BY varchar(50),
--
TYPE integer,
PERMISSION_TYPE integer,
TARGET varchar(100),
VALUE integer,
ROLE_ID varchar(36),
@ -446,7 +445,7 @@ create table SEC_ENTITY_LOG (
--
EVENT_TS timestamp,
USER_ID varchar(36),
TYPE char(1),
CHANGE_TYPE char(1),
ENTITY varchar(100),
ENTITY_ID varchar(36),
CHANGES longvarchar,
@ -512,7 +511,7 @@ create table SYS_FOLDER (
DELETE_TS timestamp,
DELETED_BY varchar(50),
--
TYPE char(1),
FOLDER_TYPE char(1),
PARENT_ID varchar(36),
NAME varchar(100),
TAB_NAME varchar(100),

View File

@ -0,0 +1,15 @@
--$Id$--
alter table SEC_USER drop column TYPE;
{call sp_rename 'SYS_FILE.SIZE', 'FILE_SIZE', 'column'};
{call sp_rename 'SYS_FOLDER.TYPE', 'FOLDER_TYPE', 'column'};
{call sp_rename 'SEC_ENTITY_LOG.TYPE', 'CHANGE_TYPE', 'column'};
{call sp_rename 'SEC_GROUP_HIERARCHY.LEVEL', 'HIERARCHY_LEVEL', 'column'};
{call sp_rename 'SEC_PERMISSION.TYPE', 'PERMISSION_TYPE', 'column'};
{call sp_rename 'SEC_ROLE.TYPE', 'ROLE_TYPE', 'column'};

View File

@ -0,0 +1,10 @@
--$Id$--
alter table SEC_USER drop TYPE;
alter table SYS_FILE rename column SIZE to FILE_SIZE;
alter table SYS_FOLDER rename column TYPE to FOLDER_TYPE;
alter table SEC_ENTITY_LOG rename column TYPE to CHANGE_TYPE;
alter table SEC_GROUP_HIERARCHY rename column LEVEL to HIERARCHY_LEVEL;
alter table SEC_PERMISSION rename column TYPE to PERMISSION_TYPE;
alter table SEC_ROLE rename column TYPE to ROLE_TYPE;

View File

@ -6,28 +6,17 @@
package com.haulmont.cuba.core.sys;
import com.haulmont.chile.core.model.Instance;
import com.haulmont.cuba.core.*;
import com.haulmont.cuba.core.entity.Entity;
import com.haulmont.cuba.core.global.*;
import com.haulmont.cuba.core.sys.persistence.EntityLifecycleListener;
import com.haulmont.cuba.core.sys.persistence.EntityTransactionListener;
import com.haulmont.cuba.security.global.UserSession;
import org.apache.openjpa.conf.OpenJPAConfiguration;
import org.apache.openjpa.enhance.PersistenceCapable;
import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
import org.apache.openjpa.jdbc.sql.DBDictionary;
import org.apache.openjpa.jdbc.sql.HSQLDictionary;
import org.apache.openjpa.jdbc.sql.PostgresDictionary;
import org.apache.openjpa.jdbc.sql.SQLServerDictionary;
import org.apache.openjpa.kernel.OpenJPAStateManager;
import org.apache.openjpa.kernel.StateManagerImpl;
import org.apache.openjpa.meta.ClassMetaData;
import org.apache.openjpa.meta.FieldMetaData;
import org.apache.openjpa.jdbc.sql.*;
import org.apache.openjpa.persistence.OpenJPAEntityManager;
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactory;
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
import org.apache.openjpa.util.ObjectId;
import org.springframework.orm.jpa.EntityManagerFactoryUtils;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.support.TransactionSynchronization;
@ -40,7 +29,6 @@ import javax.sql.DataSource;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.*;
/**
* <p>$Id$</p>
@ -104,6 +92,8 @@ public class PersistenceImpl implements Persistence {
dbDialect = new PostgresDbDialect();
} else if (dictionary instanceof SQLServerDictionary) {
dbDialect = new MssqlDbDialect();
} else if (dictionary instanceof OracleDictionary) {
dbDialect = new OracleDbDialect();
} else {
throw new UnsupportedOperationException("Unsupported DBDictionary class: " + dictionary.getClass());
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2013 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.core.sys.persistence;
import org.apache.openjpa.jdbc.kernel.exps.FilterValue;
import org.apache.openjpa.jdbc.schema.Column;
import org.apache.openjpa.jdbc.sql.OracleDictionary;
import org.apache.openjpa.jdbc.sql.SQLBuffer;
/**
* @author degtyarjov
* @version $Id$
*/
public class CubaOracleDictionary extends OracleDictionary {
@Override
public String getTypeName(Column col) {
return super.getTypeName(col);
}
@Override
public void appendCast(SQLBuffer buf, Object val, int type) {
// Convert the cast function: "CAST({0} AS {1})"
int firstParam = castFunction.indexOf("{0}");
String pre = castFunction.substring(0, firstParam); // "CAST("
String mid = castFunction.substring(firstParam + 3);
int secondParam = mid.indexOf("{1}");
String post;
if (secondParam > -1) {
post = mid.substring(secondParam + 3); // ")"
mid = mid.substring(0, secondParam); // " AS "
} else
post = "";
buf.append(pre);
if (val instanceof FilterValue)
((FilterValue) val).appendTo(buf);
else if (val instanceof SQLBuffer)
buf.append(((SQLBuffer) val));
else
buf.append(val.toString());
buf.append(mid);
buf.append(getTypeName(type).replaceAll("\\{0\\}", ""));//just a workaround because getTypeName returns NUMBER{0} for some types which is probably a bug
appendLength(buf, type);
buf.append(post);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
* Copyright (c) 2013 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
@ -16,9 +16,8 @@ import java.util.Map;
* System level enum encapsulating ORM initialization differences.
* <p>In an application code use {@link com.haulmont.cuba.core.global.DbDialect} instead.</p>
*
* <p>$Id$</p>
*
* @author krivopustov
* @version $Id$
*/
public enum DbmsType {
@ -56,6 +55,19 @@ public enum DbmsType {
"FieldStrategies='java.util.UUID=com.haulmont.cuba.core.sys.persistence.UuidMssqlValueHandler'");
return params;
}
},
ORACLE(new OracleTypeConverter()) {
@Override
public Map<String, String> getJpaParameters() {
Map<String, String> params = new HashMap<String, String>();
params.put("openjpa.jdbc.DBDictionary",
"com.haulmont.cuba.core.sys.persistence.CubaOracleDictionary(RequiresCastForComparisons=true)");
params.put("openjpa.jdbc.MappingDefaults",
"FieldStrategies='java.util.UUID=com.haulmont.cuba.core.sys.persistence.UuidStringValueHandler(Compact=true)," +
"java.lang.Boolean=com.haulmont.cuba.core.sys.persistence.BooleanCharValueHandler'");
return params;
}
};
public abstract Map<String, String> getJpaParameters();

View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 2013 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.core.sys.persistence;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Date;
import java.util.UUID;
/**
* @author degtyarjov
* @version $Id$
*/
public class OracleTypeConverter implements DbTypeConverter {
@Override
public Object getJavaObject(ResultSet resultSet, int columnIndex) throws SQLException {
Object value;
ResultSetMetaData metaData = resultSet.getMetaData();
if ((columnIndex > metaData.getColumnCount()) || (columnIndex <= 0))
throw new IndexOutOfBoundsException("Column index out of bound");
value = resultSet.getObject(columnIndex);
return value;
}
@Override
public Object getSqlObject(Object value) {
if (value instanceof Boolean) {
return ((Boolean) value) ? "1" : "0";
}
if (value instanceof UUID)
return value.toString();
return value;
}
}

View File

@ -37,7 +37,7 @@ public class FileDescriptor extends StandardEntity {
@Column(name = "EXT", length = 20)
private String extension;
@Column(name = "SIZE")
@Column(name = "FILE_SIZE")
private Integer size;
@Column(name = "CREATE_DATE")

View File

@ -18,7 +18,7 @@ import javax.persistence.Entity;
@Entity(name = "sys$Folder")
@Table(name = "SYS_FOLDER")
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = "TYPE", discriminatorType = DiscriminatorType.STRING)
@DiscriminatorColumn(name = "FOLDER_TYPE", discriminatorType = DiscriminatorType.STRING)
@DiscriminatorValue("F")
@SystemLevel
public class Folder extends StandardEntity {

View File

@ -0,0 +1,60 @@
/*
* Copyright (c) 2013 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.core.global;
/**
* Oracle dialect.
*
* @author degtyarjov
* @version $Id$
*/
public class OracleDbDialect extends DbDialect implements SequenceSupport {
public String sequenceExistsSql(String sequenceName) {
return "select SEQUENCE_NAME from USER_SEQUENCES where SEQUENCE_NAME = '" + sequenceName.toUpperCase() + "'";
}
public String createSequenceSql(String sequenceName, long startValue, long increment) {
return "create sequence " + sequenceName + " increment by " + increment + " start with " + startValue + " nocache";
}
public String modifySequenceSql(String sequenceName, long newVal) {
return "{call SET_SEQ_VAL('" + sequenceName + "', " + newVal + ")}";
}
public String getNextValueSql(String sequenceName) {
return "select " + sequenceName + ".NEXTVAL from DUAL";
}
public String getCurrentValueSql(String sequenceName) {
return "select LAST_NUMBER from USER_SEQUENCES where SEQUENCE_NAME = '" + sequenceName.toUpperCase() + "'";
}
@Override
public String getName() {
return "oracle";
}
@Override
public String getIdColumn() {
return "id";
}
@Override
public String getDeleteTsColumn() {
return "delete_ts";
}
@Override
public String getUniqueConstraintViolationPattern() {
return "ERROR: duplicate key value violates unique constraint \"(.+)\"";
}
@Override
public String getScriptSeparator() {
return "^";
}
}

View File

@ -72,7 +72,7 @@ public class EntityLogItem extends BaseUuidEntity
@JoinColumn(name = "USER_ID")
private User user;
@Column(name = "TYPE", length = 1)
@Column(name = "CHANGE_TYPE", length = 1)
private String type;
@Column(name = "ENTITY", length = 100)

View File

@ -33,7 +33,7 @@ public class GroupHierarchy extends BaseUuidEntity
@JoinColumn(name = "PARENT_ID")
private Group parent;
@Column(name = "LEVEL")
@Column(name = "HIERARCHY_LEVEL")
private Integer level;
public Group getGroup() {

View File

@ -29,7 +29,7 @@ public class Permission extends StandardEntity
public static final String TARGET_PATH_DELIMETER = ":";
/** @see com.haulmont.cuba.security.entity.PermissionType PermissionType.getId() */
@Column(name = "TYPE")
@Column(name = "PERMISSION_TYPE")
private Integer type;
@Column(name = "TARGET", length = 100)

View File

@ -44,7 +44,7 @@ public class Role extends StandardEntity
@Column(name = "DESCRIPTION", length = 1000)
private String description;
@Column(name = "TYPE")
@Column(name = "ROLE_TYPE")
private Integer type;
@Column(name = "IS_DEFAULT_ROLE")

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2013 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.core.sys.persistence;
import org.apache.openjpa.jdbc.kernel.JDBCStore;
import org.apache.openjpa.jdbc.meta.JavaSQLTypes;
import org.apache.openjpa.jdbc.meta.ValueMapping;
import org.apache.openjpa.jdbc.meta.strats.AbstractValueHandler;
import org.apache.openjpa.jdbc.schema.Column;
import org.apache.openjpa.jdbc.schema.ColumnIO;
import java.sql.Types;
import java.util.UUID;
/**
* @author degtyarjov
* @version $Id$
*/
public class BooleanCharValueHandler extends AbstractValueHandler {
private static final long serialVersionUID = -8302367450468711877L;
public static final String TRUE_STRING = "1";
public static final String FALSE_STRING = "0";
public Column[] map(ValueMapping vm, String name, ColumnIO io, boolean adapt) {
Column col = new Column();
col.setName(name);
col.setJavaType(JavaSQLTypes.STRING);
col.setType(Types.CHAR);
col.setSize(1);
return new Column[]{col};
}
public Object toDataStoreValue(ValueMapping vm, Object val, JDBCStore store) {
return val == null ? null : (Boolean) val ? TRUE_STRING : FALSE_STRING;
}
public Object toObjectValue(ValueMapping vm, Object val) {
return val == null ? null : TRUE_STRING.equalsIgnoreCase(val.toString());
}
}

View File

@ -1,11 +1,7 @@
/*
* Copyright (c) 2008 Haulmont Technology Ltd. All Rights Reserved.
* Copyright (c) 2013 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
* Author: Konstantin Krivopustov
* Created: 07.11.2008 19:09:04
* $Id$
*/
package com.haulmont.cuba.core.sys.persistence;
@ -18,10 +14,16 @@ import org.apache.openjpa.jdbc.kernel.JDBCStore;
import java.util.UUID;
public class UuidStringValueHandler extends AbstractValueHandler
{
/**
* @author krivopustov
* @version $Id$
*/
public class UuidStringValueHandler extends AbstractValueHandler {
private static final long serialVersionUID = -8302367450468711877L;
public boolean compact = false;
public Column[] map(ValueMapping vm, String name, ColumnIO io, boolean adapt) {
Column col = new Column();
col.setName(name);
@ -31,10 +33,27 @@ public class UuidStringValueHandler extends AbstractValueHandler
}
public Object toDataStoreValue(ValueMapping vm, Object val, JDBCStore store) {
return val == null ? null : val.toString();
if (val == null)
return null;
else {
return compact ? val.toString().replace("-", "") : val.toString();
}
}
public Object toObjectValue(ValueMapping vm, Object val) {
return val == null ? null : UUID.fromString((String) val);
if (val == null)
return null;
else {
String str = (String) val;
if (compact) {
StringBuilder sb = new StringBuilder((String) val);
sb.insert(8, '-');
sb.insert(13, '-');
sb.insert(18, '-');
sb.insert(23, '-');
str = sb.toString();
}
return UUID.fromString(str);
}
}
}