</dependencyManagement>
<dependencies>
- <!--<dependency org="javax.servlet.jsp" name="jsp-api" rev="2.2" />-->
+ <dependency>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm</artifactId>
+ <version>5.0.3</version>
+ <scope>compile</scope>
+ </dependency>
+ <!--<dependency org="javax.servlet.jsp" name="jsp-api" rev="2.2" />-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<!--
Needed when using the widgetset optimizer (custom ConnectorBundleLoaderFactory).
- For widgetset compilation, vaadin-client-compiler is automatically added on the
- compilation classpath by vaadin-maven-plugin so normally there is no need for an
- explicit dependency.
- -->
- <!--
- <dependency>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-client-compiler</artifactId>
- <scope>provided</scope>
- </dependency>
- -->
- <dependency>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-themes</artifactId>
- </dependency>
- <dependency>
- <groupId>com.orientechnologies</groupId>
- <artifactId>orientdb-server</artifactId>
- <version>2.1.7</version>
- </dependency>
- <dependency>
- <groupId>com.orientechnologies</groupId>
- <artifactId>orientdb-enterprise</artifactId>
- <version>2.1.7</version>
- </dependency>
- <dependency>
- <groupId>com.orientechnologies</groupId>
- <artifactId>orientdb-graphdb</artifactId>
- <version>2.1.7</version>
- </dependency>
- <dependency>
- <groupId>com.orientechnologies</groupId>
- <artifactId>orientdb-object</artifactId>
- <version>2.1.7</version>
- </dependency>
- <dependency>
- <groupId>net.korabo.lib</groupId>
- <artifactId>korabolib</artifactId>
- <version>1.2.4</version>
- </dependency>
- <dependency>
- <groupId>org.vaadin.addons</groupId>
- <artifactId>dcharts-widget</artifactId>
- <version>1.7.0</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.vaadin.addons.lazyquerycontainer</groupId>
- <artifactId>vaadin-lazyquerycontainer</artifactId>
- <version>7.6.1.3</version>
- </dependency>
- </dependencies>
+ For widgetset compilation, vaadin-client-compiler is automatically added on the
+ compilation classpath by vaadin-maven-plugin so normally there is no need for an
+ explicit dependency.
+ -->
+ <!--
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-client-compiler</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-themes</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.vaadin.addons.lazyquerycontainer</groupId>
+ <artifactId>vaadin-lazyquerycontainer</artifactId>
+ <version>7.6.1.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.tylproject.vaadin.addon.fieldbinder</groupId>
+ <artifactId>field-binder</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>com.orientechnologies</groupId>
+ <artifactId>orientdb-server</artifactId>
+ <version>2.1.7</version>
+ </dependency>
+ <dependency>
+ <groupId>com.orientechnologies</groupId>
+ <artifactId>orientdb-enterprise</artifactId>
+ <version>2.1.7</version>
+ </dependency>
+ <dependency>
+ <groupId>com.orientechnologies</groupId>
+ <artifactId>orientdb-graphdb</artifactId>
+ <version>2.1.7</version>
+ </dependency>
+ <dependency>
+ <groupId>com.orientechnologies</groupId>
+ <artifactId>orientdb-object</artifactId>
+ <version>2.1.7</version>
+ </dependency>
+ <dependency>
+ <groupId>net.korabo.lib</groupId>
+ <artifactId>korabolib</artifactId>
+ <version>1.2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.vaadin.addons</groupId>
+ <artifactId>dcharts-widget</artifactId>
+ <version>1.7.0</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.vaadin.addons.lazyquerycontainer</groupId>
+ <artifactId>vaadin-lazyquerycontainer</artifactId>
+ <version>7.6.1.3</version>
+ </dependency>
+ </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.3</version>
- <configuration>
- <encoding>${project.encoding}</encoding>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.6</version>
- <configuration>
- <encoding>${project.encoding}</encoding>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.3</version>
- <configuration>
- <failOnMissingWebXml>false</failOnMissingWebXml>
- <!-- Exclude some unnecessary files generated by the GWT compiler. -->
- <packagingExcludes>WEB-INF/classes/VAADIN/gwt-unitCache/**,
- WEB-INF/classes/VAADIN/widgetsets/WEB-INF/**</packagingExcludes>
- </configuration>
- </plugin>
- <plugin>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-maven-plugin</artifactId>
- <version>${vaadin.plugin.version}</version>
- <configuration>
- <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
- <webappDirectory>${basedir}/target/classes/VAADIN/widgetsets</webappDirectory>
- <draftCompile>false</draftCompile>
- <compileReport>false</compileReport>
- <style>OBF</style>
- <strict>true</strict>
- <runTarget>http://localhost:8888/vaadin01</runTarget>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>update-theme</goal>
- <goal>update-widgetset</goal>
- <goal>compile</goal>
- <!-- disabled by default to use on-the-fly theme compilation -->
- <!-- <goal>compile-theme</goal> -->
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <version>2.4</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-clean-plugin</artifactId>
- <version>2.6.1</version>
- <!-- Clean up also any pre-compiled themes -->
- <configuration>
- <filesets>
- <fileset>
- <directory>src/main/webapp/VAADIN/themes</directory>
- <includes>
- <include>**/styles.css</include>
- <include>**/styles.scss.cache</include>
- </includes>
- </fileset>
- </filesets>
- </configuration>
- </plugin>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.3</version>
+ <configuration>
+ <encoding>${project.encoding}</encoding>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.6</version>
+ <configuration>
+ <encoding>${project.encoding}</encoding>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <failOnMissingWebXml>false</failOnMissingWebXml>
+ <!-- Exclude some unnecessary files generated by the GWT compiler. -->
+ <packagingExcludes>WEB-INF/classes/VAADIN/gwt-unitCache/**,
+ WEB-INF/classes/VAADIN/widgetsets/WEB-INF/**</packagingExcludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-maven-plugin</artifactId>
+ <version>${vaadin.plugin.version}</version>
+ <configuration>
+ <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
+ <webappDirectory>${basedir}/target/classes/VAADIN/widgetsets</webappDirectory>
+ <draftCompile>false</draftCompile>
+ <compileReport>false</compileReport>
+ <style>OBF</style>
+ <strict>true</strict>
+ <runTarget>http://localhost:8888/vaadin01</runTarget>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>update-theme</goal>
+ <goal>update-widgetset</goal>
+ <goal>compile</goal>
+ <!-- disabled by default to use on-the-fly theme compilation -->
+ <!-- <goal>compile-theme</goal> -->
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.4</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>2.6.1</version>
+ <!-- Clean up also any pre-compiled themes -->
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>src/main/webapp/VAADIN/themes</directory>
+ <includes>
+ <include>**/styles.css</include>
+ <include>**/styles.scss.cache</include>
+ </includes>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
- <!-- The Jetty plugin allows us to easily test the development build by
- running jetty:run on the command line. -->
- <plugin>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-maven-plugin</artifactId>
- <version>${jetty.plugin.version}</version>
- <configuration>
- <scanIntervalSeconds>2</scanIntervalSeconds>
- </configuration>
- </plugin>
- </plugins>
+ <!-- The Jetty plugin allows us to easily test the development build by
+ running jetty:run on the command line. -->
+ <plugin>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-maven-plugin</artifactId>
+ <version>${jetty.plugin.version}</version>
+ <configuration>
+ <scanIntervalSeconds>2</scanIntervalSeconds>
+ </configuration>
+ </plugin>
+ </plugins>
- <pluginManagement>
- <plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
- <!-- TODO Remove when http://dev.vaadin.com/ticket/14924 is resolved -->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>com.vaadin</groupId>
- <artifactId>
- vaadin-maven-plugin
- </artifactId>
- <versionRange>[7.1.11,)</versionRange>
- <goals>
- <goal>resources</goal>
- <goal>update-widgetset</goal>
- <goal>compile</goal>
- <goal>compile-theme</goal>
- <goal>update-theme</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore></ignore>
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
+ <!-- TODO Remove when http://dev.vaadin.com/ticket/14924 is resolved -->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>com.vaadin</groupId>
+ <artifactId>
+ vaadin-maven-plugin
+ </artifactId>
+ <versionRange>[7.1.11,)</versionRange>
+ <goals>
+ <goal>resources</goal>
+ <goal>update-widgetset</goal>
+ <goal>compile</goal>
+ <goal>compile-theme</goal>
+ <goal>update-theme</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
- </build>
+ </build>
- <profiles>
- <profile>
- <!-- Vaadin pre-release repositories -->
- <id>vaadin-prerelease</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
+ <profiles>
+ <profile>
+ <!-- Vaadin pre-release repositories -->
+ <id>vaadin-prerelease</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
- <repositories>
- <repository>
- <id>vaadin-prereleases</id>
- <url>http://maven.vaadin.com/vaadin-prereleases</url>
- </repository>
+ <repositories>
+ <repository>
+ <id>vaadin-prereleases</id>
+ <url>http://maven.vaadin.com/vaadin-prereleases</url>
+ </repository>
<repository>
- <id>vaadin-addons</id>
- <url>http://maven.vaadin.com/vaadin-addons</url>
+ <id>vaadin-addons</id>
+ <url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>vaadin-prereleases</id>
- <url>http://maven.vaadin.com/vaadin-prereleases</url>
- </pluginRepository>
- </pluginRepositories>
- </profile>
- </profiles>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>vaadin-prereleases</id>
+ <url>http://maven.vaadin.com/vaadin-prereleases</url>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ </profiles>
</project>
--- /dev/null
+/*\r
+ * To change this license header, choose License Headers in Project Properties.\r
+ * To change this template file, choose Tools | Templates\r
+ * and open the template in the editor.\r
+ */\r
+package net.korabo.app.vaadin01.srv;\r
+\r
+import com.orientechnologies.orient.core.db.OPartitionedDatabasePool;\r
+import com.orientechnologies.orient.object.db.OObjectDatabaseTx;\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+import java.util.Map;\r
+import net.korabo.app.vaadin01.ent.Contact;\r
+import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;\r
+import org.vaadin.addons.lazyquerycontainer.QueryDefinition;\r
+\r
+/**\r
+ *\r
+ * @author manager\r
+ */\r
+public class ContactBeanQuery extends AbstractBeanQuery<Contact>{\r
+\r
+ private final OPartitionedDatabasePool pool;\r
+\r
+ public ContactBeanQuery(QueryDefinition definition,\r
+ Map<String, Object> queryConfiguration, Object[] sortPropertyIds,\r
+ boolean[] sortStates) {\r
+ super(definition, queryConfiguration, sortPropertyIds, sortStates);\r
+ this.pool = (OPartitionedDatabasePool)queryConfiguration.get("OPartitionedDatabasePool");\r
+ }\r
+\r
+ \r
+ @Override\r
+ protected Contact constructBean() {\r
+ return new Contact();\r
+ }\r
+\r
+ @Override\r
+ public int size() {\r
+ try (\r
+ OObjectDatabaseTx db = new OObjectDatabaseTx(pool.acquire())) {\r
+ db.getEntityManager().registerEntityClass(Contact.class);\r
+ return (int) db.countClass(Contact.class);\r
+ }\r
+ }\r
+\r
+ @Override\r
+ protected List<Contact> loadBeans(int i, int i1) {\r
+ ArrayList arrayList = new ArrayList();\r
+ try (\r
+ OObjectDatabaseTx db = new OObjectDatabaseTx(pool.acquire())) {\r
+ db.getEntityManager().registerEntityClass(Contact.class);\r
+ for (Contact contact : db.browseClass(Contact.class).) {\r
+ boolean passesFilter = (stringFilter == null || stringFilter.isEmpty())\r
+ || contact.toString().toLowerCase()\r
+ .contains(stringFilter.toLowerCase());\r
+ if (passesFilter) {\r
+// contact = db.detach(contact);\r
+ arrayList.add(db.detach(contact, true));\r
+ }\r
+ }\r
+\r
+ }\r
+ }\r
+\r
+ @Override\r
+ protected void saveBeans(List<Contact> list, List<Contact> list1, List<Contact> list2) {\r
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
+ }\r
+ \r
+}\r
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
import java.util.List;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.korabo.app.vaadin01.ent.Contact;
-import net.korabo.lib.beans.InstanceUtil;
/**
*
private static ContactService instance;
private static OPartitionedDatabasePool pool;
- public static ContactService createDemoService(){
+ public static ContactService createDemoService() {
try {
return createService0();
} catch (IOException ex) {
}
return null;
}
-
+
private static ContactService createService0() throws IOException {
if (instance == null) {
String url = remote + nameDB;
OServerAdmin serverAdmin = new OServerAdmin(url).connect("root", "korabo");
- if (!serverAdmin.listDatabases().containsKey(nameDB)){
+ if (!serverAdmin.listDatabases().containsKey(nameDB)) {
serverAdmin.createDatabase(nameDB, "object", "plocal");
System.out.println(" Database '" + nameDB + "' created!..");
}
try (
OObjectDatabaseTx db = new OObjectDatabaseTx(pool.acquire())) {
db.getEntityManager().registerEntityClass(Contact.class);
+
if (db.countClass(Contact.class) == 0) {
// init
Random r = new Random(0);
cal.set(1930 + r.nextInt(70),
r.nextInt(11), r.nextInt(28));
contact.setBirthDate(cal.getTime());
- db.save(contact);
+ db.attachAndSave(contact);
}
db.commit();
}
OObjectDatabaseTx db = new OObjectDatabaseTx(pool.acquire())) {
db.getEntityManager().registerEntityClass(Contact.class);
for (Contact contact : db.browseClass(Contact.class)) {
- boolean passesFilter = (stringFilter == null || stringFilter.isEmpty())
- || contact.toString().toLowerCase()
- .contains(stringFilter.toLowerCase());
- if (passesFilter) {
- contact = db.detach(contact);
- arrayList.add(contact);
- }
+ boolean passesFilter = (stringFilter == null || stringFilter.isEmpty())
+ || contact.toString().toLowerCase()
+ .contains(stringFilter.toLowerCase());
+ if (passesFilter) {
+// contact = db.detach(contact);
+ arrayList.add(db.detach(contact, true));
+ }
}
}
}
public synchronized void save(Contact entry) {
+ try (
+ OObjectDatabaseTx db = new OObjectDatabaseTx(pool.acquire())) {
+ db.getEntityManager().registerEntityClass(Contact.class);
+ db.begin();
+ db.attachAndSave(entry);
+ db.commit();
+ }
// if (entry.getId() == null) {
// entry.setId(nextId++);
// }