com.silverpeas.form.record
Class GenericRecordSetManager

java.lang.Object
  extended by com.silverpeas.form.record.GenericRecordSetManager

public class GenericRecordSetManager
extends Object

The GenericRecordSetManage all the GenericRecordSet. It is a singleton.


Method Summary
 void cloneRecord(IdentifiedRecordTemplate templateFrom, String objectIdFrom, IdentifiedRecordTemplate templateTo, String objectIdTo, Map<String,String> fileIds)
           
 GenericRecordSet createRecordSet(String externalId, RecordTemplate template)
          Build and return a new record set.
 GenericRecordSet createRecordSet(String externalId, RecordTemplate template, String templateName, boolean encrypted)
           
 void decryptData(String templateName)
           
 void deleteRecord(IdentifiedRecordTemplate template, DataRecord deletedRecord)
          Delete the DataRecord registered by the pair (templateId, recordId).
 void encryptData(String templateName)
           
protected  List<RecordRow> getAllRecordsOfTemplate(String templateName)
           
static GenericRecordSetManager getInstance()
          Gets the single instance of this manager.
 List<String> getLanguagesOfRecord(IdentifiedRecordTemplate template, String externalId)
           
 String getRawValue(String templateExternalId, String recordExternalId, String fieldName)
          Get value of a field record directly from database.
 DataRecord getRecord(IdentifiedRecordTemplate template, String objectId)
          Return the DataRecord registered by the pair (templateId, recordId).
 DataRecord getRecord(IdentifiedRecordTemplate template, String objectId, String language)
          Return the DataRecord registered by the tuple (templateId, objectId, language).
 RecordSet getRecordSet(String externalId)
          Return the record set known be its external id.
 void insertRecord(IdentifiedRecordTemplate template, DataRecord insertedRecord)
          Register the DataRecord with the pair (templateId, recordId).
 void moveRecord(int recordId, IdentifiedRecordTemplate templateTo)
           
 void removeRecordSet(String externalId)
          Remove the record set known by its external id.
 void removeTemplateFromCache(String templateName)
           
protected  void updateFieldRows(Connection con, List<RecordRow> rows)
           
 void updateRecord(IdentifiedRecordTemplate template, DataRecord updatedRecord)
          Save the DataRecord registered by the pair (templateId, recordId).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static GenericRecordSetManager getInstance()
Gets the single instance of this manager.

Returns:
the single instance of GenericRecordSetManager.

createRecordSet

public GenericRecordSet createRecordSet(String externalId,
                                        RecordTemplate template)
                                 throws FormException
Build and return a new record set.

Parameters:
externalId -
template -
Returns:
Throws:
FormException

createRecordSet

public GenericRecordSet createRecordSet(String externalId,
                                        RecordTemplate template,
                                        String templateName,
                                        boolean encrypted)
                                 throws FormException
Throws:
FormException

getRawValue

public String getRawValue(String templateExternalId,
                          String recordExternalId,
                          String fieldName)
                   throws FormException
Get value of a field record directly from database.

Parameters:
templateExternalId - template external id
recordExternalId - record external id
fieldName - field name
Returns:
the field record value
Throws:
FormException

getRecordSet

public RecordSet getRecordSet(String externalId)
                       throws FormException
Return the record set known be its external id.

Parameters:
externalId -
Returns:
Throws:
FormException - when the id is unknown.

removeRecordSet

public void removeRecordSet(String externalId)
                     throws FormException
Remove the record set known by its external id.

Parameters:
externalId -
Throws:
FormException - when the id is unknown.

removeTemplateFromCache

public void removeTemplateFromCache(String templateName)

getRecord

public DataRecord getRecord(IdentifiedRecordTemplate template,
                            String objectId)
                     throws FormException
Return the DataRecord registered by the pair (templateId, recordId).

Parameters:
template - the definition of the form template the record belongs to.
objectId - the ID of the resource attached to form record.
Returns:
the form record or null if not found.
Throws:
FormException - if the (templateId, recordId) pair is unknown.

getRecord

public DataRecord getRecord(IdentifiedRecordTemplate template,
                            String objectId,
                            String language)
                     throws FormException
Return the DataRecord registered by the tuple (templateId, objectId, language). If language does not match, fallback to other languages is done.

Parameters:
template - the definition of the form template the record belongs to.
objectId - the ID of the resource attached to form record.
Returns:
the form record in given language or in next language or null if not found.
Throws:
FormException - if the (templateId, recordId) pair is unknown.

getLanguagesOfRecord

public List<String> getLanguagesOfRecord(IdentifiedRecordTemplate template,
                                         String externalId)
                                  throws FormException
Throws:
FormException

insertRecord

public void insertRecord(IdentifiedRecordTemplate template,
                         DataRecord insertedRecord)
                  throws FormException
Register the DataRecord with the pair (templateId, recordId).

Parameters:
template -
insertedRecord -
Throws:
FormException - if the (templateId, recordId) pair is already known or if the given template is unknown.

cloneRecord

public void cloneRecord(IdentifiedRecordTemplate templateFrom,
                        String objectIdFrom,
                        IdentifiedRecordTemplate templateTo,
                        String objectIdTo,
                        Map<String,String> fileIds)
                 throws FormException
Throws:
FormException

moveRecord

public void moveRecord(int recordId,
                       IdentifiedRecordTemplate templateTo)
                throws FormException
Throws:
FormException

updateRecord

public void updateRecord(IdentifiedRecordTemplate template,
                         DataRecord updatedRecord)
                  throws FormException
Save the DataRecord registered by the pair (templateId, recordId).

Parameters:
template -
updatedRecord -
Throws:
FormException - when the (templateId, recordId) pair is unknown.

deleteRecord

public void deleteRecord(IdentifiedRecordTemplate template,
                         DataRecord deletedRecord)
                  throws FormException
Delete the DataRecord registered by the pair (templateId, recordId).

Parameters:
template -
deletedRecord -
Throws:
FormException - when the (templateId, recordId) pair is unknown.

encryptData

public void encryptData(String templateName)
                 throws CryptoException
Throws:
CryptoException

decryptData

public void decryptData(String templateName)
                 throws CryptoException
Throws:
CryptoException

updateFieldRows

protected void updateFieldRows(Connection con,
                               List<RecordRow> rows)
                        throws SQLException
Throws:
SQLException

getAllRecordsOfTemplate

protected List<RecordRow> getAllRecordsOfTemplate(String templateName)
                                           throws FormException
Throws:
FormException


Copyright © 2016 Silverpeas. All Rights Reserved.