com.groiss.store
Interface Exportable

All Known Implementing Classes:
BatchJob, DMSFolderItemRel, DocForm, DocumentVersion, DocumentVersionRel, FolderForm, com.dec.avw.core.Form, com.dec.gi.sql.LoggedObject, com.dec.gi.sql.SQLObject

public interface Exportable

Classes that want to provide the possibility of being exported/imported by the import/export functionality of @enterprise must implement this interface.

Since:
@enterprise 6.3

Field Summary
static java.lang.String[][] emptyKeys
          Empty String array which can be used by classes which don't want to define keys.
 
Method Summary
 void addRequiredObjects(java.util.List preReqObjects)
          This methid is called by the exporter before an object is exported.
 boolean beforeImport(java.util.Map values, ImportHandler data)
          This method is called by the importer before the object is filled with data.
 java.util.List exportAsElements()
          A class can use this method to define which fields should be exported as own XML elements instead of simple attributes.
 java.lang.String[][] getKeys()
          A class has to return key groups in order to identify already existing objects of that class.
 java.util.List ignoreFields()
          Here a class can return the names of fields which should not be exported during an @enterprise export.
 

Field Detail

emptyKeys

static final java.lang.String[][] emptyKeys
Empty String array which can be used by classes which don't want to define keys.

Method Detail

getKeys

java.lang.String[][] getKeys()
A class has to return key groups in order to identify already existing objects of that class. A key group must uniquely identify an object. This method returns an array of arrays, because a class can have more than one key group. In that case each of the key groups must be unique for an object to be unique (thus, group1 matches OR group2 matches etc.).

Returns:
An array of arrays containing object field names of the fields which form key groups for uniquely identifying objects of classes implementing this interface. An example would be {{"name", "birthdate"}} for a class defining one key group containing the fields name and birthdate.

ignoreFields

java.util.List ignoreFields()
Here a class can return the names of fields which should not be exported during an @enterprise export.
Fields that are declared with the modifiers transient or volatile are never exported, thus you don't need to include them here.

Returns:
A list containing the names (as Strings) of fields which will not be exported when an export is being performed.

exportAsElements

java.util.List exportAsElements()
A class can use this method to define which fields should be exported as own XML elements instead of simple attributes. This is optionally and just can help to make the resulting XML export file more readable.
Fields of type byte[] are always exported as elements and don't need to be included here.

Returns:
A list containing the names (as Strings) of fields which will be exported as XML elements instead of attributes.

addRequiredObjects

void addRequiredObjects(java.util.List preReqObjects)
This methid is called by the exporter before an object is exported. The object can add required objects to the passed list.

Parameters:
preReqObjects - List containing required objects. Required objects must be Persistent objects implementing the Exportable interface.

beforeImport

boolean beforeImport(java.util.Map values,
                     ImportHandler data)
This method is called by the importer before the object is filled with data. An object can modify the values before the import is performed and decide if it wants to be imported at all (by returning true or false).
Attention: if you want to modify values, change them directly in the values Map! Don't set fields of the exportable object, because they would be overwritten later when the importer fills the object with the values of the values Map.

Parameters:
values - The map contains the values with which the object will be filled. Key is a String with the field name, value is the value object (String for text fields, Long or Double for decimal fields, etc.).
Returns:
true if import should be performed or false if this object should be skipped.


Copyright © 2001-2006 Groiss Informatics GmbH. All Rights Reserved.