net.datacrow.core.modules
Class DcModules

java.lang.Object
  extended by net.datacrow.core.modules.DcModules

public class DcModules
extends java.lang.Object

This class registers and manages all modules present within Data Crow. Things to know: - Property modules are stored in "propertyBaseModules". These modules are used as templates for the actual references. (DcPropertyModule.getIndex() + DcModule.getIndex()) - Multi relation references are stored in the same way except they also get a mapping module (<ParentModule>.getIndex() + <ReferencedModule>.getIndex() + DcModules._MAPPING) - If defined, a base property module serves multiple modules (such as the music genres).

Author:
Robert Jan van der Waals

Field Summary
static int _ACTOR
           
static int _AUDIOCD
           
static int _AUDIOTRACK
           
static int _AUTHOR
           
static int _BINDING
           
static int _BOOK
           
static int _BOOKPUBLISHER
           
static int _CATEGORY
           
static int _CONTACTPERSON
           
static int _CONTAINER
           
static int _CONTAINERTYPE
           
static int _COUNTRY
           
static int _DEVELOPER
           
static int _DIRECTOR
           
static int _EDITIONTYPE
           
static int _EXTERNALREFERENCE
           
static int _GENRE
           
static int _IMAGE
           
static int _ITEM
           
static int _LANGUAGE
           
static int _LICENSE
           
static int _LOAN
           
static int _MAPPING
           
static int _MEDIA
           
static int _MOVIE
           
static int _MOVIE_ASPECT_RATIO
           
static int _MOVIE_COLOR
           
static int _MUSICALBUM
           
static int _MUSICARTIST
           
static int _MUSICGENRE
           
static int _MUSICTRACK
           
static int _PERMISSION
           
static int _PICTURE
           
static int _PLATFORM
           
static int _SOFTWARE
           
static int _SOFTWAREPUBLISHER
           
static int _STATE
           
static int _STORAGEMEDIA
           
static int _TAB
           
static int _TEMPLATE
           
static int _USER
           
 
Constructor Summary
DcModules()
           
 
Method Summary
static void applySettings()
          Apply all settings on the item.
static DcModule convert(XmlModule xmlModule)
          Converts a XmlModule to a real module.
static DcModule get(int key)
          Get the module for the specified key.
static DcModule get(java.lang.String name)
          Get the module based on its internal name.
static java.util.List<DcModule> getAbstractModules(DcModule m)
           
static java.util.Collection<DcModule> getActualReferencingModules(int moduleIdx)
          Retrieves all modules having a reference to the specified modules.
static java.util.Collection<DcModule> getAllModules()
          Retrieves all modules
static int getAvailableIdx(XmlModule module)
          Get a new, unused, index.
static DcModule getCurrent()
          Returns the currently selected main module.
static java.util.Collection<DcModule> getCustomModules()
          Retrieves the user defined modules
static int getMappingModIdx(int module, int referenceModIdx, int fieldIdx)
          Determines the correct index for the mapping module.
static DcModule getModuleForTable(java.lang.String table)
           
static java.util.Collection<DcModule> getModules()
          Retrieves all enabled modules
static java.util.List<DcModule> getPersistentModules(DcModule abstractModule)
           
static DcPropertyModule getPropertyBaseModule(int module)
          Retrieves the property base module which can be used as template.
static java.util.Collection<DcPropertyModule> getPropertyBaseModules()
          Retrieves the property base modules which are used as templates.
static DcPropertyModule getPropertyModule(DcField field)
          Retrieve the referenced property module for the given field.
static java.util.Collection<DcPropertyModule> getPropertyModules(DcModule module)
          Retrieves the property modules used by the specified module.
static DcModule getReferencedModule(DcField field)
          Retrieve the referenced module for the given field.
static java.util.Collection<DcModule> getReferencedModules(int moduleIdx)
           
static java.util.Collection<DcModule> getReferencingModules(int moduleIdx)
          Retrieves all modules having a reference to the specified modules.
static boolean isTopModule(int moduleIdx)
           
static boolean isUsedInMapping(int modIdx)
           
static void load()
          Loads all modules.
static void loadData()
          Start to load data for all modules
static void register(DcModule module)
          A direct add of the module to the modules list.
static void registerBasePropertyModule(DcPropertyModule module)
          Holds the global property modules.
static void registerPropertyModules(DcModule module)
          Registers the property modules referenced by the given module
static void remove(int key)
          Remove the specified module.
static void save()
          Save all module jar files
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_SOFTWARE

public static final int _SOFTWARE
See Also:
Constant Field Values

_MOVIE

public static final int _MOVIE
See Also:
Constant Field Values

_MUSICALBUM

public static final int _MUSICALBUM
See Also:
Constant Field Values

_AUDIOCD

public static final int _AUDIOCD
See Also:
Constant Field Values

_BOOK

public static final int _BOOK
See Also:
Constant Field Values

_IMAGE

public static final int _IMAGE
See Also:
Constant Field Values

_CONTACTPERSON

public static final int _CONTACTPERSON
See Also:
Constant Field Values

_MEDIA

public static final int _MEDIA
See Also:
Constant Field Values

_MUSICTRACK

public static final int _MUSICTRACK
See Also:
Constant Field Values

_AUDIOTRACK

public static final int _AUDIOTRACK
See Also:
Constant Field Values

_PICTURE

public static final int _PICTURE
See Also:
Constant Field Values

_LOAN

public static final int _LOAN
See Also:
Constant Field Values

_USER

public static final int _USER
See Also:
Constant Field Values

_PERMISSION

public static final int _PERMISSION
See Also:
Constant Field Values

_CONTAINER

public static final int _CONTAINER
See Also:
Constant Field Values

_ITEM

public static final int _ITEM
See Also:
Constant Field Values

_CATEGORY

public static final int _CATEGORY
See Also:
Constant Field Values

_STORAGEMEDIA

public static final int _STORAGEMEDIA
See Also:
Constant Field Values

_PLATFORM

public static final int _PLATFORM
See Also:
Constant Field Values

_TEMPLATE

public static final int _TEMPLATE
See Also:
Constant Field Values

_MUSICGENRE

public static final int _MUSICGENRE
See Also:
Constant Field Values

_STATE

public static final int _STATE
See Also:
Constant Field Values

_GENRE

public static final int _GENRE
See Also:
Constant Field Values

_CONTAINERTYPE

public static final int _CONTAINERTYPE
See Also:
Constant Field Values

_TAB

public static final int _TAB
See Also:
Constant Field Values

_ACTOR

public static final int _ACTOR
See Also:
Constant Field Values

_DIRECTOR

public static final int _DIRECTOR
See Also:
Constant Field Values

_AUTHOR

public static final int _AUTHOR
See Also:
Constant Field Values

_BOOKPUBLISHER

public static final int _BOOKPUBLISHER
See Also:
Constant Field Values

_SOFTWAREPUBLISHER

public static final int _SOFTWAREPUBLISHER
See Also:
Constant Field Values

_DEVELOPER

public static final int _DEVELOPER
See Also:
Constant Field Values

_MUSICARTIST

public static final int _MUSICARTIST
See Also:
Constant Field Values

_COUNTRY

public static final int _COUNTRY
See Also:
Constant Field Values

_LANGUAGE

public static final int _LANGUAGE
See Also:
Constant Field Values

_BINDING

public static final int _BINDING
See Also:
Constant Field Values

_EDITIONTYPE

public static final int _EDITIONTYPE
See Also:
Constant Field Values

_EXTERNALREFERENCE

public static final int _EXTERNALREFERENCE
See Also:
Constant Field Values

_MOVIE_COLOR

public static final int _MOVIE_COLOR
See Also:
Constant Field Values

_MOVIE_ASPECT_RATIO

public static final int _MOVIE_ASPECT_RATIO
See Also:
Constant Field Values

_LICENSE

public static final int _LICENSE
See Also:
Constant Field Values

_MAPPING

public static final int _MAPPING
See Also:
Constant Field Values
Constructor Detail

DcModules

public DcModules()
Method Detail

load

public static void load()
                 throws ModuleUpgradeException,
                        InvalidModuleXmlException,
                        ModuleJarException
Loads all modules.

Throws:
ModuleUpgradeException
InvalidModuleXmlException
ModuleJarException

isTopModule

public static boolean isTopModule(int moduleIdx)

save

public static void save()
Save all module jar files


getMappingModIdx

public static int getMappingModIdx(int module,
                                   int referenceModIdx,
                                   int fieldIdx)
Determines the correct index for the mapping module. Note that these indices are also used to determine the mapped modules indices.


getAvailableIdx

public static int getAvailableIdx(XmlModule module)
Get a new, unused, index. Should only be used by the module wizards


getCustomModules

public static java.util.Collection<DcModule> getCustomModules()
Retrieves the user defined modules


convert

public static DcModule convert(XmlModule xmlModule)
Converts a XmlModule to a real module.


registerBasePropertyModule

public static void registerBasePropertyModule(DcPropertyModule module)
Holds the global property modules. These are used as a template to create specific referenced modules from.


register

public static void register(DcModule module)
A direct add of the module to the modules list. An error is logged if the module was already registered.


registerPropertyModules

public static void registerPropertyModules(DcModule module)
Registers the property modules referenced by the given module


getPropertyModules

public static java.util.Collection<DcPropertyModule> getPropertyModules(DcModule module)
Retrieves the property modules used by the specified module. References are determined by the fields of the module.


getReferencedModule

public static DcModule getReferencedModule(DcField field)
Retrieve the referenced module for the given field. This can either be the module to which the field belongs, the referenced module or null.

Parameters:
field -

getPropertyModule

public static DcPropertyModule getPropertyModule(DcField field)
Retrieve the referenced property module for the given field. Will return null when the field does not contain a reference to a property module.

Parameters:
field -

getPropertyBaseModules

public static java.util.Collection<DcPropertyModule> getPropertyBaseModules()
Retrieves the property base modules which are used as templates.


getPropertyBaseModule

public static DcPropertyModule getPropertyBaseModule(int module)
Retrieves the property base module which can be used as template.

Parameters:
module - The module index

get

public static DcModule get(java.lang.String name)
Get the module based on its internal name. The internal name differs, in most cases, from the label.

Parameters:
name -

get

public static DcModule get(int key)
Get the module for the specified key.

Parameters:
key -

remove

public static void remove(int key)
Remove the specified module.


getCurrent

public static DcModule getCurrent()
Returns the currently selected main module.


applySettings

public static void applySettings()
Apply all settings on the item.

Parameters:
definitions -

getModuleForTable

public static DcModule getModuleForTable(java.lang.String table)

loadData

public static void loadData()
Start to load data for all modules


isUsedInMapping

public static boolean isUsedInMapping(int modIdx)

getReferencedModules

public static java.util.Collection<DcModule> getReferencedModules(int moduleIdx)

getReferencingModules

public static java.util.Collection<DcModule> getReferencingModules(int moduleIdx)
Retrieves all modules having a reference to the specified modules. Note: The check is based on the source module index (base module), not the actual instances.

Parameters:
moduleIdx -
See Also:
getActualReferencingModules(int)

getActualReferencingModules

public static java.util.Collection<DcModule> getActualReferencingModules(int moduleIdx)
Retrieves all modules having a reference to the specified modules. Note: The check is based on the actual module index (the calculated module index).

Parameters:
moduleIdx -
See Also:
getReferencingModules(int)

getAllModules

public static java.util.Collection<DcModule> getAllModules()
Retrieves all modules


getAbstractModules

public static java.util.List<DcModule> getAbstractModules(DcModule m)

getPersistentModules

public static java.util.List<DcModule> getPersistentModules(DcModule abstractModule)

getModules

public static java.util.Collection<DcModule> getModules()
Retrieves all enabled modules