Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5c84b03
Showing
43 changed files
with
1,051 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.gradle | ||
*.ipr | ||
*.iml | ||
*.iws | ||
build/* | ||
modules/*/build/* | ||
out | ||
test-run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Screen Manipulation | ||
|
||
This project demonstrates how to programmatically manipulate screens in [CUBA](https://www.cuba-platform.com) applications. | ||
|
||
* `CustomerEdit` screen controller defines dialog options in its `init()` method. | ||
|
||
* `CustomerList` is a controller of the simple screen that contains a drop-down list of customers. | ||
|
||
* `OrderEdit` screen controller demonstrates two ways of looking up an entity: from a lookup screen and from an arbitrary screen. | ||
|
||
Based on CUBA Platform 6.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,223 @@ | ||
|
||
buildscript { | ||
ext.cubaVersion = '6.1.1' | ||
repositories { | ||
maven { | ||
url 'https://repo.cuba-platform.com/content/groups/work' | ||
credentials { | ||
username(rootProject.hasProperty('repoUser') ? rootProject['repoUser'] : 'cuba') | ||
password(rootProject.hasProperty('repoPass') ? rootProject['repoPass'] : 'cuba123') | ||
} | ||
} | ||
|
||
} | ||
dependencies { | ||
classpath "com.haulmont.gradle:cuba-plugin:$cubaVersion" | ||
} | ||
} | ||
|
||
def globalModule = project(':app-global') | ||
def coreModule = project(':app-core') | ||
def guiModule = project(':app-gui') | ||
def webModule = project(':app-web') | ||
|
||
def servletApi = 'org.apache.tomcat:tomcat-servlet-api:8.0.26' | ||
|
||
|
||
apply(plugin: 'idea') | ||
apply(plugin: 'cuba') | ||
|
||
cuba { | ||
artifact { | ||
group = 'com.company.sample' | ||
version = '0.1' | ||
isSnapshot = true | ||
} | ||
tomcat { | ||
dir = "$project.rootDir/build/tomcat" | ||
} | ||
ide { | ||
copyright = '''Copyright (c) ${today.year} ${project.name}''' // Copyright Notice for IDEA project | ||
classComment ='''/** | ||
* @author ${USER} | ||
*/''' | ||
vcs = 'Git' | ||
|
||
} | ||
} | ||
|
||
def hsql = 'org.hsqldb:hsqldb:2.2.9' | ||
|
||
configure([globalModule, coreModule, guiModule, webModule]) { | ||
apply(plugin: 'java') | ||
apply(plugin: 'maven') | ||
apply(plugin: 'idea') | ||
apply(plugin: 'cuba') | ||
|
||
dependencies { | ||
testCompile('junit:junit:4.12') | ||
} | ||
|
||
task sourceJar(type: Jar) { | ||
from file('src') | ||
classifier = 'sources' | ||
} | ||
|
||
artifacts { | ||
archives sourceJar | ||
} | ||
} | ||
|
||
configure(globalModule) { | ||
dependencies { | ||
compile("com.haulmont.cuba:cuba-global:$cubaVersion") | ||
|
||
} | ||
|
||
task enhance(type: CubaEnhancing) | ||
|
||
} | ||
|
||
configure(coreModule) { | ||
|
||
configurations { | ||
jdbc | ||
dbscripts | ||
} | ||
|
||
dependencies { | ||
compile(globalModule) | ||
provided(servletApi) | ||
jdbc(hsql) | ||
testRuntime(hsql) | ||
compile("com.haulmont.cuba:cuba-core:$cubaVersion") | ||
testCompile("com.haulmont.cuba:cuba-core-tests:$cubaVersion") | ||
testCompile("com.haulmont.cuba:cuba-shared-lib:$cubaVersion") | ||
dbscripts("com.haulmont.cuba:cuba-core:$cubaVersion:db@zip") | ||
|
||
} | ||
|
||
task cleanConf(description: 'Cleans up conf directory') << { | ||
def dir = new File(cuba.tomcat.dir, '/conf/app-core') | ||
if (dir.isDirectory()) { | ||
ant.delete(includeemptydirs: true) { | ||
fileset(dir: dir, includes: '**/*', excludes: 'local.app.properties') | ||
} | ||
} | ||
} | ||
|
||
task deploy(dependsOn: [assemble, cleanConf], type: CubaDeployment) { | ||
appName = 'app-core' | ||
appJars('cuba-core', 'cuba-global', | ||
'app-global', 'app-core') | ||
} | ||
|
||
task createDb(dependsOn: assembleDbScripts, description: 'Creates local database', type: CubaDbCreation) { | ||
dbms = 'hsql' | ||
dbmsVersion = 'null' | ||
host = 'localhost' | ||
dbName = 'sample' | ||
dbUser = 'sa' | ||
dbPassword = '' | ||
} | ||
|
||
task updateDb(dependsOn: assembleDbScripts, description: 'Updates local database', type: CubaDbUpdate) { | ||
dbms = 'hsql' | ||
dbmsVersion = 'null' | ||
host = 'localhost' | ||
dbName = 'sample' | ||
dbUser = 'sa' | ||
dbPassword = '' | ||
} | ||
} | ||
|
||
configure(guiModule) { | ||
dependencies { | ||
compile(globalModule) | ||
compile("com.haulmont.cuba:cuba-gui:$cubaVersion") | ||
testCompile("com.haulmont.cuba:cuba-client-tests:$cubaVersion") | ||
|
||
} | ||
|
||
task deployConf(type: Copy) { | ||
from file('src') | ||
include "com/company/sample/**" | ||
into "$cuba.tomcat.dir/conf/app" | ||
} | ||
} | ||
|
||
configure(webModule) { | ||
configurations { | ||
webcontent | ||
|
||
} | ||
|
||
dependencies { | ||
provided(servletApi) | ||
compile(guiModule) | ||
compile("com.haulmont.cuba:cuba-web:$cubaVersion") | ||
webcontent("com.haulmont.cuba:cuba-web:$cubaVersion:web@zip") | ||
webcontent("com.haulmont.cuba:cuba-web-toolkit:$cubaVersion:web@zip") | ||
testCompile("com.haulmont.cuba:cuba-client-tests:$cubaVersion") | ||
|
||
} | ||
|
||
task webArchive(type: Zip) { | ||
from file('web') | ||
classifier = 'web' | ||
} | ||
|
||
artifacts { | ||
archives webArchive | ||
} | ||
|
||
task deployConf(type: Copy) { | ||
from file('src') | ||
include "com/company/sample/**" | ||
into "$cuba.tomcat.dir/conf/app" | ||
} | ||
|
||
task clearMessagesCache(type: CubaClearMessagesCache) { | ||
appName = 'app' | ||
} | ||
deployConf.dependsOn clearMessagesCache | ||
|
||
task cleanConf(description: 'Cleans up conf directory') << { | ||
def dir = new File(cuba.tomcat.dir, '/conf/app') | ||
if (dir.isDirectory()) { | ||
ant.delete(includeemptydirs: true) { | ||
fileset(dir: dir, includes: '**/*', excludes: 'local.app.properties') | ||
} | ||
} | ||
} | ||
|
||
task deploy(dependsOn: [assemble, cleanConf], type: CubaDeployment) { | ||
appName = 'app' | ||
appJars('cuba-client', 'cuba-gui', 'cuba-rest-api', 'cuba-web', 'cuba-global', | ||
'app-global', 'app-gui', 'app-web') | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
task undeploy(type: Delete, dependsOn: ':app-web:cleanConf') { | ||
delete("$cuba.tomcat.dir/shared") | ||
delete("$cuba.tomcat.dir/webapps/app-core") | ||
delete("$cuba.tomcat.dir/webapps/app") | ||
} | ||
|
||
task restart(dependsOn: ['stop', ':app-core:deploy', ':app-web:deploy'], description: 'Redeploys applications and restarts local Tomcat') << { | ||
ant.waitfor(maxwait: 6, maxwaitunit: 'second', checkevery: 2, checkeveryunit: 'second') { | ||
not { | ||
socket(server: 'localhost', port: '8787') | ||
} | ||
} | ||
start.execute() | ||
} | ||
|
||
task wrapper(type: Wrapper) { | ||
gradleVersion = '2.6' | ||
} | ||
|
||
apply from: 'extra.gradle' |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
-- begin SAMPLE_CUSTOMER | ||
create table SAMPLE_CUSTOMER ( | ||
ID varchar(36) not null, | ||
CREATE_TS timestamp, | ||
CREATED_BY varchar(50), | ||
VERSION integer not null, | ||
UPDATE_TS timestamp, | ||
UPDATED_BY varchar(50), | ||
DELETE_TS timestamp, | ||
DELETED_BY varchar(50), | ||
-- | ||
NAME varchar(255), | ||
EMAIL varchar(100), | ||
-- | ||
primary key (ID) | ||
)^ | ||
-- end SAMPLE_CUSTOMER | ||
-- begin SAMPLE_ORDER | ||
create table SAMPLE_ORDER ( | ||
ID varchar(36) not null, | ||
CREATE_TS timestamp, | ||
CREATED_BY varchar(50), | ||
VERSION integer not null, | ||
UPDATE_TS timestamp, | ||
UPDATED_BY varchar(50), | ||
DELETE_TS timestamp, | ||
DELETED_BY varchar(50), | ||
-- | ||
DATE_ date, | ||
NUM varchar(100), | ||
CUSTOMER_ID varchar(36), | ||
-- | ||
primary key (ID) | ||
)^ | ||
-- end SAMPLE_ORDER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- begin SAMPLE_ORDER | ||
alter table SAMPLE_ORDER add constraint FK_SAMPLE_ORDER_CUSTOMER_ID foreign key (CUSTOMER_ID) references SAMPLE_CUSTOMER(ID)^ | ||
create index IDX_SAMPLE_ORDER_CUSTOMER on SAMPLE_ORDER (CUSTOMER_ID)^ | ||
-- end SAMPLE_ORDER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
insert into SAMPLE_CUSTOMER | ||
(ID, CREATE_TS, CREATED_BY, VERSION, UPDATE_TS, UPDATED_BY, DELETE_TS, DELETED_BY, NAME, EMAIL) | ||
values ('405d5d7d-ed85-10e5-5e45-eeea2e574d18', '2016-04-11 09:34:55', 'admin', 1, '2016-04-11 09:34:55', null, null, null, 'Globex Corporation', 'info@globex.com'); | ||
|
||
insert into SAMPLE_CUSTOMER | ||
(ID, CREATE_TS, CREATED_BY, VERSION, UPDATE_TS, UPDATED_BY, DELETE_TS, DELETED_BY, NAME, EMAIL) | ||
values ('d43d25fd-563e-0eb7-0766-0c01c27aae19', '2016-04-11 09:35:13', 'admin', 1, '2016-04-11 09:35:13', null, null, null, 'Sirius Cybernetics Corporation', 'info@sirius.com'); | ||
|
||
insert into SAMPLE_CUSTOMER | ||
(ID, CREATE_TS, CREATED_BY, VERSION, UPDATE_TS, UPDATED_BY, DELETE_TS, DELETED_BY, NAME, EMAIL) | ||
values ('b01cfb8c-4797-6767-96cc-0b186e18de55', '2016-04-11 09:35:33', 'admin', 1, '2016-04-11 09:35:33', null, null, null, 'Initech', 'info@initech.com'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
############################################################################### | ||
# Configuration # | ||
############################################################################### | ||
|
||
cuba.dbmsType = hsql | ||
|
||
cuba.springContextConfig = cuba-spring.xml spring.xml | ||
|
||
cuba.persistenceConfig = cuba-persistence.xml persistence.xml | ||
|
||
cuba.metadataConfig = cuba-metadata.xml metadata.xml | ||
|
||
cuba.viewsConfig = cuba-views.xml views.xml | ||
|
||
cuba.mainMessagePack = com.haulmont.cuba.core com.company.sample.core | ||
|
||
############################################################################### | ||
# Other # | ||
############################################################################### | ||
|
||
cuba.webContextName = app-core | ||
cuba.availableLocales = English|en | ||
cuba.localeSelectVisible = false |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<beans xmlns="http://www.springframework.org/schema/beans" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:context="http://www.springframework.org/schema/context" | ||
xmlns:aop="http://www.springframework.org/schema/aop" | ||
xmlns:task="http://www.springframework.org/schema/task" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd | ||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd | ||
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd | ||
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.2.xsd"> | ||
|
||
<!-- Annotation-based beans --> | ||
<context:component-scan base-package="com.company.sample"/> | ||
|
||
</beans> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<Context> | ||
|
||
<!-- Database connection --> | ||
<Resource | ||
name="jdbc/CubaDS" | ||
type="javax.sql.DataSource" | ||
maxTotal="20" | ||
maxIdle="2" | ||
maxWaitMillis="5000" | ||
driverClassName="org.hsqldb.jdbc.JDBCDriver" | ||
url="jdbc:hsqldb:hsql://localhost/sample" | ||
username="sa" | ||
password=""/> | ||
|
||
<!-- Switch off session serialization --> | ||
<Manager pathname=""/> | ||
|
||
</Context> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<web-app xmlns="http://java.sun.com/xml/ns/javaee" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee | ||
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" | ||
version="2.5"> | ||
|
||
<!-- Application properties config files --> | ||
<context-param> | ||
<param-name>appPropertiesConfig</param-name> | ||
<param-value> | ||
classpath:cuba-app.properties | ||
classpath:app.properties | ||
/WEB-INF/local.app.properties | ||
"file:${catalina.home}/conf/app-core/local.app.properties" | ||
</param-value> | ||
</context-param> | ||
|
||
<listener> | ||
<listener-class>com.haulmont.cuba.core.sys.AppContextLoader</listener-class> | ||
</listener> | ||
|
||
<servlet> | ||
<servlet-name>remoting</servlet-name> | ||
<servlet-class>com.haulmont.cuba.core.sys.remoting.RemotingServlet</servlet-class> | ||
<load-on-startup>1</load-on-startup> | ||
</servlet> | ||
|
||
<servlet-mapping> | ||
<servlet-name>remoting</servlet-name> | ||
<url-pattern>/remoting/*</url-pattern> | ||
</servlet-mapping> | ||
|
||
</web-app> |
Oops, something went wrong.