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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<PluginWrapperModel<E>>
protected IGenericDao<E>
protected InternalMessageBean
protected boolean
protected boolean
protected LocaleBean
protected List<PluginWrapperModel<E>>
protected List<PluginDependencies>
protected PluginDependenciesBean
protected boolean
protected Map<Long,
PluginUpdateMetadata> protected SameChecksumPlugins<E>
protected Map<Long,
org.apache.commons.lang3.tuple.Pair<String, EPluginUpdateAvailability>> protected PluginWrapperModel<E>
protected PluginUpdateMetadata
protected SelectionBean
protected SessionUserManager
protected ViewContextBean
protected ViewEventBusBean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
activate
(PluginWrapperModel<E> plugin) When the user click on the button to activate a plugin.void
addNew()
This method is called when the plugin management page is loaded initially.void
x Handler for when the user click on the button in the UI.void
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
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
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
getAll()
protected abstract Set<PluginRuntime>
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.protected abstract EEntityKeySelectionType
org.primefaces.model.StreamedContent
protected abstract PluginWrapperModel<E>
getPluginFile
(PluginWrapperModel<E> plugin) protected String
getPluginKey
(PluginWrapperModel<E> plugin) getPluginName
(PluginWrapperModel<E> plugin) org.primefaces.model.StreamedContent
getSinglePlugin
(PluginWrapperModel<E> plugin) protected org.primefaces.model.StreamedContent
getStreamedContent
(List<PluginWrapperModel<E>> plugins, String zipFileName) getUpdateStatus
(PluginWrapperModel<E> plugin) This method returns the current update status of a plugin from the pluginUpdateStatusMap.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
boolean
boolean
isLegacyPlugin
(PluginWrapperModel<E> plugin) boolean
boolean
protected <R> StageChain<Boolean,
R> This method returns informations about the connecting to the plugin store.boolean
protected <R> StageChain<Void,
R> loadInitialSelectedPluginData
(IPublicPromaInvocationContext pc, de.xima.proma.restclient.pub.gen.model.PublicStoreItemUpdateCheckResult result, String licenseKey) void
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
void
protected <R> StageChain<Void,
R> 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
protected void
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
void
setSelected
(PluginWrapperModel<E> selected) void
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
Sorts the plugin list by the plugin name from proma.void
update
(PluginWrapperModel<E> plugin, File updatedFile) 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
void
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> void
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 Details
-
all
-
dao
-
internalMessageBean
-
isPromaDataLoading
protected boolean isPromaDataLoading -
marked
-
pluginStoreListChecksum
-
pluginMetadataMap
-
pluginUpdateStatusMap
protected Map<Long,org.apache.commons.lang3.tuple.Pair<String, pluginUpdateStatusMapEPluginUpdateAvailability>> -
pluginValidationMap
-
selected
-
selectedPluginMetadata
-
userManager
-
selectionBean
-
localeBean
-
viewContextBean
-
viewEventBusBean
-
pluginDependencyBean
-
pluginDescExpanded
protected boolean pluginDescExpanded -
pluginDependencies
-
isDeactivateWithSave
protected boolean isDeactivateWithSave
-
-
Constructor Details
-
BasicPluginBean
-
-
Method Details
-
ec
-
expandPluginDesc
public void expandPluginDesc() -
activate
When the user click on the button to activate a plugin.- Parameters:
plugin
- Plugin to activate.
-
addNew
public void addNew() -
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
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
-
openPluginDeactivateDialog
-
openPluginDeleteDialog
-
openPluginMarkedDeleteDialog
public void openPluginMarkedDeleteDialog() -
delete
When the user clicks on the button to delete a plugin.- Parameters:
plugin
- Plugin to delete.
-
deletePlugins
-
deleteMarked
public void deleteMarked() -
getAll
-
createStoreItemMetaResources
protected List<de.xima.proma.restclient.pub.gen.model.PublicStoreItemMetaResource> createStoreItemMetaResources(List<PluginWrapperModel<E>> pluginList) -
getAllPluginsByKey
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
-
getInternalMessageBean
-
getMarked
-
getMarkedPlugins
public org.primefaces.model.StreamedContent getMarkedPlugins() -
getPluginFile
- Throws:
IOException
-
getPluginName
-
getPluginStoreListChecksum
-
getPluginUpdateStatusMap
-
getSelected
-
getSelectedPluginMetadata
-
getSelectionBean
-
isPluginDescExpanded
public boolean isPluginDescExpanded() -
setPluginDescExpanded
public void setPluginDescExpanded(boolean pluginDescExpanded) -
getSinglePlugin
-
getUpdateStatus
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
-
getValidationStatus
-
isContainsEntityPlugins
public boolean isContainsEntityPlugins() -
isLegacyPlugin
-
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
-
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
-
setMarked
-
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
-
setPluginUpdateStatusMap
-
setPropertiesAfterActivation
-
setSelected
-
setSelectedFromMarked
public void setSelectedFromMarked() -
setSelectedPluginMetadata
-
setSelectionBean
-
update
-
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
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
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
This method deletes the internal update message of a plugin.- Parameters:
plugin
- the plugin for deleting internal message
-
deletePlugin
- Parameters:
plugin
- Plugin to be deleted.- Returns:
true
iff the plugin was deleted.
-
getAllPluginRuntimes
-
getKeyType
-
getNewPlugin
-
getPluginKey
-
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
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
-
selectDefault
protected void selectDefault() -
setTempRuntimeFile
-
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
-
getPluginDependencies
-
isDeactivateWithSave
public boolean isDeactivateWithSave() -
setDeactivateWithSave
public void setDeactivateWithSave(boolean isDeactivateWithSave) -
getPluginsToDelete
-
setPluginsToDelete
-
getPluginToDeactivate
-
setPluginToDeactivate
-
getSelectedOverwriteData
-
setSelectedOverwriteData
-