diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/IProjectDAO.java b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/IProjectDAO.java index fcf803b048a8307a497f4597d7148708b514008a..265b07f6fdcc27fbda5623c9fd847ed1b3ec1f6f 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/IProjectDAO.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/IProjectDAO.java @@ -33,8 +33,7 @@ import org.primefaces.model.UploadedFile; import org.springframework.security.access.prepost.PreAuthorize; /** - * This is the interface for the data access object(s) which will access for example the file system to manage the available projects. The implementing classes are - * responsible for suitable synchronization. + * This is the interface for the data access object(s) which will access for example the file system to manage the available projects. * * @author Nils Christian Ehmke */ diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/IUserDAO.java b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/IUserDAO.java index fc5b5076a3c9a8c97b87d8b4bb2389eb5720800f..f33390abda84e5f55f7b5ffe0c862f9b7a076230 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/IUserDAO.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/IUserDAO.java @@ -42,6 +42,7 @@ public interface IUserDAO { * If it was not possible to add the user to the system. Either because a constraint was violated or because the connection to the database has * somehow been damaged. * @throws UserAlreadyExistingException + * If a user with the given name exists already. */ @PreAuthorize("hasRole('Administrator')") public void addUser(final User user) throws DataAccessException, UserAlreadyExistingException; 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 00f2d936774264ad22b9c8f237073e1a03133a0a..e09f6195aa0e9cf3e4b79b873b41d62b2b9f113d 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 @@ -39,8 +39,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; /** - * This service is an implementation of the {@link IUserDAO} interface, which uses Apache Derby to store and manage the available users. A transaction manager makes - * sure that all operations are atomically. The connection to the data base and the actual data source are managed by the Spring framework. + * This service uses Apache Derby to persist and manage the available users. A transaction manager makes sure that all operations are atomically. The connection to + * the data base, the actual data source, and the transaction manager are managed by the Spring framework. * * @author Nils Christian Ehmke */ @@ -80,8 +80,9 @@ public final class DerbyUserDAOImpl implements IUserDAO { statement.execute(); } catch (final SQLException ex) { + // Check whether the execution failed due to a duplicate key if (SQL_STATE_DUPLICATE_KEY.equals(ex.getSQLState())) { - throw new UserAlreadyExistingException("A user with the given name exists already", ex); + throw new UserAlreadyExistingException("A user with the given name exists already.", ex); } // Something else went wrong. throw new DataAccessException("Could not add user to the database.", ex); @@ -181,7 +182,7 @@ public final class DerbyUserDAOImpl implements IUserDAO { DerbyUserDAOImpl.queryToUsers(queryResult, result); } catch (final SQLException ex) { - LOG.error("Could not receive user list.", ex); + throw new DataAccessException("Could not receive user list.", ex); } finally { // Try to close everything. If this is not possible then log the problem. It is not necessary to inform the calling method about a fail though. if (queryResult != null) { diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/service/IProjectService.java b/Kieker.WebGUI/src/main/java/kieker/webgui/service/IProjectService.java index 87f44ba574b03ede4728aa702cd63553eb8cf07c..3472968ea1fd8dc559b3c55e719077a676bd4e9e 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/service/IProjectService.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/service/IProjectService.java @@ -128,6 +128,24 @@ public interface IProjectService { public void copyProject(final String originalProjectName, final String newProjectName) throws ProjectNotExistingException, ProjectAlreadyExistingException, IOException, LockProjectException; + /** + * This method renames the given project. + * + * @param originalProjectName + * The old project name. + * @param newProjectName + * The new project name. + * + * @throws ProjectNotExistingException + * If a project with the given (source) name doesn't exist. + * @throws ProjectAlreadyExistingException + * If a project with the same (target) name exists already. + * @throws IOException + * If something went wrong during the creation of the target-project or during the loading of the source-project. + * @throws LockProjectException + * If the project could not be locked. + */ + @PreAuthorize("hasAnyRole('User', 'Administrator')") public void renameProject(final String originalProjectName, final String newProjectName) throws ProjectNotExistingException, ProjectAlreadyExistingException, IOException, LockProjectException; @@ -483,6 +501,11 @@ public interface IProjectService { @PreAuthorize("isAuthenticated()") public DisplayType getDisplayType(final String projectName, final String viewName, final String displayConnectorName) throws LockProjectException; + /** + * Delivers a list of the currently available projects. The returned list is a copy. + * + * @return A list containing the available projects. + */ @PreAuthorize("isAuthenticated()") public List<String> getProjects(); diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/service/IUserService.java b/Kieker.WebGUI/src/main/java/kieker/webgui/service/IUserService.java index fcbafaacd24c83fb08a893c604e5c89a47ebde3a..1667b68cb191bba83653831d2764ce334a35971d 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/service/IUserService.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/service/IUserService.java @@ -41,6 +41,7 @@ public interface IUserService { * If it was not possible to add the user to the system. Either because a constraint was violated or because the connection to the database has * somehow been damaged. * @throws UserAlreadyExistingException + * If a user with the given name exists already. */ @PreAuthorize("hasRole('Administrator')") public void addUser(final User user) throws DataAccessException, UserAlreadyExistingException; diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CockpitEditorBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CockpitEditorBean.java index 0240d8245cf69cca757d3cc7d497b07768904c9e..742dbfe74aa17e7431cc00394ee500052fa2b836 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CockpitEditorBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CockpitEditorBean.java @@ -239,10 +239,8 @@ public final class CockpitEditorBean { /** * This method adds a new view to the project. * - * @param viewName - * The name of the new view. - * @param viewDescription - * The description of the new view. + * @param newViewBean + * The bean containing the necessary data to create the view. */ public void addView(final NewViewBean newViewBean) { if ((this.project != null) && this.checkViewName(newViewBean.getViewName(), newViewBean.getMessageTarget().getClientId())) { diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/ProjectOverviewBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/ProjectOverviewBean.java index c7d807796481e6041dc112503686c676fafcec39..cf39fa604691cf43449609d9a96355a603579a1b 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/ProjectOverviewBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/ProjectOverviewBean.java @@ -112,6 +112,12 @@ public final class ProjectOverviewBean { } } + /** + * This method renames the current project. + * + * @param renameProjectBean + * The bean containing the necessary data to rename the current project. + */ public void renameProject(final RenameProjectBean renameProjectBean) { try { // Try and use the service to copy the project atomically. @@ -137,6 +143,9 @@ public final class ProjectOverviewBean { } } + /** + * This method deletes the current project. + */ public void delProject() { try { // Try and use the project service to delete the project atomically. @@ -160,6 +169,12 @@ public final class ProjectOverviewBean { } } + /** + * This method copies the current project. + * + * @param copyProjectBean + * The bean containing the necessary data to copy the current project. + */ public void copyProject(final CopyProjectBean copyProjectBean) { try { // Try and use the service to copy the project atomically. @@ -186,6 +201,12 @@ public final class ProjectOverviewBean { } } + /** + * This method uploads a project. + * + * @param importProjectBean + * The bean containing the necessary data to upload the project. + */ public void uploadProject(final ImportProjectBean importProjectBean) { try { if (importProjectBean.getUploadedFile() == null) { diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/UserManagementBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/UserManagementBean.java index e90a8d61ec8ab1487e1d1d9c96235f1acea52644..c2429bb873ff3735b41457d148bc88b44531e6ba 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/UserManagementBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/UserManagementBean.java @@ -77,14 +77,8 @@ public final class UserManagementBean { /** * This method adds the given user to the database and informs about success via the growl component. * - * @param username - * The name of the new user. - * @param password - * The password of the new user. - * @param role - * The role of the new user. - * @param isEnabled - * Determines whether the user is enabled already or not. + * @param newUserBean + * The bean containing the necessary data to create the user. */ public void addUser(final NewUserBean newUserBean) { final User user = new User(newUserBean.getUsername(), newUserBean.getPassword(), newUserBean.getRole(), newUserBean.isActive()); diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/utility/command/AbstractEditorCommand.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/utility/command/AbstractEditorCommand.java index 5a3963b523deeae9489e0df83bfdd203ace50148..66956a6bf0b77907b182eb804a3d562352717017 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/utility/command/AbstractEditorCommand.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/utility/command/AbstractEditorCommand.java @@ -37,6 +37,8 @@ public abstract class AbstractEditorCommand { /** * Inverts this command. + * + * @return The inverted command. */ public abstract AbstractEditorCommand invert();