|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpl.edu.agh.cast.importer.base.template.ImportTemplateManager
public class ImportTemplateManager
A class which manages import templates.
Constructor Summary | |
---|---|
|
ImportTemplateManager()
Default constructor. |
protected |
ImportTemplateManager(ITemplateProvider provider)
Constructor (for test purpose). |
Method Summary | |
---|---|
void |
addTemplateToGroup(ImportTemplateGroup group,
IImportTemplate template)
Adds a given template to a given group. |
protected ImportTemplateGroup |
createNewDefaultGroup()
|
IImportTemplate |
createTemplateBasedOnImportProcess(ImportProcess process,
String name,
String description)
Creates new import template based on given ImportProcess object with given name and description. |
void |
exportTemplateToFile(UUID templateId,
File dest)
Exports a given template to specified file using defined ITemplateProvider . |
Collection<ImportTemplateGroup> |
getAllTemplateGroups()
|
IImportTemplate |
getTemplate(UUID templateId)
Gets template with specified id. |
IImportTemplate |
importTemplateFromFile(File file,
IMsgBoxHelper msgBoxHelper)
Imports template from a given file using defined ITemplateProvider . |
void |
reload()
This method clears cached data and rebuilds all templates and groups based on written data. |
void |
removeTemplate(UUID templateId)
Removed a template with given id. |
void |
removeTemplateFromGroup(ImportTemplateGroup group,
UUID templateId)
Removes template from a given group. |
void |
removeTemplateGroup(UUID groupId)
Removes template group with given id. |
protected ImportTemplateGroup |
retriveDefaultGroup()
|
void |
saveTemplate(IImportTemplate template,
ImportTemplateGroup group)
Adds newly created template to default template group. |
void |
saveTemplateGroup(ImportTemplateGroup group)
Saves template group. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ImportTemplateManager()
protected ImportTemplateManager(ITemplateProvider provider) throws TemplateException
provider
- custom template provider
TemplateException
Method Detail |
---|
public void saveTemplate(IImportTemplate template, ImportTemplateGroup group) throws TemplateException
template
- a new template to addgroup
- group which a new template will belong to; if null
a new template will be added to
default group
TemplateException
public void saveTemplateGroup(ImportTemplateGroup group) throws TemplateException
group
- group to save
TemplateException
public void removeTemplate(UUID templateId) throws TemplateException
templateId
- template id to remove
TemplateException
public void removeTemplateGroup(UUID groupId) throws TemplateException
IllegalArgumentException
is thrown. If
group is not empty an TemplateException
is thrown.
groupId
- id of group to be removed
TemplateException
- when given group is not emptypublic void addTemplateToGroup(ImportTemplateGroup group, IImportTemplate template) throws TemplateException
group
- a grouptemplate
- template to add
TemplateException
public void removeTemplateFromGroup(ImportTemplateGroup group, UUID templateId) throws TemplateException
group
- a grouptemplateId
- id of template to be removed from the group
TemplateException
public IImportTemplate getTemplate(UUID templateId)
templateId
- template id
null
if template with specified id does not existpublic Collection<ImportTemplateGroup> getAllTemplateGroups()
public IImportTemplate importTemplateFromFile(File file, IMsgBoxHelper msgBoxHelper) throws TemplateException
ITemplateProvider
. If imported templates already exists
method returns without import action.
file
- file from which a new template will be importedmsgBoxHelper
- message box helper which is used to show messages to user
null
if user cancelled the operation
TemplateException
public void exportTemplateToFile(UUID templateId, File dest) throws TemplateException
ITemplateProvider
.
templateId
- id of template to exportdest
- file where a template will be stored
TemplateException
- when an error occurs during saving template in external filepublic IImportTemplate createTemplateBasedOnImportProcess(ImportProcess process, String name, String description) throws TemplateException
ImportProcess
object with given name and description.
process
- import process which is base for new templatename
- template namedescription
- template description
TemplateException
- when import process is not completepublic void reload() throws TemplateException
TemplateException
protected ImportTemplateGroup retriveDefaultGroup() throws TemplateException
TemplateException
protected ImportTemplateGroup createNewDefaultGroup()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |