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

Quick Search    Search Deep

Source code: com/obs/common/accounting/objects/GLAccountType.java


1   package com.obs.common.accounting.objects;
2   import java.util.ArrayList;
3   import java.util.Arrays;
4   import java.util.List;
5   
6   public class GLAccountType implements java.io.Serializable {
7   
8     public static final int CURRENT_ASSET = 1,
9                             INVENTORY     = 2,
10                            LONG_TERM_ASSET     = 3,
11                            OTHER_ASSET         = 4,
12                            CURRENT_LIABILITY   = 5,
13                            LONG_TERM_LIABILITY = 6,
14                            OTHER_LIABILITY     = 7,
15                            REVENUE             = 8,
16                            EXPENSE             = 9,
17                            EQUITY              = 10;
18  
19    public static final int[] range = {CURRENT_ASSET, INVENTORY,
20                                                         LONG_TERM_ASSET, OTHER_ASSET,
21                                                         CURRENT_LIABILITY, LONG_TERM_LIABILITY,
22                                                         OTHER_LIABILITY, REVENUE,
23                                                         EXPENSE, EQUITY};
24  
25    public static final int LOW_RANGE  = 1, HIGH_RANGE = 10;
26    
27    public static final boolean[] balanceTypes = {true,
28                                                                                true,
29                                                                                true,
30                                                                                true,
31                                                                                false,
32                                                                                false,
33                                                                                false,
34                                                                                false,
35                                                                                false,
36                                                                                false};
37  
38    public static final String[] names = {"Current Asset",
39                                                                "Inventory",
40                                                                "Long Term Asset",
41                                                                "Other Asset",
42                                                                "Current Liability",
43                                                                "Long Term Liability",
44                                                                "Other Liability",
45                                                                "Revenue",
46                                                                "Expense",
47                                                                "Equity"};
48  
49  
50      protected int actType;
51  
52      public GLAccountType() { setAccountType(1); }
53      public GLAccountType(int accountType) { setAccountType(accountType); }
54  
55      public GLAccountType(String accountType) throws NumberFormatException {
56        setAccountType(new Integer(accountType).intValue());
57      }
58      public GLAccountType(Integer accountType) {
59        setAccountType(accountType.intValue());
60      }
61      
62      public static List getTypeNames() {
63          return Arrays.asList(names); 
64      }
65    
66      public static List getTypeNames(int currentType) {
67          List fullList = getTypeNames();
68          if(currentType >= LOW_RANGE && currentType <= HIGH_RANGE)
69              fullList.remove(currentType);
70          return fullList;                                                             
71      }
72    
73      public static List getRange() {
74          int c;
75          List list = new ArrayList();
76          for(c = LOW_RANGE;c <= HIGH_RANGE; c++) {
77              list.add(new Integer(range[c-1]).toString());     
78          }
79          return list;
80      }
81    
82  
83    public void setAccountType(int accountType) {
84      if(accountType >= LOW_RANGE && accountType <= HIGH_RANGE) { actType = accountType; }
85      else { actType = LOW_RANGE; }
86    }
87    
88    
89    public int intValue() { return this.actType; }
90  
91    public boolean getPositiveBalanceType() { return balanceTypes[actType - 1]; }
92    public String getAccountTypeName()     { return names[actType - 1]; }
93  
94  }