Class GenericRecordSetManager
- java.lang.Object
-
- org.silverpeas.core.contribution.content.form.record.GenericRecordSetManager
-
public class GenericRecordSetManager extends Object
The GenericRecordSetManage all the GenericRecordSet. It is a singleton.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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(DataRecord deletedRecord)
Delete the DataRecord registered by the pair (templateId, recordId).void
encryptData(String templateName)
Set<String>
getAllComponentIdsOfRecords()
protected List<RecordRow>
getAllRecordsOfTemplate(String templateName)
List<String>
getExternalIdOfComponentInstanceId(String componentInstanceId)
static GenericRecordSetManager
getInstance()
Gets the single instance of this manager.List<String>
getLanguagesOfRecord(IdentifiedRecordTemplate template, String externalId)
Map<String,Integer>
getNumberOfRecordsByTemplateAndComponents(String templateName)
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).List<DataRecord>
getRecords(IdentifiedRecordTemplate template, String fieldName, String fieldValue)
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).
-
-
-
Method Detail
-
getInstance
public static GenericRecordSetManager getInstance()
Gets the single instance of this manager.- Returns:
- the single instance of GenericRecordSetManager.
-
getExternalIdOfComponentInstanceId
public List<String> getExternalIdOfComponentInstanceId(String componentInstanceId) throws FormException
- Throws:
FormException
-
createRecordSet
public GenericRecordSet createRecordSet(String externalId, RecordTemplate template) throws FormException
Build and return a new record set.- 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 idrecordExternalId
- record external idfieldName
- 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.- Throws:
FormException
- when the id is unknown.
-
removeRecordSet
public void removeRecordSet(String externalId) throws FormException
Remove the record set known by its external id.- 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.
-
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(DataRecord deletedRecord) throws FormException
Delete the DataRecord registered by the pair (templateId, recordId).- Parameters:
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
-
getRecords
public List<DataRecord> getRecords(IdentifiedRecordTemplate template, String fieldName, String fieldValue) throws FormException
- Throws:
FormException
-
getNumberOfRecordsByTemplateAndComponents
public Map<String,Integer> getNumberOfRecordsByTemplateAndComponents(String templateName) throws FormException
- Throws:
FormException
-
getAllComponentIdsOfRecords
public Set<String> getAllComponentIdsOfRecords() throws FormException
- Throws:
FormException
-
updateFieldRows
protected void updateFieldRows(Connection con, List<RecordRow> rows) throws SQLException
- Throws:
SQLException
-
getAllRecordsOfTemplate
protected List<RecordRow> getAllRecordsOfTemplate(String templateName) throws FormException
- Throws:
FormException
-
-