forked from codinguser/gnucash-android
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
codinguser#876 - Create AccountUtils
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
app/src/main/java/org/gnucash/android/ui/util/AccountUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package org.gnucash.android.ui.util; | ||
|
||
import org.gnucash.android.db.DatabaseSchema; | ||
import org.gnucash.android.model.AccountType; | ||
|
||
/** | ||
* Utilities for Accounts UI | ||
* | ||
* @author JeanGarf | ||
*/ | ||
public class AccountUtils { | ||
|
||
/** | ||
* Build the where clause to select Accounts allowed for Transfer | ||
* for the given accountUID | ||
* | ||
* @param accountUID | ||
* The account UID for which we want to collect account allowed for transfer | ||
* May be null (to allow all non special accounts) | ||
* | ||
* @return | ||
* the where clause | ||
* | ||
* @author JeanGarf | ||
*/ | ||
public static String getTransfertAccountWhereClause(final String accountUID) { | ||
|
||
return "(" | ||
+ DatabaseSchema.AccountEntry.COLUMN_UID | ||
+ " != '" | ||
+ ((accountUID != null) ? accountUID : "") | ||
+ "' AND " | ||
+ DatabaseSchema.AccountEntry.COLUMN_TYPE | ||
+ " != '" | ||
+ AccountType.ROOT.name() | ||
+ "' AND " | ||
+ DatabaseSchema.AccountEntry.COLUMN_PLACEHOLDER | ||
+ " = 0" | ||
+ " AND " | ||
+ DatabaseSchema.AccountEntry.COLUMN_HIDDEN | ||
+ " = 0" | ||
+ ")"; | ||
} | ||
} |