http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-web/.gitignore ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-web/.gitignore b/odata2-jpa-processor/jpa-web/.gitignore index fe5d89b..a7ffe90 100644 --- a/odata2-jpa-processor/jpa-web/.gitignore +++ b/odata2-jpa-processor/jpa-web/.gitignore @@ -1,8 +1,8 @@ -.project -.classpath -.settings -target -bin -*.bak -classes +.project +.classpath +.settings +target +bin +*.bak +classes .DS_Store \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OnDBWriteContent.java ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OnDBWriteContent.java b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OnDBWriteContent.java index 678b62a..f93a977 100644 --- a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OnDBWriteContent.java +++ b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OnDBWriteContent.java @@ -1,55 +1,55 @@ -/******************************************************************************* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - ******************************************************************************/ -package org.apache.olingo.odata2.jpa.processor.ref.extension; - -import java.sql.Blob; -import java.sql.Clob; -import java.sql.SQLException; - -import javax.sql.rowset.serial.SerialException; - -import org.apache.olingo.odata2.jpa.processor.api.OnJPAWriteContent; -import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; -import org.hsqldb.jdbc.JDBCBlob; -import org.hsqldb.jdbc.JDBCClob; - -public class OnDBWriteContent implements OnJPAWriteContent { - - @Override - public Blob getJPABlob(final byte[] binaryData) throws ODataJPARuntimeException { - try { - return new JDBCBlob(binaryData); - } catch (SerialException e) { - ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e); - } catch (SQLException e) { - ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e); - } - return null; - } - - @Override - public Clob getJPAClob(final char[] characterData) throws ODataJPARuntimeException { - try { - return new JDBCClob(new String(characterData)); - } catch (SQLException e) { - ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e); - } - return null; - } -} +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + ******************************************************************************/ +package org.apache.olingo.odata2.jpa.processor.ref.extension; + +import java.sql.Blob; +import java.sql.Clob; +import java.sql.SQLException; + +import javax.sql.rowset.serial.SerialException; + +import org.apache.olingo.odata2.jpa.processor.api.OnJPAWriteContent; +import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; +import org.hsqldb.jdbc.JDBCBlob; +import org.hsqldb.jdbc.JDBCClob; + +public class OnDBWriteContent implements OnJPAWriteContent { + + @Override + public Blob getJPABlob(final byte[] binaryData) throws ODataJPARuntimeException { + try { + return new JDBCBlob(binaryData); + } catch (SerialException e) { + ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e); + } catch (SQLException e) { + ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e); + } + return null; + } + + @Override + public Clob getJPAClob(final char[] characterData) throws ODataJPARuntimeException { + try { + return new JDBCClob(new String(characterData)); + } catch (SQLException e) { + ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e); + } + return null; + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OrderValue.java ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OrderValue.java b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OrderValue.java index 7b056e0..e65221d 100644 --- a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OrderValue.java +++ b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OrderValue.java @@ -1,42 +1,42 @@ -/******************************************************************************* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - ******************************************************************************/ -package org.apache.olingo.odata2.jpa.processor.ref.extension; - -public class OrderValue { - - private double amount; - private String currency; - - public double getAmount() { - return amount; - } - - public void setAmount(final double amount) { - this.amount = amount; - } - - public String getCurrency() { - return currency; - } - - public void setCurrency(final String currency) { - this.currency = currency; - } - -} +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + ******************************************************************************/ +package org.apache.olingo.odata2.jpa.processor.ref.extension; + +public class OrderValue { + + private double amount; + private String currency; + + public double getAmount() { + return amount; + } + + public void setAmount(final double amount) { + this.amount = amount; + } + + public String getCurrency() { + return currency; + } + + public void setCurrency(final String currency) { + this.currency = currency; + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderHeaderProcessor.java ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderHeaderProcessor.java b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderHeaderProcessor.java index 5dc9017..945d909 100644 --- a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderHeaderProcessor.java +++ b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderHeaderProcessor.java @@ -1,136 +1,136 @@ -/******************************************************************************* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - ******************************************************************************/ -package org.apache.olingo.odata2.jpa.processor.ref.extension; - -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.Persistence; -import javax.persistence.Query; - -import org.apache.olingo.odata2.api.annotation.edm.EdmFacets; -import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport; -import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.HttpMethod; -import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.ReturnType; -import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.ReturnType.Type; -import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImportParameter; -import org.apache.olingo.odata2.api.exception.ODataException; -import org.apache.olingo.odata2.jpa.processor.ref.model.Address; -import org.apache.olingo.odata2.jpa.processor.ref.model.SalesOrderHeader; -import org.apache.olingo.odata2.jpa.processor.ref.model.SalesOrderItem; - -public class SalesOrderHeaderProcessor { - - private EntityManager em; - - public SalesOrderHeaderProcessor() { - em = Persistence.createEntityManagerFactory("salesorderprocessing") - .createEntityManager(); - } - - @SuppressWarnings("unchecked") - @EdmFunctionImport(name = "FindAllSalesOrders", entitySet = "SalesOrders", returnType = @ReturnType( - type = Type.ENTITY, isCollection = true)) - public List<SalesOrderHeader> findAllSalesOrders( - @EdmFunctionImportParameter(name = "DeliveryStatusCode", - facets = @EdmFacets(maxLength = 2)) final String status) { - - Query q = em - .createQuery("SELECT E1 from SalesOrderHeader E1 WHERE E1.deliveryStatus = '" - + status + "'"); - List<SalesOrderHeader> soList = (List<SalesOrderHeader>) q - .getResultList(); - return soList; - } - - @EdmFunctionImport(name = "CheckATP", returnType = @ReturnType(type = Type.SIMPLE, isCollection = false), - httpMethod = HttpMethod.GET) - public boolean checkATP( - @EdmFunctionImportParameter(name = "SoID", facets = @EdmFacets(nullable = false)) final Long soID, - @EdmFunctionImportParameter(name = "LiId", facets = @EdmFacets(nullable = false)) final Long lineItemID) { - if (soID == 2L) { - return false; - } else { - return true; - } - } - - @EdmFunctionImport(returnType = @ReturnType(type = Type.ENTITY, isCollection = true), entitySet = "SalesOrders") - public SalesOrderHeader calculateNetAmount( - @EdmFunctionImportParameter(name = "SoID", facets = @EdmFacets(nullable = false)) final Long soID) - throws ODataException { - - if (soID <= 0L) { - throw new ODataException("Invalid SoID"); - } - - Query q = em - .createQuery("SELECT E1 from SalesOrderHeader E1 WHERE E1.soId = " - + soID + "l"); - if (q.getResultList().isEmpty()) { - return null; - } - SalesOrderHeader so = (SalesOrderHeader) q.getResultList().get(0); - double amount = 0; - for (SalesOrderItem soi : so.getSalesOrderItem()) { - amount = amount - + (soi.getAmount() * soi.getDiscount() * soi.getQuantity()); - } - so.setNetAmount(amount); - return so; - } - - @SuppressWarnings("unchecked") - @EdmFunctionImport(returnType = @ReturnType(type = Type.COMPLEX)) - public Address getAddress( - @EdmFunctionImportParameter(name = "SoID", facets = @EdmFacets(nullable = false)) final Long soID) { - Query q = em - .createQuery("SELECT E1 from SalesOrderHeader E1 WHERE E1.soId = " - + soID + "l"); - List<SalesOrderHeader> soList = (List<SalesOrderHeader>) q - .getResultList(); - if (!soList.isEmpty()) { - return soList.get(0).getCustomer().getAddress(); - } else { - return null; - } - } - - @EdmFunctionImport(returnType = @ReturnType(type = Type.COMPLEX)) - public OrderValue orderValue( - @EdmFunctionImportParameter(name = "SoId", facets = @EdmFacets(nullable = false)) final Long soID) { - Query q = em - .createQuery("SELECT E1 from SalesOrderHeader E1 WHERE E1.soId = " - + soID + "l"); - if (q.getResultList().isEmpty()) { - return null; - } - SalesOrderHeader so = (SalesOrderHeader) q.getResultList().get(0); - double amount = 0; - for (SalesOrderItem soi : so.getSalesOrderItem()) { - amount = amount - + (soi.getAmount() * soi.getDiscount() * soi.getQuantity()); - } - OrderValue orderValue = new OrderValue(); - orderValue.setAmount(amount); - orderValue.setCurrency(so.getCurrencyCode()); - return orderValue; - } - -} +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + ******************************************************************************/ +package org.apache.olingo.odata2.jpa.processor.ref.extension; + +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.Persistence; +import javax.persistence.Query; + +import org.apache.olingo.odata2.api.annotation.edm.EdmFacets; +import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport; +import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.HttpMethod; +import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.ReturnType; +import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.ReturnType.Type; +import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImportParameter; +import org.apache.olingo.odata2.api.exception.ODataException; +import org.apache.olingo.odata2.jpa.processor.ref.model.Address; +import org.apache.olingo.odata2.jpa.processor.ref.model.SalesOrderHeader; +import org.apache.olingo.odata2.jpa.processor.ref.model.SalesOrderItem; + +public class SalesOrderHeaderProcessor { + + private EntityManager em; + + public SalesOrderHeaderProcessor() { + em = Persistence.createEntityManagerFactory("salesorderprocessing") + .createEntityManager(); + } + + @SuppressWarnings("unchecked") + @EdmFunctionImport(name = "FindAllSalesOrders", entitySet = "SalesOrders", returnType = @ReturnType( + type = Type.ENTITY, isCollection = true)) + public List<SalesOrderHeader> findAllSalesOrders( + @EdmFunctionImportParameter(name = "DeliveryStatusCode", + facets = @EdmFacets(maxLength = 2)) final String status) { + + Query q = em + .createQuery("SELECT E1 from SalesOrderHeader E1 WHERE E1.deliveryStatus = '" + + status + "'"); + List<SalesOrderHeader> soList = (List<SalesOrderHeader>) q + .getResultList(); + return soList; + } + + @EdmFunctionImport(name = "CheckATP", returnType = @ReturnType(type = Type.SIMPLE, isCollection = false), + httpMethod = HttpMethod.GET) + public boolean checkATP( + @EdmFunctionImportParameter(name = "SoID", facets = @EdmFacets(nullable = false)) final Long soID, + @EdmFunctionImportParameter(name = "LiId", facets = @EdmFacets(nullable = false)) final Long lineItemID) { + if (soID == 2L) { + return false; + } else { + return true; + } + } + + @EdmFunctionImport(returnType = @ReturnType(type = Type.ENTITY, isCollection = false), entitySet = "SalesOrders") + public SalesOrderHeader calculateNetAmount( + @EdmFunctionImportParameter(name = "SoID", facets = @EdmFacets(nullable = false)) final Long soID) + throws ODataException { + + if (soID <= 0L) { + throw new ODataException("Invalid SoID"); + } + + Query q = em + .createQuery("SELECT E1 from SalesOrderHeader E1 WHERE E1.soId = " + + soID + "l"); + if (q.getResultList().isEmpty()) { + return null; + } + SalesOrderHeader so = (SalesOrderHeader) q.getResultList().get(0); + double amount = 0; + for (SalesOrderItem soi : so.getSalesOrderItem()) { + amount = amount + + (soi.getAmount() * soi.getDiscount() * soi.getQuantity()); + } + so.setNetAmount(amount); + return so; + } + + @SuppressWarnings("unchecked") + @EdmFunctionImport(returnType = @ReturnType(type = Type.COMPLEX)) + public Address getAddress( + @EdmFunctionImportParameter(name = "SoID", facets = @EdmFacets(nullable = false)) final Long soID) { + Query q = em + .createQuery("SELECT E1 from SalesOrderHeader E1 WHERE E1.soId = " + + soID + "l"); + List<SalesOrderHeader> soList = (List<SalesOrderHeader>) q + .getResultList(); + if (!soList.isEmpty()) { + return soList.get(0).getCustomer().getAddress(); + } else { + return null; + } + } + + @EdmFunctionImport(returnType = @ReturnType(type = Type.COMPLEX)) + public OrderValue orderValue( + @EdmFunctionImportParameter(name = "SoId", facets = @EdmFacets(nullable = false)) final Long soID) { + Query q = em + .createQuery("SELECT E1 from SalesOrderHeader E1 WHERE E1.soId = " + + soID + "l"); + if (q.getResultList().isEmpty()) { + return null; + } + SalesOrderHeader so = (SalesOrderHeader) q.getResultList().get(0); + double amount = 0; + for (SalesOrderItem soi : so.getSalesOrderItem()) { + amount = amount + + (soi.getAmount() * soi.getDiscount() * soi.getQuantity()); + } + OrderValue orderValue = new OrderValue(); + orderValue.setAmount(amount); + orderValue.setCurrency(so.getCurrencyCode()); + return orderValue; + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/util/DataGenerator.java ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/util/DataGenerator.java b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/util/DataGenerator.java index e840119..e8c74dd 100644 --- a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/util/DataGenerator.java +++ b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/util/DataGenerator.java @@ -1,158 +1,158 @@ -/******************************************************************************* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - ******************************************************************************/ -package org.apache.olingo.odata2.jpa.processor.ref.util; - -import java.util.Arrays; -import java.util.List; -import java.util.ResourceBundle; -import java.util.Set; - -import javax.persistence.EntityManager; -import javax.persistence.Query; - -import org.apache.olingo.odata2.jpa.processor.ref.model.Material; -import org.apache.olingo.odata2.jpa.processor.ref.model.Store; -import org.eclipse.persistence.internal.jpa.EntityManagerImpl; -import org.eclipse.persistence.queries.DataModifyQuery; -import org.eclipse.persistence.queries.SQLCall; -import org.eclipse.persistence.sessions.Session; - -/** - * This is a utility class for generating and cleaning data. The generated data would be used by the application. - * - * - */ -public class DataGenerator { - - private EntityManager entityManager; - - /** - * This is configuration property to hold comma separated names of Insert Files - */ - private static final String SQL_INSERT_CONFIG = "SQL_Insert_Config"; - - /** - * This is key which will be used to fetch file names from SQL Insert Config File. - */ - private static final String SQL_INSERT_FILE_NAMES_KEY = "insert_file_names"; - - private static final String SQL_DELETE_CONFIG = "SQL_Cleanup"; - private static final String SQL_DELETE_STATEMENTS_KEY = "delete_queries"; - - public DataGenerator(final EntityManager entityManager) { - this.entityManager = entityManager; - } - - /** - * This method generates data to be used in the application. It does so by - * reading properties file. Currently it iterates through comma separated - * file names in file SQLInsertConfig and gets the insert statements from - * those files in the order provided in the file. - */ - public void generate() { - String[] resourceSQLPropFileNames = getSQLInsertFileNames(); - if (resourceSQLPropFileNames.length > 0) { // If configuration is proper with at least one file - Session session = ((EntityManagerImpl) entityManager).getActiveSession(); - ResourceBundle[] resourceBundleArr = new ResourceBundle[resourceSQLPropFileNames.length]; - entityManager.getTransaction().begin(); - - for (int i = 0; i < resourceSQLPropFileNames.length; i++) { // For each Entity SQL property file, - System.out.println("Reading from File - " + resourceSQLPropFileNames[i]); - resourceBundleArr[i] = ResourceBundle.getBundle(resourceSQLPropFileNames[i]);// Get SQL statements as properties - - Set<String> keySet = resourceBundleArr[i].keySet(); - - for (String string : keySet) { - String currentSQL = (String) string; - String sqlQuery = resourceBundleArr[i].getString(currentSQL); - System.out.println("Executing Query - " + sqlQuery); - SQLCall sqlCall = new SQLCall(sqlQuery); - - DataModifyQuery query = new DataModifyQuery(); - query.setCall(sqlCall); - session.executeQuery(query); - } - } - setMaterialInStore(); - entityManager.flush(); - entityManager.getTransaction().commit(); - } - - } - - @SuppressWarnings("unchecked") - private void setMaterialInStore() { - Query query = entityManager.createQuery("SELECT e FROM Material e"); - List<Material> materials = (List<Material>) query.getResultList(); - - query = entityManager.createQuery("SELECT e FROM Store e"); - List<Store> stores = (List<Store>) query.getResultList(); - - int storeSize = stores.size(); - int i = 0; - for (Material material : materials) { - List<Store> storesA = Arrays.asList(stores.get(i), stores.get(i + 1)); - material.setStores(storesA); - i++; - if (i > storeSize - 2) { - i = 0; - } - entityManager.persist(material); - } - entityManager.flush(); - } - - private String[] getSQLInsertFileNames() { - ResourceBundle resourceBundle = ResourceBundle.getBundle(SQL_INSERT_CONFIG);// File names from properties - String namesStr = resourceBundle.getString(SQL_INSERT_FILE_NAMES_KEY); - return namesStr.split(","); - } - - private String[] getSQLDeleteStatements() { - ResourceBundle resourceBundle = ResourceBundle.getBundle(SQL_DELETE_CONFIG);// File names from properties - String deleteStatements = resourceBundle.getString(SQL_DELETE_STATEMENTS_KEY); - return deleteStatements.split(","); - } - - /** - * This method deletes data from JPA tables created. This method reads comma - * separated SQL delete statements from DataDeleteSQLs properties files and - * executes them in order. - */ - public void clean() { - // Delete using SQLs - String[] deleteStatements = getSQLDeleteStatements(); - if (deleteStatements.length > 0) { // If configuration is proper with at least one delete Statements - Session session = ((EntityManagerImpl) entityManager).getActiveSession(); - entityManager.getTransaction().begin(); - for (String deleteStatement : deleteStatements) { - System.out.println("Cleaning - " + deleteStatement); - SQLCall sqlCall = new SQLCall(deleteStatement); - - DataModifyQuery query = new DataModifyQuery(); - query.setCall(sqlCall); - session.executeQuery(query); - } - entityManager.getTransaction().commit(); - } else { - System.err.println("Delete configuration file doesn't have any delete statements."); - } - } - -} +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + ******************************************************************************/ +package org.apache.olingo.odata2.jpa.processor.ref.util; + +import java.util.Arrays; +import java.util.List; +import java.util.ResourceBundle; +import java.util.Set; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import org.apache.olingo.odata2.jpa.processor.ref.model.Material; +import org.apache.olingo.odata2.jpa.processor.ref.model.Store; +import org.eclipse.persistence.internal.jpa.EntityManagerImpl; +import org.eclipse.persistence.queries.DataModifyQuery; +import org.eclipse.persistence.queries.SQLCall; +import org.eclipse.persistence.sessions.Session; + +/** + * This is a utility class for generating and cleaning data. The generated data would be used by the application. + * + * + */ +public class DataGenerator { + + private EntityManager entityManager; + + /** + * This is configuration property to hold comma separated names of Insert Files + */ + private static final String SQL_INSERT_CONFIG = "SQL_Insert_Config"; + + /** + * This is key which will be used to fetch file names from SQL Insert Config File. + */ + private static final String SQL_INSERT_FILE_NAMES_KEY = "insert_file_names"; + + private static final String SQL_DELETE_CONFIG = "SQL_Cleanup"; + private static final String SQL_DELETE_STATEMENTS_KEY = "delete_queries"; + + public DataGenerator(final EntityManager entityManager) { + this.entityManager = entityManager; + } + + /** + * This method generates data to be used in the application. It does so by + * reading properties file. Currently it iterates through comma separated + * file names in file SQLInsertConfig and gets the insert statements from + * those files in the order provided in the file. + */ + public void generate() { + String[] resourceSQLPropFileNames = getSQLInsertFileNames(); + if (resourceSQLPropFileNames.length > 0) { // If configuration is proper with at least one file + Session session = ((EntityManagerImpl) entityManager).getActiveSession(); + ResourceBundle[] resourceBundleArr = new ResourceBundle[resourceSQLPropFileNames.length]; + entityManager.getTransaction().begin(); + + for (int i = 0; i < resourceSQLPropFileNames.length; i++) { // For each Entity SQL property file, + System.out.println("Reading from File - " + resourceSQLPropFileNames[i]); + resourceBundleArr[i] = ResourceBundle.getBundle(resourceSQLPropFileNames[i]);// Get SQL statements as properties + + Set<String> keySet = resourceBundleArr[i].keySet(); + + for (String string : keySet) { + String currentSQL = (String) string; + String sqlQuery = resourceBundleArr[i].getString(currentSQL); + System.out.println("Executing Query - " + sqlQuery); + SQLCall sqlCall = new SQLCall(sqlQuery); + + DataModifyQuery query = new DataModifyQuery(); + query.setCall(sqlCall); + session.executeQuery(query); + } + } + setMaterialInStore(); + entityManager.flush(); + entityManager.getTransaction().commit(); + } + + } + + @SuppressWarnings("unchecked") + private void setMaterialInStore() { + Query query = entityManager.createQuery("SELECT e FROM Material e"); + List<Material> materials = (List<Material>) query.getResultList(); + + query = entityManager.createQuery("SELECT e FROM Store e"); + List<Store> stores = (List<Store>) query.getResultList(); + + int storeSize = stores.size(); + int i = 0; + for (Material material : materials) { + List<Store> storesA = Arrays.asList(stores.get(i), stores.get(i + 1)); + material.setStores(storesA); + i++; + if (i > storeSize - 2) { + i = 0; + } + entityManager.persist(material); + } + entityManager.flush(); + } + + private String[] getSQLInsertFileNames() { + ResourceBundle resourceBundle = ResourceBundle.getBundle(SQL_INSERT_CONFIG);// File names from properties + String namesStr = resourceBundle.getString(SQL_INSERT_FILE_NAMES_KEY); + return namesStr.split(","); + } + + private String[] getSQLDeleteStatements() { + ResourceBundle resourceBundle = ResourceBundle.getBundle(SQL_DELETE_CONFIG);// File names from properties + String deleteStatements = resourceBundle.getString(SQL_DELETE_STATEMENTS_KEY); + return deleteStatements.split(","); + } + + /** + * This method deletes data from JPA tables created. This method reads comma + * separated SQL delete statements from DataDeleteSQLs properties files and + * executes them in order. + */ + public void clean() { + // Delete using SQLs + String[] deleteStatements = getSQLDeleteStatements(); + if (deleteStatements.length > 0) { // If configuration is proper with at least one delete Statements + Session session = ((EntityManagerImpl) entityManager).getActiveSession(); + entityManager.getTransaction().begin(); + for (String deleteStatement : deleteStatements) { + System.out.println("Cleaning - " + deleteStatement); + SQLCall sqlCall = new SQLCall(deleteStatement); + + DataModifyQuery query = new DataModifyQuery(); + query.setCall(sqlCall); + session.executeQuery(query); + } + entityManager.getTransaction().commit(); + } else { + System.err.println("Delete configuration file doesn't have any delete statements."); + } + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Cleanup.properties ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Cleanup.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Cleanup.properties index 19f859d..27c4f3d 100644 --- a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Cleanup.properties +++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Cleanup.properties @@ -1,22 +1,22 @@ -#------------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -#------------------------------------------------------------------------------- - -#Config file for deleting the entities. They are deleted in the order provided in the below comma-separated string. -#It is mandatory due to referential constaints. +#------------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +#------------------------------------------------------------------------------- + +#Config file for deleting the entities. They are deleted in the order provided in the below comma-separated string. +#It is mandatory due to referential constaints. delete_queries = DELETE FROM T_NOTE,DELETE FROM T_SALESORDERITEM,DELETE FROM T_MATERIAL_T_STORE,DELETE FROM T_MATERIAL,DELETE FROM T_STORE,DELETE FROM T_SALESORDERHEADER \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Category.properties ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Category.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Category.properties index d9b44e6..6bda640 100644 --- a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Category.properties +++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Category.properties @@ -1,22 +1,22 @@ -#------------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -#------------------------------------------------------------------------------- -query_1 = INSERT INTO T_CATEGORY (CODE,ID,DESC) VALUES('P1',1,'Pen'); -query_2 = INSERT INTO T_CATEGORY (CODE,ID,DESC) VALUES('P2',1,'Pencil'); -query_3 = INSERT INTO T_CATEGORY (CODE,ID,DESC) VALUES('S1',2,'Sharpner'); +#------------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +#------------------------------------------------------------------------------- +query_1 = INSERT INTO T_CATEGORY (CODE,ID,DESC) VALUES('P1',1,'Pen'); +query_2 = INSERT INTO T_CATEGORY (CODE,ID,DESC) VALUES('P2',1,'Pencil'); +query_3 = INSERT INTO T_CATEGORY (CODE,ID,DESC) VALUES('S1',2,'Sharpner'); query_4 = INSERT INTO T_CATEGORY (CODE,ID,DESC) VALUES('E1',3,'Eraser'); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Config.properties ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Config.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Config.properties index 5910123..6a55bab 100644 --- a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Config.properties +++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Config.properties @@ -1,22 +1,22 @@ -#------------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -#------------------------------------------------------------------------------- - -#This file contains names of file which will contain the SQL statements to be executed by Data generator. Add a file name here and it will be picked up by Generator -#You need to put the file names in order you want to get them called. First Entry will be inserted first. +#------------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +#------------------------------------------------------------------------------- + +#This file contains names of file which will contain the SQL statements to be executed by Data generator. Add a file name here and it will be picked up by Generator +#You need to put the file names in order you want to get them called. First Entry will be inserted first. insert_file_names = SQL_Insert_Customer,SQL_Insert_Category,SQL_Insert_SalesOrderHeader,SQL_Insert_Store,SQL_Insert_Material,SQL_Insert_SalesOrderItem,SQL_Insert_Note \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Customer.properties ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Customer.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Customer.properties index fe52d68..a42f23e 100644 --- a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Customer.properties +++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Customer.properties @@ -1,23 +1,23 @@ -#------------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -#------------------------------------------------------------------------------- -query_1 = INSERT INTO T_CUSTOMER (ID , NAME, HOUSE_NUMBER , STREET_NAME, CITY, COUNTRY, PINCODE,CREATED_AT) VALUES(100,'Bob Bryan',7,'5 cross Street', 'London', 'UK', 'E7','2012-11-01 00:01:00'); -query_2 = INSERT INTO T_CUSTOMER (ID , NAME, HOUSE_NUMBER , STREET_NAME, CITY, COUNTRY, PINCODE,CREATED_AT) VALUES(200,'Mike Bryan',7,'8 cross Street', 'New York', 'USA', '10011','2012-11-01 00:01:00'); -query_3 = INSERT INTO T_CUSTOMER (ID , NAME, HOUSE_NUMBER , STREET_NAME, CITY, COUNTRY, PINCODE,CREATED_AT) VALUES(201,'Steve Roger',7,'9 cross Street', 'Mumbai', 'India', '200101','2012-11-01 00:01:00'); -query_4 = INSERT INTO T_CUSTOMER (ID , NAME, HOUSE_NUMBER , STREET_NAME, CITY, COUNTRY, PINCODE,CREATED_AT) VALUES(101,'Pac Man',7,'25 cross Street', 'Frankfurt', 'Germany', '60001','2012-11-01 00:01:00'); +#------------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +#------------------------------------------------------------------------------- +query_1 = INSERT INTO T_CUSTOMER (ID , NAME, HOUSE_NUMBER , STREET_NAME, CITY, COUNTRY, PINCODE,CREATED_AT) VALUES(100,'Bob Bryan',7,'5 cross Street', 'London', 'UK', 'E7','2012-11-01 00:01:00'); +query_2 = INSERT INTO T_CUSTOMER (ID , NAME, HOUSE_NUMBER , STREET_NAME, CITY, COUNTRY, PINCODE,CREATED_AT) VALUES(200,'Mike Bryan',7,'8 cross Street', 'New York', 'USA', '10011','2012-11-01 00:01:00'); +query_3 = INSERT INTO T_CUSTOMER (ID , NAME, HOUSE_NUMBER , STREET_NAME, CITY, COUNTRY, PINCODE,CREATED_AT) VALUES(201,'Steve Roger',7,'9 cross Street', 'Mumbai', 'India', '200101','2012-11-01 00:01:00'); +query_4 = INSERT INTO T_CUSTOMER (ID , NAME, HOUSE_NUMBER , STREET_NAME, CITY, COUNTRY, PINCODE,CREATED_AT) VALUES(101,'Pac Man',7,'25 cross Street', 'Frankfurt', 'Germany', '60001','2012-11-01 00:01:00'); query_5 = INSERT INTO T_CUSTOMER (ID , NAME, HOUSE_NUMBER , STREET_NAME, CITY, COUNTRY, PINCODE,CREATED_AT) VALUES(202,'Bolt Man',7,'25 cross Street', 'Toronto', 'Canada', 'NE','2012-11-01 00:01:00'); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Material.properties ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Material.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Material.properties index 653fafd..7c64d36 100644 --- a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Material.properties +++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Material.properties @@ -1,30 +1,30 @@ -#------------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -#------------------------------------------------------------------------------- - -material_query_1 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, CAT_ID, PRICE, MEASUREMENT_UNIT) values(111, 'My Pen', 'P1', 1, 111.1, 'Piece'); -material_query_2 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, CAT_ID, PRICE, MEASUREMENT_UNIT) values(112, 'My Great Pen', 'P1', 1, 112.1, 'Piece'); -material_query_3 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, CAT_ID, PRICE, MEASUREMENT_UNIT) values(113, 'Super Pen', 'P1', 1, 113.1, 'Piece'); -material_query_4 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, CAT_ID, PRICE, MEASUREMENT_UNIT) values(114, 'Marvel Pen', 'P1', 1, 114.1, 'Piece'); -material_query_5 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, CAT_ID, PRICE, MEASUREMENT_UNIT) values(115, 'Smooth', 'P2', 1, 115.1, 'Piece'); -material_query_6 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, CAT_ID, PRICE, MEASUREMENT_UNIT) values(116, 'Silver Line', 'P2', 1, 116.1, 'Piece'); -material_query_7 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, CAT_ID, PRICE, MEASUREMENT_UNIT) values(117, 'Dark Line', 'P2', 1, 117.1, 'Piece'); -material_query_8 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, CAT_ID, PRICE, MEASUREMENT_UNIT) values(118, 'Sharp', 'S1', 2, 118.1, 'Piece'); -material_query_9 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, CAT_ID, PRICE, MEASUREMENT_UNIT) values(119, 'Cut Sharp', 'S1', 2, 119.1, 'Piece'); -material_query_10 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, CAT_ID, PRICE, MEASUREMENT_UNIT) values(120, 'Thin line', 'S1', 2, 120.1, 'Piece'); +#------------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +#------------------------------------------------------------------------------- + +material_query_1 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, CAT_ID, PRICE, MEASUREMENT_UNIT) values(111, 'My Pen', 'P1', 1, 111.1, 'Piece'); +material_query_2 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, CAT_ID, PRICE, MEASUREMENT_UNIT) values(112, 'My Great Pen', 'P1', 1, 112.1, 'Piece'); +material_query_3 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, CAT_ID, PRICE, MEASUREMENT_UNIT) values(113, 'Super Pen', 'P1', 1, 113.1, 'Piece'); +material_query_4 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, CAT_ID, PRICE, MEASUREMENT_UNIT) values(114, 'Marvel Pen', 'P1', 1, 114.1, 'Piece'); +material_query_5 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, CAT_ID, PRICE, MEASUREMENT_UNIT) values(115, 'Smooth', 'P2', 1, 115.1, 'Piece'); +material_query_6 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, CAT_ID, PRICE, MEASUREMENT_UNIT) values(116, 'Silver Line', 'P2', 1, 116.1, 'Piece'); +material_query_7 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, CAT_ID, PRICE, MEASUREMENT_UNIT) values(117, 'Dark Line', 'P2', 1, 117.1, 'Piece'); +material_query_8 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, CAT_ID, PRICE, MEASUREMENT_UNIT) values(118, 'Sharp', 'S1', 2, 118.1, 'Piece'); +material_query_9 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, CAT_ID, PRICE, MEASUREMENT_UNIT) values(119, 'Cut Sharp', 'S1', 2, 119.1, 'Piece'); +material_query_10 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, CAT_ID, PRICE, MEASUREMENT_UNIT) values(120, 'Thin line', 'S1', 2, 120.1, 'Piece'); material_query_11 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, CAT_ID, PRICE, MEASUREMENT_UNIT) values(121, 'Clean', 'E1', 3, 121.1, 'Piece'); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderHeader.properties ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderHeader.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderHeader.properties index 8b519bf..f27abd4 100644 --- a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderHeader.properties +++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderHeader.properties @@ -1,30 +1,30 @@ -#------------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -#------------------------------------------------------------------------------- - -query1 = insert into T_SALESORDERHEADER (SO_ID, customer_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(1, 100, 'INR', '01', '2012-11-01 00:01:00'); -query2 = insert into T_SALESORDERHEADER (SO_ID, customer_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(2, 100, 'USD', '01', '2013-01-02 00:00:00'); -query3 = insert into T_SALESORDERHEADER (SO_ID, customer_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(3, 100, 'USD', '02', '2013-01-01 14:00:00'); -query4 = insert into T_SALESORDERHEADER (SO_ID, customer_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(4, 200, 'INR', '01', '2013-01-02 00:00:00'); -query5 = insert into T_SALESORDERHEADER (SO_ID, customer_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(5, 201, 'INR', '02', '2013-01-01 14:14:14'); -query6 = insert into T_SALESORDERHEADER (SO_ID, customer_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(6, 101, 'EUR', '01', '2013-01-02 00:00:00'); -query7 = insert into T_SALESORDERHEADER (SO_ID, customer_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(7, 201, 'EUR', '02', '2013-01-01 14:14:00'); -query8 = insert into T_SALESORDERHEADER (SO_ID, customer_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(8, 201, 'GBR', '01', '2013-01-02 00:00:00'); -query9 = insert into T_SALESORDERHEADER (SO_ID, customer_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(9, 101, 'GBR', '02', '2013-01-01 00:00:00'); -query10 = insert into T_SALESORDERHEADER (SO_ID, customer_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(10, 100, 'AUD', '01', '2013-01-01 00:00:00'); +#------------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +#------------------------------------------------------------------------------- + +query1 = insert into T_SALESORDERHEADER (SO_ID, customer_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(1, 100, 'INR', '01', '2012-11-01 00:01:00'); +query2 = insert into T_SALESORDERHEADER (SO_ID, customer_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(2, 100, 'USD', '01', '2013-01-02 00:00:00'); +query3 = insert into T_SALESORDERHEADER (SO_ID, customer_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(3, 100, 'USD', '02', '2013-01-01 14:00:00'); +query4 = insert into T_SALESORDERHEADER (SO_ID, customer_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(4, 200, 'INR', '01', '2013-01-02 00:00:00'); +query5 = insert into T_SALESORDERHEADER (SO_ID, customer_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(5, 201, 'INR', '02', '2013-01-01 14:14:14'); +query6 = insert into T_SALESORDERHEADER (SO_ID, customer_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(6, 101, 'EUR', '01', '2013-01-02 00:00:00'); +query7 = insert into T_SALESORDERHEADER (SO_ID, customer_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(7, 201, 'EUR', '02', '2013-01-01 14:14:00'); +query8 = insert into T_SALESORDERHEADER (SO_ID, customer_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(8, 201, 'GBR', '01', '2013-01-02 00:00:00'); +query9 = insert into T_SALESORDERHEADER (SO_ID, customer_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(9, 101, 'GBR', '02', '2013-01-01 00:00:00'); +query10 = insert into T_SALESORDERHEADER (SO_ID, customer_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(10, 100, 'AUD', '01', '2013-01-01 00:00:00'); query11 = insert into T_SALESORDERHEADER (SO_ID, customer_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(11, 202, 'AUD', '02', '2013-01-02 00:00:00'); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderItem.properties ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderItem.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderItem.properties index 0cc7669..3c0b221 100644 --- a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderItem.properties +++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderItem.properties @@ -1,30 +1,30 @@ -#------------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -#------------------------------------------------------------------------------- - -line_item_query1 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id, delivered ) values(111, 1, 10.1, 1.11, 3, 11,true); -line_item_query2 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id, delivered ) values(112, 1, 111.1, 1.12, 2, 10,true); -line_item_query3 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id, delivered ) values(113, 1, 211.1, 1.13, 3, 9,false); -line_item_query4 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id, delivered ) values(114, 1, 221.1, 1.14, 4, 8,false); -line_item_query5 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id, delivered ) values(115, 1, 651.1, 1.15, 5, 7,true); -line_item_query6 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id, delivered ) values(116, 1, 653.21, 1.16, 6, 6,true); -line_item_query7 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id, delivered ) values(117, 1, 57.11, 1.17, 7, 5,true); -line_item_query8 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id, delivered ) values(118, 1, 52.98, 1.18, 8, 4,false); -line_item_query9 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id, delivered ) values(119, 1, 78.99, 1.19, 9, 3,false); -line_item_query10 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id, delivered ) values(120, 1,69.23, 1.20, 10, 2,true); -line_item_query11 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id , delivered) values(121, 1, 356.65, 1.21, 3, 1,true); +#------------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +#------------------------------------------------------------------------------- + +line_item_query1 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id, delivered ) values(111, 1, 10.1, 1.11, 3, 11,true); +line_item_query2 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id, delivered ) values(112, 1, 111.1, 1.12, 2, 10,true); +line_item_query3 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id, delivered ) values(113, 1, 211.1, 1.13, 3, 9,false); +line_item_query4 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id, delivered ) values(114, 1, 221.1, 1.14, 4, 8,false); +line_item_query5 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id, delivered ) values(115, 1, 651.1, 1.15, 5, 7,true); +line_item_query6 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id, delivered ) values(116, 1, 653.21, 1.16, 6, 6,true); +line_item_query7 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id, delivered ) values(117, 1, 57.11, 1.17, 7, 5,true); +line_item_query8 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id, delivered ) values(118, 1, 52.98, 1.18, 8, 4,false); +line_item_query9 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id, delivered ) values(119, 1, 78.99, 1.19, 9, 3,false); +line_item_query10 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id, delivered ) values(120, 1,69.23, 1.20, 10, 2,true); +line_item_query11 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id , delivered) values(121, 1, 356.65, 1.21, 3, 1,true); http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Store.properties ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Store.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Store.properties index 20860f2..24d1bce 100644 --- a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Store.properties +++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Store.properties @@ -1,30 +1,30 @@ -#------------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -#------------------------------------------------------------------------------- - -store_query_1 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(131, 'Store New York', 11, 'New York Street', 'New York', 'USA','10001'); -store_query_2 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(132, 'Store Bengaluru', 21, 'Whitefield', 'Bengaluru', 'India','560037'); -store_query_3 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(133, 'Store Toronto', 31, 'Toronto Street', 'Toronto', 'Canada','M4J'); -store_query_4 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(134, 'Store Chicago', 41, 'Chicago Street', 'Chicago', 'USA','60625'); -store_query_5 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(135, 'Store Chennai', 51, 'Park Street', 'Chennai', 'India','600021'); -store_query_6 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(136, 'Store Frankfurt', 61, 'Frankfurt Street', 'Frankfurt', 'Germany','60001'); -store_query_7 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(137, 'Store Berlin', 71, 'Berlin Street', 'Berlin', 'Germany','10115'); -store_query_8 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(138, 'Store Hamburg', 81, 'Hamburg Street', 'Hamburg', 'Germany','20001'); -store_query_9 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(139, 'Store New Delhi', 91, 'New Delhi Street', 'New Delhi', 'India','110001'); -store_query_10 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(140, 'Store Ottawa', 100, 'Ottawa Street', 'Ottawa', 'Canada','K0A'); +#------------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +#------------------------------------------------------------------------------- + +store_query_1 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(131, 'Store New York', 11, 'New York Street', 'New York', 'USA','10001'); +store_query_2 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(132, 'Store Bengaluru', 21, 'Whitefield', 'Bengaluru', 'India','560037'); +store_query_3 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(133, 'Store Toronto', 31, 'Toronto Street', 'Toronto', 'Canada','M4J'); +store_query_4 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(134, 'Store Chicago', 41, 'Chicago Street', 'Chicago', 'USA','60625'); +store_query_5 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(135, 'Store Chennai', 51, 'Park Street', 'Chennai', 'India','600021'); +store_query_6 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(136, 'Store Frankfurt', 61, 'Frankfurt Street', 'Frankfurt', 'Germany','60001'); +store_query_7 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(137, 'Store Berlin', 71, 'Berlin Street', 'Berlin', 'Germany','10115'); +store_query_8 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(138, 'Store Hamburg', 81, 'Hamburg Street', 'Hamburg', 'Germany','20001'); +store_query_9 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(139, 'Store New Delhi', 91, 'New Delhi Street', 'New Delhi', 'India','110001'); +store_query_10 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(140, 'Store Ottawa', 100, 'Ottawa Street', 'Ottawa', 'Canada','K0A'); store_query_11 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(141, 'Store Kolkata', 101, 'Kolkata Street', 'Kolkata', 'India','310001'); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-web/src/main/resources/serviceConfig.properties ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/serviceConfig.properties b/odata2-jpa-processor/jpa-web/src/main/resources/serviceConfig.properties index 747277e..774b83a 100644 --- a/odata2-jpa-processor/jpa-web/src/main/resources/serviceConfig.properties +++ b/odata2-jpa-processor/jpa-web/src/main/resources/serviceConfig.properties @@ -1,19 +1,19 @@ -#------------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +#------------------------------------------------------------------------------- showDetailError=true \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-web/src/main/webapp/SalesOrderProcessingMappingModel.xml ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-web/src/main/webapp/SalesOrderProcessingMappingModel.xml b/odata2-jpa-processor/jpa-web/src/main/webapp/SalesOrderProcessingMappingModel.xml index cba7813..e690d0a 100644 --- a/odata2-jpa-processor/jpa-web/src/main/webapp/SalesOrderProcessingMappingModel.xml +++ b/odata2-jpa-processor/jpa-web/src/main/webapp/SalesOrderProcessingMappingModel.xml @@ -1,43 +1,44 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor - license agreements. See the NOTICE file distributed with this work for additional - information regarding copyright ownership. The ASF licenses this file to - you under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of - the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required - by applicable law or agreed to in writing, software distributed under the - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS - OF ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. --> -<JPAEDMMappingModel - xmlns="http://www.apache.org/olingo/odata2/jpa/processor/api/model/mapping"> - <PersistenceUnit name="salesorderprocessing"> - <EDMSchemaNamespace>SalesOrderProcessing</EDMSchemaNamespace> - <JPAEntityTypes> - <JPAEntityType name="SalesOrderHeader"> - <EDMEntityType>SalesOrder</EDMEntityType> - <EDMEntitySet>SalesOrders</EDMEntitySet> - <JPAAttributes> - <JPAAttribute name="soId">ID</JPAAttribute> - <JPAAttribute name="netAmount">NetAmount</JPAAttribute> - <JPAAttribute name="buyerAddress">BuyerAddressInfo</JPAAttribute> - </JPAAttributes> - <JPARelationships> - <JPARelationship name="salesOrderItem">SalesOrderLineItemDetails</JPARelationship> - <JPARelationship name="notes">NotesDetails</JPARelationship> - </JPARelationships> - </JPAEntityType> - <JPAEntityType name="SalesOrderItem"> - <EDMEntityType>SalesOrderLineItem</EDMEntityType> - <EDMEntitySet>SalesOrderLineItems</EDMEntitySet> - <JPAAttributes> - <JPAAttribute name="liId">ID</JPAAttribute> - <JPAAttribute name="soId">SalesOrderID</JPAAttribute> - </JPAAttributes> - <JPARelationships> - <JPARelationship name="salesOrderHeader">SalesOrderHeaderDetails</JPARelationship> - <JPARelationship name="materials">MaterialDetails</JPARelationship> - </JPARelationships> +<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor + license agreements. See the NOTICE file distributed with this work for additional + information regarding copyright ownership. The ASF licenses this file to + you under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of + the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required + by applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. --> +<JPAEDMMappingModel + xmlns="http://www.apache.org/olingo/odata2/jpa/processor/api/model/mapping"> + <PersistenceUnit name="salesorderprocessing"> + <EDMSchemaNamespace>SalesOrderProcessing</EDMSchemaNamespace> + <JPAEntityTypes> + <JPAEntityType name="SalesOrderHeader"> + <EDMEntityType>SalesOrder</EDMEntityType> + <EDMEntitySet>SalesOrders</EDMEntitySet> + <JPAAttributes> + <JPAAttribute name="soId">ID</JPAAttribute> + <JPAAttribute name="netAmount">NetAmount</JPAAttribute> + <JPAAttribute name="buyerAddress">BuyerAddressInfo</JPAAttribute> + </JPAAttributes> + <JPARelationships> + <JPARelationship name="salesOrderItem">SalesOrderLineItemDetails</JPARelationship> + <JPARelationship name="notes">NotesDetails</JPARelationship> + </JPARelationships> + </JPAEntityType> + <JPAEntityType name="SalesOrderItem"> + <EDMEntityType>SalesOrderLineItem</EDMEntityType> + <EDMEntitySet>SalesOrderLineItems</EDMEntitySet> + <JPAAttributes> + <JPAAttribute name="liId">ID</JPAAttribute> + <JPAAttribute name="soId">SalesOrderID</JPAAttribute> + <JPAAttribute name="Material_Id">mID</JPAAttribute> + </JPAAttributes> + <JPARelationships> + <JPARelationship name="salesOrderHeader">SalesOrderHeaderDetails</JPARelationship> + <JPARelationship name="materials">MaterialDetails</JPARelationship> + </JPARelationships> </JPAEntityType> <JPAEntityType name="EmailActivity"> <EDMEntityType>Email</EDMEntityType> @@ -46,16 +47,16 @@ <JPAEntityType name="AppointmentActivity"> <EDMEntityType>Appointment</EDMEntityType> <EDMEntitySet>Appointments</EDMEntitySet> - </JPAEntityType> - </JPAEntityTypes> - <JPAEmbeddableTypes> - <JPAEmbeddableType name="Address"> - <EDMComplexType>AddressInfo</EDMComplexType> - <JPAAttributes> - <JPAAttribute name="houseNumber">Number</JPAAttribute> - <JPAAttribute name="streetName">Street</JPAAttribute> - </JPAAttributes> - </JPAEmbeddableType> - </JPAEmbeddableTypes> - </PersistenceUnit> -</JPAEDMMappingModel> \ No newline at end of file + </JPAEntityType> + </JPAEntityTypes> + <JPAEmbeddableTypes> + <JPAEmbeddableType name="Address"> + <EDMComplexType>AddressInfo</EDMComplexType> + <JPAAttributes> + <JPAAttribute name="houseNumber">Number</JPAAttribute> + <JPAAttribute name="streetName">Street</JPAAttribute> + </JPAAttributes> + </JPAEmbeddableType> + </JPAEmbeddableTypes> + </PersistenceUnit> +</JPAEDMMappingModel> http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-web/src/main/webapp/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-web/src/main/webapp/WEB-INF/web.xml b/odata2-jpa-processor/jpa-web/src/main/webapp/WEB-INF/web.xml index df2bba0..cffa37e 100644 --- a/odata2-jpa-processor/jpa-web/src/main/webapp/WEB-INF/web.xml +++ b/odata2-jpa-processor/jpa-web/src/main/webapp/WEB-INF/web.xml @@ -18,30 +18,30 @@ under the License. --> -<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" - id="WebApp_ID" version="2.5"> - <display-name>OData - JPA Reference</display-name> - <welcome-file-list> - <welcome-file>index.jsp</welcome-file> - </welcome-file-list> - - <servlet> - <servlet-name>JPARefScenarioServlet</servlet-name> - <servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-class> - <init-param> - <param-name>javax.ws.rs.Application</param-name> - <param-value>org.apache.olingo.odata2.core.rest.app.ODataApplication</param-value> - </init-param> - <init-param> - <param-name>org.apache.olingo.odata2.service.factory</param-name> - <param-value>org.apache.olingo.odata2.jpa.processor.ref.web.JPAReferenceServiceFactory</param-value> - </init-param> - <load-on-startup>1</load-on-startup> - </servlet> - <servlet-mapping> - <servlet-name>JPARefScenarioServlet</servlet-name> - <url-pattern>/SalesOrderProcessing.svc/*</url-pattern> - </servlet-mapping> -</web-app> +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" + id="WebApp_ID" version="2.5"> + <display-name>OData - JPA Reference</display-name> + <welcome-file-list> + <welcome-file>index.jsp</welcome-file> + </welcome-file-list> + + <servlet> + <servlet-name>JPARefScenarioServlet</servlet-name> + <servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-class> + <init-param> + <param-name>javax.ws.rs.Application</param-name> + <param-value>org.apache.olingo.odata2.core.rest.app.ODataApplication</param-value> + </init-param> + <init-param> + <param-name>org.apache.olingo.odata2.service.factory</param-name> + <param-value>org.apache.olingo.odata2.jpa.processor.ref.web.JPAReferenceServiceFactory</param-value> + </init-param> + <load-on-startup>1</load-on-startup> + </servlet> + <servlet-mapping> + <servlet-name>JPARefScenarioServlet</servlet-name> + <url-pattern>/SalesOrderProcessing.svc/*</url-pattern> + </servlet-mapping> +</web-app>
