--------------------------------------------------------------------------------
/contractmanager/lib/odfdom_info.xml:
--------------------------------------------------------------------------------
1 |
2 | ODFDOM - the OpenDocument API 0.8.9-incubating
3 | A free OpenDocument Format (ODF) library
4 | https://incubator.apache.org/odftoolkit/odfdom/index.html
5 | Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt
6 |
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/util/CalendarBuilder.java:
--------------------------------------------------------------------------------
1 | package de.janrieke.contractmanager.util;
2 |
3 | import java.util.Calendar;
4 |
5 | /**
6 | * A simple builder class for calenders. Can be mocked for testing purposes.
7 | */
8 | public class CalendarBuilder {
9 | public Calendar getInstance() {
10 | return Calendar.getInstance();
11 | }
12 | }
--------------------------------------------------------------------------------
/contractmanager/lib/odfdom_dependencies_info.xml:
--------------------------------------------------------------------------------
1 |
2 | ODFDOM dependencies
3 | commons-validator 1.4.0; org.apache.clerezza (rdf.rdfa) 0.1-incubating; org.apache.jena (jena-arq) 2.9.4; xerces (xercesImpl) 2.9.1
4 | https://incubator.apache.org/odftoolkit/mvn-site/0.8.9-incubating/odfdom-java/dependencies.html
5 | diverse
6 |
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/util/ValidRuntimes.java:
--------------------------------------------------------------------------------
1 | package de.janrieke.contractmanager.util;
2 |
3 | import de.janrieke.contractmanager.rmi.IntervalType;
4 |
5 | /**
6 | * Instances of this class shall only be returned if all fields are
7 | * set and valid.
8 | */
9 | public class ValidRuntimes {
10 | public IntervalType firstMinRuntimeType;
11 | public Integer firstMinRuntimeCount;
12 | public IntervalType followingMinRuntimeType;
13 | public Integer followingMinRuntimeCount;
14 | public Boolean fixedTerms = false;
15 | }
--------------------------------------------------------------------------------
/contractmanager/updatesite/repository.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/contractmanager/src/updates/java/update0024.java:
--------------------------------------------------------------------------------
1 | import de.janrieke.contractmanager.server.DBSupportH2Impl;
2 |
3 | /**
4 | * New flag to snap period ends to end of selected period, e.g., MONTHs.
5 | */
6 | public class update0024 extends AbstractUpdate {
7 | /**
8 | * Default constructor
9 | */
10 | public update0024() {
11 | // Update for H2
12 | statements.put(DBSupportH2Impl.class.getName(),
13 | "ALTER TABLE costs ADD COLUMN payday date;\n");
14 | }
15 |
16 | /**
17 | * @see de.willuhn.sql.version.Update#getName()
18 | */
19 | @Override
20 | public String getName() {
21 | return "Database update v23 to v24 (add payday for costs)";
22 | }
23 | }
--------------------------------------------------------------------------------
/contractmanager/src/updates/java/update0023.java:
--------------------------------------------------------------------------------
1 | import de.janrieke.contractmanager.server.DBSupportH2Impl;
2 |
3 | /**
4 | * New flag to snap period ends to end of selected period, e.g., MONTHs.
5 | */
6 | public class update0023 extends AbstractUpdate {
7 | /**
8 | * Default constructor
9 | */
10 | public update0023() {
11 | // Update for H2
12 | statements.put(DBSupportH2Impl.class.getName(),
13 | "ALTER TABLE contract ADD COLUMN runtime_snap_to_end int(1);\n");
14 | }
15 |
16 | /**
17 | * @see de.willuhn.sql.version.Update#getName()
18 | */
19 | @Override
20 | public String getName() {
21 | return "Database update v22 to v23 (add snap to end of period flag)";
22 | }
23 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ContractManager
2 |
3 | ContractManager is a contract management software for the Jameica platform (http://willuhn.de/products/jameica/). It allows you to enter details of your contracts, e.g., financial information, runtime, or cancellation deadlines. It notifies you about upcoming cancellation deadlines.
4 |
5 | For installation instruction, see http://janrieke.de/contractmanager/.
6 |
7 | [ContractManager Web Site](http://janrieke.de/contractmanager/)
8 |
9 | ## Features
10 | * Management of contractual details, e.g., financial information, addresses, terms, documents
11 | * Reminders for cancellation deadlines
12 | * Export reminders to iCalendar file
13 | * Generation of letters of cancellation
14 |
--------------------------------------------------------------------------------
/contractmanager/README:
--------------------------------------------------------------------------------
1 | ContractManager for Jameica
2 | Copyright (C) 2010-2019 Jan Rieke
3 |
4 | ContractManager is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 |
9 | ContractManager is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 |
17 |
18 |
19 | Contact the author at: it (AT) janrieke (DOT) de
--------------------------------------------------------------------------------
/contractmanager/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | contractmanager
4 |
5 |
6 |
7 |
8 |
9 | org.python.pydev.PyDevBuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.jdt.core.javabuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.m2e.core.maven2Builder
20 |
21 |
22 |
23 |
24 |
25 | org.eclipse.m2e.core.maven2Nature
26 | org.eclipse.jdt.core.javanature
27 | org.python.pydev.pythonNature
28 |
29 |
30 |
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/input/CheckboxInput.java:
--------------------------------------------------------------------------------
1 | package de.janrieke.contractmanager.gui.input;
2 |
3 | import org.eclipse.swt.widgets.Control;
4 | import org.eclipse.swt.widgets.Label;
5 |
6 | /**
7 | * Extends the {@link de.willuhn.jameica.gui.input.CheckboxInput} class with
8 | * tooltips.
9 | */
10 | public class CheckboxInput extends de.willuhn.jameica.gui.input.CheckboxInput {
11 |
12 | private String tooltip;
13 | private Control control;
14 |
15 | public CheckboxInput(boolean value) {
16 | super(value);
17 | }
18 |
19 | @Override
20 | public Control getControl() {
21 | if (control != null) {
22 | return control;
23 | }
24 | control = super.getControl();
25 | if (tooltip != null) {
26 | control.setToolTipText(tooltip);
27 | setTooltipForLabel(tooltip);
28 | }
29 | return control;
30 | }
31 |
32 | public void setTooltip(String tooltip) {
33 | this.tooltip = tooltip;
34 | if (control != null) {
35 | control.setToolTipText(tooltip);
36 | setTooltipForLabel(tooltip);
37 | }
38 | }
39 |
40 | private void setTooltipForLabel(String tooltip) {
41 | Object label = getData("jameica.label");
42 | if (label instanceof Label) {
43 | ((Label) label).setToolTipText(tooltip);
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/models/MonthlyCosts.java:
--------------------------------------------------------------------------------
1 | package de.janrieke.contractmanager.models;
2 |
3 | import de.janrieke.contractmanager.rmi.IntervalType;
4 |
5 | /**
6 | * Helper class to provide a model for drawing monthly costs statistics.
7 | */
8 | public class MonthlyCosts {
9 | private final String description;
10 | private final double money;
11 |
12 | public MonthlyCosts(String description, double money) {
13 | super();
14 | this.description = description;
15 | this.money = money;
16 | }
17 |
18 | public static double averageToMonthly(double money, IntervalType interval) {
19 | switch (interval) {
20 | case DAYS:
21 | return money * 30;
22 | case WEEKS:
23 | return money * (52d/12);
24 | case MONTHS:
25 | return money;
26 | case QUARTER_YEARS:
27 | return money / 3;
28 | case HALF_YEARS:
29 | return money / 6;
30 | case YEARS:
31 | return money / 12;
32 |
33 | default:
34 | return 0.0f;
35 | }
36 | }
37 |
38 | public static MonthlyCosts averageToMonthlyCosts(String description, double money, IntervalType interval) {
39 | return new MonthlyCosts(description, averageToMonthly(money, interval));
40 | }
41 |
42 | public String getDescription() {
43 | return description;
44 | }
45 |
46 | public double getMoney() {
47 | return money;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/action/RestoreAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package de.janrieke.contractmanager.gui.action;
19 |
20 | import de.willuhn.jameica.gui.AbstractView;
21 | import de.willuhn.jameica.gui.Action;
22 | import de.willuhn.jameica.gui.GUI;
23 | import de.willuhn.util.ApplicationException;
24 |
25 | public class RestoreAction implements Action {
26 |
27 | private AbstractView view;
28 |
29 | public RestoreAction(AbstractView view) {
30 | this.view = view;
31 | }
32 |
33 | @Override
34 | public void handleAction(Object context) throws ApplicationException {
35 | GUI.startView(view, context);
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/action/ShowSettingsView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package de.janrieke.contractmanager.gui.action;
19 |
20 | import de.willuhn.jameica.gui.Action;
21 | import de.willuhn.jameica.gui.GUI;
22 | import de.willuhn.util.ApplicationException;
23 |
24 | /**
25 | * Action to open the project list.
26 | */
27 | public class ShowSettingsView implements Action {
28 |
29 | /**
30 | * @see de.willuhn.jameica.gui.Action#handleAction(java.lang.Object)
31 | */
32 | public void handleAction(Object context) throws ApplicationException {
33 | GUI.startView(de.janrieke.contractmanager.gui.view.SettingsView.class
34 | .getName(), null);
35 | }
36 |
37 | }
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/action/ShowWelcomeView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package de.janrieke.contractmanager.gui.action;
19 |
20 | import de.willuhn.jameica.gui.Action;
21 | import de.willuhn.jameica.gui.GUI;
22 | import de.willuhn.util.ApplicationException;
23 |
24 | /**
25 | * Action for the welcome screen.
26 | */
27 | public class ShowWelcomeView implements Action {
28 |
29 | /**
30 | * @see de.willuhn.jameica.gui.Action#handleAction(java.lang.Object)
31 | */
32 | public void handleAction(Object context) throws ApplicationException {
33 | GUI.startView(
34 | de.janrieke.contractmanager.gui.view.WelcomeView.class.getName(),
35 | null);
36 | }
37 |
38 | }
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/action/ShowAddressListView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package de.janrieke.contractmanager.gui.action;
19 |
20 | import de.willuhn.jameica.gui.Action;
21 | import de.willuhn.jameica.gui.GUI;
22 | import de.willuhn.util.ApplicationException;
23 |
24 | /**
25 | * Action to open the project list.
26 | */
27 | public class ShowAddressListView implements Action {
28 |
29 | /**
30 | * @see de.willuhn.jameica.gui.Action#handleAction(java.lang.Object)
31 | */
32 | public void handleAction(Object context) throws ApplicationException {
33 | GUI.startView(de.janrieke.contractmanager.gui.view.AddressListView.class
34 | .getName(), null);
35 | }
36 |
37 | }
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/action/ShowContractListView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package de.janrieke.contractmanager.gui.action;
19 |
20 | import de.willuhn.jameica.gui.Action;
21 | import de.willuhn.jameica.gui.GUI;
22 | import de.willuhn.util.ApplicationException;
23 |
24 | /**
25 | * Action to open the project list.
26 | */
27 | public class ShowContractListView implements Action {
28 |
29 | /**
30 | * @see de.willuhn.jameica.gui.Action#handleAction(java.lang.Object)
31 | */
32 | public void handleAction(Object context) throws ApplicationException {
33 | GUI.startView(de.janrieke.contractmanager.gui.view.ContractListView.class
34 | .getName(), null);
35 | }
36 |
37 | }
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/action/ShowExpensesAnalysisView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package de.janrieke.contractmanager.gui.action;
19 |
20 | import de.willuhn.jameica.gui.Action;
21 | import de.willuhn.jameica.gui.GUI;
22 | import de.willuhn.util.ApplicationException;
23 |
24 | /**
25 | * Action to open the project list.
26 | */
27 | public class ShowExpensesAnalysisView implements Action {
28 |
29 | /**
30 | * @see de.willuhn.jameica.gui.Action#handleAction(java.lang.Object)
31 | */
32 | public void handleAction(Object context) throws ApplicationException {
33 | GUI.startView(de.janrieke.contractmanager.gui.view.ExpensesAnalysisView.class
34 | .getName(), null);
35 | }
36 |
37 | }
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/action/ShowTransactionDetailsView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package de.janrieke.contractmanager.gui.action;
19 |
20 | import de.willuhn.jameica.gui.Action;
21 | import de.willuhn.jameica.gui.GUI;
22 | import de.willuhn.util.ApplicationException;
23 |
24 | /**
25 | * Action to open the project list.
26 | */
27 | public class ShowTransactionDetailsView implements Action {
28 |
29 | /**
30 | * @see de.willuhn.jameica.gui.Action#handleAction(java.lang.Object)
31 | */
32 | public void handleAction(Object context) throws ApplicationException {
33 | GUI.startView(de.janrieke.contractmanager.gui.view.ContractListView.class
34 | .getName(), null);
35 | }
36 |
37 | }
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/rmi/Transaction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package de.janrieke.contractmanager.rmi;
19 |
20 | import java.rmi.RemoteException;
21 |
22 | import de.willuhn.datasource.rmi.DBObject;
23 |
24 | /*
25 | * CREATE TABLE umsaetze (
26 | * umsatz_id int(4),
27 | * contract_id int(4),
28 | * UNIQUE (umsatz_id),
29 | * PRIMARY KEY (umsatz_id)
30 | * );
31 | */
32 | public interface Transaction extends DBObject {
33 | public void setTransactionID(Integer id) throws RemoteException;
34 | public Integer getTransactionID() throws RemoteException;
35 | public Contract getContract() throws RemoteException;
36 | public void setContract(Contract contract) throws RemoteException;
37 | }
38 |
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/action/ShowIncomeExpensesAnalysisView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package de.janrieke.contractmanager.gui.action;
19 |
20 | import de.willuhn.jameica.gui.Action;
21 | import de.willuhn.jameica.gui.GUI;
22 | import de.willuhn.util.ApplicationException;
23 |
24 | /**
25 | * Action to open the project list.
26 | */
27 | public class ShowIncomeExpensesAnalysisView implements Action {
28 |
29 | /**
30 | * @see de.willuhn.jameica.gui.Action#handleAction(java.lang.Object)
31 | */
32 | public void handleAction(Object context) throws ApplicationException {
33 | GUI.startView(de.janrieke.contractmanager.gui.view.IncomeExpensesAnalysisView.class
34 | .getName(), null);
35 | }
36 |
37 | }
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/action/ShowJameicaSettings.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package de.janrieke.contractmanager.gui.action;
19 |
20 | import de.willuhn.jameica.gui.Action;
21 | import de.willuhn.jameica.gui.GUI;
22 | import de.willuhn.jameica.gui.internal.views.Settings;
23 | import de.willuhn.util.ApplicationException;
24 |
25 | public class ShowJameicaSettings implements Action {
26 |
27 | private String tab;
28 |
29 | public ShowJameicaSettings(String tab) {
30 | this.tab = tab;
31 | }
32 |
33 | /**
34 | * @see de.willuhn.jameica.gui.Action#handleAction(java.lang.Object)
35 | */
36 | public void handleAction(Object context) throws ApplicationException {
37 | GUI.startView(Settings.class, tab);
38 | }
39 | }
--------------------------------------------------------------------------------
/contractmanager/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/ext/hibiscus/TransactionUtils.java:
--------------------------------------------------------------------------------
1 | package de.janrieke.contractmanager.ext.hibiscus;
2 |
3 | import java.rmi.RemoteException;
4 | import java.util.Optional;
5 |
6 | import de.janrieke.contractmanager.Settings;
7 | import de.janrieke.contractmanager.rmi.Contract;
8 | import de.janrieke.contractmanager.rmi.Transaction;
9 | import de.willuhn.datasource.rmi.DBIterator;
10 | import de.willuhn.datasource.rmi.DBService;
11 | import de.willuhn.jameica.hbci.rmi.Umsatz;
12 |
13 | public class TransactionUtils {
14 | private TransactionUtils() {
15 | throw new AssertionError("no instantiation");
16 | }
17 |
18 | /**
19 | * Prueft, ob der Umsatz bereits einem Vertrag zugeordnet ist.
20 | * @param u der zu pruefende Umsatz.
21 | * @return true, wenn es bereits einen Vertrag gibt.
22 | * @throws Exception
23 | */
24 | public static boolean isAssigned(Umsatz u) throws RemoteException {
25 | return getTransactionsFor(u).hasNext();
26 | }
27 |
28 | public static Optional getContractFor(Umsatz u) throws RemoteException {
29 | DBIterator transactions = getTransactionsFor(u);
30 | if (transactions.hasNext()) {
31 | return Optional.of(transactions.next().getContract());
32 | }
33 | return Optional.empty();
34 | }
35 |
36 | private static DBIterator getTransactionsFor(Umsatz u) throws RemoteException {
37 | DBService service = Settings.getDBService();
38 | DBIterator transactions = service.createList(Transaction.class);
39 | transactions.addFilter("transaction_id = ?",new Object[]{u.getID()});
40 | return transactions;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/input/PositiveIntegerInput.java:
--------------------------------------------------------------------------------
1 | package de.janrieke.contractmanager.gui.input;
2 |
3 | import org.eclipse.swt.SWT;
4 | import org.eclipse.swt.widgets.Control;
5 | import org.eclipse.swt.widgets.Event;
6 | import org.eclipse.swt.widgets.Listener;
7 |
8 | import de.willuhn.jameica.gui.input.IntegerInput;
9 |
10 | public class PositiveIntegerInput extends IntegerInput {
11 | public PositiveIntegerInput() {
12 | super();
13 | }
14 |
15 | public PositiveIntegerInput(int value) {
16 | super(value < 0 ? 0 : value);
17 | }
18 |
19 | /**
20 | * @see de.willuhn.jameica.gui.input.Input#getControl()
21 | */
22 | public Control getControl() {
23 | final Control c = super.getControl();
24 | if (c != text)
25 | return c; //this should not happen
26 | if ((Integer)getValue() == 0)
27 | text.setText("");
28 | text.addListener(SWT.FocusOut, new Listener() {
29 | public void handleEvent(Event event) {
30 | Object value = getValue();
31 | if (value == null || value.toString().length() == 0)
32 | return;
33 | try {
34 | Integer intVal = new Integer(value.toString());
35 | if (intVal <= 0) {
36 | setValue(0);
37 | text.setText("");
38 | } else
39 | setValue(intVal); // normalize
40 | } catch (NumberFormatException e) {
41 | setValue(0);
42 | text.setText("");
43 | }
44 | }
45 | });
46 | return c;
47 | }
48 |
49 | @Override
50 | public Object getValue() {
51 | Object value = super.getValue();
52 | if (value == null || !(value instanceof Integer) || (Integer) value < 0)
53 | return 0;
54 | else
55 | return value;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/action/ShowAboutDialog.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package de.janrieke.contractmanager.gui.action;
19 |
20 | import de.janrieke.contractmanager.Settings;
21 | import de.willuhn.jameica.gui.Action;
22 | import de.willuhn.jameica.gui.dialogs.AbstractDialog;
23 | import de.willuhn.logging.Logger;
24 | import de.willuhn.util.ApplicationException;
25 |
26 | public class ShowAboutDialog implements Action {
27 |
28 | /**
29 | * @see de.willuhn.jameica.gui.Action#handleAction(java.lang.Object)
30 | */
31 | public void handleAction(Object context) throws ApplicationException {
32 | try {
33 | new de.janrieke.contractmanager.gui.dialog.AboutDialog(
34 | AbstractDialog.POSITION_CENTER).open();
35 | } catch (Exception e) {
36 | Logger.error("error while opening about dialog", e);
37 | throw new ApplicationException(Settings.i18n().tr(
38 | "Error while opening the About dialog"));
39 | }
40 | }
41 |
42 | }
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/action/ShowDocumentStorage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package de.janrieke.contractmanager.gui.action;
19 |
20 | import de.janrieke.contractmanager.Settings;
21 | import de.janrieke.contractmanager.rmi.Contract;
22 | import de.willuhn.jameica.gui.Action;
23 | import de.willuhn.logging.Logger;
24 | import de.willuhn.util.ApplicationException;
25 |
26 | public class ShowDocumentStorage implements Action {
27 |
28 | /**
29 | * @see de.willuhn.jameica.gui.Action#handleAction(java.lang.Object)
30 | */
31 | public void handleAction(Object context) throws ApplicationException {
32 | try {
33 | new de.janrieke.contractmanager.gui.dialog.DocumentStorageDialog((Contract) context).open();
34 | } catch (Exception e) {
35 | Logger.error("error while opening file storage dialog", e);
36 | throw new ApplicationException(Settings.i18n().tr(
37 | "Error while opening the storage dialog"));
38 | }
39 | }
40 |
41 | }
--------------------------------------------------------------------------------
/contractmanager/src/assembly/assembly.xml:
--------------------------------------------------------------------------------
1 |
5 | bin
6 |
7 | zip
8 |
9 | contractmanager
10 |
11 |
12 | ${project.basedir}
13 |
14 |
15 | README
16 | VERSION_HISTORY.txt
17 | LICENSE
18 | plugin.xml
19 |
20 |
21 |
22 | ${project.build.directory}/classes
23 | updates/
24 |
25 | *.class
26 |
27 |
28 |
29 | ${project.basedir}/lib
30 | lib/
31 |
32 | *.xml
33 | epl-v10.html
34 | org.odftoolkit.odfdom_0.8.9.jar
35 |
36 |
37 |
38 | ${project.basedir}/src/main/resources/sql
39 | sql/
40 |
41 |
42 | ${project.basedir}/src/main/resources/templates
43 | templates/
44 |
45 |
46 |
47 |
48 | ${project.build.directory}/${project.build.finalName}.jar
49 | contractmanager.jar
50 |
51 |
52 |
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/input/ICSFileInput.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package de.janrieke.contractmanager.gui.input;
19 |
20 | import org.eclipse.swt.widgets.FileDialog;
21 |
22 | import de.janrieke.contractmanager.Settings;
23 | import de.willuhn.jameica.gui.input.FileInput;
24 |
25 | /**
26 | * FileInput with customized dialog for ICS file selection.
27 | */
28 | public class ICSFileInput extends FileInput {
29 |
30 | private boolean save;
31 |
32 | public ICSFileInput(String file, boolean save) {
33 | super(file, save);
34 | this.save = save;
35 | }
36 |
37 | @Override
38 | protected void customize(FileDialog fd) {
39 | String[] names = {
40 | Settings.i18n().tr("iCalendar file" + " (*.ics)"),
41 | Settings.i18n().tr("All files") + " (*.*)" };
42 | String[] filters = { "*.ics", "*.*" };
43 | fd.setFilterExtensions(filters);
44 | fd.setFilterNames(names);
45 | if (save)
46 | fd.setOverwrite(true);
47 | fd.setFileName(value);
48 | super.customize(fd);
49 | }
50 | }
--------------------------------------------------------------------------------
/contractmanager/VERSION_HISTORY.txt:
--------------------------------------------------------------------------------
1 | VERSION HISTORY:
2 |
3 | 0.1:
4 | - Basic contract management
5 | - Cancellation Reminder
6 | - Generation of letters of cancellation
7 | - Export reminders to iCal
8 |
9 | 0.2:
10 | - Reload iCal file instead of overwriting (do not re-remind of already checked cancellation)
11 | - Better address management
12 |
13 | 0.3:
14 | - Include payments from Hibiscus
15 |
16 | 0.3.1:
17 | - Moving iCal import/export to Jameica's calander + jameica.ical
18 |
19 | 0.4:
20 | - Analysis diagrams
21 |
22 | 0.4.1:
23 | - Bugfixes
24 |
25 | 0.4.2:
26 | - Bugfixes
27 |
28 | 0.5:
29 | - Document storage
30 | - SEPA-Mandatsreferenz und -Gl�ubiger-ID
31 | - Improved import dialog (intelligent pre-selection of contract)
32 | - Auto-import of new Hibiscus transactions
33 | - Added quarterly/semiannually as payment interval
34 | - update libs (ODFDOM 0.8.9-incubating)
35 |
36 | 0.5.1:
37 | - "Remind me next term" function
38 | - Dialog with database login data
39 | - Import/Export
40 |
41 | 0.5.2:
42 | - Hide inactive contracts from contract list
43 | - More templates for document generation
44 | - Improved assignment of Hibiscus transactions
45 | - "Snap to end" feature to fix the end date of a contract to, e.g., the end of month
46 | - Preparations for MySQL support (thx Harald)
47 |
48 | 0.5.3:
49 | - Payment dates
50 | - MySQL/MariaDB support
51 |
52 | 0.5.4:
53 | - Fixed exception in contract list
54 |
55 | 0.5.5:
56 | - Shortcut for "New Contract" is now ALT+N (avoid collision on Mac).
57 | - Re-saving a contract no longer unsets the Hibiscus category.
58 | - Jameica 2.8+ is now required.
59 |
60 |
61 | ROADMAP:
62 |
63 | 0.6:
64 | - Grouping of contracs
65 |
66 | 1.0:
67 | - Contract detection based on Hibiscus transactions
68 | - Analyses based on "real" Hibiscus transaction
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/action/ShowHibiscusSettings.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package de.janrieke.contractmanager.gui.action;
19 |
20 | import de.janrieke.contractmanager.Settings;
21 | import de.willuhn.jameica.gui.Action;
22 | import de.willuhn.jameica.gui.dialogs.AbstractDialog;
23 | import de.willuhn.jameica.system.OperationCanceledException;
24 | import de.willuhn.logging.Logger;
25 | import de.willuhn.util.ApplicationException;
26 |
27 | public class ShowHibiscusSettings implements Action {
28 |
29 | /**
30 | * @see de.willuhn.jameica.gui.Action#handleAction(java.lang.Object)
31 | */
32 | public void handleAction(Object context) throws ApplicationException {
33 | try {
34 | new de.janrieke.contractmanager.gui.dialog.ContractDetailViewSettingsDialog(
35 | AbstractDialog.POSITION_CENTER).open();
36 | } catch (OperationCanceledException e) {
37 | } catch (Exception e) {
38 | Logger.error("error while opening about dialog", e);
39 | throw new ApplicationException(Settings.i18n().tr(
40 | "Error while opening the About dialog"));
41 | }
42 | }
43 |
44 | }
--------------------------------------------------------------------------------
/contractmanager/src/updates/java/AbstractUpdate.java:
--------------------------------------------------------------------------------
1 | import java.io.StringReader;
2 | import java.util.HashMap;
3 | import java.util.Map;
4 |
5 | import de.janrieke.contractmanager.rmi.ContractDBService;
6 | import de.janrieke.contractmanager.server.ContractDBUpdateProvider;
7 | import de.janrieke.contractmanager.server.DBSupportH2Impl;
8 | import de.willuhn.logging.Logger;
9 | import de.willuhn.sql.ScriptExecutor;
10 | import de.willuhn.sql.version.Update;
11 | import de.willuhn.sql.version.UpdateProvider;
12 | import de.willuhn.util.ApplicationException;
13 | import de.willuhn.util.I18N;
14 |
15 | public abstract class AbstractUpdate implements Update {
16 |
17 | protected Map statements = new HashMap<>();
18 |
19 | public AbstractUpdate() {
20 | super();
21 | }
22 |
23 | /**
24 | * @see de.willuhn.sql.version.Update#execute(de.willuhn.sql.version.UpdateProvider)
25 | */
26 | @Override
27 | public void execute(UpdateProvider provider) throws ApplicationException {
28 | ContractDBUpdateProvider myProvider = (ContractDBUpdateProvider) provider;
29 | I18N i18n = myProvider.getResources().getI18N();
30 |
31 | // Get the SQL dialect
32 | String driver = ContractDBService.SETTINGS.getString("database.driver",
33 | DBSupportH2Impl.class.getName());
34 | String sql = statements.get(driver);
35 | if (sql == null) {
36 | throw new ApplicationException(i18n.tr(
37 | "Database {0} not supported", driver));
38 | }
39 |
40 | try {
41 | ScriptExecutor
42 | .execute(new StringReader(sql), myProvider.getConnection(),
43 | myProvider.getProgressMonitor());
44 | myProvider.getProgressMonitor().log(i18n.tr("Database updated."));
45 | } catch (ApplicationException ae) {
46 | throw ae;
47 | } catch (Exception e) {
48 | Logger.error("unable to execute update", e);
49 | throw new ApplicationException(
50 | i18n.tr("Error during database update"), e);
51 | }
52 | }
53 |
54 | }
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/action/ShowLicenseInfoView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | /**********************************************************************
19 | * Copied from Jameica
20 | *
21 | * $Source: /cvsroot/jameica/jameica/src/de/willuhn/jameica/gui/internal/action/License.java,v $
22 | * $Revision: 1.4 $
23 | * $Date: 2005-01-19 00:15:49 $
24 | * $Author: willuhn $
25 | * $Locker: $
26 | * $State: Exp $
27 | *
28 | * Copyright (c) by willuhn.webdesign
29 | * All rights reserved
30 | *
31 | **********************************************************************/
32 |
33 | package de.janrieke.contractmanager.gui.action;
34 |
35 | import de.willuhn.jameica.gui.Action;
36 | import de.willuhn.jameica.gui.GUI;
37 | import de.willuhn.util.ApplicationException;
38 |
39 | /**
40 | * @author willuhn
41 | */
42 | public class ShowLicenseInfoView implements Action
43 | {
44 |
45 | /**
46 | * @see de.willuhn.jameica.gui.Action#handleAction(java.lang.Object)
47 | */
48 | public void handleAction(Object context) throws ApplicationException
49 | {
50 | GUI.startView(de.janrieke.contractmanager.gui.view.LicenseInfoView.class,null);
51 | }
52 |
53 | }
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/chart/Chart.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | /*
20 | * Partially copied from Hibiscus/Syntax, (c) by willuhn.webdesign
21 | */
22 | package de.janrieke.contractmanager.gui.chart;
23 |
24 | import java.rmi.RemoteException;
25 |
26 | import de.willuhn.jameica.gui.Part;
27 |
28 | /**
29 | * Basis-Interface fuer ein Chart.
30 | * @param der Typ der Chartdaten.
31 | */
32 | public interface Chart extends Part
33 | {
34 | /**
35 | * Speichert den Titel des Charts.
36 | * @param title Titel.
37 | */
38 | public void setTitle(String title);
39 |
40 | /**
41 | * Liefert den Titel des Charts.
42 | * @return Titel.
43 | */
44 | public String getTitle();
45 |
46 | /**
47 | * Fuegt dem Chart eine Datenreihe hinzu,
48 | * @param data
49 | */
50 | public void addData(T data);
51 |
52 | /**
53 | * Entfernt eine Datenreihe aus dem Chart.
54 | * @param data
55 | */
56 | public void removeData(T data);
57 |
58 | /**
59 | * Entfernt alle Datenreihen.
60 | */
61 | public void removeAllData();
62 |
63 | /**
64 | * Zeichnet das Chart neu.
65 | * Ist eigentlich nur noetig, wenn sich die Daten tatsaechlich geaendert haben.
66 | * @throws RemoteException
67 | */
68 | public void redraw() throws RemoteException;
69 | }
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/action/ShowAddressDetailView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package de.janrieke.contractmanager.gui.action;
19 |
20 | import java.rmi.RemoteException;
21 |
22 | import de.janrieke.contractmanager.Settings;
23 | import de.janrieke.contractmanager.rmi.Address;
24 | import de.willuhn.jameica.gui.Action;
25 | import de.willuhn.jameica.gui.GUI;
26 | import de.willuhn.util.ApplicationException;
27 |
28 | /**
29 | * Action for "show contract details" or "create new contract".
30 | */
31 | public class ShowAddressDetailView implements Action {
32 |
33 | /**
34 | * @see de.willuhn.jameica.gui.Action#handleAction(java.lang.Object)
35 | */
36 | public void handleAction(Object context) throws ApplicationException {
37 |
38 | Address p = null;
39 |
40 | // check if the context is a contract
41 | if (context != null && (context instanceof Address))
42 | p = (Address) context;
43 | else {
44 | try {
45 | p = (Address) Settings.getDBService().createObject(
46 | Address.class, null);
47 | } catch (RemoteException e) {
48 | throw new ApplicationException(Settings.i18n().tr(
49 | "Error while creating new contract"), e);
50 | }
51 | }
52 |
53 | // ok, lets start the dialog
54 | GUI.startView(de.janrieke.contractmanager.gui.view.AddressDetailView.class
55 | .getName(), p);
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/menu/CostsListMenu.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package de.janrieke.contractmanager.gui.menu;
19 |
20 | import de.janrieke.contractmanager.Settings;
21 | import de.janrieke.contractmanager.gui.action.CreateNewCostEntry;
22 | import de.janrieke.contractmanager.gui.action.DeleteCostEntry;
23 | import de.janrieke.contractmanager.gui.action.RemovePaydayFromCostEntry;
24 | import de.janrieke.contractmanager.gui.control.ContractControl;
25 | import de.willuhn.jameica.gui.parts.CheckedContextMenuItem;
26 | import de.willuhn.jameica.gui.parts.ContextMenu;
27 | import de.willuhn.jameica.gui.parts.ContextMenuItem;
28 |
29 | public class CostsListMenu extends ContextMenu {
30 |
31 | public CostsListMenu(ContractControl contractControl) {
32 | // CheckedContextMenuItems will be disabled, if the user clicks into an
33 | // empty space of the table
34 | addItem(new ContextMenuItem(Settings.i18n().tr(
35 | "Create a new cost entry"), new CreateNewCostEntry(contractControl),
36 | "document-new.png"));
37 |
38 | addItem(ContextMenuItem.SEPARATOR);
39 | addItem(new CheckedContextMenuItem(Settings.i18n().tr(
40 | "Remove payday..."), new RemovePaydayFromCostEntry(contractControl), null));
41 | addItem(new CheckedContextMenuItem(Settings.i18n().tr(
42 | "Delete cost entry..."), new DeleteCostEntry(contractControl), "window-close.png"));
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/view/AddressListView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package de.janrieke.contractmanager.gui.view;
19 |
20 | import de.janrieke.contractmanager.Settings;
21 | import de.janrieke.contractmanager.gui.action.ShowAddressDetailView;
22 | import de.janrieke.contractmanager.gui.control.AddressControl;
23 | import de.willuhn.jameica.gui.AbstractView;
24 | import de.willuhn.jameica.gui.GUI;
25 | import de.willuhn.jameica.gui.util.ButtonArea;
26 | import de.willuhn.util.ApplicationException;
27 |
28 | /**
29 | * View to show the list of existing contracts.
30 | */
31 | public class AddressListView extends AbstractView {
32 |
33 | /**
34 | * @see de.willuhn.jameica.gui.AbstractView#bind()
35 | */
36 | public void bind() throws Exception {
37 |
38 | GUI.getView().setTitle(Settings.i18n().tr("Existing addresses"));
39 |
40 | AddressControl control = new AddressControl(this);
41 |
42 | control.getAddressesTable().paint(this.getParent());
43 |
44 | ButtonArea buttons = new ButtonArea(this.getParent(), 3);
45 | //buttons.addButton(new Back(false));
46 |
47 | buttons.addButton(Settings.i18n().tr("Create new address..."),
48 | new ShowAddressDetailView(), null, true, "document-new.png");
49 | }
50 |
51 | /**
52 | * @see de.willuhn.jameica.gui.AbstractView#unbind()
53 | */
54 | public void unbind() throws ApplicationException {
55 | }
56 |
57 | }
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/rmi/Costs.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package de.janrieke.contractmanager.rmi;
19 |
20 | import java.rmi.RemoteException;
21 | import java.util.Date;
22 |
23 | import de.willuhn.datasource.rmi.DBObject;
24 | /*
25 | * CREATE TABLE costs (
26 | * id IDENTITY,
27 | * contract_id int(5),
28 | * description varchar(255),
29 | * money double,
30 | * period int(1),
31 | * payday date,
32 | * UNIQUE (id),
33 | * PRIMARY KEY (id)
34 | * );
35 | */
36 | public interface Costs extends DBObject {
37 | public Contract getContract() throws RemoteException;
38 | public void setContract(Contract contract) throws RemoteException;
39 |
40 | public String getDescription() throws RemoteException;
41 | public void setDescription(String description) throws RemoteException;
42 |
43 | public double getMoney() throws RemoteException;
44 | public void setMoney(double money) throws RemoteException;
45 |
46 | public IntervalType getPeriod() throws RemoteException;
47 | public void setPeriod(IntervalType period) throws RemoteException;
48 |
49 | public Date getPayday() throws RemoteException;
50 | public void setPayday(Date payday) throws RemoteException;
51 |
52 | public static final String NEXT_PAYDAY = "next_payday";
53 | public Date getNextPayday() throws RemoteException;
54 | public Date getNextPayday(Date after) throws RemoteException;
55 |
56 | }
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/chart/ChartData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | /*
20 | * Partially copied from Hibiscus/Syntax, (c) by willuhn.webdesign
21 | */
22 | package de.janrieke.contractmanager.gui.chart;
23 |
24 | import java.rmi.RemoteException;
25 | import java.util.List;
26 |
27 | /**
28 | * Basis-Interface, welches die zu zeichnenden Datenreihen enthaelt.
29 | */
30 | public interface ChartData
31 | {
32 | /**
33 | * Liefert die zu zeichnende Datenreihe.
34 | * @return Datenreihe.
35 | * @throws RemoteException
36 | */
37 | public List> getData() throws RemoteException;
38 |
39 | /**
40 | * Liefert das Label der Datenreihe.
41 | * @return Label der Datenreihe.
42 | * @throws RemoteException
43 | */
44 | public String getLabel() throws RemoteException;
45 |
46 | /**
47 | * Liefert den Namen des Attributs, welches fuer die Werte
48 | * verwendet werden soll. Der Wert des Attributes muss vom Typ java.lang.Number sein.
49 | * @return Name des Werte-Attributs.
50 | * @throws RemoteException
51 | */
52 | public String getDataAttribute() throws RemoteException;
53 |
54 | /**
55 | * Liefert den Namen des Attributs fuer die Beschriftung.
56 | * @return Name des Attributs fuer die Beschriftung.
57 | * Der Wert des Attributes muss vom Typ java.lang.Date sein.
58 | * @throws RemoteException
59 | */
60 | public String getLabelAttribute() throws RemoteException;
61 | }
--------------------------------------------------------------------------------
/contractmanager/src/updates/java/update0022.java:
--------------------------------------------------------------------------------
1 | import java.io.StringReader;
2 | import java.util.HashMap;
3 | import java.util.Map;
4 |
5 | import de.janrieke.contractmanager.rmi.ContractDBService;
6 | import de.janrieke.contractmanager.server.ContractDBUpdateProvider;
7 | import de.janrieke.contractmanager.server.DBSupportH2Impl;
8 | import de.willuhn.logging.Logger;
9 | import de.willuhn.sql.ScriptExecutor;
10 | import de.willuhn.sql.version.Update;
11 | import de.willuhn.sql.version.UpdateProvider;
12 | import de.willuhn.util.ApplicationException;
13 | import de.willuhn.util.I18N;
14 |
15 | /**
16 | * MySQL support preparations
17 | */
18 | public class update0022 implements Update {
19 | private Map statements = new HashMap<>();
20 |
21 | /**
22 | * Default constructor
23 | */
24 | public update0022() {
25 | // Update for H2
26 | statements.put(DBSupportH2Impl.class.getName(),
27 | "ALTER TABLE settings ALTER COLUMN key RENAME TO mkey;\n");
28 | }
29 |
30 | /**
31 | * @see de.willuhn.sql.version.Update#execute(de.willuhn.sql.version.UpdateProvider)
32 | */
33 | @Override
34 | public void execute(UpdateProvider provider) throws ApplicationException {
35 | ContractDBUpdateProvider myProvider = (ContractDBUpdateProvider) provider;
36 | I18N i18n = myProvider.getResources().getI18N();
37 |
38 | // Get the SQL dialect
39 | String driver = ContractDBService.SETTINGS.getString("database.driver",
40 | DBSupportH2Impl.class.getName());
41 | String sql = statements.get(driver);
42 | if (sql == null) {
43 | throw new ApplicationException(i18n.tr(
44 | "Database {0} not supported", driver));
45 | }
46 |
47 | try {
48 | ScriptExecutor
49 | .execute(new StringReader(sql), myProvider.getConnection(),
50 | myProvider.getProgressMonitor());
51 | myProvider.getProgressMonitor().log(i18n.tr("Database updated."));
52 | } catch (ApplicationException ae) {
53 | throw ae;
54 | } catch (Exception e) {
55 | Logger.error("unable to execute update", e);
56 | throw new ApplicationException(
57 | i18n.tr("Error during database update"), e);
58 | }
59 | }
60 |
61 | /**
62 | * @see de.willuhn.sql.version.Update#getName()
63 | */
64 | @Override
65 | public String getName() {
66 | return "Database update v21 to v22 (add support for mysql)";
67 | }
68 |
69 | }
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/gui/action/CreateNewCostEntry.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package de.janrieke.contractmanager.gui.action;
19 |
20 | import java.rmi.RemoteException;
21 |
22 | import de.janrieke.contractmanager.Settings;
23 | import de.janrieke.contractmanager.gui.control.ContractControl;
24 | import de.janrieke.contractmanager.rmi.Contract;
25 | import de.janrieke.contractmanager.rmi.Costs;
26 | import de.janrieke.contractmanager.rmi.IntervalType;
27 | import de.willuhn.jameica.gui.Action;
28 | import de.willuhn.util.ApplicationException;
29 |
30 | /**
31 | * Action for "delete contract".
32 | */
33 | public class CreateNewCostEntry implements Action {
34 |
35 | private ContractControl contract;
36 |
37 | public CreateNewCostEntry(ContractControl contract) {
38 | this.contract = contract;
39 | }
40 |
41 | /**
42 | * @see de.willuhn.jameica.gui.Action#handleAction(java.lang.Object)
43 | */
44 | public void handleAction(Object context) throws ApplicationException {
45 | try {
46 | Costs c = (Costs) Settings.getDBService().createObject(
47 | Costs.class, null);
48 | c.setContract((Contract) contract.getCurrentObject());
49 | c.setDescription("");
50 | c.setMoney(0);
51 | c.setPeriod(IntervalType.YEARS);
52 | contract.addTemporaryCostEntry(c);
53 | } catch (RemoteException e) {
54 | throw new ApplicationException(Settings.i18n().tr(
55 | "Error while creating new cost entry"), e);
56 | }
57 | }
58 | }
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/rmi/Storage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package de.janrieke.contractmanager.rmi;
19 |
20 | import java.io.InputStream;
21 | import java.rmi.RemoteException;
22 |
23 | import de.willuhn.datasource.rmi.DBObject;
24 |
25 | /*
26 | * CREATE TABLE storage (
27 | * id IDENTITY,
28 | * contract_id int(5),
29 | * description varchar(255),
30 | * path varchar(65535),
31 | * file BLOB,
32 | * UNIQUE (id),
33 | * PRIMARY KEY (id),
34 | * CONSTRAINT fk_storage_contract FOREIGN KEY (contract_id) REFERENCES contract (id) ON DELETE CASCADE ON UPDATE CASCADE
35 | * );
36 | */
37 | public interface Storage extends DBObject {
38 | public Contract getContract() throws RemoteException;
39 | public void setContract(Contract contract) throws RemoteException;
40 | public String getDescription() throws RemoteException;
41 | public void setDescription(String desc) throws RemoteException;
42 | public String getPath() throws RemoteException;
43 | public void setPath(String path) throws RemoteException;
44 |
45 | /**
46 | * Returns a stream for reading the binary contents stored in the "file" field.
47 | * Note: All data must be read before calling any other database operation.
48 | * Any other DB operation will implicitly close the stream.
49 | * @return a stream with the file contents
50 | * @throws RemoteException
51 | */
52 | public InputStream getFile() throws RemoteException;
53 | //saving is only implemented via prepared statements
54 | }
55 |
--------------------------------------------------------------------------------
/contractmanager/src/main/java/de/janrieke/contractmanager/rmi/Setting.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ContractManager for Jameica.
3 | * Copyright (C) 2010-2011 Jan Rieke
4 | *
5 | * ContractManager is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * ContractManager is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package de.janrieke.contractmanager.rmi;
19 |
20 | import java.rmi.RemoteException;
21 |
22 | import de.willuhn.datasource.rmi.DBObject;
23 |
24 | /**
25 | * Interface of the business object for settings. According to the SQL table, we
26 | * define some getters and setters here.
27 | *
28 | *