Package de.xima.fc.gui.bean.plugin
Class BasicPluginBean<E extends IPluginEntity<?,?,?>>
- java.lang.Object
-
- de.xima.fc.gui.bean.plugin.BasicPluginBean<E>
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ClientPluginBean
,SystemPluginBean
public abstract class BasicPluginBean<E extends IPluginEntity<?,?,?>> extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description BasicPluginBean(IGenericDao<E> dao)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
activate(PluginWrapperModel<E> plugin)
When the user click on the button to activate a plugin.void
addNew()
Void
checkForAvailableUpdates()
This method is called when the plugin management page is loaded initially.void
checkMarkedPluginUpdates()
x Handler for when the user click on the button in the UI.void
checkPluginUpdate()
This method checks if the currently selected plugin needs an update.void
checkPluginUpdate(PluginWrapperModel<E> plugin)
This method checks if the passed plugin needs an update.abstract List<PluginDependencies>
createPluginDependencies(PluginRuntime runtime)
This method creates a list of plugin dependencies.protected List<de.xima.proma.restclient.pub.gen.model.PublicStoreItemMetaResource>
createStoreItemMetaResources(List<PluginWrapperModel<E>> pluginList)
void
deactivate()
void
deactivate(PluginWrapperModel<E> plugin)
void
delete(PluginWrapperModel<E> plugin)
When the user clicks on the button to delete a plugin.protected abstract void
deleteInternPluginMessages(IEntityContext ec, PluginWrapperModel<E> plugin)
This method deletes the internal update message of a plugin.void
deleteMarked()
protected abstract boolean
deletePlugin(PluginWrapperModel<E> plugin)
void
deletePlugins(List<PluginWrapperModel<E>> pluginList)
protected boolean
doesPluginKeyExist(PluginWrapperModel<E> plugin, String currentPluginKey, String currentPluginFileKey)
protected boolean
doesPluginKeyExist(String currentPluginKey, String currentPluginFileKey)
protected static IEntityContext
ec()
void
expandPluginDesc()
List<PluginWrapperModel<E>>
getAll()
protected abstract Set<PluginRuntime>
getAllPluginRuntimes()
List<PluginWrapperModel<E>>
getAllPluginsByKey(String key)
This method returns a list of plugins which all have either the same plugin key in the database or in the manifest.String
getEntityClassKey()
InternalMessageBean
getInternalMessageBean()
protected abstract EEntityKeySelectionType
getKeyType()
List<PluginWrapperModel<E>>
getMarked()
org.primefaces.model.StreamedContent
getMarkedPlugins()
protected abstract PluginWrapperModel<E>
getNewPlugin()
List<PluginDependencies>
getPluginDependencies()
File
getPluginFile(PluginWrapperModel<E> plugin)
protected String
getPluginKey(PluginWrapperModel<E> plugin)
String
getPluginName(PluginWrapperModel<E> plugin)
List<PluginWrapperModel<E>>
getPluginsToDelete()
SameChecksumPlugins<E>
getPluginStoreListChecksum()
PluginWrapperModel<E>
getPluginToDeactivate()
Map<Long,PluginUpdateMetadata>
getPluginUpdateStatusMap()
PluginWrapperModel<E>
getSelected()
PluginOverwriteData
getSelectedOverwriteData()
PluginUpdateMetadata
getSelectedPluginMetadata()
SelectionBean
getSelectionBean()
org.primefaces.model.StreamedContent
getSinglePlugin(PluginWrapperModel<E> plugin)
protected org.primefaces.model.StreamedContent
getStreamedContent(List<PluginWrapperModel<E>> plugins, String zipFileName)
EPluginUpdateAvailability
getUpdateStatus(PluginWrapperModel<E> plugin)
This method returns the current update status of a plugin from the pluginUpdateStatusMap.List<String>
getValidationErrorMessages(PluginWrapperModel<E> plugin)
boolean
getValidationStatus(PluginWrapperModel<E> plugin)
protected <R> StageChain<Void,R>
insertPluginUpdateStates(IPublicPromaInvocationContext pc, List<PluginWrapperModel<E>> pluginList)
protected <R> StageChain<Void,R>
insertPluginUpdateStatus(IPublicPromaInvocationContext pc, List<PluginWrapperModel<E>> pluginList)
boolean
isContainsEntityPlugins()
boolean
isDeactivateWithSave()
boolean
isLegacyPlugin(PluginWrapperModel<E> plugin)
boolean
isMarkedContainsEntityPlugins()
boolean
isPluginDescExpanded()
protected <R> StageChain<Boolean,R>
isPluginStoreConnected(IPublicPromaInvocationContext pc)
This method returns informations about the connecting to the plugin store.boolean
isPromaDataLoading()
protected <R> StageChain<Void,R>
loadInitialSelectedPluginData(IPublicPromaInvocationContext pc, de.xima.proma.restclient.pub.gen.model.PublicStoreItemUpdateCheckResult result, String licenseKey)
List<PluginWrapperModel<E>>
markedWithUpdates()
void
onPluginSelected()
When the user select a plugin in the list of plugins to the left.void
openPluginDeactivateDialog(PluginWrapperModel<E> plugin, boolean isDeactivateWithSave)
void
openPluginDeleteDialog(PluginWrapperModel<E> plugin)
void
openPluginMarkedDeleteDialog()
void
overwriteSelectedPlugin()
protected <R> StageChain<Void,R>
preparePluginForUpdateCheck(IPublicPromaInvocationContext pc, PluginWrapperModel<E> plugin)
void
save()
When the user click on the save button, persists the currently selected plugin and activates it.protected abstract boolean
save(PluginWrapperModel<E> plugin, boolean isUpdate)
void
savePlugin()
protected void
selectDefault()
void
setDeactivateWithSave(boolean isDeactivateWithSave)
void
setInternalMessageBean(InternalMessageBean internalMessageBean)
void
setMarked(List<PluginWrapperModel<E>> marked)
void
setPluginDescExpanded(boolean pluginDescExpanded)
void
setPluginKeyFromChecksum(de.xima.proma.restclient.pub.gen.model.PublicStoreItemResource pluginsWithSameChecksum)
For the dialog where the user can choose a plugin when the plugin does not have a PROMA ID yet and multiple plugins with the same checksum were found.void
setPluginsToDelete(List<PluginWrapperModel<E>> pluginsToDelete)
void
setPluginStoreListChecksum(SameChecksumPlugins<E> pluginStoreListChecksum)
void
setPluginToDeactivate(PluginWrapperModel<E> pluginToDeactivate)
void
setPluginUpdateStatusMap(Map<Long,PluginUpdateMetadata> pluginUpdateStatusMap)
void
setPropertiesAfterActivation(PluginWrapperModel<E> plugin)
void
setSelected(PluginWrapperModel<E> selected)
void
setSelectedFromMarked()
void
setSelectedOverwriteData(PluginOverwriteData selectedOverwriteData)
void
setSelectedPluginMetadata(PluginUpdateMetadata selectedPluginMetadata)
void
setSelectionBean(SelectionBean selectionBean)
protected void
setTempRuntimeFile(PluginWrapperModel<E> plugin)
protected <R> StageChain<Void,R>
showUpdateAvailabilityMsg(IPublicPromaInvocationContext pc, EPluginUpdateAvailability updateStatus, PluginWrapperModel<E> plugin)
protected void
sortAllByPluginName()
Sorts the plugin list by the plugin name from proma.void
update(PluginWrapperModel<E> plugin, File updatedFile)
PluginWrapperModel<E>
updateAssignedPlugin(PluginWrapperModel<E> plugin, String pluginKey, String repository)
This method sets the plugin key for assigning the plugin to a plugin in proma and saving it in the database.abstract void
updateData()
void
updateMarkedPlugins()
When the user clicks on the button to update all plugins currently selected by the user on the UI.void
updatePlugin(PluginWrapperModel<E> plugin, boolean updateSelectedPlugin)
Updates a plugin with the updated plugin version from proma.protected <R> StageChain<EPluginUpdateAvailability,R>
updatePluginStatus(IPublicPromaInvocationContext pc, PluginWrapperModel<E> plugin)
void
updateSelectedPlugin()
void
upload(org.primefaces.event.FileUploadEvent evt)
When the user uploads a plugin.void
uploadAndPersist(org.primefaces.event.FileUploadEvent evt)
When the user uploads a plugin.void
uploadUpdatedPlugin(org.primefaces.event.FileUploadEvent evt)
When the user uploads a plugin for updating manually.
-
-
-
Field Detail
-
all
protected List<PluginWrapperModel<E extends IPluginEntity<?,?,?>>> all
-
dao
protected IGenericDao<E extends IPluginEntity<?,?,?>> dao
-
internalMessageBean
@Inject protected InternalMessageBean internalMessageBean
-
isPromaDataLoading
protected boolean isPromaDataLoading
-
marked
protected List<PluginWrapperModel<E extends IPluginEntity<?,?,?>>> marked
-
pluginStoreListChecksum
protected SameChecksumPlugins<E extends IPluginEntity<?,?,?>> pluginStoreListChecksum
-
pluginMetadataMap
protected Map<Long,PluginUpdateMetadata> pluginMetadataMap
-
pluginUpdateStatusMap
protected Map<Long,org.apache.commons.lang3.tuple.Pair<String,EPluginUpdateAvailability>> pluginUpdateStatusMap
-
selected
protected PluginWrapperModel<E extends IPluginEntity<?,?,?>> selected
-
selectedPluginMetadata
protected PluginUpdateMetadata selectedPluginMetadata
-
userManager
@Inject protected SessionUserManager userManager
-
selectionBean
@Inject protected SelectionBean selectionBean
-
localeBean
@Inject protected LocaleBean localeBean
-
viewContextBean
@Inject protected ViewContextBean viewContextBean
-
viewEventBusBean
@Inject protected ViewEventBusBean viewEventBusBean
-
pluginDependencyBean
@Inject protected PluginDependenciesBean pluginDependencyBean
-
pluginDescExpanded
protected boolean pluginDescExpanded
-
pluginDependencies
protected List<PluginDependencies> pluginDependencies
-
isDeactivateWithSave
protected boolean isDeactivateWithSave
-
-
Constructor Detail
-
BasicPluginBean
public BasicPluginBean(IGenericDao<E> dao)
-
-
Method Detail
-
ec
protected static IEntityContext ec()
-
expandPluginDesc
public void expandPluginDesc()
-
activate
public void activate(PluginWrapperModel<E> plugin)
When the user click on the button to activate a plugin.- Parameters:
plugin
- Plugin to activate.
-
addNew
public void addNew()
-
checkForAvailableUpdates
public Void checkForAvailableUpdates()
This method is called when the plugin management page is loaded initially. It fetches the plugin meta data from PROMA and updates the UI when done.- Returns:
- A stage that completes once the update check has completed.
-
checkMarkedPluginUpdates
public void checkMarkedPluginUpdates()
x Handler for when the user click on the button in the UI. It checks if the marked plugins needs a update.
-
checkPluginUpdate
public void checkPluginUpdate()
This method checks if the currently selected plugin needs an update. When multiple plugin candidates were found in PROMA, shows the dialog for selecting a plugin.
-
checkPluginUpdate
public void checkPluginUpdate(PluginWrapperModel<E> plugin)
This method checks if the passed plugin needs an update. When multiple plugin candidates were found in PROMA, shows the dialog for selecting a plugin.- Parameters:
plugin
- the plugin for update check
-
deactivate
public void deactivate()
-
deactivate
public void deactivate(PluginWrapperModel<E> plugin)
-
openPluginDeactivateDialog
public void openPluginDeactivateDialog(PluginWrapperModel<E> plugin, boolean isDeactivateWithSave)
-
openPluginDeleteDialog
public void openPluginDeleteDialog(PluginWrapperModel<E> plugin)
-
openPluginMarkedDeleteDialog
public void openPluginMarkedDeleteDialog()
-
delete
public void delete(PluginWrapperModel<E> plugin)
When the user clicks on the button to delete a plugin.- Parameters:
plugin
- Plugin to delete.
-
deletePlugins
public void deletePlugins(List<PluginWrapperModel<E>> pluginList)
-
deleteMarked
public void deleteMarked()
-
getAll
public List<PluginWrapperModel<E>> getAll()
-
createStoreItemMetaResources
protected List<de.xima.proma.restclient.pub.gen.model.PublicStoreItemMetaResource> createStoreItemMetaResources(List<PluginWrapperModel<E>> pluginList)
-
getAllPluginsByKey
public List<PluginWrapperModel<E>> getAllPluginsByKey(String key)
This method returns a list of plugins which all have either the same plugin key in the database or in the manifest.- Parameters:
key
- the plugin key which should be compared- Returns:
- a list of all plugins with the same plugin key
-
getEntityClassKey
public String getEntityClassKey()
-
getInternalMessageBean
public InternalMessageBean getInternalMessageBean()
-
getMarked
public List<PluginWrapperModel<E>> getMarked()
-
getMarkedPlugins
public org.primefaces.model.StreamedContent getMarkedPlugins()
-
getPluginFile
public File getPluginFile(PluginWrapperModel<E> plugin) throws IOException
- Throws:
IOException
-
getPluginName
public String getPluginName(PluginWrapperModel<E> plugin)
-
getPluginStoreListChecksum
public SameChecksumPlugins<E> getPluginStoreListChecksum()
-
getPluginUpdateStatusMap
public Map<Long,PluginUpdateMetadata> getPluginUpdateStatusMap()
-
getSelected
public PluginWrapperModel<E> getSelected()
-
getSelectedPluginMetadata
public PluginUpdateMetadata getSelectedPluginMetadata()
-
getSelectionBean
public SelectionBean getSelectionBean()
-
isPluginDescExpanded
public boolean isPluginDescExpanded()
-
setPluginDescExpanded
public void setPluginDescExpanded(boolean pluginDescExpanded)
-
getSinglePlugin
public org.primefaces.model.StreamedContent getSinglePlugin(PluginWrapperModel<E> plugin)
-
getUpdateStatus
public EPluginUpdateAvailability getUpdateStatus(PluginWrapperModel<E> plugin)
This method returns the current update status of a plugin from the pluginUpdateStatusMap.- Parameters:
plugin
- the plugin which should be checked- Returns:
- the update status of the plugin
-
getValidationErrorMessages
public List<String> getValidationErrorMessages(PluginWrapperModel<E> plugin)
-
getValidationStatus
public boolean getValidationStatus(PluginWrapperModel<E> plugin)
-
isContainsEntityPlugins
public boolean isContainsEntityPlugins()
-
isLegacyPlugin
public boolean isLegacyPlugin(PluginWrapperModel<E> plugin)
-
isMarkedContainsEntityPlugins
public boolean isMarkedContainsEntityPlugins()
- Returns:
true
if the marked plugins containing an entity-based one
-
isPromaDataLoading
public boolean isPromaDataLoading()
- Returns:
- Whether data is currently being fetched from PROMA. Used to show a loading icon initially when the page is loaded.
-
markedWithUpdates
public List<PluginWrapperModel<E>> markedWithUpdates()
-
onPluginSelected
public void onPluginSelected()
When the user select a plugin in the list of plugins to the left.
-
savePlugin
public void savePlugin()
-
save
public void save()
When the user click on the save button, persists the currently selected plugin and activates it.
-
setInternalMessageBean
public void setInternalMessageBean(InternalMessageBean internalMessageBean)
-
setMarked
public void setMarked(List<PluginWrapperModel<E>> marked)
-
setPluginKeyFromChecksum
public void setPluginKeyFromChecksum(de.xima.proma.restclient.pub.gen.model.PublicStoreItemResource pluginsWithSameChecksum)
For the dialog where the user can choose a plugin when the plugin does not have a PROMA ID yet and multiple plugins with the same checksum were found. This method assign an ID to the plugin selected by the user and closes the assignment dialog.- Parameters:
pluginsWithSameChecksum
- The resource of the PROMA plugin store with the same check sum.
-
setPluginStoreListChecksum
public void setPluginStoreListChecksum(SameChecksumPlugins<E> pluginStoreListChecksum)
-
setPluginUpdateStatusMap
public void setPluginUpdateStatusMap(Map<Long,PluginUpdateMetadata> pluginUpdateStatusMap)
-
setPropertiesAfterActivation
public void setPropertiesAfterActivation(PluginWrapperModel<E> plugin)
-
setSelected
public void setSelected(PluginWrapperModel<E> selected)
-
setSelectedFromMarked
public void setSelectedFromMarked()
-
setSelectedPluginMetadata
public void setSelectedPluginMetadata(PluginUpdateMetadata selectedPluginMetadata)
-
setSelectionBean
public void setSelectionBean(SelectionBean selectionBean)
-
update
public void update(PluginWrapperModel<E> plugin, File updatedFile)
-
updateAssignedPlugin
public PluginWrapperModel<E> updateAssignedPlugin(PluginWrapperModel<E> plugin, String pluginKey, String repository)
This method sets the plugin key for assigning the plugin to a plugin in proma and saving it in the database.- Parameters:
plugin
- the plugin which should be assigniedpluginKey
- the plugin key for assigning- Returns:
- the saved and updated plugin which is assignied to a plugin in proma
-
updateData
public abstract void updateData()
-
createPluginDependencies
public abstract List<PluginDependencies> createPluginDependencies(PluginRuntime runtime)
This method creates a list of plugin dependencies. Dependencies are workflow actions and trigger, client dashboards and authenticators.- Parameters:
runtime
- the plugin runtime to get all dependencies- Returns:
- list of plugin dependencies
-
updateMarkedPlugins
public void updateMarkedPlugins()
When the user clicks on the button to update all plugins currently selected by the user on the UI.
-
updatePlugin
public void updatePlugin(PluginWrapperModel<E> plugin, boolean updateSelectedPlugin)
Updates a plugin with the updated plugin version from proma. If it is a plugin that consists of several files, the file key, which comes either from the database or manifest, is used to determine which plugin jar is updated with which file from proma. If no file key is available, identical plugin jar names are searched. Remaining files from Proma will be installed additionally.- Parameters:
plugin
- the plugin which should be updatedupdateSelectedPlugin
- Whether the selected plugin should be updated.
-
updateSelectedPlugin
public void updateSelectedPlugin()
-
upload
public void upload(org.primefaces.event.FileUploadEvent evt)
When the user uploads a plugin. Reads the plugin file and shows the contents of the plugin. The plugin is not saved in the database.- Parameters:
evt
- File upload event with the plugin JAR.
-
uploadAndPersist
public void uploadAndPersist(org.primefaces.event.FileUploadEvent evt)
When the user uploads a plugin. Reads the plugin file and shows the contents of the plugin. When the plugin was newly added , also saves the plugin.- Parameters:
evt
- File event with the uploaded plugin JAR.
-
uploadUpdatedPlugin
public void uploadUpdatedPlugin(org.primefaces.event.FileUploadEvent evt)
When the user uploads a plugin for updating manually. Reads the plugin file and shows the contents of the plugin. The plugin is not saved in the database. This method is for the manually update. For this there is no check for already existing plugins based on the plugin key.- Parameters:
evt
- File upload event with the plugin JAR.
-
overwriteSelectedPlugin
public void overwriteSelectedPlugin()
-
deleteInternPluginMessages
protected abstract void deleteInternPluginMessages(IEntityContext ec, PluginWrapperModel<E> plugin)
This method deletes the internal update message of a plugin.- Parameters:
plugin
- the plugin for deleting internal message
-
deletePlugin
protected abstract boolean deletePlugin(PluginWrapperModel<E> plugin)
- Parameters:
plugin
- Plugin to be deleted.- Returns:
true
iff the plugin was deleted.
-
getAllPluginRuntimes
protected abstract Set<PluginRuntime> getAllPluginRuntimes()
-
getKeyType
protected abstract EEntityKeySelectionType getKeyType()
-
getNewPlugin
protected abstract PluginWrapperModel<E> getNewPlugin()
-
getPluginKey
protected String getPluginKey(PluginWrapperModel<E> plugin)
-
getStreamedContent
protected org.primefaces.model.StreamedContent getStreamedContent(List<PluginWrapperModel<E>> plugins, String zipFileName)
-
insertPluginUpdateStatus
protected <R> StageChain<Void,R> insertPluginUpdateStatus(IPublicPromaInvocationContext pc, List<PluginWrapperModel<E>> pluginList)
-
insertPluginUpdateStates
protected <R> StageChain<Void,R> insertPluginUpdateStates(IPublicPromaInvocationContext pc, List<PluginWrapperModel<E>> pluginList)
-
loadInitialSelectedPluginData
protected <R> StageChain<Void,R> loadInitialSelectedPluginData(IPublicPromaInvocationContext pc, de.xima.proma.restclient.pub.gen.model.PublicStoreItemUpdateCheckResult result, String licenseKey)
-
preparePluginForUpdateCheck
protected <R> StageChain<Void,R> preparePluginForUpdateCheck(IPublicPromaInvocationContext pc, PluginWrapperModel<E> plugin)
-
isPluginStoreConnected
protected <R> StageChain<Boolean,R> isPluginStoreConnected(IPublicPromaInvocationContext pc)
This method returns informations about the connecting to the plugin store. This may be a problem with the websocket or with the connection to proma or the plugin store.- Returns:
- true if there is a active websocket connection and a connection to the plugin store. It returns false if no connection can be established via websocket or there are problems connecting to the plugin store.
-
save
protected abstract boolean save(PluginWrapperModel<E> plugin, boolean isUpdate)
-
selectDefault
protected void selectDefault()
-
setTempRuntimeFile
protected void setTempRuntimeFile(PluginWrapperModel<E> plugin)
-
showUpdateAvailabilityMsg
protected <R> StageChain<Void,R> showUpdateAvailabilityMsg(IPublicPromaInvocationContext pc, EPluginUpdateAvailability updateStatus, PluginWrapperModel<E> plugin)
-
sortAllByPluginName
protected void sortAllByPluginName()
Sorts the plugin list by the plugin name from proma.
-
updatePluginStatus
protected <R> StageChain<EPluginUpdateAvailability,R> updatePluginStatus(IPublicPromaInvocationContext pc, PluginWrapperModel<E> plugin)
-
doesPluginKeyExist
protected boolean doesPluginKeyExist(PluginWrapperModel<E> plugin, String currentPluginKey, String currentPluginFileKey)
-
doesPluginKeyExist
protected boolean doesPluginKeyExist(String currentPluginKey, String currentPluginFileKey)
-
getPluginDependencies
public List<PluginDependencies> getPluginDependencies()
-
isDeactivateWithSave
public boolean isDeactivateWithSave()
-
setDeactivateWithSave
public void setDeactivateWithSave(boolean isDeactivateWithSave)
-
getPluginsToDelete
public List<PluginWrapperModel<E>> getPluginsToDelete()
-
setPluginsToDelete
public void setPluginsToDelete(List<PluginWrapperModel<E>> pluginsToDelete)
-
getPluginToDeactivate
public PluginWrapperModel<E> getPluginToDeactivate()
-
setPluginToDeactivate
public void setPluginToDeactivate(PluginWrapperModel<E> pluginToDeactivate)
-
getSelectedOverwriteData
public PluginOverwriteData getSelectedOverwriteData()
-
setSelectedOverwriteData
public void setSelectedOverwriteData(PluginOverwriteData selectedOverwriteData)
-
-