From fe67f0ede584d3675e0c615f1360585e73c49c60 Mon Sep 17 00:00:00 2001 From: mogray5 Date: Sun, 7 Oct 2018 15:41:09 -0400 Subject: [PATCH 1/8] Add tests to common lib --- appimage/create_appimage.sh | 1 + debian/control | 3 +- infinitypfm-common/project.xml | 1 + .../infinitypfm/core/conf/TestLangLoader.java | 18 ++++ .../core/data/TestDataFormatUtils.java | 90 +++++++++++++++++++ 5 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 infinitypfm-common/src/test/java/org/infinitypfm/core/conf/TestLangLoader.java create mode 100644 infinitypfm-common/src/test/java/org/infinitypfm/core/data/TestDataFormatUtils.java diff --git a/appimage/create_appimage.sh b/appimage/create_appimage.sh index 5b76794..37a4a69 100755 --- a/appimage/create_appimage.sh +++ b/appimage/create_appimage.sh @@ -34,6 +34,7 @@ cp -L /usr/share/java/commons-lang.jar infinitypfm.AppDir/usr/lib/; cp -L /usr/share/java/ezmorph.jar infinitypfm.AppDir/usr/lib/; cp -L /usr/share/java/commons-collections3.jar infinitypfm.AppDir/usr/lib/; cp -L /usr/share/java/hsqldb.jar infinitypfm.AppDir/usr/lib/; +cp -L /usrshare/java/junit.jar infinitypfm.AppDir/usr/lib/; cp -L /usr/lib/jni/libswt-cairo-gtk-3836.so infinitypfm.AppDir/usr/lib/; cp -L /usr/lib/jni/libswt-atk-gtk-3836.so infinitypfm.AppDir/usr/lib/; cp -L /usr/lib/jni/libswt-awt-gtk-3836.so infinitypfm.AppDir/usr/lib/; diff --git a/debian/control b/debian/control index 03e5e4f..b7c40e6 100644 --- a/debian/control +++ b/debian/control @@ -12,7 +12,8 @@ Build-Depends-Indep: default-jdk, libhsqldb-java, libgettext-commons-java, libcommons-httpclient-java, - libjson-java + libjson-java, + junit Standards-Version: 3.9.8 Homepage: http://infinitypfm.org/ Section: gnome diff --git a/infinitypfm-common/project.xml b/infinitypfm-common/project.xml index 77961e1..5628ddd 100644 --- a/infinitypfm-common/project.xml +++ b/infinitypfm-common/project.xml @@ -12,6 +12,7 @@ + diff --git a/infinitypfm-common/src/test/java/org/infinitypfm/core/conf/TestLangLoader.java b/infinitypfm-common/src/test/java/org/infinitypfm/core/conf/TestLangLoader.java new file mode 100644 index 0000000..80b96a5 --- /dev/null +++ b/infinitypfm-common/src/test/java/org/infinitypfm/core/conf/TestLangLoader.java @@ -0,0 +1,18 @@ +package org.infinitypfm.core.conf; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class TestLangLoader { + + @Test + public void LoadTest() { + + LangLoader loader = new LangLoader(); + assertEquals("Name", loader.getPhrase("1")); + assertEquals("Balance", loader.getPhrase("2")); + + } + +} diff --git a/infinitypfm-common/src/test/java/org/infinitypfm/core/data/TestDataFormatUtils.java b/infinitypfm-common/src/test/java/org/infinitypfm/core/data/TestDataFormatUtils.java new file mode 100644 index 0000000..354f7dd --- /dev/null +++ b/infinitypfm-common/src/test/java/org/infinitypfm/core/data/TestDataFormatUtils.java @@ -0,0 +1,90 @@ +package org.infinitypfm.core.data; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.GregorianCalendar; + +import org.apache.commons.codec.EncoderException; +import org.junit.Test; + +public class TestDataFormatUtils { + + @Test + public void TestFormatting() { + + DataFormatUtil format = new DataFormatUtil(5); + //Month starts at zero for some reason so this is October 5th 2018 + Date date = new GregorianCalendar(2018, 9, 5).getTime(); + format.setDate(date); + + String result = format.getFormat(DataFormatUtil.DefaultDateFormat); + assertEquals("10-05-2018", result); + + result = format.getAmountFormatted(10000000000L); + assertEquals("100.00000", result); + + format.setPrecision(4); + result = format.getAmountFormatted(10000000000L); + assertEquals("100.0000", result); + + result = format.getAmountFormatted(10000090000L); + assertEquals("100.0009", result); + + result = format.getAmountFormatted(10009990000L); + assertEquals("100.0999", result); + + } + + @Test + public void MoneyAndRoundingTest() { + + DataFormatUtil format = new DataFormatUtil(); + double result = format.roundDouble(1123.659D, "####.0"); + assertEquals("1123.7", Double.toString(result)); + + long lResult = DataFormatUtil.moneyToLong("(100.60)"); + assertEquals(-10060000000L, lResult); + + lResult = DataFormatUtil.moneyToLong("100.60"); + assertEquals(10060000000L, lResult); + + BigDecimal rBigDecimal = format.strictDivide("500", "500", 2); + assertEquals("1.00", rBigDecimal.toString()); + + rBigDecimal = format.strictMultiply("1", "0"); + assertEquals("0", rBigDecimal.toString()); + } + + @Test + public void EncodingTest() { + + DataFormatUtil format = new DataFormatUtil(); + EncoderException error = null; + String result = null; + + try { + result = format.urlEncode("aslash/and spaces"); + + } catch (EncoderException e) { + error = e; + } + + assertNull(error); + assertEquals("aslash%2Fand+spaces", result); + + result = format.urlDecode(result); + + assertEquals("aslash/and spaces", result); + + Date date = new GregorianCalendar(2018, 9, 5).getTime(); + format.setDate(date); + + result = format.urlEncode(date); + + assertEquals("10-05-2018", result); + + } +} From e7302ca20d536563e20cc7bcb4958d31cd35a54b Mon Sep 17 00:00:00 2001 From: mogray5 Date: Sat, 13 Oct 2018 11:19:16 -0400 Subject: [PATCH 2/8] More cleanup. Add missing licences, add comments. --- .../infinitypfm/core/conf/LangInstance.java | 9 +- .../org/infinitypfm/core/conf/LangLoader.java | 5 +- .../infinitypfm/core/conf/PfmSettings.java | 61 ++---- .../org/infinitypfm/core/conf/lang_en.xml | 173 ------------------ .../org/infinitypfm/core/data/Account.java | 12 +- .../infinitypfm/core/data/AccountHash.java | 11 +- .../org/infinitypfm/core/data/Accounts.java | 18 ++ .../org/infinitypfm/core/data/Budget.java | 16 +- .../infinitypfm/core/data/BudgetBalance.java | 10 +- .../infinitypfm/core/data/BudgetBalances.java | 23 +++ .../infinitypfm/core/data/BudgetDetail.java | 13 +- .../infinitypfm/core/data/BudgetDetails.java | 22 +++ .../org/infinitypfm/core/data/Budgets.java | 22 +++ .../org/infinitypfm/core/data/Connector.java | 1 + .../org/infinitypfm/core/data/Currencies.java | 25 ++- .../org/infinitypfm/core/data/Currency.java | 8 +- .../infinitypfm/core/data/CurrencyMethod.java | 19 +- .../core/data/CurrencyMethods.java | 22 +++ .../infinitypfm/core/data/DataFormatUtil.java | 106 ++++++++++- 19 files changed, 288 insertions(+), 288 deletions(-) delete mode 100644 infinitypfm-common/src/main/java/org/infinitypfm/core/conf/lang_en.xml diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/conf/LangInstance.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/conf/LangInstance.java index bb6cbe7..69f69df 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/conf/LangInstance.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/conf/LangInstance.java @@ -18,6 +18,12 @@ */ package org.infinitypfm.core.conf; +/** + * Singleton for loading translations. + * + * TODO: This should replace MM.phrases + * + */ public class LangInstance { private static LangInstance instance = null; @@ -31,15 +37,12 @@ public static LangInstance getInstance() { if (instance == null) { instance = new LangInstance(); - } return instance; - } public String getPhrase(String index) { - return this.lang.getPhrase(index); } diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/conf/LangLoader.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/conf/LangLoader.java index 76cbbce..28d3fd9 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/conf/LangLoader.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/conf/LangLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2017 Wayne Gray All rights reserved + * Copyright (c) 2005-2018 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -26,6 +26,9 @@ /** + * This class loads a HashMap of words and phrases in the user's local language and is + * referenced throughout the application. + * * @author Wayne Gray */ public class LangLoader { diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/conf/PfmSettings.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/conf/PfmSettings.java index c46d486..729ffeb 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/conf/PfmSettings.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/conf/PfmSettings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2012 Wayne Gray All rights reserved + * Copyright (c) 2005-2018 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -19,62 +19,29 @@ package org.infinitypfm.core.conf; -import java.io.File; - - /** - * @author wayne + * Common settings used in infinitypfm-common. + * + * @author Wayne Gray * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates */ public class PfmSettings { /* - * Program Constants + * Lookup key for Weekly transaction recurrence phrase. */ - public static final String APPTITLE = "Infinity PFM"; - public static final String APPVERSION = "0.7.0"; - public static final String APPLINK = "https://www.infinitypfm.org"; - public static final String APPLICENCE = "GNU General Public License v3"; - public static final String APPCOPYRIGHT = "(c) 2005-2013 by Wayne Gray"; - //public static final String APPPATH = System.getProperty("INFINITYPFM_HOME") + File.separator; - public static final String APPPATH = "blah"; - - public static final String ACT_TYPE_EXPENSE = "Expense"; - public static final String ACT_TYPE_LIABILITY = "Liability"; - public static final String ACT_TYPE_INCOME = "Income"; - - //public static String DATPATH = System.getProperty("INFINITYPFM_DATA") + File.separator; - public static String DATPATH = "/var/lib/infinitypfm"; - public static String HELPPATH = "file://///" + PfmSettings.APPPATH + - "docs" + File.separator + "index.html"; - public static String REPORTFOLDERURL = "file://///" + PfmSettings.APPPATH + - "reports" + File.separator; - public static String REPORTFOLDER = PfmSettings.APPPATH + - "reports" + File.separator; - - public static String MOCK_FOLDER = "/tmp/"; - public static final String RECUR_WEEKLY = "147"; + /* + * Lookup key for Bi-weekly transaction recurrence phrase. + */ public static final String RECUR_BIWEEKLY = "149"; + /* + * Lookup key for Monthly transaction recurrence phrase. + */ public static final String RECUR_MONTHLY = "146"; + /* + * Lookup key for Annual transaction recurrence phrase. + */ public static final String RECUR_YEARLY = "148"; - public static final int THIS_MONTH = 4; - public static final int LAST_MONTH = 5; - - public static final int MENU_REPORTS_MONTHLY_BALANCE = 100; - public static final int MENU_REPORTS_PRIOR_MONTHLY_BALANCE = 101; - public static final int MENU_REPORTS_ACCOUNT_HISTORY = 102; - public static final int MENU_REPORTS_BUDGET_PERFORMANCE = 103; - public static final int MENU_REPORTS_BUDGET_PERFORMANCE_ACT = 104; - public static final int MENU_REPORTS_INCOME_VS_EXPENSE = 105; - - public static final String REPORT_MONTHLY_BALANCES = "getReportMonthlyBalances"; - public static final String REPORT_ACCOUNT_HISTORY = "getReportAccountHistory"; - public static final String REPORT_BUDGET_VS_EXPENSE = "getBudgetVsExpenseByMonth"; - public static final String REPORT_BUDGET_VS_EXPENSE_MONTHLY = "getBudgetVsExpenseByMonthAndAccount"; - public static final String REPORT_INCOME_VS_EXPENSE = "getIncomeVsExpense"; - } diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/conf/lang_en.xml b/infinitypfm-common/src/main/java/org/infinitypfm/core/conf/lang_en.xml deleted file mode 100644 index b2a6d00..0000000 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/conf/lang_en.xml +++ /dev/null @@ -1,173 +0,0 @@ - - - - Name - Balance - Log Setup - Cancel - OK - Remove - New Account - Bank Accounts - Expense Accounts - Income Accounts - Import - Yes - No - Commit - Import Account - Connection Error - Log - Import Transactions - File - Location - File format not supported - Liabilities - Logs - Date - No such source file: - FileCopy: source file - is unreadable - FileCopy: destination - file is unwritable - already exists. Overwrite? (Y/N) - FileCopy: copy cancelled. - is not a file - directory does not exist - directory is unwritable - does not exist! - Error reading/writing files - Error applying updates. Error is: - Save - Invalid account name - Invalid account type - Memo - Offset Account - Refresh All - Select All - Add - Credit - Refresh - Debit - Delete failed, account has a balance - Connection - Delete Account - Liability Accounts - Close View - Amount - Type - deleted - Exit - Edit - Contents - About - Help - Personal Finance - No bank accounts exist - Console - Clear Console - Options - Setup - Language File - You must restart for changes to take affect. - Version - Visit - This product contains software from the following: - The Apache Software Foundation (http://www.apache.org) - HSQL Database Engine (http://www.hsqldb.org/) - Are you sure you want to delete account? - Error stopping server - Updates found for InfinityPFM. They will now be applied. - Transaction Entry - User Name - Password - New Account Dialog - Checking for updates - Starting Balance - is not connected to - View - Ready - Close Console - Saving transactions... - Do you want to commit these transactions? - Current Year - added - Account - Expenses - Over/Under Month - Updates applied! - Budgets - New Budget - Month - Budget - Configure - - Error - Enter budget name. - Budget name invalid - January - February - March - April - May - June - July - August - September - October - November - December - Income - Profit/Loss - Add to budget - Account already in budget - Reports - Monthly Balances - Eclipse.org (http://www.eclipse.org/) - Actual - Prior Month - Save budget values to all months - Budget values have been applied to all months. - Over/Under Year - Budget Remaining - Reset estimated budget remaining - Add Accounts From List - Default Accounts - Are you sure you want to add these accounts? - Leaving the offset account blank will skip the row. - Account History - Avg Weekly - Budget Weekly - Select Account - Remove From Budget - Report save successful - Add Recurring Transaction - Name - Frequency - Next Run Date - Monthly - Weekly - Yearly - Bi-Weekly - Pending Transactions - Delete - Saved Recurring Transactions - Are you sure you want to delete this recurring transaction? - Processing recurring transactions - Manage Recurring Transactions - Term(Mths) - APR - Backup - Restore - Database - Select a directory - Database backed up to: - Select Date - Budget Performance - Select Budget - Year - - diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Account.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Account.java index 57b4e3c..d9ca896 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Account.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Account.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2011 Wayne Gray All rights reserved + * Copyright (c) 2005-2018 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -22,10 +22,8 @@ import java.io.Serializable; /** - * @author wayne + * POJO for accounts. * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates */ public class Account implements Serializable { @@ -40,15 +38,9 @@ public class Account implements Serializable { private String currencyName = null; private String isoCode = null; - - /** - * - */ public Account() { super(); } - - /** * @return Returns the actId. diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/AccountHash.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/AccountHash.java index d0ba161..d9f23ee 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/AccountHash.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/AccountHash.java @@ -21,10 +21,9 @@ import java.util.*; /** - * @author wayne - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates + * Helper class to create a HashMap of a list + * of accounts and allow searching for accounts + * by name. */ public class AccountHash { @@ -32,14 +31,10 @@ public class AccountHash { @SuppressWarnings("rawtypes") private List actList = null; - /** - * - */ public AccountHash(@SuppressWarnings("rawtypes") List list) { super(); actList = list; HashAccounts(); - } private void HashAccounts(){ diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Accounts.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Accounts.java index 63d033d..af955bf 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Accounts.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Accounts.java @@ -1,3 +1,21 @@ +/* + * Copyright (c) 2005-2018 Wayne Gray All rights reserved + * + * This file is part of Infinity PFM. + * + * Infinity PFM is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Infinity PFM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Infinity PFM. If not, see . +*/ package org.infinitypfm.core.data; public class Accounts { diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Budget.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Budget.java index a3bd4cd..141516b 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Budget.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Budget.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2011 Wayne Gray All rights reserved + * Copyright (c) 2005-2018 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -24,31 +24,20 @@ /** - * @author wayne + * POJO for Budgets. * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates */ public class Budget implements Serializable { - /** - * - */ private static final long serialVersionUID = 1L; int budgetId = -1; String budgetName = null; BudgetDetail[] budgetDetail = null; - /** - * - */ public Budget() { super(); - // TODO Auto-generated constructor stub } - - /** * @return Returns the budgetId. */ @@ -74,7 +63,6 @@ public void setBudgetName(String budgetName) { this.budgetName = budgetName; } - /** * @return Returns the budgetDetail. */ diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetBalance.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetBalance.java index fa47199..6881834 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetBalance.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetBalance.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2011 Wayne Gray All rights reserved + * Copyright (c) 2005-2018 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -24,7 +24,7 @@ import org.infinitypfm.core.data.IReportable; /** - * @author wayne + * POJO for storing budget totals. * */ @JsonIgnoreProperties(ignoreUnknown = true) @@ -106,9 +106,6 @@ public void setActName(String actName) { this.actName = actName; } - /* (non-Javadoc) - * @see org.infinitypfm.core.data.IReportable#getHeaderRow() - */ @Override public String getHeaderRow() { StringBuilder sb = new StringBuilder(); @@ -120,9 +117,6 @@ public String getHeaderRow() { return sb.toString(); } - /* (non-Javadoc) - * @see org.infinitypfm.core.data.IReportable#toReportRow() - */ @Override public String toReportRow() { diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetBalances.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetBalances.java index 747e1a6..fc0d102 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetBalances.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetBalances.java @@ -1,5 +1,28 @@ +/* + * Copyright (c) 2005-2018 Wayne Gray All rights reserved + * + * This file is part of Infinity PFM. + * + * Infinity PFM is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Infinity PFM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Infinity PFM. If not, see . +*/ + package org.infinitypfm.core.data; +/** + * POJO for storing a list of BudgetBalances. + * + */ public class BudgetBalances { private BudgetBalance[] budgetBalances; diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetDetail.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetDetail.java index 04868b7..e6c4b31 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetDetail.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetDetail.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2011 Wayne Gray All rights reserved + * Copyright (c) 2005-2018 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -21,16 +21,11 @@ import java.io.Serializable; /** - * @author Wayne Gray + * POJO for budget data by account. * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates */ public class BudgetDetail implements Serializable { - /** - * - */ private static final long serialVersionUID = 1L; int budgetId = -1; int mth = 0; @@ -40,12 +35,8 @@ public class BudgetDetail implements Serializable { long actBalance = 0; long amount = 0; - /** - * - */ public BudgetDetail() { super(); - // TODO Auto-generated constructor stub } /** diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetDetails.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetDetails.java index 5c6f8af..4a151fd 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetDetails.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetDetails.java @@ -1,5 +1,27 @@ +/* + * Copyright (c) 2005-2018 Wayne Gray All rights reserved + * + * This file is part of Infinity PFM. + * + * Infinity PFM is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Infinity PFM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Infinity PFM. If not, see . +*/ package org.infinitypfm.core.data; +/** + * POJO for storing a list of BudgetDetail objects. + * + */ public class BudgetDetails { private BudgetDetail[] budgetDetails; diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Budgets.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Budgets.java index 0a81ca6..dc0f3a8 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Budgets.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Budgets.java @@ -1,5 +1,27 @@ +/* + * Copyright (c) 2005-2018 Wayne Gray All rights reserved + * + * This file is part of Infinity PFM. + * + * Infinity PFM is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Infinity PFM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Infinity PFM. If not, see . +*/ package org.infinitypfm.core.data; +/** + * POJO for storing a list of Budget objects. + * + */ public class Budgets { private Budget[] budgets; diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Connector.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Connector.java index 39eaf5f..419b399 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Connector.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Connector.java @@ -19,6 +19,7 @@ package org.infinitypfm.core.data; +@Deprecated public class Connector { private long connectorId; diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Currencies.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Currencies.java index 97212b4..1fadc74 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Currencies.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Currencies.java @@ -1,5 +1,27 @@ +/* + * Copyright (c) 2005-2018 Wayne Gray All rights reserved + * + * This file is part of Infinity PFM. + * + * Infinity PFM is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Infinity PFM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Infinity PFM. If not, see . +*/ package org.infinitypfm.core.data; +/** + * POJO for storing a list of CurrencyObjects + * + */ public class Currencies { private Currency[] currencyList; @@ -13,7 +35,4 @@ public void setCurrencyList(Currency[] retVal) { currencyList = retVal; } - - - } diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Currency.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Currency.java index 5ef5446..ebfc992 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Currency.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/Currency.java @@ -1,6 +1,5 @@ - /* - * Copyright (c) 2005-2011 Wayne Gray All rights reserved + * Copyright (c) 2005-2018 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -23,6 +22,10 @@ import java.io.Serializable; import java.util.Date; +/** + * POJO defining a Currency. + * + */ public class Currency implements Serializable { @@ -72,5 +75,4 @@ public void setIsDefault(String isDefault) { this.isDefault = isDefault; } - } diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/CurrencyMethod.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/CurrencyMethod.java index 24801cc..d01c2ac 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/CurrencyMethod.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/CurrencyMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2011 Wayne Gray All rights reserved + * Copyright (c) 2005-2018 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -20,11 +20,20 @@ import java.io.Serializable; +/** + * POJO for defining a CurrencyMethod. + * + * Currency Method are a mechanism for looking + * up the exchange rate for a currency. + * + * The lookup requires a HTTP address and + * the results need to be JSON. + * + * They are user defined. + * + */ public class CurrencyMethod implements Serializable{ - /** - * - */ private static final long serialVersionUID = 1L; private long currencyID; @@ -57,6 +66,4 @@ public void setMethodPath(String methodPath) { this.methodPath = methodPath; } - - } diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/CurrencyMethods.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/CurrencyMethods.java index dee978e..965015c 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/CurrencyMethods.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/CurrencyMethods.java @@ -1,5 +1,27 @@ +/* + * Copyright (c) 2005-2018 Wayne Gray All rights reserved + * + * This file is part of Infinity PFM. + * + * Infinity PFM is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Infinity PFM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Infinity PFM. If not, see . +*/ package org.infinitypfm.core.data; +/** + * POJO for storing CurrencyMethod objects. + * + */ public class CurrencyMethods { private CurrencyMethod[] currencyMethods; diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/DataFormatUtil.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/DataFormatUtil.java index fb06042..bfbda87 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/DataFormatUtil.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/DataFormatUtil.java @@ -37,7 +37,8 @@ import org.infinitypfm.core.conf.PfmSettings; /** - * @author Wayne Gray + * Helper methods for working with dates, number formats, + * and rounding. * */ public class DataFormatUtil implements Serializable { @@ -66,6 +67,12 @@ public DataFormatUtil() { formatter = new DecimalFormat(NumberFormat.getDefault()); } + /** + * + * @param precision set precision level of numbers. + * Bitcoin and related currencies can be up to eight + * decimal places. + */ public DataFormatUtil(int precision) { today = new GregorianCalendar(); calendar = new GregorianCalendar(); @@ -74,17 +81,35 @@ public DataFormatUtil(int precision) { formatter = new DecimalFormat(NumberFormat.getDefault(_precision)); } + /** + * Use a date created external to this class. + * + * @param dt Date to format + */ public void setDate(Date dt) { date = dt; calendar.setTime(date); } + /** + * Use a date with passed year and month. + * + * @param yr Year + * @param month Month 1-12 + */ public void setDate(int yr, int month) { calendar = new GregorianCalendar(yr, month - 1, 1); date = calendar.getTime(); } + + /** + * Convert the passed string to a date + * using the current format setting. + * + * @param sDate String to parse into a date + */ public void setDate(String sDate) { try { @@ -100,6 +125,13 @@ public void setDate(String sDate) { } + /** + * Convert the passed string to a date + * using the passed format setting. + * + * @param sDate String to parse into a date + * @param format Format tu use for parsing the date + */ public void setDate(String sDate, String format) { dateFmt = new SimpleDateFormat(format); setDate(sDate); @@ -114,6 +146,13 @@ public int getMonth() { } + /** + * Return the full name for month of the current + * date setting. January, February etc. + * + * @param offset Java offsetted month to return 0-11 + * @return + */ public String getMonthName(int offset) { return monthName[calendar.get(Calendar.MONTH) + offset]; } @@ -138,6 +177,13 @@ public String getFormat(String format) { return dateFmt.format(this.getToday()); } + /** + * Format a number using default format with passed + * precision. + * + * @param amount in long format + * @return Formatted amount as string + */ public String getAmountFormatted(long amount) { formatter.applyPattern(NumberFormat.getDefault(_precision)); @@ -148,6 +194,14 @@ public String getAmountFormatted(long amount) { } + /** + * Format a number using passed format with passed + * precision. + * + * @param amount in long format + * @param format format to use + * @return Formatted amount as a string + */ public String getAmountFormatted(long amount, String format) { formatter.applyPattern(format); @@ -158,11 +212,25 @@ public String getAmountFormatted(long amount, String format) { return formatter.format(amtD); } + /** + * Round passed double using the passed format. + * + * @param val number to be rounded + * @param format format to use + * @return rounded double + */ public double roundDouble(double val, String format) { DecimalFormat twoDForm = new DecimalFormat(format); return Double.valueOf(twoDForm.format(val)); } + /** + * Move a date forward to a future date. Used in recurring + * transactions + * + * @param frequency as string "Monthly, Daily, etc" + * @return Future date + */ public Date setNext(String frequency) { LangInstance lang = LangInstance.getInstance(); @@ -184,6 +252,13 @@ public Date getToday() { return today.getTime(); } + /** + * Convert a money value formatted as a string back into + * long format which is what's stored in the DB. + * + * @param val money value as a String + * @return money value converted long format + */ public static long moneyToLong(String val) { if (val.startsWith("(")) { @@ -197,12 +272,27 @@ public static long moneyToLong(String val) { } + /** + * Convert a money value formatted as a BigDecimal back into + * long format which is what's stored in the DB. + * + * @param val money value as BigDecimal + * @return money value converted long format + */ public static long moneyToLong(BigDecimal val) { return val.multiply(new BigDecimal("100000000")).longValue(); } + /** + * Divide two money values without losing precision. + * + * @param numerator BigDecimal + * @param denominator BigDecimal + * @param scale Desired decimal precision of the output + * @return BigDecimal of divided result + */ public BigDecimal strictDivide(String numerator, String denominator, int scale) { @@ -214,6 +304,14 @@ public BigDecimal strictDivide(String numerator, String denominator, } + /** + * Multiply two money values passed as strings without losing + * precision. + * + * @param x money value as string + * @param y value as string + * @return BigDecimal of multiplied result + */ public BigDecimal strictMultiply(String x, String y) { BigDecimal valX = new BigDecimal(x); @@ -238,6 +336,12 @@ public String urlEncode(String orig) throws EncoderException{ return result; } + /** + * URL Encode a date value + * + * @param dt Date + * @return String result + */ public String urlEncode(Date dt) { if (dt == null) return ""; From c7fd18cc7f7d4706f846ff08e3ed9bbef234ac09 Mon Sep 17 00:00:00 2001 From: mogray5 Date: Sun, 23 Dec 2018 15:06:27 -0500 Subject: [PATCH 3/8] Fix for 11: Transaction Entry changing offset accounts causes app to crash and 10: Transaction Entry not working for liability to liability accounts --- .../main/java/org/infinitypfm/core/data/BudgetBalance.java | 5 +---- .../java/org/infinitypfm/core/data/DataFormatUtil.java | 3 +++ .../java/org/infinitypfm/core/data/MonthlyBalance.java | 7 ++----- .../org/infinitypfm/core/data/MonthlyBalanceByType.java | 7 ++----- .../src/main/java/org/infinitypfm/graphics/ImageMap.java | 3 +-- .../org/infinitypfm/ui/view/dialogs/TransactionDialog.java | 5 ++++- 6 files changed, 13 insertions(+), 17 deletions(-) diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetBalance.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetBalance.java index 6881834..204e3eb 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetBalance.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetBalance.java @@ -20,14 +20,11 @@ import java.io.Serializable; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.infinitypfm.core.data.IReportable; - /** * POJO for storing budget totals. * */ -@JsonIgnoreProperties(ignoreUnknown = true) +//@JsonIgnoreProperties(ignoreUnknown = true) public class BudgetBalance implements Serializable, IReportable { diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/DataFormatUtil.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/DataFormatUtil.java index bfbda87..76ac702 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/DataFormatUtil.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/DataFormatUtil.java @@ -266,6 +266,9 @@ public static long moneyToLong(String val) { val = val.replaceAll("\\(", "\\-").replaceAll("\\)", ""); } + // Strip off commas + val = val.replaceAll("\\,", ""); + BigDecimal newVal = new BigDecimal(val); return moneyToLong(newVal); diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/MonthlyBalance.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/MonthlyBalance.java index 1655d1c..8fcf702 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/MonthlyBalance.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/MonthlyBalance.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2011 Wayne Gray All rights reserved + * Copyright (c) 2005-2018 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -20,9 +20,6 @@ import java.io.Serializable; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.infinitypfm.core.data.IReportable; - /** * @author wayne @@ -30,7 +27,7 @@ * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ -@JsonIgnoreProperties(ignoreUnknown = true) +//@JsonIgnoreProperties(ignoreUnknown = true) public class MonthlyBalance implements Serializable, IReportable { /** diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/MonthlyBalanceByType.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/MonthlyBalanceByType.java index 9f9003b..21560af 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/MonthlyBalanceByType.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/MonthlyBalanceByType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2011 Wayne Gray All rights reserved + * Copyright (c) 2005-2018 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -20,10 +20,7 @@ import java.io.Serializable; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.infinitypfm.core.data.IReportable; - -@JsonIgnoreProperties(ignoreUnknown = true) +//@JsonIgnoreProperties(ignoreUnknown = true) public class MonthlyBalanceByType implements Serializable, IReportable{ private static final long serialVersionUID = 1919973868244212053L; diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/ImageMap.java b/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/ImageMap.java index f1469f7..cbf3c5d 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/ImageMap.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/ImageMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2017 Wayne Gray All rights reserved + * Copyright (c) 2005-2018 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -78,7 +78,6 @@ public void QZDispose() { for (int i = 0; i < aFiles.size(); i++) { item = (ImageData) hm.get(aFiles.get(i)); if (item != null) { - // item.dispose(); } } } diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/TransactionDialog.java b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/TransactionDialog.java index cd69a53..06ba5b3 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/TransactionDialog.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/TransactionDialog.java @@ -404,7 +404,8 @@ private boolean OffsetValidate() { try { if (txtOffset.getText().length()>0) { - float amount = new Float(txtOffset.getText()); + + float amount = new Float(txtOffset.getText().replaceAll("\\,", "")); if (amount != 0){ if (cmbOffset.getText().length() > 0) { amount = new Float(txtExRate.getText()); @@ -543,6 +544,8 @@ public void widgetSelected(SelectionEvent e){ cmbOffset.clearSelection(); txtOffset.setText("0"); txtExRate.setText("1"); + } else { + InfinityPfm.LogMessage(MM.PHRASES.getPhrase("234"), true); } } }; From f94ad81fd9fe2bb6bb4581bd33fe8681717de047 Mon Sep 17 00:00:00 2001 From: mogray5 Date: Fri, 28 Dec 2018 13:54:04 -0500 Subject: [PATCH 4/8] Updates to debian build --- debian/infinitypfm-ui.classpath | 1 + debian/infinitypfm-ui.install | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 debian/infinitypfm-ui.classpath diff --git a/debian/infinitypfm-ui.classpath b/debian/infinitypfm-ui.classpath new file mode 100644 index 0000000..d14a766 --- /dev/null +++ b/debian/infinitypfm-ui.classpath @@ -0,0 +1 @@ +infinitypfm-ui.jar /usr/share/java/swt.jar /usr/share/java/hsqldb.jar /usr/share/java/ibatis.jar /usr/share/java/commons-io.jar /usr/share/java/commons-compress.jar /usr/share/java/gettext-commons.jar /usr/share/java/commons-httpclient.jar /usr/share/java/commons-beanutils.jar /usr/share/java/commons-logging.jar /usr/share/java/json-lib.jar /usr/share/java/commons-lang.jar /usr/share/java/ezmorph.jar /usr/share/java/commons-collections3.jar /usr/share/java/commons-configuration.jar /usr/share/java/commons-csv.jar /usr/share/java/commons-codec.jar /usr/share/java/infinitypfm-btc.jar /usr/share/java/infinitypfm-common.jar \ No newline at end of file diff --git a/debian/infinitypfm-ui.install b/debian/infinitypfm-ui.install index c6a808f..dc2cbdf 100644 --- a/debian/infinitypfm-ui.install +++ b/debian/infinitypfm-ui.install @@ -1,2 +1,2 @@ -infinitypfm/infinitypfm.desktop /usr/share/applications -infinitypfm/infinitypfm.xpm /usr/share/pixmaps +infinitypfm-ui/infinitypfm.desktop /usr/share/applications +infinitypfm-ui/infinitypfm.xpm /usr/share/pixmaps From fd9c1827595812a2a630df55248f6344d79839d1 Mon Sep 17 00:00:00 2001 From: mogray5 Date: Sat, 29 Dec 2018 18:27:45 -0500 Subject: [PATCH 5/8] Start on generic download bundle for windows/linux. Fix for db creation error on first start. --- appimage/create_appimage.sh | 2 +- archive/create_archive.sh | 71 +++++++++++++++++++ archive/infinitypfm.bat | 2 + archive/infinitypfm.sh | 8 +++ .../infinitypfm/core/data/SqlMapConfig.xml | 2 +- .../org/infinitypfm/client/InfinityPfm.java | 2 +- .../main/java/org/infinitypfm/conf/MM.java | 2 +- .../org/infinitypfm/data/InfinityUpdates.java | 2 +- 8 files changed, 86 insertions(+), 5 deletions(-) create mode 100755 archive/create_archive.sh create mode 100644 archive/infinitypfm.bat create mode 100755 archive/infinitypfm.sh diff --git a/appimage/create_appimage.sh b/appimage/create_appimage.sh index 37a4a69..f68066b 100755 --- a/appimage/create_appimage.sh +++ b/appimage/create_appimage.sh @@ -7,7 +7,7 @@ read response sudo apt-get install libibatis-java libcommons-io-java libcommons-compress-java libhsqldb-java libgettext-commons-java libcommons-httpclient-java libjson-java libmail-java libcommons-csv-java sudo apt-get install libswt-gtk-3-java libswt-webkit-gtk-3-jni libswt-cairo-gtk-3-jni -sudo apt-get install bzr ant default-jdk +sudo apt-get install ant default-jdk mkdir -p infinitypfm.AppDir/usr/bin mkdir -p infinitypfm.AppDir/usr/lib diff --git a/archive/create_archive.sh b/archive/create_archive.sh new file mode 100755 index 0000000..75a0c60 --- /dev/null +++ b/archive/create_archive.sh @@ -0,0 +1,71 @@ +# Pre-Step - Download SWT 3.8.2 for Windows 64bit. +#http://archive.eclipse.org/eclipse/downloads/drops/R-3.8.2-201301310800/download.php?dropFile=swt-3.8.2-win32-win32-x86_64.zip + +WIN_SWT_LOCAL=/tmp/swt-3.8.2-win32-win32-x86_64 + +# Create Archive Bundle on Ubuntu 18.04 LTS + +echo -e "\n +Enter release version to use when naming the archive: \n" +read response + +echo -e "\n +Install required libraries? (y|n): \n" +read doinstall + +rm -rf infinitypfm.archive +rm -rf infinitypfm-$response +rm infinitypfm-$response.zip + +if [[ "${doinstall}" == *"y"* ]] +then + sudo apt install libibatis-java libcommons-io-java libcommons-compress-java libhsqldb-java libgettext-commons-java libcommons-httpclient-java libjson-java libmail-java libcommons-csv-java + sudo apt install libswt-gtk-3-java libswt-webkit-gtk-3-jni libswt-cairo-gtk-3-jni + sudo apt install ant default-jdk +fi + +mkdir -p infinitypfm.archive/bin +mkdir -p infinitypfm.archive/lib + +ant + +cp archive/infinitypfm.bat infinitypfm.archive/bin; +cp archive/infinitypfm.sh infinitypfm.archive/bin; +chmod a+x infinitypfm.archive/bin; +#cp infinitypfm-ui/infinitypfm.desktop infinitypfm.archive/; +#cp infinitypfm-ui/infinitypfm.xpm infinitypfm.archive/; +cp *.jar infinitypfm.archive/lib/; +cp -L /usr/share/java/swt.jar infinitypfm.archive/lib/; +cp -L $WIN_SWT_LOCAL/swt.jar infinitypfm.archive/lib/swt_win.jar; +cp -L /usr/share/java/ibatis.jar infinitypfm.archive/lib/; +cp -L /usr/share/java/commons-io.jar infinitypfm.archive/lib/; +cp -L /usr/share/java/commons-compress.jar infinitypfm.archive/lib/; +cp -L /usr/share/java/commons-codec.jar infinitypfm.archive/lib/; +cp -L /usr/share/java/gettext-commons.jar infinitypfm.archive/lib/; +cp -L /usr/share/java/commons-httpclient.jar infinitypfm.archive/lib/; +cp -L /usr/share/java/commons-beanutils.jar infinitypfm.archive/lib/; +cp -L /usr/share/java/commons-configuration.jar infinitypfm.archive/lib/; +cp -L /usr/share/java/commons-logging.jar infinitypfm.archive/lib/; +cp -L /usr/share/java/json-lib.jar infinitypfm.archive/lib/; +cp -L /usr/share/java/commons-lang.jar infinitypfm.archive/lib/; +cp -L /usr/share/java/ezmorph.jar infinitypfm.archive/lib/; +cp -L /usr/share/java/commons-collections3.jar infinitypfm.archive/lib/; +cp -L /usr/share/java/hsqldb.jar infinitypfm.archive/lib/; +cp -L /usr/share/java/junit.jar infinitypfm.archive/lib/; +cp -L /usr/lib/jni/libswt-cairo-gtk-3836.so infinitypfm.archive/lib/; +cp -L /usr/lib/jni/libswt-atk-gtk-3836.so infinitypfm.archive/lib/; +cp -L /usr/lib/jni/libswt-awt-gtk-3836.so infinitypfm.archive/lib/; +cp -L /usr/lib/jni/libswt-gtk-3836.so infinitypfm.archive/lib/; +cp -L /usr/lib/jni/libswt-pi-gtk-3836.so infinitypfm.archive/lib/; +cp -L /usr/lib/jni/libswt-webkit-gtk-3836.so infinitypfm.archive/lib/; +cp -L /usr/share/java/mailapi.jar infinitypfm.archive/lib/; +cp -L /usr/share/java/commons-csv.jar infinitypfm.archive/lib/; +#cp -L -R /usr/lib/jvm/java-1.8.0-openjdk-amd64 infinitypfm.archive/lib/; + +#cp infinitypfm.run infinitypfm.archive/usr/bin/infinitypfm + +# appimagetool-x86_64.AppImage infinitypfm.archive infinitypfm-"$response".AppImage generate + +mv infinitypfm.archive infinitypfm-$response +zip -r infinitypfm-$response.zip infinitypfm-$response/bin infinitypfm-$response/lib + diff --git a/archive/infinitypfm.bat b/archive/infinitypfm.bat new file mode 100644 index 0000000..684088c --- /dev/null +++ b/archive/infinitypfm.bat @@ -0,0 +1,2 @@ +del ..\lib\swt.jar +java -cp "..\lib\*" org.infinitypfm.client.InfinityPfm diff --git a/archive/infinitypfm.sh b/archive/infinitypfm.sh new file mode 100755 index 0000000..760797f --- /dev/null +++ b/archive/infinitypfm.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +set -x + +rm lib/swt_win.jar +java -Djava.library.path="lib" -cp "lib/*" org.infinitypfm.client.InfinityPfm + +set +x diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/SqlMapConfig.xml b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/SqlMapConfig.xml index c7ff5d7..1b6240b 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/SqlMapConfig.xml +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/SqlMapConfig.xml @@ -51,7 +51,7 @@ - + diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/client/InfinityPfm.java b/infinitypfm-ui/src/main/java/org/infinitypfm/client/InfinityPfm.java index 777df7c..298b96f 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/client/InfinityPfm.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/client/InfinityPfm.java @@ -104,7 +104,7 @@ public static void main(String[] args) { try { updates.ProcessUpdates(); } catch (SQLException e) { - InfinityPfm.LogMessage(e.getMessage(), true); + e.printStackTrace(); } //Load app options diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/conf/MM.java b/infinitypfm-ui/src/main/java/org/infinitypfm/conf/MM.java index 183cfe5..bc11c81 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/conf/MM.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/conf/MM.java @@ -33,7 +33,7 @@ public class MM { * Program Constants */ public static final String APPTITLE = "Infinity PFM"; - public static final String APPVERSION = "0.7.7"; // <-- Used during database creation only + public static final String APPVERSION = "0.7.8"; // <-- Used during database creation only public static final String APPLINK = "https://www.infinitypfm.org"; public static final String APPLICENCE = "GNU General Public License v3"; public static final String APPCOPYRIGHT = "(c) 2005-2017 by Wayne Gray"; diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/data/InfinityUpdates.java b/infinitypfm-ui/src/main/java/org/infinitypfm/data/InfinityUpdates.java index 1e61d39..078dc0b 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/data/InfinityUpdates.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/data/InfinityUpdates.java @@ -49,7 +49,7 @@ public void ProcessUpdates() throws SQLException { } } - if (sVersion.equals("0.0.1")) { + if (sVersion.equals("0.0.1") || sVersion == null) { ApplyVersion002(); ApplyVersion010(); ApplyVersion030(); From 4a990943aaf1535317067c0387c6ba8cc83c9986 Mon Sep 17 00:00:00 2001 From: mogray5 Date: Sun, 30 Dec 2018 11:43:48 -0500 Subject: [PATCH 6/8] Start on adding unit tests to build. Not working yet. --- appimage/create_appimage.sh | 13 +++++++++--- build.xml | 7 ++++++- infinitypfm-common/build.xml | 39 +++++++++++++++++++++++++++++++++--- 3 files changed, 52 insertions(+), 7 deletions(-) diff --git a/appimage/create_appimage.sh b/appimage/create_appimage.sh index f68066b..732e05b 100755 --- a/appimage/create_appimage.sh +++ b/appimage/create_appimage.sh @@ -5,9 +5,16 @@ echo -e "\n Enter release version to use when naming the app image: \n" read response -sudo apt-get install libibatis-java libcommons-io-java libcommons-compress-java libhsqldb-java libgettext-commons-java libcommons-httpclient-java libjson-java libmail-java libcommons-csv-java -sudo apt-get install libswt-gtk-3-java libswt-webkit-gtk-3-jni libswt-cairo-gtk-3-jni -sudo apt-get install ant default-jdk +echo -e "\n +Install required libraries? (y|n): \n" +read doinstall + +if [[ "${doinstall}" == *"y"* ]] +then + sudo apt-get install libibatis-java libcommons-io-java libcommons-compress-java libhsqldb-java libgettext-commons-java libcommons-httpclient-java libjson-java libmail-java libcommons-csv-java + sudo apt-get install libswt-gtk-3-java libswt-webkit-gtk-3-jni libswt-cairo-gtk-3-jni + sudo apt-get install ant default-jdk +fi mkdir -p infinitypfm.AppDir/usr/bin mkdir -p infinitypfm.AppDir/usr/lib diff --git a/build.xml b/build.xml index a9bad68..2e51408 100644 --- a/build.xml +++ b/build.xml @@ -10,15 +10,20 @@ + + + + + - + diff --git a/infinitypfm-common/build.xml b/infinitypfm-common/build.xml index 9c931fa..40bc500 100644 --- a/infinitypfm-common/build.xml +++ b/infinitypfm-common/build.xml @@ -1,10 +1,18 @@ - + + - + + + + + + + + @@ -31,7 +39,8 @@ - + + @@ -50,4 +59,28 @@ + + + + + + + + + + + + + + + + + + + + From 06c8d7ddbcaf315841bec3d602fa5391694e87fb Mon Sep 17 00:00:00 2001 From: mogray5 Date: Mon, 31 Dec 2018 11:45:17 -0500 Subject: [PATCH 7/8] Fixes for app image build --- appimage/AppRun | 5 +++-- appimage/create_appimage.sh | 4 ++-- infinitypfm-common/build.xml | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/appimage/AppRun b/appimage/AppRun index 330ef37..428cb6f 100644 --- a/appimage/AppRun +++ b/appimage/AppRun @@ -2,7 +2,8 @@ set -x HERE="$(dirname "$(readlink -f "${0}")")" -export PATH="${HERE}"/usr/bin/:"${HERE}"/usr/sbin/:"${HERE}"/usr/games/:"${HERE}"/bin/:"${HERE}"/sbin/:"${PATH}" +export JAVA_HOME="${HERE}"/usr/lib/java-1.8.0-openjdk-amd64; +export PATH="${HERE}"/usr/bin/:"${HERE}"/usr/sbin/:"${HERE}"/usr/games/:"${HERE}"/bin/:"${HERE}"/sbin/:"${JAVA_HOME}"/bin/:${PATH} export LD_LIBRARY_PATH="${HERE}"/usr/lib/:"${HERE}"/usr/lib/i386-linux-gnu/:"${HERE}"/usr/lib/x86_64-linux-gnu/:"${HERE}"/usr/lib32/:"${HERE}"/usr/lib64/:"${HERE}"/lib/:"${HERE}"/lib/i386-linux-gnu/:"${HERE}"/lib/x86_64-linux-gnu/:"${HERE}"/lib32/:"${HERE}"/lib64/:"${LD_LIBRARY_PATH}" export PYTHONPATH="${HERE}"/usr/share/pyshared/:"${PYTHONPATH}" export XDG_DATA_DIRS="${HERE}"/usr/share/:"${XDG_DATA_DIRS}" @@ -11,7 +12,7 @@ export GSETTINGS_SCHEMA_DIR="${HERE}"/usr/share/glib-2.0/schemas/:"${GSETTINGS_S export QT_PLUGIN_PATH="${HERE}"/usr/lib/qt4/plugins/:"${HERE}"/usr/lib/i386-linux-gnu/qt4/plugins/:"${HERE}"/usr/lib/x86_64-linux-gnu/qt4/plugins/:"${HERE}"/usr/lib32/qt4/plugins/:"${HERE}"/usr/lib64/qt4/plugins/:"${HERE}"/usr/lib/qt5/plugins/:"${HERE}"/usr/lib/i386-linux-gnu/qt5/plugins/:"${HERE}"/usr/lib/x86_64-linux-gnu/qt5/plugins/:"${HERE}"/usr/lib32/qt5/plugins/:"${HERE}"/usr/lib64/qt5/plugins/:"${QT_PLUGIN_PATH}" EXEC=$(grep -e '^Exec=.*' "${HERE}"/*.desktop | head -n 1 | cut -d "=" -f 2 | cut -d " " -f 1) #exec "${EXEC}" $@ -export JAVA_HOME="${HERE}"/usr/lib/java-1.8.0-openjdk-amd64; + java -Djava.library.path="${HERE}"/usr/lib -cp "${HERE}/usr/lib/*" org.infinitypfm.client.InfinityPfm diff --git a/appimage/create_appimage.sh b/appimage/create_appimage.sh index 732e05b..6512c13 100755 --- a/appimage/create_appimage.sh +++ b/appimage/create_appimage.sh @@ -41,14 +41,14 @@ cp -L /usr/share/java/commons-lang.jar infinitypfm.AppDir/usr/lib/; cp -L /usr/share/java/ezmorph.jar infinitypfm.AppDir/usr/lib/; cp -L /usr/share/java/commons-collections3.jar infinitypfm.AppDir/usr/lib/; cp -L /usr/share/java/hsqldb.jar infinitypfm.AppDir/usr/lib/; -cp -L /usrshare/java/junit.jar infinitypfm.AppDir/usr/lib/; +cp -L /usr/share/java/junit4.jar infinitypfm.AppDir/usr/lib/; cp -L /usr/lib/jni/libswt-cairo-gtk-3836.so infinitypfm.AppDir/usr/lib/; cp -L /usr/lib/jni/libswt-atk-gtk-3836.so infinitypfm.AppDir/usr/lib/; cp -L /usr/lib/jni/libswt-awt-gtk-3836.so infinitypfm.AppDir/usr/lib/; cp -L /usr/lib/jni/libswt-gtk-3836.so infinitypfm.AppDir/usr/lib/; cp -L /usr/lib/jni/libswt-pi-gtk-3836.so infinitypfm.AppDir/usr/lib/; cp -L /usr/lib/jni/libswt-webkit-gtk-3836.so infinitypfm.AppDir/usr/lib/; -cp -L /usr/shre/java/mailapi.jar infinitypfm.AppDir/usr/lib/; +cp -L /usr/share/java/mailapi.jar infinitypfm.AppDir/usr/lib/; cp -L /usr/share/java/commons-csv.jar infinitypfm.AppDir/usr/lib/; cp -L -R /usr/lib/jvm/java-1.8.0-openjdk-amd64 infinitypfm.AppDir/usr/lib/; diff --git a/infinitypfm-common/build.xml b/infinitypfm-common/build.xml index 40bc500..4f65af7 100644 --- a/infinitypfm-common/build.xml +++ b/infinitypfm-common/build.xml @@ -61,7 +61,7 @@ - +