From 2c7ecc78cd69bc5a0bcd57fd0dda680462d127bc Mon Sep 17 00:00:00 2001 From: Nils Christian Ehmke <nie@informatik.uni-kiel.de> Date: Tue, 11 Dec 2012 15:09:16 +0100 Subject: [PATCH] Modified some code for quality reasons. --- .../common/ClassAndMethodContainer.java | 282 +++++++++++------- .../persistence/impl/DerbyUserDAOImpl.java | 40 ++- .../web/beans/application/ProjectsBean.java | 15 +- .../beans/view/CurrentCockpitEditorBean.java | 14 +- 4 files changed, 220 insertions(+), 131 deletions(-) diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/ClassAndMethodContainer.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/ClassAndMethodContainer.java index c443809a..0fbbf0c0 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/ClassAndMethodContainer.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/ClassAndMethodContainer.java @@ -63,7 +63,7 @@ public final class ClassAndMethodContainer { */ private static final String MSG_LOAD_EXCEPTION = "An error occured while loading the classes and methods."; - private final Class<?> logImplWebguiLoggingClass; + private Class<?> logImplWebguiLoggingClass; /** * This is the class equivalence of {@link AnalysisControllerWithMapping}. */ @@ -71,143 +71,143 @@ public final class ClassAndMethodContainer { /** * This is the class equivalence of {@link AnalysisController}. */ - private final Class<?> analysisControllerClass; + private Class<?> analysisControllerClass; /** * This is the class equivalence of {@link AnalysisControllerThread}. */ - private final Class<?> analysisControllerThreadClass; + private Class<?> analysisControllerThreadClass; /** * This is the class equivalence of {@link AbstractRepository}. */ - private final Class<?> abstractRepositoryClass; + private Class<?> abstractRepositoryClass; /** * This is the class equivalence of {@link AbstractPlugin}. */ - private final Class<?> abstractPluginClass; + private Class<?> abstractPluginClass; /** * This is the class equivalence of {@link AbstractFilterPlugin}. */ - private final Class<?> abstractFilterPluginClass; + private Class<?> abstractFilterPluginClass; /** * This is the class equivalence of {@link AbstractRepository}. */ - private final Class<?> abstractReaderPluginClass; + private Class<?> abstractReaderPluginClass; /** * This is the class equivalence of {@link Plugin}. */ - private final Class<? extends Annotation> pluginAnnotationClass; + private Class<? extends Annotation> pluginAnnotationClass; /** * This is the class equivalence of {@link Repository}. */ - private final Class<? extends Annotation> repositoryAnnotationClass; + private Class<? extends Annotation> repositoryAnnotationClass; /** * This is the class equivalence of {@link Property}. */ - private final Class<? extends Annotation> propertyAnnotationClass; + private Class<? extends Annotation> propertyAnnotationClass; /** * This is the class equivalence of {@link OutputPort}. */ - private final Class<? extends Annotation> outputPortAnnotationClass; + private Class<? extends Annotation> outputPortAnnotationClass; /** * This is the class equivalence of {@link InputPort}. */ - private final Class<? extends Annotation> inputPortAnnotationClass; + private Class<? extends Annotation> inputPortAnnotationClass; /** * This is the class equivalence of {@link RepositoryPort}. */ - private final Class<? extends Annotation> repositoryPortAnnotationClass; + private Class<? extends Annotation> repositoryPortAnnotationClass; /** * This is the class equivalence of {@link Display}. */ - private final Class<? extends Annotation> displayAnnotationClass; + private Class<? extends Annotation> displayAnnotationClass; /** * This is the class equivalence of {@link Image}. */ - private final Class<?> imageClass; + private Class<?> imageClass; /** * This is the class equivalence of {@link PlainText}. */ - private final Class<?> plainTextClass; + private Class<?> plainTextClass; /** * This is the class equivalence of {@link HtmlText}. */ - private final Class<?> htmlTextClass; + private Class<?> htmlTextClass; /** * This is the description()-method of the class equivalence of {@link Plugin}. */ - private final Method pluginDescriptionMethod; + private Method pluginDescriptionMethod; /** * This is the description()-method of the class equivalence of {@link Repository}. */ - private final Method repositoryDescriptionMethod; + private Method repositoryDescriptionMethod; /** * This is the configuration()-method of the class equivalence of {@link Plugin}. */ - private final Method pluginConfigurationMethod; + private Method pluginConfigurationMethod; /** * This is the description()-method of the class equivalence of {@link Repository}. */ - private final Method repositoryConfigurationMethod; + private Method repositoryConfigurationMethod; /** * This is the outputPorts()-method of the class equivalence of {@link Plugin}. */ - private final Method pluginOutputPortsMethod; + private Method pluginOutputPortsMethod; /** * This is the repositoryPorts()-method of the class equivalence of {@link Plugin}. */ - private final Method pluginRepositoryPortsMethod; + private Method pluginRepositoryPortsMethod; /** * This is the name()-method of the class equivalence of {@link Display}. */ - private final Method displayNameMethod; + private Method displayNameMethod; /** * This is the name()-method of the class equivalence of {@link InputPort}. */ - private final Method inputPortNameMethod; + private Method inputPortNameMethod; /** * This is the name()-method of the class equivalence of {@link OutputPort}. */ - private final Method outputPortNameMethod; + private Method outputPortNameMethod; /** * This is the name()-method of the class equivalence of {@link RepositoryPort}. */ - private final Method repositoryPortNameMethod; + private Method repositoryPortNameMethod; /** * This is the name()-method of the class equivalence of {@link Property}. */ - private final Method propertyNameMethod; + private Method propertyNameMethod; /** * This is the defaultValue()-method of the class equivalence of {@link Property}. */ - private final Method propertyDefaultValueMethod; + private Method propertyDefaultValueMethod; /** * This is the getText()-method of the class equivalence of {@link PlainText}. */ - private final Method plainTextgetTextMethod; + private Method plainTextgetTextMethod; /** * This is the getController()-method of the class equivalence of {@link AnalysisControllerWithMapping}. */ - private final Method analysisControllerWithMappingGetController; + private Method analysisControllerWithMappingGetController; /** * This is the getPluginMap()-method of the class equivalence of {@link AnalysisControllerWithMapping}. */ - private final Method analysisControllerWithMappingGetMapping; + private Method analysisControllerWithMappingGetMapping; /** * This is the createAnalysisController(MIProject, ClassLoader)-method of the class equivalence of {@link AnalysisControllerWithMapping}. */ - private final Method analysisControllerCreateAnalysisController; + private Method analysisControllerCreateAnalysisController; /** * This is the start()-method of the class equivalence of {@link AnalysisController}. */ - private final Method analysisControllerThreadStart; + private Method analysisControllerThreadStart; /** * This is the terminate()-method of the class equivalence of {@link AnalysisController}. */ - private final Method analysisControllerThreadTerminate; + private Method analysisControllerThreadTerminate; /** * This is the join(long)-method of the class equivalence of {@link AnalysisController}. */ - private final Method analysisControllerThreadJoin; + private Method analysisControllerThreadJoin; /** * This is the getState()-method of the class equivalence of {@link AnalysisController}. */ @@ -215,37 +215,37 @@ public final class ClassAndMethodContainer { /** * This is the description()-method of the class equivalence of {@link Property}. */ - private final Method propertyDescriptionMethod; + private Method propertyDescriptionMethod; /** * This is the loadFromFile(File)-method of the class equivalence of {@link AnalysisController}. */ - private final Method analysisControllerLoadFromFile; + private Method analysisControllerLoadFromFile; /** * This is the description()-method of the class equivalence of {@link Display}. */ - private final Method displayDescriptionMethod; + private Method displayDescriptionMethod; /** * This is the dependencies()-method of the class equivalence of {@link Plugin}. */ - private final Method pluginDependenciesMethod; + private Method pluginDependenciesMethod; /** * This is the dependencies()-method of the class equivalence of {@link Repository}. */ - private final Method repositoryDependenciesMethod; + private Method repositoryDependenciesMethod; /** * This is the programmaticOnly()-method of the class equivalence of {@link Plugin}. */ - private final Method pluginProgrammaticOnlyMethod; + private Method pluginProgrammaticOnlyMethod; /** * This is the programmaticOnly()-method of the class equivalence of {@link Repository}. */ - private final Method repositoryProgrammaticOnlyMethod; - private final Method logImplWebguiLoggingClassGetEntriesMethod; + private Method repositoryProgrammaticOnlyMethod; + private Method logImplWebguiLoggingClassGetEntriesMethod; /** * This is the constructor for {@link AnalysisControllerThread}, which gets an instance of {@link AnalysisController}. */ - private final Constructor<?> analysisControllerThreadConstructor; + private Constructor<?> analysisControllerThreadConstructor; /** * Creates a new instance of this class, using the given class loader. @@ -255,78 +255,14 @@ public final class ClassAndMethodContainer { * @throws ProjectLoadException * If one or more of the classes or methods for this container could not be found. */ - @SuppressWarnings("unchecked") public ClassAndMethodContainer(final ClassLoader classLoader) throws ProjectLoadException { try { - // For the first: Use the classloader the load all classes we will need. - this.logImplWebguiLoggingClass = classLoader.loadClass(LogImplWebguiLogging.class.getName()); - - this.analysisControllerWithMappingClass = classLoader.loadClass(AnalysisControllerWithMapping.class.getName()); - - this.analysisControllerClass = classLoader.loadClass(AnalysisController.class.getName()); - this.analysisControllerThreadClass = classLoader.loadClass(AnalysisControllerThread.class.getName()); - this.abstractFilterPluginClass = classLoader.loadClass(AbstractFilterPlugin.class.getName()); - this.abstractReaderPluginClass = classLoader.loadClass(AbstractReaderPlugin.class.getName()); - this.abstractRepositoryClass = classLoader.loadClass(AbstractRepository.class.getName()); - this.abstractPluginClass = classLoader.loadClass(AbstractPlugin.class.getName()); - this.htmlTextClass = classLoader.loadClass(HtmlText.class.getName()); - this.plainTextClass = classLoader.loadClass(PlainText.class.getName()); - this.imageClass = classLoader.loadClass(Image.class.getName()); - - // Now we load the more specific annotation classes - this.pluginAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(Plugin.class.getName()); - this.repositoryAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(Repository.class.getName()); - this.propertyAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(Property.class.getName()); - this.outputPortAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(OutputPort.class.getName()); - this.inputPortAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(InputPort.class.getName()); - this.repositoryPortAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(RepositoryPort.class.getName()); - this.displayAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(Display.class.getName()); - - // The following part has to be done carefully: The methods will be loaded via the name - this.pluginDescriptionMethod = this.pluginAnnotationClass.getMethod("description", new Class<?>[0]); - this.repositoryDescriptionMethod = this.repositoryAnnotationClass.getMethod("description", new Class<?>[0]); - this.pluginConfigurationMethod = this.pluginAnnotationClass.getMethod("configuration", new Class<?>[0]); - this.repositoryConfigurationMethod = this.repositoryAnnotationClass.getMethod("configuration", new Class<?>[0]); - this.pluginOutputPortsMethod = this.pluginAnnotationClass.getMethod("outputPorts", new Class<?>[0]); - this.pluginRepositoryPortsMethod = this.pluginAnnotationClass.getMethod("repositoryPorts", new Class<?>[0]); - this.displayNameMethod = this.displayAnnotationClass.getMethod("name", new Class<?>[0]); - this.inputPortNameMethod = this.inputPortAnnotationClass.getMethod("name", new Class<?>[0]); - this.outputPortNameMethod = this.outputPortAnnotationClass.getMethod("name", new Class<?>[0]); - this.repositoryPortNameMethod = this.repositoryPortAnnotationClass.getMethod("name", new Class<?>[0]); - this.propertyNameMethod = this.propertyAnnotationClass.getMethod("name", new Class<?>[0]); - this.propertyDefaultValueMethod = this.propertyAnnotationClass.getMethod("defaultValue", new Class<?>[0]); - this.plainTextgetTextMethod = this.plainTextClass.getMethod("getText", new Class<?>[0]); - this.analysisControllerWithMappingGetController = this.analysisControllerWithMappingClass.getMethod("getController", new Class<?>[0]); - this.analysisControllerWithMappingGetMapping = this.analysisControllerWithMappingClass.getMethod("getPluginMap", new Class<?>[0]); - this.analysisControllerThreadStart = this.analysisControllerThreadClass.getMethod("start", new Class<?>[0]); - this.analysisControllerThreadTerminate = this.analysisControllerThreadClass.getMethod("terminate", new Class<?>[0]); - this.analysisControllerGetState = this.analysisControllerClass.getMethod("getState", new Class<?>[0]); - this.propertyDescriptionMethod = this.propertyAnnotationClass.getMethod("description", new Class<?>[0]); - this.displayDescriptionMethod = this.displayAnnotationClass.getMethod("description", new Class<?>[0]); - this.pluginDependenciesMethod = this.pluginAnnotationClass.getMethod("dependencies", new Class<?>[0]); - this.repositoryDependenciesMethod = this.repositoryAnnotationClass.getMethod("dependencies", new Class<?>[0]); - this.pluginProgrammaticOnlyMethod = this.pluginAnnotationClass.getMethod("programmaticOnly", new Class<?>[0]); - this.repositoryProgrammaticOnlyMethod = this.repositoryAnnotationClass.getMethod("programmaticOnly", new Class<?>[0]); - this.logImplWebguiLoggingClassGetEntriesMethod = this.logImplWebguiLoggingClass.getMethod("getEntries", String.class); - - // This is a special case as we need to load some additional classes to search for the correct method - final Class<?> miProjectClass = classLoader.loadClass(MIProject.class.getName()); - this.analysisControllerLoadFromFile = this.analysisControllerClass.getMethod("loadFromFile", File.class); - - this.analysisControllerCreateAnalysisController = this.analysisControllerClass.getMethod("createAnalysisController", miProjectClass, ClassLoader.class); - - // Another special case as the parameter is a long - final Method[] methods = this.analysisControllerThreadClass.getMethods(); - Method joinMethod = null; - for (final Method method : methods) { - if ("join".equals(method.getName())) { - joinMethod = method; - } - } - this.analysisControllerThreadJoin = joinMethod; - // Now the constructors - this.analysisControllerThreadConstructor = this.analysisControllerThreadClass.getConstructor(this.analysisControllerClass); + this.loadClasses(classLoader); + this.loadMethods(); + this.loadSpecialCases(classLoader); + this.loadConstructors(); + } catch (final ClassNotFoundException ex) { // Something went wrong. We can do nothing except throwing an exception ClassAndMethodContainer.LOG.error(ClassAndMethodContainer.MSG_LOAD_EXCEPTION, ex); @@ -346,6 +282,124 @@ public final class ClassAndMethodContainer { } } + /** + * Loads the constructors. + * + * @throws NoSuchMethodException + * If something went wrong. + * @throws SecurityException + * If something went wrong. + * + */ + private void loadConstructors() throws SecurityException, NoSuchMethodException { + // Now the constructors + this.analysisControllerThreadConstructor = this.analysisControllerThreadClass.getConstructor(this.analysisControllerClass); + } + + /** + * Loads the special cases. + * + * @param classLoader + * The classloader. + * @throws ClassNotFoundException + * If something went wrong. + * @throws NoSuchMethodException + * If something went wrong. + * @throws SecurityException + * If something went wrong. + * + */ + private void loadSpecialCases(final ClassLoader classLoader) throws ClassNotFoundException, SecurityException, NoSuchMethodException { + // This is a special case as we need to load some additional classes to search for the correct method + final Class<?> miProjectClass = classLoader.loadClass(MIProject.class.getName()); + this.analysisControllerLoadFromFile = this.analysisControllerClass.getMethod("loadFromFile", File.class); + + this.analysisControllerCreateAnalysisController = this.analysisControllerClass.getMethod("createAnalysisController", miProjectClass, ClassLoader.class); + + // Another special case as the parameter is a long + final Method[] methods = this.analysisControllerThreadClass.getMethods(); + Method joinMethod = null; + for (final Method method : methods) { + if ("join".equals(method.getName())) { + joinMethod = method; + } + } + this.analysisControllerThreadJoin = joinMethod; + } + + /** + * Loads the methods. + * + * @throws NoSuchMethodException + * If something went wrong. + * @throws SecurityException + * If something went wrong. + */ + private void loadMethods() throws SecurityException, NoSuchMethodException { + // The following part has to be done carefully: The methods will be loaded via the name + this.pluginDescriptionMethod = this.pluginAnnotationClass.getMethod("description", new Class<?>[0]); + this.repositoryDescriptionMethod = this.repositoryAnnotationClass.getMethod("description", new Class<?>[0]); + this.pluginConfigurationMethod = this.pluginAnnotationClass.getMethod("configuration", new Class<?>[0]); + this.repositoryConfigurationMethod = this.repositoryAnnotationClass.getMethod("configuration", new Class<?>[0]); + this.pluginOutputPortsMethod = this.pluginAnnotationClass.getMethod("outputPorts", new Class<?>[0]); + this.pluginRepositoryPortsMethod = this.pluginAnnotationClass.getMethod("repositoryPorts", new Class<?>[0]); + this.displayNameMethod = this.displayAnnotationClass.getMethod("name", new Class<?>[0]); + this.inputPortNameMethod = this.inputPortAnnotationClass.getMethod("name", new Class<?>[0]); + this.outputPortNameMethod = this.outputPortAnnotationClass.getMethod("name", new Class<?>[0]); + this.repositoryPortNameMethod = this.repositoryPortAnnotationClass.getMethod("name", new Class<?>[0]); + this.propertyNameMethod = this.propertyAnnotationClass.getMethod("name", new Class<?>[0]); + this.propertyDefaultValueMethod = this.propertyAnnotationClass.getMethod("defaultValue", new Class<?>[0]); + this.plainTextgetTextMethod = this.plainTextClass.getMethod("getText", new Class<?>[0]); + this.analysisControllerWithMappingGetController = this.analysisControllerWithMappingClass.getMethod("getController", new Class<?>[0]); + this.analysisControllerWithMappingGetMapping = this.analysisControllerWithMappingClass.getMethod("getPluginMap", new Class<?>[0]); + this.analysisControllerThreadStart = this.analysisControllerThreadClass.getMethod("start", new Class<?>[0]); + this.analysisControllerThreadTerminate = this.analysisControllerThreadClass.getMethod("terminate", new Class<?>[0]); + this.analysisControllerGetState = this.analysisControllerClass.getMethod("getState", new Class<?>[0]); + this.propertyDescriptionMethod = this.propertyAnnotationClass.getMethod("description", new Class<?>[0]); + this.displayDescriptionMethod = this.displayAnnotationClass.getMethod("description", new Class<?>[0]); + this.pluginDependenciesMethod = this.pluginAnnotationClass.getMethod("dependencies", new Class<?>[0]); + this.repositoryDependenciesMethod = this.repositoryAnnotationClass.getMethod("dependencies", new Class<?>[0]); + this.pluginProgrammaticOnlyMethod = this.pluginAnnotationClass.getMethod("programmaticOnly", new Class<?>[0]); + this.repositoryProgrammaticOnlyMethod = this.repositoryAnnotationClass.getMethod("programmaticOnly", new Class<?>[0]); + this.logImplWebguiLoggingClassGetEntriesMethod = this.logImplWebguiLoggingClass.getMethod("getEntries", String.class); + + } + + /** + * Loads the classes. + * + * @param classLoader + * The classloader. + * @throws ClassNotFoundException + * if something went wrong. + */ + @SuppressWarnings("unchecked") + private void loadClasses(final ClassLoader classLoader) throws ClassNotFoundException { + // For the first: Use the classloader the load all classes we will need. + this.logImplWebguiLoggingClass = classLoader.loadClass(LogImplWebguiLogging.class.getName()); + + this.analysisControllerWithMappingClass = classLoader.loadClass(AnalysisControllerWithMapping.class.getName()); + + this.analysisControllerClass = classLoader.loadClass(AnalysisController.class.getName()); + this.analysisControllerThreadClass = classLoader.loadClass(AnalysisControllerThread.class.getName()); + this.abstractFilterPluginClass = classLoader.loadClass(AbstractFilterPlugin.class.getName()); + this.abstractReaderPluginClass = classLoader.loadClass(AbstractReaderPlugin.class.getName()); + this.abstractRepositoryClass = classLoader.loadClass(AbstractRepository.class.getName()); + this.abstractPluginClass = classLoader.loadClass(AbstractPlugin.class.getName()); + this.htmlTextClass = classLoader.loadClass(HtmlText.class.getName()); + this.plainTextClass = classLoader.loadClass(PlainText.class.getName()); + this.imageClass = classLoader.loadClass(Image.class.getName()); + + // Now we load the more specific annotation classes + this.pluginAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(Plugin.class.getName()); + this.repositoryAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(Repository.class.getName()); + this.propertyAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(Property.class.getName()); + this.outputPortAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(OutputPort.class.getName()); + this.inputPortAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(InputPort.class.getName()); + this.repositoryPortAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(RepositoryPort.class.getName()); + this.displayAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(Display.class.getName()); + } + /** * The getter-method for the field {@link ClassAndMethodContainer#abstractFilterPluginClass}. * diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/DerbyUserDAOImpl.java b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/DerbyUserDAOImpl.java index ac122082..c69eee5d 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/DerbyUserDAOImpl.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/DerbyUserDAOImpl.java @@ -202,20 +202,8 @@ public class DerbyUserDAOImpl implements IUserDAO { try { getQuery = connection.prepareStatement("SELECT name, isGuest, isUser, isAdministrator, isEnabled FROM Users"); - // Run through all results queryResult = getQuery.executeQuery(); - while (queryResult.next()) { - final String username = queryResult.getString(1); - final boolean isGuest = queryResult.getBoolean(2); - final boolean isUser = queryResult.getBoolean(3); - final boolean isAdministrator = queryResult.getBoolean(4); - final boolean isEnabled = queryResult.getBoolean(5); - - // The case that the user has no role cannot happen, as the database should make sure that this is not possible - final Role role = isAdministrator ? Role.ROLE_ADMIN : (isUser ? Role.ROLE_USER : (isGuest ? Role.ROLE_GUEST : null)); // NOPMD (Null assigning) - - result.add(new User(username, null, role, isEnabled)); - } + this.queryToUsers(queryResult, result); } catch (final SQLException ex) { DerbyUserDAOImpl.LOG.error("Could not receive user list.", ex); } finally { @@ -244,4 +232,30 @@ public class DerbyUserDAOImpl implements IUserDAO { return result; } + + /** + * Transforms the given query result into the single users. + * + * @param queryResult + * The query result. + * @param result + * The list which will be filled with users. + * @throws SQLException + * If something went wrong. + */ + private void queryToUsers(final ResultSet queryResult, final List<User> result) throws SQLException { + // Run through all results + while (queryResult.next()) { + final String username = queryResult.getString(1); + final boolean isGuest = queryResult.getBoolean(2); + final boolean isUser = queryResult.getBoolean(3); + final boolean isAdministrator = queryResult.getBoolean(4); + final boolean isEnabled = queryResult.getBoolean(5); + + // The case that the user has no role cannot happen, as the database should make sure that this is not possible + final Role role = isAdministrator ? Role.ROLE_ADMIN : (isUser ? Role.ROLE_USER : (isGuest ? Role.ROLE_GUEST : null)); // NOPMD (Null assigning) + + result.add(new User(username, null, role, isEnabled)); + } + } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/application/ProjectsBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/application/ProjectsBean.java index 804d2cbf..3d269b75 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/application/ProjectsBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/application/ProjectsBean.java @@ -150,7 +150,20 @@ public final class ProjectsBean { } } - public void uploadProject(final String projectName, final UploadedFile file, final CurrentProjectOverviewBean currentProjectOverviewBean, final UserBean userBean) { + /** + * This method imports the given project. + * + * @param projectName + * The name of the new project. + * @param file + * The file to be uploaded. + * @param currentProjectOverviewBean + * The current instance of {@link CurrentProjectOverviewBean}. + * @param userBean + * The current session instance of {@link UserBean}. + */ + public void uploadProject(final String projectName, final UploadedFile file, final CurrentProjectOverviewBean currentProjectOverviewBean, + final UserBean userBean) { try { // Try and use the FS-Manager to create the project atomically. this.projectService.importProject(projectName, userBean.getUsername(), file); diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitEditorBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitEditorBean.java index 53885179..26ef1148 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitEditorBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitEditorBean.java @@ -103,7 +103,12 @@ public final class CurrentCockpitEditorBean { this.createDashboard(); } - public MIDisplayConnector getSelectedNode() { + /** + * Delivers the currently selected display connector. + * + * @return The selected connector. + */ + public synchronized MIDisplayConnector getSelectedNode() { return this.selectedNode; } @@ -140,9 +145,9 @@ public final class CurrentCockpitEditorBean { final Application application = fc.getApplication(); // Add a panel for every display connector we have - final List<MIDisplayConnector> connectors = this.activeView.getDisplayConnectors(); + final List<MIDisplayConnector> displayConnectors = this.activeView.getDisplayConnectors(); this.currId = 0; - for (final MIDisplayConnector connector : connectors) { + for (final MIDisplayConnector connector : displayConnectors) { final Panel panel = (Panel) application.createComponent(fc, "org.primefaces.component.Panel", "org.primefaces.component.PanelRenderer"); panel.setId("displayConnector_" + Integer.toString(this.connectors.get(connector))); panel.setHeader(connector.getName()); @@ -387,6 +392,9 @@ public final class CurrentCockpitEditorBean { } } + /** + * This is the event if a node has been clicked and should be selected. + */ public synchronized void nodeSelected() { final Map<String, String> paramMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); -- GitLab