diff --git a/src/eclipse/ant/deploy-workspace.xml b/src/eclipse/ant/deploy-workspace.xml new file mode 100644 index 0000000..0365e89 --- /dev/null +++ b/src/eclipse/ant/deploy-workspace.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + Copy Launchers + + + + + Copy java compiler settings to projects + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/eclipse/launch-template/vasc-demo-client-swing.launch-template b/src/eclipse/launch-template/vasc-demo-client-swing.launch-template new file mode 100644 index 0000000..d5fa885 --- /dev/null +++ b/src/eclipse/launch-template/vasc-demo-client-swing.launch-template @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/src/eclipse/launch-template/vasc-demo-server.launch-template b/src/eclipse/launch-template/vasc-demo-server.launch-template new file mode 100644 index 0000000..d027be7 --- /dev/null +++ b/src/eclipse/launch-template/vasc-demo-server.launch-template @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/src/eclipse/settings/org.eclipse.jdt.core.prefs-template b/src/eclipse/settings/org.eclipse.jdt.core.prefs-template new file mode 100644 index 0000000..24c61bc --- /dev/null +++ b/src/eclipse/settings/org.eclipse.jdt.core.prefs-template @@ -0,0 +1,92 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=warning +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackendResult.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackendResult.java new file mode 100644 index 0000000..36a6e20 --- /dev/null +++ b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackendResult.java @@ -0,0 +1,80 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.backend; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** + * AbstractVascBackendResult. + * + * @author Willem Cazander + * @version 1.0 Aug 23, 2014 + */ +abstract public class AbstractVascBackendResult implements VascBackendResult { + + private final List pageData; + private final long totalSize; + private final Map pageSummary; + private final Map totalSummary; + + public AbstractVascBackendResult(List pageData,long totalSize,Map pageSummary,Map totalSummary) { + this.pageData = pageData; + this.totalSize = totalSize; + this.pageSummary = pageSummary; + this.totalSummary = totalSummary; + } + + /** + * @see net.forwardfire.vasc.backend.VascBackendResult#getPageData() + */ + @Override + public List getPageData() { + return pageData; + } + + /** + * @see net.forwardfire.vasc.backend.VascBackendResult#getTotalSize() + */ + @Override + public long getTotalSize() { + return totalSize; + } + + /** + * @see net.forwardfire.vasc.backend.VascBackendResult#getPageSummary() + */ + @Override + public Map getPageSummary() { + return pageSummary; + } + + /** + * @see net.forwardfire.vasc.backend.VascBackendResult#getTotalSummary() + */ + @Override + public Map getTotalSummary() { + return totalSummary; + } +} diff --git a/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/DefaultVascBackendResult.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/DefaultVascBackendResult.java new file mode 100644 index 0000000..55a8867 --- /dev/null +++ b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/DefaultVascBackendResult.java @@ -0,0 +1,46 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.backend; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** + * DefaultVascBackendResult. + * + * @author Willem Cazander + * @version 1.0 Aug 23, 2014 + */ +public final class DefaultVascBackendResult extends AbstractVascBackendResult { + + public DefaultVascBackendResult(List pageData) { + this(pageData,-1,null,null); + } + + public DefaultVascBackendResult(List pageData, long totalSize, + Map pageSummary, + Map totalSummary) { + super(pageData, totalSize, pageSummary, totalSummary); + } +} diff --git a/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascBackendResult.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascBackendResult.java new file mode 100644 index 0000000..205fadc --- /dev/null +++ b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascBackendResult.java @@ -0,0 +1,41 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.backend; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** + * VascBackendResult. + * + * @author Willem Cazander + * @version 1.0 Aug 23, 2014 + */ +public interface VascBackendResult { + + List getPageData(); + long getTotalSize(); + Map getPageSummary(); + Map getTotalSummary(); +} diff --git a/vasc-backend/vasc-backend-test/.project b/vasc-backend/vasc-backend-test/.project new file mode 100644 index 0000000..a326b25 --- /dev/null +++ b/vasc-backend/vasc-backend-test/.project @@ -0,0 +1,23 @@ + + + vasc-backend-test + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/vasc-backend/vasc-backend-test/pom.xml b/vasc-backend/vasc-backend-test/pom.xml new file mode 100644 index 0000000..ac42c2c --- /dev/null +++ b/vasc-backend/vasc-backend-test/pom.xml @@ -0,0 +1,44 @@ + + 4.0.0 + + net.forwardfire.vasc.backend + vasc-backend + 0.4.2-SNAPSHOT + + vasc-backend-test + vasc-backend-test + vasc-backend-test + + + net.forwardfire.vasc.backend + vasc-backend-jdbc + ${project.version} + + + net.forwardfire.vasc.backend + vasc-backend-metamodel + ${project.version} + + + net.forwardfire.vasc.backend + vasc-backend-mongodb + ${project.version} + + + net.forwardfire.vasc.backend + vasc-backend-ldap + ${project.version} + + + + com.h2database + h2 + ${h2.version} + + + postgresql + postgresql + ${postgresql.version} + + + \ No newline at end of file diff --git a/vasc-backend/vasc-backend-test/src/main/java/net/forwardfire/vasc/backend/test/CrudTest.java b/vasc-backend/vasc-backend-test/src/main/java/net/forwardfire/vasc/backend/test/CrudTest.java new file mode 100644 index 0000000..2e67a8c --- /dev/null +++ b/vasc-backend/vasc-backend-test/src/main/java/net/forwardfire/vasc/backend/test/CrudTest.java @@ -0,0 +1,62 @@ +package net.forwardfire.vasc.backend.test; + +import java.io.Serializable; + +import junit.framework.TestCase; +import net.forwardfire.vasc.backend.DefaultVascBackendController; +import net.forwardfire.vasc.backend.DefaultVascBackendState; +import net.forwardfire.vasc.backend.VascBackend; +import net.forwardfire.vasc.backend.VascBackendResult; +import net.forwardfire.vasc.backend.VascEntryFieldValue; +import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextJdbc; +import net.forwardfire.vasc.backend.metamodel.MetaModelVascBackend; + +import org.testng.annotations.Test; + +public class CrudTest extends TestCase { + + private DefaultVascBackendController backends; + + //@Before + public void setup() { + backends = new DefaultVascBackendController(); + + MetaModelDataContextJdbc mmDB = new MetaModelDataContextJdbc(); + mmDB.setConnectUrl("jdbc:postgresql://localhost/moviedb"); + mmDB.setDriverClass("org.postgresql.Driver"); + mmDB.setUsername("postgres"); + mmDB.setPassword("postgresql"); + + MetaModelVascBackend mm = new MetaModelVascBackend(); + mm.setId("mm"); + mm.setTable("country"); + mm.setTableId("country_id"); + mm.setDataContextProvider(mmDB); + + + backends.addVascBackend(mm); + } + + @Test + public void testCrudBackends() throws Exception { + + setup(); + + VascBackend backend = (VascBackend) backends.getVascBackendById("mm"); + assertNotNull(backend); + + DefaultVascBackendState state = new DefaultVascBackendState(); + VascBackendResult result = backend.execute(state); + assertNotNull(result); + assertFalse(result.getPageData().isEmpty()); + + VascEntryFieldValue values = backend.provideVascEntryFieldValue(); + + for (Serializable record:result.getPageData()) { + Object id = values.getValue("country_id", record); + Object name = values.getValue("name", record); + Object code = values.getValue("code", record); + System.out.println("line: "+id+" name: "+name+" code: "+code); + } + } +} diff --git a/vasc-backend/vasc-backend-test/src/main/java/net/forwardfire/vasc/backend/test/package-info.java b/vasc-backend/vasc-backend-test/src/main/java/net/forwardfire/vasc/backend/test/package-info.java new file mode 100644 index 0000000..b2e55ad --- /dev/null +++ b/vasc-backend/vasc-backend-test/src/main/java/net/forwardfire/vasc/backend/test/package-info.java @@ -0,0 +1,8 @@ +/** + * + */ +/** + * @author willemc + * + */ +package net.forwardfire.vasc.backend.test; \ No newline at end of file