Skip to content
Snippets Groups Projects
Commit 9448e2a0 authored by Nils Christian Ehmke's avatar Nils Christian Ehmke
Browse files

Added some comments; Modified the visual appearance.

parent e1e321dd
No related branches found
No related tags found
No related merge requests found
......@@ -55,6 +55,16 @@ public interface IProjectDAO {
@PreAuthorize("hasAnyRole('User', 'Administrator')")
public abstract void addProject(String projectName, final String username) throws ProjectAlreadyExistingException, IOException;
/**
* This method removes the given project from the application. This is done by simply removing the whole project directory. It is possible that this action fails
* for various reasons - in this cases it is not guaranteed that the project is still in a valid state.
*
* @param projectName
* The name of the project.
*
* @throws IOException
* If something went wrong during the removing.
*/
@PreAuthorize("hasAnyRole('User', 'Administrator')")
public abstract void removeProject(String projectName) throws IOException;
......
......
......@@ -723,14 +723,42 @@ public class FSProjectDAOImpl implements IProjectDAO, ReleaseListener {
*/
@Override
public String getLayout(final String projectName) {
return FSProjectDAOImpl.getProperty(projectName, FSProjectDAOImpl.PROPERTY_KEY_LAYOUT, null);
}
/*
* (non-Javadoc)
*
* @see kieker.webgui.persistence.IProjectDAO#getOwner(java.lang.String)
*/
@Override
public String getOwner(final String projectName) {
return FSProjectDAOImpl.getProperty(projectName, FSProjectDAOImpl.PROPERTY_KEY_OWNER, "N/A");
}
/*
* (non-Javadoc)
*
* @see kieker.webgui.persistence.IProjectDAO#getLastUser(java.lang.String)
*/
@Override
public String getLastUser(final String projectName) {
return FSProjectDAOImpl.getProperty(projectName, FSProjectDAOImpl.PROPERTY_KEY_LAST_USER, "N/A");
}
private static String getProperty(final String projectName, final String propertyKey, final String defaultValue) {
try {
final Properties properties = FSProjectDAOImpl.loadPropertiesFile(projectName);
return properties.getProperty(FSProjectDAOImpl.PROPERTY_KEY_LAYOUT);
final String value = properties.getProperty(propertyKey);
if (value != null) {
return value;
}
} catch (final IOException ex) {
FSProjectDAOImpl.LOG.warn("Could not open meta file.", ex);
}
return null;
return defaultValue;
}
/*
......@@ -782,45 +810,10 @@ public class FSProjectDAOImpl implements IProjectDAO, ReleaseListener {
}
}
/*
* (non-Javadoc)
*
* @see kieker.webgui.persistence.IProjectDAO#getOwner(java.lang.String)
*/
@Override
public String getOwner(final String projectName) {
try {
final Properties properties = FSProjectDAOImpl.loadPropertiesFile(projectName);
return properties.getProperty(FSProjectDAOImpl.PROPERTY_KEY_OWNER);
} catch (final IOException ex) {
FSProjectDAOImpl.LOG.warn("Could not open meta file.", ex);
}
return "N/A";
}
/*
* (non-Javadoc)
*
* @see kieker.webgui.persistence.IProjectDAO#getLastUser(java.lang.String)
*/
@Override
public String getLastUser(final String projectName) {
try {
final Properties properties = FSProjectDAOImpl.loadPropertiesFile(projectName);
return properties.getProperty(FSProjectDAOImpl.PROPERTY_KEY_LAST_USER);
} catch (final IOException ex) {
FSProjectDAOImpl.LOG.warn("Could not open meta file.", ex);
}
return "N/A";
}
/**
* This helper class is responsible for creating a classloader as a privileged action. This is recommended due to the java security manager.
*
* @author Nils Christian Ehmke
* @version 1.0
*/
private static class PrivilegedClassLoaderAction implements PrivilegedAction<CloseableURLClassLoader> {
/**
......
......
......@@ -52,6 +52,7 @@ public interface IProjectService {
* The name of the new project.
* @param username
* The name of the user who created the project.
*
* @throws ProjectAlreadyExistingException
* If a project with the same name exists already.
* @throws IOException
......@@ -60,6 +61,18 @@ public interface IProjectService {
@PreAuthorize("hasAnyRole('User', 'Administrator')")
public void addProject(final String projectName, final String username) throws ProjectAlreadyExistingException, IOException;
/**
* This method removes the given project from the application. This is done by simply removing the whole project directory. It is possible that this action fails
* for various reasons - in this cases it is not guaranteed that the project is still in a valid state.
*
* @param projectName
* The name of the project.
*
* @throws ProjectNotExistingException
* If a project with the given name doesn't exist.
* @throws IOException
* If something went wrong during the removing.
*/
@PreAuthorize("hasAnyRole('User', 'Administrator')")
public void delProject(final String projectName) throws ProjectNotExistingException, IOException;
......@@ -73,6 +86,7 @@ public interface IProjectService {
* The name of the user who imported the project.
* @param file
* The kax file to be uploaded.
*
* @throws ProjectAlreadyExistingException
* If a project with the same name exists already.
* @throws IOException
......@@ -89,6 +103,7 @@ public interface IProjectService {
* The name of the source project.
* @param newProjectName
* The name of the target project.
*
* @throws ProjectNotExistingException
* If a project with the given (source) name doesn't exist.
* @throws ProjectAlreadyExistingException
......
......
......@@ -45,6 +45,7 @@ import org.primefaces.model.UploadedFile;
*
* @author Nils Christian Ehmke
*/
// TODO Remove the lock objects for removed projects as well (take a look at #591).
@Service
public final class ProjectServiceImpl implements IProjectService {
......
......
......@@ -117,6 +117,9 @@ public final class ProjectsBean {
}
}
/**
* {@inheritDoc}
*/
public void delProject(final String project, final CurrentProjectOverviewBean currentProjectOverviewBean) {
try {
// Try and use the project service to delete the project atomically.
......
......
......@@ -125,10 +125,14 @@ public final class CurrentAnalysisEditorBean {
}
} catch (final ProjectLoadException ex) {
CurrentAnalysisEditorBean.LOG.error("An error occured while loading the project.", ex);
// FacesContext.getCurrentInstance().getApplication().getNavigationHandler().handleNavigation(FacesContext.getCurrentInstance(), null,
// "projectOverview");
GlobalPropertiesBean.showMessage(FacesMessage.SEVERITY_ERROR, this.globalPropertiesBean.getMsgProjectLoadingException());
} catch (final NullPointerException ex) {
// This exception can occur, when a property has not been initialized
CurrentAnalysisEditorBean.LOG.error("An error occured while loading the project.", ex);
// FacesContext.getCurrentInstance().getApplication().getNavigationHandler().handleNavigation(FacesContext.getCurrentInstance(), null,
// "projectOverview");
GlobalPropertiesBean.showMessage(FacesMessage.SEVERITY_ERROR, this.globalPropertiesBean.getMsgProjectLoadingException());
}
}
......
......
......@@ -334,6 +334,12 @@ public final class CurrentCockpitEditorBean {
return this.activeView;
}
/**
* Sets the active view and updates the dashboard.
*
* @param view
* The new view.
*/
public synchronized void setActiveView(final MIView view) {
this.activeView = view;
......
......
......@@ -63,21 +63,17 @@
nodeSelected([{name : 'id', value : event.currentTarget.id}]);
});
</script>
<h:outputText value="Description: "/>
<p:inplace id="basic" editor="true">
<p:inputText value="#{currentCockpitEditorBean.activeView.description}" />
</p:inplace>
<br/>
<hr/>
<p:dashboard id="dynamicDashboard" binding="#{currentCockpitEditorBean.dashboard}"/>
</ui:fragment>
</h:form>
</ui:define>
<ui:define name="furtherLayoutUnits">
<p:layoutUnit position="west" resizable="true" size="300" collapsible="true" header="Available Views">
<p:layoutUnit position="west" resizable="true" maxSize="350" collapsible="true">
<h:form id="availableViewsForm">
<p:dataList value="#{currentCockpitEditorBean.project.views}" var="viewElem">
<p:dataTable value="#{currentCockpitEditorBean.project.views}" var="viewElem">
<p:column headerText="View">
<div align="center">
<p:commandLink id="dynaButton" value="#{viewElem.name}"/>
<p:menu overlay="true" trigger="dynaButton" my="left top" at="left bottom" style="width:210px">
......@@ -87,7 +83,17 @@
<p:menuitem icon="ui-icon-edit" styleClass="element-with-whitespace" value=" #{localizedCockpitEditorPageMessages.renameView}"/>
<p:menuitem icon="ui-icon-delete" styleClass="element-with-whitespace" value=" #{localizedCockpitEditorPageMessages.deleteView}" action="#{currentCockpitEditorBean.deleteView(viewElem)}"/>
</p:menu>
</p:dataList>
</div>
</p:column>
<p:column headerText="# Elements"><div align="center">#{viewElem.displayConnectors.size()}</div></p:column>
<p:column headerText="Description">
<div align="center">
<p:inplace id="normalEditor" editor="true">
<p:inputText value="#{viewElem.description}" />
</p:inplace>
</div>
</p:column>
</p:dataTable>
</h:form>
</p:layoutUnit>
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment