net.datacrow.core.data
Class DataManager

java.lang.Object
  extended by net.datacrow.core.data.DataManager

public class DataManager
extends java.lang.Object

Author:
Robert Jan van der Waals

Constructor Summary
DataManager()
           
 
Method Summary
static DcImageIcon addIcon(java.lang.String ID, java.lang.String base64)
           
static void addMapping(DcObject parent, DcObject child, int fieldIdx)
          Adds a referenced item to the specified parent object.
static boolean checkTab(int module, java.lang.String name)
          Retrieves the tab.
static DcObject createReference(DcObject dco, int fieldIdx, java.lang.Object value)
          Creates a reference to the specified object.
static void deleteIcons()
           
static java.util.List<DcObject> get(DataFilter filter)
          Overloaded
static java.util.List<DcObject> get(DataFilter filter, int[] fields)
          Retrieve items using the specified data filter.
static java.util.List<DcObject> get(int modIdx, int[] fields)
          Overloaded
static java.util.List<DcObject> getChildren(java.lang.String parentID, int childIdx, int[] fields)
          Retrieves the children for the specified parent.
static java.util.Map<java.lang.String,java.lang.Integer> getChildrenKeys(java.lang.String parentID, int childIdx)
          Retrieves the children for the specified parent.
static int getCount(int module, int field, java.lang.Object value)
           
static Loan getCurrentLoan(java.lang.String parentID)
          Retrieves the actual loan.
static DcImageIcon getIcon(DcObject dco)
           
static DcObject getItem(int module, java.lang.String ID)
           
static DcObject getItem(int module, java.lang.String ID, int[] fields)
          Retrieve the item based on its ID.
static java.util.List<java.lang.String> getKeyList(DataFilter filter)
           
static java.util.Map<java.lang.String,java.lang.Integer> getKeys(DataFilter filter)
           
static java.util.Collection<Loan> getLoans(java.lang.String parentID)
          Retrieves all the loans (actual and historic).
static DcObject getObjectByExternalID(int moduleIdx, java.lang.String type, java.lang.String externalID)
           
static DcObject getObjectForString(int module, java.lang.String reference)
           
static java.util.Collection<DcObject> getPictures(java.lang.String parentID)
          Retrieves all pictures for the given parent ID.
static java.util.List<DcObject> getReferences(int modIdx, java.lang.String parentID, boolean full)
          Retrieve all referenced items for the given parent ID.
static java.util.List<DcObject> getReferencingItems(DcObject item)
           
static java.util.List<DcSimpleValue> getSimpleValues(int module, boolean icons)
          Retrieve items using the specified data filter.
static DcObject getTab(int module, java.lang.String name)
           
static java.util.List<DcObject> getTabs(int module)
           
static java.util.List<java.util.List<java.lang.String>> getWebValues(DataFilter df, int[] fields, java.util.List<WebFieldDefinition> definitions)
          Specifically created for the web interface.
static void removeIcon(java.lang.String ID)
           
static void updateIcon(java.lang.String ID)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataManager

public DataManager()
Method Detail

addIcon

public static DcImageIcon addIcon(java.lang.String ID,
                                  java.lang.String base64)

getIcon

public static DcImageIcon getIcon(DcObject dco)

removeIcon

public static void removeIcon(java.lang.String ID)

updateIcon

public static void updateIcon(java.lang.String ID)

deleteIcons

public static void deleteIcons()

getCount

public static int getCount(int module,
                           int field,
                           java.lang.Object value)

getWebValues

public static java.util.List<java.util.List<java.lang.String>> getWebValues(DataFilter df,
                                                                            int[] fields,
                                                                            java.util.List<WebFieldDefinition> definitions)
Specifically created for the web interface. Returns the entire result set as a flat string structure.

Parameters:
df -
fields -
definitions -
Returns:

getChildren

public static java.util.List<DcObject> getChildren(java.lang.String parentID,
                                                   int childIdx,
                                                   int[] fields)
Retrieves the children for the specified parent.

Parameters:
parentId - The parent object ID.
childIdx - The child module index.
Returns:
The children or an empty collection.

getChildrenKeys

public static java.util.Map<java.lang.String,java.lang.Integer> getChildrenKeys(java.lang.String parentID,
                                                                                int childIdx)
Retrieves the children for the specified parent.

Parameters:
parentId - The parent object ID.
childIdx - The child module index.
Returns:
The children or an empty collection.

createReference

public static DcObject createReference(DcObject dco,
                                       int fieldIdx,
                                       java.lang.Object value)
Creates a reference to the specified object. The provided value can either be a DcObject or a display string. In the latter case the display string will be used to retrieve the DcObject. If no object is found it will be created and saved. The online search is used to retrieve additional information.

Parameters:
dco - The item to which the reference will be created.
fieldIdx - The field index to set the reference on.
value - The referenced value.
Returns:
If an object has been created for the specified value this object will be returned. Else null will be returned.

getReferencingItems

public static java.util.List<DcObject> getReferencingItems(DcObject item)

checkTab

public static boolean checkTab(int module,
                               java.lang.String name)
Retrieves the tab. In case it does not yet exists the tab is created and stored to the database.

Parameters:
module -
name -
create -
Returns:
Existing or newly created tab

getTab

public static DcObject getTab(int module,
                              java.lang.String name)

getTabs

public static java.util.List<DcObject> getTabs(int module)

addMapping

public static void addMapping(DcObject parent,
                              DcObject child,
                              int fieldIdx)
Adds a referenced item to the specified parent object.

Parameters:
parent - The item to which the reference will be added.
child - The to be referenced item.
fieldIdx - The field holding the reference.

getLoans

public static java.util.Collection<Loan> getLoans(java.lang.String parentID)
Retrieves all the loans (actual and historic).

Parameters:
parentID - The item ID for which the loans are retrieved.
Returns:
A collection holding loans or an empty collection.

getCurrentLoan

public static Loan getCurrentLoan(java.lang.String parentID)
Retrieves the actual loan.

Parameters:
parentID - The item ID for which the loan is retrieved.

getObjectByExternalID

public static DcObject getObjectByExternalID(int moduleIdx,
                                             java.lang.String type,
                                             java.lang.String externalID)

getObjectForString

public static DcObject getObjectForString(int module,
                                          java.lang.String reference)

getItem

public static DcObject getItem(int module,
                               java.lang.String ID)

getItem

public static DcObject getItem(int module,
                               java.lang.String ID,
                               int[] fields)
Retrieve the item based on its ID.

Parameters:
module -
ID -
Returns:
null or the item if found.

getReferences

public static java.util.List<DcObject> getReferences(int modIdx,
                                                     java.lang.String parentID,
                                                     boolean full)
Retrieve all referenced items for the given parent ID.

Parameters:
module -
parentId -

getPictures

public static java.util.Collection<DcObject> getPictures(java.lang.String parentID)
Retrieves all pictures for the given parent ID.

Parameters:
parentId -
Returns:
Either the pictures or an empty collection.

getKeyList

public static java.util.List<java.lang.String> getKeyList(DataFilter filter)

getKeys

public static java.util.Map<java.lang.String,java.lang.Integer> getKeys(DataFilter filter)

getSimpleValues

public static java.util.List<DcSimpleValue> getSimpleValues(int module,
                                                            boolean icons)
Retrieve items using the specified data filter.

Parameters:
filter -
fields -
See Also:
DataFilter

get

public static java.util.List<DcObject> get(DataFilter filter,
                                           int[] fields)
Retrieve items using the specified data filter.

Parameters:
filter -
fields -
See Also:
DataFilter

get

public static java.util.List<DcObject> get(int modIdx,
                                           int[] fields)
Overloaded

See Also:
get(DataFilter, int[])

get

public static java.util.List<DcObject> get(DataFilter filter)
Overloaded

See Also:
get(DataFilter, int[])