Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.pjsofts.eurobudget.beans
Class Transaction  view Transaction download Transaction.java

java.lang.Object
  extended bycom.pjsofts.eurobudget.beans.Transaction
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable, java.awt.datatransfer.Transferable
Direct Known Subclasses:
Payment, Retrait, TransactionGroup, Versement, Virement

public class Transaction
extends java.lang.Object
implements java.lang.Comparable, java.awt.datatransfer.Transferable, java.io.Serializable

Java Bean Operation, Payment ... Any move of money managed by this software Can't be abstract cause Bean but this class should normally never be instanciated directly. (except to create some tmp transaction that serves to make a search in a list of txns)


Field Summary
private  double amount
          Holds value of property amount.
private static java.util.Calendar cal
          used to reset dates
private  CategoryPair categoryPair
          Holds value of property category.
private  boolean checked
          Holds value of property checked.
private  Category[] classification
          another category to look in many other ways , not used yet
private  java.util.Date creationDate
          Date & Time on which the user enter this transaction (date de saisie, util pour qq tri)
static java.awt.datatransfer.DataFlavor DATA_FLAVOR
           
private  java.util.Date date
          Holds value of property date.(Time should be reset to same value for all date)
private  java.lang.String details
          Holds value of property details.
private  java.util.Date effectiveDate
          Date on which the amount is really on our account
private  java.util.BitSet flags
          may be used later on ...
private static java.util.ResourceBundle i18n
           
static java.lang.String PROPERTY_ACCOUNT
           
static java.lang.String PROPERTY_AMOUNT
           
static java.lang.String PROPERTY_CATEGORY
           
static java.lang.String PROPERTY_CATEGORYPAIR
           
static java.lang.String PROPERTY_CHECKED
           
static java.lang.String PROPERTY_CREATION_DATE
           
static java.lang.String PROPERTY_DATE
           
static java.lang.String PROPERTY_DETAILS
           
static java.lang.String PROPERTY_DIRECTION
           
static java.lang.String PROPERTY_EFFECTIVE_DATE
           
static java.lang.String PROPERTY_ENTITY
           
static java.lang.String PROPERTY_FROM_ENTITY
           
static java.lang.String PROPERTY_NUMBER
           
static java.lang.String PROPERTY_SPLITTED
           
static java.lang.String PROPERTY_SRC_ACCOUNT
           
static java.lang.String PROPERTY_SUBCATEGORY
           
static java.lang.String PROPERTY_TARGET_ACCOUNT
           
static java.lang.String PROPERTY_TO_ENTITY
           
static java.lang.String PROPERTY_TYPE
           
static java.lang.String PROPERTY_TYPE_ICON
           
static java.lang.String PROPERTY_VERIFIED
           
private static long serialVersionUID
           
private  java.util.List txnList
          contains other transaction (for split txns)
private  boolean verified
          Holds value of property verified.
 
Constructor Summary
  Transaction()
          default constructor for a bean set the creation date to now
protected Transaction(java.util.Date date, double amount, java.lang.String details, CategoryPair cat)
          convenient constructor used by child public constructor but here should not be public
  Transaction(Transaction t)
          copy/convertor constructor (this accepts to create a Check from a Virement !)
 
Method Summary
private  void append(java.lang.StringBuffer sb, boolean xml, java.lang.String tag, java.lang.Object value, java.lang.String prefix, java.lang.String suffix)
          param tag name of xml tag
 int compareTo(java.lang.Object obj)
          Note: this class has a natural ordering that is inconsistent with equals ! should accept date null values, null means before anything Ordered on : Date,CreationDate
 void copy(Transaction t)
          Not a real copy constructor, but a convertor need to be overridden by each child (that add a property) this may not copy all properties to respect our human rules...
 void copyAutoEntry(Transaction t)
          Copy field that are null or empty for a template transaction.
 double getAmount()
          Getter for property amount.
 CategoryPair getCategoryPair()
          Getter for property category.
 Category[] getClassification()
          Getter for property classification.
 java.util.Date getCreationDate()
          Getter for property CreationDate.
 java.util.Date getDate()
          Getter for property date.
 java.lang.String getDetails()
          Getter for property details.
 java.lang.String getDirectionTip()
           
 java.util.Date getEffectiveDate()
          Getter for property effective_date.
 Entity getEntity()
          Convenient method when iterating over transactions and avoiding instanceof
 java.lang.String getEntityName()
          Convenient method when iterating over transactions and avoiding instanceof
 java.util.BitSet getFlags()
          Getter for property flags.
 java.lang.Long getID()
           
 Transaction getPasteClone()
           
static java.util.List getPasteClone(java.util.List list)
           
 double getRealAmount()
           
 java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
          Returns an object which represents the data to be transferred.
 java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
          Returns an array of DataFlavor objects indicating the flavors the data can be provided in.
 java.util.List getTxnList()
          Getter for property txnList.
 java.lang.String getType()
          not static as it should be override
 javax.swing.Icon getTypeIcon()
           
 boolean isChecked()
          Getter for property checked.
 boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
          Returns whether or not the specified data flavor is supported for this object.
 boolean isSplitted()
           
 boolean isVerified()
          Getter for property verified.
 void setAmount(double amount)
          Setter for property amount.
 void setCategoryPair(CategoryPair categoryPair)
          Complex behavior: - if given pair is special set to it - if current pair is null or special create a new one - if given pair is not special, just copy it.
 void setChecked(boolean checked)
          Setter for property checked.
 void setClassification(Category[] classification)
          Setter for property classification.
 void setCreationDate(java.util.Date creationDate)
          Should not be called manually, only serve to reload a bean.
 void setDate(java.util.Date date)
          Setter for property date.
 void setDetails(java.lang.String details)
          Setter for property details.
 void setEffectiveDate(java.util.Date effective_date)
          Setter for property effective_date.
 void setFlags(java.util.BitSet flags)
          Setter for property flags.
 void setTxnList(java.util.List txnList)
          Setter for property txnList.
 void setVerified(boolean verified)
          Setter for property verified.
 java.lang.String toString()
          Returns a string representation of the object.
private  java.lang.String toString(java.lang.String p, java.lang.String s, boolean xml)
           
 java.lang.String toStringCSV()
           
 java.lang.String toStringTAB()
           
 java.lang.String toStringXML()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

i18n

private static final transient java.util.ResourceBundle i18n

PROPERTY_AMOUNT

public static final transient java.lang.String PROPERTY_AMOUNT
See Also:
Constant Field Values

PROPERTY_DATE

public static final transient java.lang.String PROPERTY_DATE
See Also:
Constant Field Values

PROPERTY_EFFECTIVE_DATE

public static final transient java.lang.String PROPERTY_EFFECTIVE_DATE
See Also:
Constant Field Values

PROPERTY_CREATION_DATE

public static final transient java.lang.String PROPERTY_CREATION_DATE
See Also:
Constant Field Values

PROPERTY_CATEGORYPAIR

public static final transient java.lang.String PROPERTY_CATEGORYPAIR
See Also:
Constant Field Values

PROPERTY_CATEGORY

public static final transient java.lang.String PROPERTY_CATEGORY
See Also:
Constant Field Values

PROPERTY_SUBCATEGORY

public static final transient java.lang.String PROPERTY_SUBCATEGORY
See Also:
Constant Field Values

PROPERTY_DETAILS

public static final transient java.lang.String PROPERTY_DETAILS
See Also:
Constant Field Values

PROPERTY_NUMBER

public static final transient java.lang.String PROPERTY_NUMBER
See Also:
Constant Field Values

PROPERTY_TO_ENTITY

public static final transient java.lang.String PROPERTY_TO_ENTITY
See Also:
Constant Field Values

PROPERTY_FROM_ENTITY

public static final transient java.lang.String PROPERTY_FROM_ENTITY
See Also:
Constant Field Values

PROPERTY_ACCOUNT

public static final transient java.lang.String PROPERTY_ACCOUNT
See Also:
Constant Field Values

PROPERTY_CHECKED

public static final transient java.lang.String PROPERTY_CHECKED
See Also:
Constant Field Values

PROPERTY_VERIFIED

public static final transient java.lang.String PROPERTY_VERIFIED
See Also:
Constant Field Values

PROPERTY_SRC_ACCOUNT

public static final transient java.lang.String PROPERTY_SRC_ACCOUNT
See Also:
Constant Field Values

PROPERTY_TARGET_ACCOUNT

public static final transient java.lang.String PROPERTY_TARGET_ACCOUNT
See Also:
Constant Field Values

PROPERTY_DIRECTION

public static final transient java.lang.String PROPERTY_DIRECTION
See Also:
Constant Field Values

PROPERTY_ENTITY

public static final transient java.lang.String PROPERTY_ENTITY
See Also:
Constant Field Values

PROPERTY_TYPE

public static final transient java.lang.String PROPERTY_TYPE
See Also:
Constant Field Values

PROPERTY_TYPE_ICON

public static final transient java.lang.String PROPERTY_TYPE_ICON
See Also:
Constant Field Values

PROPERTY_SPLITTED

public static final transient java.lang.String PROPERTY_SPLITTED
See Also:
Constant Field Values

DATA_FLAVOR

public static final transient java.awt.datatransfer.DataFlavor DATA_FLAVOR

cal

private static final transient java.util.Calendar cal
used to reset dates


date

private java.util.Date date
Holds value of property date.(Time should be reset to same value for all date)


effectiveDate

private java.util.Date effectiveDate
Date on which the amount is really on our account


creationDate

private java.util.Date creationDate
Date & Time on which the user enter this transaction (date de saisie, util pour qq tri)


amount

private double amount
Holds value of property amount.


verified

private boolean verified
Holds value of property verified. It means owner make verification from the bank monthly receipe until this item


checked

private boolean checked
Holds value of property checked. It means if this transaction has been checked by the owner (thanks to a ticket,note or memory)


details

private java.lang.String details
Holds value of property details. (comment, details d'écriture ) Commentaire ou détails


flags

private transient java.util.BitSet flags
may be used later on ...


categoryPair

private CategoryPair categoryPair
Holds value of property category. (revenues/costs) Warning each txn should have its own instance of CategoryPair (or we will have bad bugs !!)


classification

private transient Category[] classification
another category to look in many other ways , not used yet


txnList

private java.util.List txnList
contains other transaction (for split txns)

Constructor Detail

Transaction

public Transaction()
default constructor for a bean set the creation date to now


Transaction

public Transaction(Transaction t)
copy/convertor constructor (this accepts to create a Check from a Virement !)


Transaction

protected Transaction(java.util.Date date,
                      double amount,
                      java.lang.String details,
                      CategoryPair cat)
convenient constructor used by child public constructor but here should not be public

Method Detail

copy

public void copy(Transaction t)
Not a real copy constructor, but a convertor need to be overridden by each child (that add a property) this may not copy all properties to respect our human rules... Used in convertion action of Payment to Versement ..


copyAutoEntry

public void copyAutoEntry(Transaction t)
Copy field that are null or empty for a template transaction. (Works on details, category pair, amount) need to be overridden by each child (that add a property) this may not copy all properties to respect our human rules...


isSplitted

public boolean isSplitted()

getDate

public java.util.Date getDate()
Getter for property date.


setDate

public void setDate(java.util.Date date)
Setter for property date.


getAmount

public double getAmount()
Getter for property amount.


setAmount

public void setAmount(double amount)
Setter for property amount.


isVerified

public boolean isVerified()
Getter for property verified.


setVerified

public void setVerified(boolean verified)
Setter for property verified.


isChecked

public boolean isChecked()
Getter for property checked.


setChecked

public void setChecked(boolean checked)
Setter for property checked.


getDetails

public java.lang.String getDetails()
Getter for property details.


setDetails

public void setDetails(java.lang.String details)
Setter for property details.


getCategoryPair

public CategoryPair getCategoryPair()
Getter for property category.


setCategoryPair

public void setCategoryPair(CategoryPair categoryPair)
Complex behavior: - if given pair is special set to it - if current pair is null or special create a new one - if given pair is not special, just copy it. Setter for property category. warning, used for serialization but if you need to copy a category pair or change its main or sub ctg, use other methods. (like getCategoryPair().setMain(categoryPair.getMain()))


getType

public java.lang.String getType()
not static as it should be override


getTypeIcon

public javax.swing.Icon getTypeIcon()

getDirectionTip

public java.lang.String getDirectionTip()

getRealAmount

public double getRealAmount()

getID

public java.lang.Long getID()

getEffectiveDate

public java.util.Date getEffectiveDate()
Getter for property effective_date.


setEffectiveDate

public void setEffectiveDate(java.util.Date effective_date)
Setter for property effective_date.


compareTo

public int compareTo(java.lang.Object obj)
Note: this class has a natural ordering that is inconsistent with equals ! should accept date null values, null means before anything Ordered on : Date,CreationDate

Specified by:
compareTo in interface java.lang.Comparable

getEntity

public Entity getEntity()
Convenient method when iterating over transactions and avoiding instanceof


getEntityName

public java.lang.String getEntityName()
Convenient method when iterating over transactions and avoiding instanceof


getCreationDate

public java.util.Date getCreationDate()
Getter for property CreationDate.


setCreationDate

public void setCreationDate(java.util.Date creationDate)
Should not be called manually, only serve to reload a bean. Setter for property creationDate.


toStringCSV

public java.lang.String toStringCSV()

toStringTAB

public java.lang.String toStringTAB()

toStringXML

public java.lang.String toStringXML()

toString

private java.lang.String toString(java.lang.String p,
                                  java.lang.String s,
                                  boolean xml)

append

private void append(java.lang.StringBuffer sb,
                    boolean xml,
                    java.lang.String tag,
                    java.lang.Object value,
                    java.lang.String prefix,
                    java.lang.String suffix)
param tag name of xml tag


getTransferData

public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
                                 throws java.awt.datatransfer.UnsupportedFlavorException,
                                        java.io.IOException
Returns an object which represents the data to be transferred. The class of the object returned is defined by the representation class of the flavor.

Specified by:
getTransferData in interface java.awt.datatransfer.Transferable

getTransferDataFlavors

public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
Returns an array of DataFlavor objects indicating the flavors the data can be provided in. The array should be ordered according to preference for providing the data (from most richly descriptive to least descriptive). Order: Transaction instance, text/csv, text/plain, String

Specified by:
getTransferDataFlavors in interface java.awt.datatransfer.Transferable

isDataFlavorSupported

public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
Returns whether or not the specified data flavor is supported for this object.

Specified by:
isDataFlavorSupported in interface java.awt.datatransfer.Transferable

getFlags

public java.util.BitSet getFlags()
Getter for property flags.


setFlags

public void setFlags(java.util.BitSet flags)
Setter for property flags.


getClassification

public Category[] getClassification()
Getter for property classification.


setClassification

public void setClassification(Category[] classification)
Setter for property classification.


toString

public java.lang.String toString()
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 


getTxnList

public java.util.List getTxnList()
Getter for property txnList.


setTxnList

public void setTxnList(java.util.List txnList)
Setter for property txnList.


getPasteClone

public Transaction getPasteClone()

getPasteClone

public static java.util.List getPasteClone(java.util.List list)