public class MoneydanceSyncableItem
extends java.lang.Object
implements com.infinitekind.tiksync.SyncableItem
Modifier and Type | Field and Description |
---|---|
protected AccountBook |
book |
protected com.infinitekind.tiksync.SyncRecord |
info |
Constructor and Description |
---|
MoneydanceSyncableItem() |
MoneydanceSyncableItem(AccountBook book) |
Modifier and Type | Method and Description |
---|---|
void |
addParameters(java.util.Map<java.lang.String,java.lang.String> additionalParams)
Add/merge all parameters from the given map that don't already have a key in the internal map
|
void |
addTags(java.util.Map<java.lang.String,java.lang.String> newTags)
Set the TagSet associated with this object.
|
protected boolean |
autoSyncsChanges()
Return true if any changes to this object are automatically synced
|
static java.util.List<java.lang.String> |
decodeKeywordList(java.lang.String keywordString) |
boolean |
deleteItem()
Deletes this item and writes a remove-item entry to the syncing system.
|
boolean |
doesParameterExist(java.lang.String parameterName) |
MoneydanceSyncableItem |
duplicate()
Return a clone of this object with the same backing info
|
static java.lang.String |
encodeKeywordList(java.util.List<java.lang.String> keywords) |
boolean |
equals(java.lang.Object obj) |
Account |
getAccountParameter(java.lang.String acctNumKey,
java.lang.String acctIDKey,
Account defaultValue)
Lookup and return an account that was referenced by this object using one
of the given parameter names.
|
AddressBookEntry |
getAddress() |
AddressBookEntry |
getAddressParameter(java.lang.String addressNumKey,
java.lang.String addressIDKey,
AddressBookEntry defaultValue)
Lookup and return an address book entry that was referenced by this object using one
of the given parameter names.
|
AccountBook |
getBook() |
boolean |
getBooleanParameter(java.lang.String parameterName,
boolean defaultVal)
Get the specified parameter as a boolean.
|
CurrencyType |
getCurrencyParameter(java.lang.String currNumKey,
java.lang.String currIDKey,
CurrencyType defaultValue)
Lookup and return a currency that was referenced by this object using one
of the given parameter names.
|
double |
getDoubleParameter(java.lang.String parameterName,
double defaultVal)
Get the specified parameter as a double (64 bit) float.
|
int |
getIntParameter(java.lang.String parameterName,
int defaultVal)
Get the specified parameter as an integer.
|
java.util.List<java.lang.String> |
getKeywords() |
long |
getLongParameter(java.lang.String parameterName,
long defaultVal)
Get the specified parameter as a long.
|
java.lang.String |
getParameter(java.lang.String parameterName) |
java.lang.String |
getParameter(java.lang.String parameterName,
java.lang.String defaultStr)
Get the specified parameter name.
|
int |
getParameterCount()
Get an enumeration of the keys of this object's parameters
|
java.util.Set<java.lang.String> |
getParameterKeys() |
java.lang.String |
getPreference(java.lang.String key,
java.lang.String defaultValue)
Returns the String value associated with the given key in the local data file-specific preferences
|
boolean |
getPreferenceBoolean(java.lang.String key,
boolean defaultValue)
Returns the boolean value associated with the given key in the local data file-specific preferences
|
double |
getPreferenceDouble(java.lang.String key,
double defaultValue)
Returns the double value associated with the given key in the local data file-specific preferences
|
int |
getPreferenceInt(java.lang.String key,
int defaultValue)
Returns the integer value associated with the given key in the local data file-specific preferences
|
int[] |
getPreferenceIntArray(java.lang.String key)
Returns an array of integers from in the local data file-specific preferences that were stored
using setPreference(String, int[])
|
long |
getPreferenceLong(java.lang.String key,
long defaultValue)
Returns the long value associated with the given key in the local data file-specific preferences
|
java.util.List<java.lang.String> |
getPreferenceStringList(java.lang.String key)
Return a list of string values that were stored with setPreference(key, ...)
(ie in the local data file-specific preferences)
|
java.util.List<com.infinitekind.tiksync.SyncRecord> |
getPreferenceSublist(java.lang.String prefix)
Returns a list of SyncRecord objects which were stored with setPreference(key, ...)
in the local data file-specific preferences.
|
com.infinitekind.tiksync.SyncRecord |
getPreferenceSubset(java.lang.String prefix)
Returns a new SyncRecord with the key-value pairs for which the keys
have the given prefix in the local data file-specific preferences.
|
com.infinitekind.tiksync.SyncRecord |
getSyncInfo()
save this item to a new SyncRecord and return it.
|
java.lang.String |
getSyncItemType()
Subclasses should override this to return a static string identifying their type of object
|
long |
getSyncTimestamp()
The timestamp is handled in the loading/syncing code
|
java.lang.String |
getUUID()
Return the unique identifier for this object
|
int |
hashCode() |
boolean |
hasKeywordSubstring(java.lang.String matchString,
boolean caseSensitive) |
protected void |
initialize(AccountBook book) |
protected boolean |
isInEditingMode() |
protected boolean |
isSyncable() |
protected void |
itemWasUpdated()
This is called after an item is updated by calling itemWasUpdated(SyncRecord).
|
void |
itemWasUpdated(com.infinitekind.tiksync.SyncRecord syncInfo)
Is called when this item was synced from the net so that the object can be made aware of new values
|
protected void |
itemWillSync()
This is called just before an item will be stored and/or synced when itemWillSync(SyncRecord)
is called.
|
void |
itemWillSync(com.infinitekind.tiksync.SyncRecord syncInfo)
Called just before this item is synced to the net so that the object can store its values
into the given map.
|
static MoneydanceSyncableItem |
makeSyncableItem(AccountBook accountBook,
com.infinitekind.tiksync.SyncRecord itemInfo) |
void |
removeParameter(java.lang.String parameterName)
Remove the parameter with the given name.
|
void |
setAccountParameter(java.lang.String acctNumKey,
java.lang.String acctIDKey,
Account acct)
Store a reference to acct in this object using the given keys.
|
void |
setAddress(AddressBookEntry address) |
void |
setAddressParameter(java.lang.String oldAddressIDKey,
java.lang.String addressIDKey,
AddressBookEntry address)
Store a reference to address in this account using the keys.
|
void |
setCurrencyParameter(java.lang.String currNumKey,
java.lang.String currIDKey,
CurrencyType curr)
Store a reference to currency in this object using the given keys.
|
protected void |
setDirty()
Marks this object as needing saving and puts it in a buffer for objects needing syncing
|
void |
setEditingMode()
Put the object into "editing mode" in which no changes will be automatically saved until
you call syncItem() on this.
|
void |
setKeywords(java.util.List<java.lang.String> newKeywords)
Store a reference to the given keywords (aka tags) in this object.
|
void |
setParameter(java.lang.String parameterName,
boolean parameterValue)
Set the given parameter name to the given boolean value
|
void |
setParameter(java.lang.String parameterName,
double parameterValue)
Set the given parameter name to the given double value
|
void |
setParameter(java.lang.String parameterName,
int parameterValue)
Set the given parameter name to the given integer value
|
void |
setParameter(java.lang.String parameterName,
long parameterValue)
Set the given parameter name to the given long value
|
void |
setParameter(java.lang.String name,
java.util.Map value) |
void |
setParameter(java.lang.String name,
java.lang.String val) |
void |
setParameterNoNotify(java.lang.String parameterName,
java.lang.String parameterValue)
Set the given parameter name to the given value but don't notify listeners of changes!
|
void |
setPreference(java.lang.String parameterName,
boolean parameterValue)
Set the given parameter name to the given boolean value, without sending
an account-changed event, or recording the account as dirty.
|
void |
setPreference(java.lang.String parameterName,
int parameterValue)
Set the given parameter name to the given integer value, without sending
an account-changed event, or recording the account as dirty.
|
void |
setPreference(java.lang.String parameterName,
java.lang.String parameterValue)
Set the given preference name to the given value and associate it with this
object in _local storage_.
|
boolean |
syncItem()
Call this to tell the storage that this item was changed and needs to be synced
Please don't call this when either of the itemWasUpdated(..) methods are invoked
unless you enjoy infinite loops as well as wasting bandwidth and disk space.
|
protected com.infinitekind.tiksync.SyncRecord info
protected AccountBook book
public MoneydanceSyncableItem(AccountBook book)
public MoneydanceSyncableItem()
protected void initialize(AccountBook book)
public final AccountBook getBook()
public void setEditingMode()
protected boolean isInEditingMode()
public boolean syncItem()
public boolean deleteItem()
protected boolean autoSyncsChanges()
protected void setDirty()
protected void itemWasUpdated()
protected void itemWillSync()
public final void itemWasUpdated(com.infinitekind.tiksync.SyncRecord syncInfo)
com.infinitekind.tiksync.SyncableItem
itemWasUpdated
in interface com.infinitekind.tiksync.SyncableItem
public final void itemWillSync(com.infinitekind.tiksync.SyncRecord syncInfo)
com.infinitekind.tiksync.SyncableItem
itemWillSync
in interface com.infinitekind.tiksync.SyncableItem
protected boolean isSyncable()
public final java.lang.String getUUID()
com.infinitekind.tiksync.SyncableItem
getUUID
in interface com.infinitekind.tiksync.SyncableItem
public final com.infinitekind.tiksync.SyncRecord getSyncInfo()
public final long getSyncTimestamp()
getSyncTimestamp
in interface com.infinitekind.tiksync.SyncableItem
public java.lang.String getSyncItemType()
getSyncItemType
in interface com.infinitekind.tiksync.SyncableItem
public MoneydanceSyncableItem duplicate()
public final boolean doesParameterExist(java.lang.String parameterName)
public final java.lang.String getParameter(java.lang.String parameterName)
public final java.lang.String getParameter(java.lang.String parameterName, java.lang.String defaultStr)
public final int getIntParameter(java.lang.String parameterName, int defaultVal)
public final long getLongParameter(java.lang.String parameterName, long defaultVal)
public double getDoubleParameter(java.lang.String parameterName, double defaultVal)
public final boolean getBooleanParameter(java.lang.String parameterName, boolean defaultVal)
public final void setParameter(java.lang.String parameterName, boolean parameterValue)
public final void setParameter(java.lang.String parameterName, int parameterValue)
public final void setParameter(java.lang.String parameterName, long parameterValue)
public final void setParameter(java.lang.String parameterName, double parameterValue)
public final void setPreference(java.lang.String parameterName, boolean parameterValue)
public final void setPreference(java.lang.String parameterName, int parameterValue)
public final void setPreference(java.lang.String parameterName, java.lang.String parameterValue)
public final void setParameter(java.lang.String name, java.lang.String val)
public void addParameters(java.util.Map<java.lang.String,java.lang.String> additionalParams)
public final void addTags(java.util.Map<java.lang.String,java.lang.String> newTags)
public final void setParameter(java.lang.String name, java.util.Map value)
public com.infinitekind.tiksync.SyncRecord getPreferenceSubset(java.lang.String prefix)
public java.util.List<java.lang.String> getPreferenceStringList(java.lang.String key)
public java.util.List<com.infinitekind.tiksync.SyncRecord> getPreferenceSublist(java.lang.String prefix)
public int getPreferenceInt(java.lang.String key, int defaultValue)
public int[] getPreferenceIntArray(java.lang.String key)
public long getPreferenceLong(java.lang.String key, long defaultValue)
public double getPreferenceDouble(java.lang.String key, double defaultValue)
public boolean getPreferenceBoolean(java.lang.String key, boolean defaultValue)
public java.lang.String getPreference(java.lang.String key, java.lang.String defaultValue)
public final void setParameterNoNotify(java.lang.String parameterName, java.lang.String parameterValue)
public final void removeParameter(java.lang.String parameterName)
public final int getParameterCount()
public Account getAccountParameter(java.lang.String acctNumKey, java.lang.String acctIDKey, Account defaultValue)
public void setAccountParameter(java.lang.String acctNumKey, java.lang.String acctIDKey, Account acct)
public CurrencyType getCurrencyParameter(java.lang.String currNumKey, java.lang.String currIDKey, CurrencyType defaultValue)
public void setCurrencyParameter(java.lang.String currNumKey, java.lang.String currIDKey, CurrencyType curr)
public AddressBookEntry getAddressParameter(java.lang.String addressNumKey, java.lang.String addressIDKey, AddressBookEntry defaultValue)
public void setAddress(AddressBookEntry address)
public AddressBookEntry getAddress()
public void setAddressParameter(java.lang.String oldAddressIDKey, java.lang.String addressIDKey, AddressBookEntry address)
public void setKeywords(java.util.List<java.lang.String> newKeywords)
public java.util.List<java.lang.String> getKeywords()
public boolean hasKeywordSubstring(java.lang.String matchString, boolean caseSensitive)
public static final java.lang.String encodeKeywordList(java.util.List<java.lang.String> keywords)
public static final java.util.List<java.lang.String> decodeKeywordList(java.lang.String keywordString)
public final java.util.Set<java.lang.String> getParameterKeys()
public static MoneydanceSyncableItem makeSyncableItem(AccountBook accountBook, com.infinitekind.tiksync.SyncRecord itemInfo)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object