From 5577e005d76df90bc4642abc8ca21baec661e832 Mon Sep 17 00:00:00 2001 From: Mridul Pathak Date: Sun, 31 Jul 2016 06:04:09 +0000 Subject: [PATCH] [OFBIZ-7529] Part 1 of "Delete stale java files from applications and framework". Deleted following files/directories and references - applications/content/src/main/java/org/ofbiz/content/report applications/content/src/main/java/org/ofbiz/content/report/JREntityListIteratorDataSource.java applications/content/src/main/java/org/ofbiz/content/report/JRMapCollectionDataSource.java git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1754634 13f79535-47bb-0310-9956-ffa450edef68 --- OPTIONAL_LIBRARIES | 1 - .../JREntityListIteratorDataSource.java | 85 ------------------- .../report/JRMapCollectionDataSource.java | 75 ---------------- build.gradle | 2 - 4 files changed, 163 deletions(-) delete mode 100644 applications/content/src/main/java/org/apache/ofbiz/content/report/JREntityListIteratorDataSource.java delete mode 100644 applications/content/src/main/java/org/apache/ofbiz/content/report/JRMapCollectionDataSource.java diff --git a/OPTIONAL_LIBRARIES b/OPTIONAL_LIBRARIES index ef5ac06990..a724b5beca 100644 --- a/OPTIONAL_LIBRARIES +++ b/OPTIONAL_LIBRARIES @@ -19,7 +19,6 @@ on the old Undersun SVN server in the specialized/libraries component directory. http://sourceforge.net/projects/jasperreports TO BUILD comment out excludes: framework/webapp/build.xml:org/apache/ofbiz/webapp/view/JasperReportsPdfViewHandler.java,org/apache/ofbiz/webapp/view/JasperReportsXmlViewHandler.java - applications/content/build.xml:org/apache/ofbiz/content/report/JREntityListIteratorDataSource.java,org/apache/ofbiz/content/report/JRMapCollectionDataSource.java - JIMI (used by FOP ): http://java.sun.com/products/jimi diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/report/JREntityListIteratorDataSource.java b/applications/content/src/main/java/org/apache/ofbiz/content/report/JREntityListIteratorDataSource.java deleted file mode 100644 index 852608faf2..0000000000 --- a/applications/content/src/main/java/org/apache/ofbiz/content/report/JREntityListIteratorDataSource.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * 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.ofbiz.content.report; - -import net.sf.jasperreports.engine.JRDataSource; -import net.sf.jasperreports.engine.JRException; -import net.sf.jasperreports.engine.JRField; - -import org.apache.ofbiz.base.util.Debug; -import org.apache.ofbiz.entity.GenericEntity; -import org.apache.ofbiz.entity.GenericEntityException; -import org.apache.ofbiz.entity.util.EntityListIterator; - -/** - * JREntityListIteratorDataSource - */ -public class JREntityListIteratorDataSource implements JRDataSource { - - public static final String module = JREntityListIteratorDataSource.class.getName(); - - private EntityListIterator entityListIterator = null; - private GenericEntity currentEntity = null; - - public JREntityListIteratorDataSource(EntityListIterator entityListIterator) { - this.entityListIterator = entityListIterator; - } - - public boolean next() throws JRException { - if (this.entityListIterator == null) { - return false; - } - Object nextObj = this.entityListIterator.next(); - if (nextObj != null) { - if (nextObj instanceof GenericEntity) { - this.currentEntity = (GenericEntity) nextObj; - } else { - throw new JRException("Current collection object does not seem to be a GenericEntity (or GenericValue or GenericPK)."); - } - return true; - } else { - // nothing left, close here... - try { - this.entityListIterator.close(); - } catch (GenericEntityException e) { - Debug.logError(e, "Error closing EntityListIterator in Jasper Reports DataSource", module); - throw new JRException(e); - } - this.entityListIterator = null; - return false; - } - } - - public Object getFieldValue(JRField jrField) throws JRException { - Object value = null; - if (this.currentEntity != null) { - try { - value = this.currentEntity.get(jrField.getName()); - } catch (IllegalArgumentException e) { - try { - value = this.currentEntity.get(org.apache.ofbiz.entity.model.ModelUtil.dbNameToVarName(jrField.getName())); - } catch (IllegalArgumentException ex) { - throw new JRException("The specified field name [" + jrField.getName() + "] is not a valid field-name for the entity: " + this.currentEntity.getEntityName(), e); - } - } - } - return value; - } -} diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/report/JRMapCollectionDataSource.java b/applications/content/src/main/java/org/apache/ofbiz/content/report/JRMapCollectionDataSource.java deleted file mode 100644 index e3762f03a6..0000000000 --- a/applications/content/src/main/java/org/apache/ofbiz/content/report/JRMapCollectionDataSource.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * 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.ofbiz.content.report; - -import java.util.Collection; -import java.util.Iterator; -import java.util.Map; - -import net.sf.jasperreports.engine.JRDataSource; -import net.sf.jasperreports.engine.JRException; -import net.sf.jasperreports.engine.JRField; - -/** - * JRMapCollectionDataSource - */ -public class JRMapCollectionDataSource implements JRDataSource { - - private Collection data = null; - private Iterator iterator = null; - private Map currentMap = null; - - public JRMapCollectionDataSource(Collection mapCollection) { - this.data = mapCollection; - - if (data != null) { - this.iterator = data.iterator(); - } - } - - public boolean next() throws JRException { - boolean hasNext = false; - - if (this.iterator != null) { - hasNext = this.iterator.hasNext(); - - if (hasNext) { - try { - this.currentMap = (Map) this.iterator.next(); - } catch (Exception e) { - throw new JRException("Current collection object does not seem to be a Map.", e); - } - } - } - - return hasNext; - } - - public Object getFieldValue(JRField jrField) throws JRException { - Object value = null; - - if (currentMap != null) { - value = currentMap.get(jrField.getName()); - } - - return value; - } - -} diff --git a/build.gradle b/build.gradle index e5b7b123fc..659ebc119f 100644 --- a/build.gradle +++ b/build.gradle @@ -213,8 +213,6 @@ excludedJavaSources.add 'org/apache/ofbiz/content/openoffice/OpenOfficeByteArray excludedJavaSources.add 'org/apache/ofbiz/content/openoffice/OpenOfficeByteArrayOutputStream.java' excludedJavaSources.add 'org/apache/ofbiz/content/openoffice/OpenOfficeServices.java' excludedJavaSources.add 'org/apache/ofbiz/content/openoffice/OpenOfficeWorker.java' -excludedJavaSources.add 'org/apache/ofbiz/content/report/JREntityListIteratorDataSource.java' -excludedJavaSources.add 'org/apache/ofbiz/content/report/JRMapCollectionDataSource.java' excludedJavaSources.add 'org/apache/ofbiz/order/thirdparty/taxware/TaxwareException.java' excludedJavaSources.add 'org/apache/ofbiz/order/thirdparty/taxware/TaxwareServices.java' excludedJavaSources.add 'org/apache/ofbiz/order/thirdparty/taxware/TaxwareUTL.java'