Commit 61911fdf authored by piotr.gawron's avatar piotr.gawron
Browse files

rename of get project file function

parent 998c0537
......@@ -1447,8 +1447,8 @@ public class ProjectService implements IProjectService {
}
@Override
public byte[] getInputDataForLayout(ProjectView projectView) {
return getInputDataForLayout(projectView.getIdObject());
public byte[] getInputDataForProject(ProjectView projectView) {
return getInputDataForProject(projectView.getIdObject());
}
/**
......@@ -1461,7 +1461,7 @@ public class ProjectService implements IProjectService {
* @return original data file for given layout, if such file is not stored in
* database (compatibility reasons) then null is returned
*/
private byte[] getInputDataForLayout(int projectId) {
private byte[] getInputDataForProject(int projectId) {
Project project = projectDao.getById(projectId);
if (project == null) {
return null;
......
package lcsb.mapviewer.services.interfaces;
import java.util.List;
import lcsb.mapviewer.model.Project;
import lcsb.mapviewer.model.user.User;
import lcsb.mapviewer.services.utils.CreateProjectParams;
import lcsb.mapviewer.services.view.ProjectView;
import org.primefaces.model.TreeNode;
/**
* Service that manages projects.
*
* @author Piotr Gawron
*
*/
public interface IProjectService {
/**
* Returns a project with a give {@link Project#projectId project identifier}.
*
* @param projectId
* {@link Project#projectId project identifier}
* @return project with an identifier given as parameter. Null if such project
* doesn't exist.
*/
Project getProjectByProjectId(String projectId);
/**
* Checks if project with a given {@link Project#projectId identifier} exists.
*
* @param projectId
* {@link Project#projectId project identifier}
* @return <code>true</code> if the project with the given name exists,
* <code>false</code> otherwise
*/
boolean projectExists(String projectId);
/**
* Returns list of all projects.
*
* @return list of all projects.
*/
List<Project> getAllProjects();
/**
* Returns a list of Project views for all projects.
*
* @return list of Project views for all projects
*/
List<ProjectView> getAllProjectViews();
/**
* Updates project.
*
* @param projectView
* project view with the data to update
*/
void updateProject(ProjectView projectView);
/**
* Removes project from the system.
*
* @param homeDir
* directory where the system is deployed
*
* @param projectView
* information about project to remove
* @param async
* should the operation be done asynchronously
*/
void removeProject(ProjectView projectView, String homeDir, boolean async);
/**
* Removes project from the system.
*
* @param homeDir
* directory where the system is deployed
* @param project
* object to remove
* @param async
* should the operation be done asynchronously
*/
void removeProject(Project project, String homeDir, boolean async);
/**
* Gets view of the project by the {@link Project#projectId project
* identifier}.
*
* @param projectId
* {@link Project#projectId project identifier}
* @return view of the project
*/
ProjectView getProjectViewByProjectId(String projectId);
/**
* Adds project to the system.
*
* @param project
* object to add
*/
void addProject(Project project);
/**
* Return the view of the project identified by database identifier.
*
* @param id
* database identifier of the project
* @return project view
*/
ProjectView getProjectViewById(Integer id);
/**
* Creates project using give parameters. See {@link CreateProjectParams}.
*
* @param params
* information about project to create
*/
void createProject(CreateProjectParams params);
/**
* Creates empty {@link ProjectView}.
*
* @return empty {@link ProjectView}
*/
ProjectView createEmpty();
/**
* Creates {@link TreeNode} that contains information about all classes that
* can be annotated and associate set of
* {@link lcsb.mapviewer.annotation.services.annotators.ElementAnnotator
* ElementAnnotator} valid for these classes.
*
* @param user
* for which information should be retrieved
* @return {@link TreeNode} that contains information about all classes that
* can be annotated
*/
TreeNode createClassAnnotatorTree(User user);
/**
* Update default set of annotators, lists of required/valid annotations for a
* given user and default params used when creating project.
*
* @param user
* user for which we updte information
* @param sbgnFormat
* new
* {@link lcsb.mapviewer.model.user.UserAnnotationSchema#sbgnFormat}
* value
* @param networkLayoutAsDefault
* new
* {@link lcsb.mapviewer.model.user.UserAnnotationSchema#networkLayoutAsDefault}
* value
* @param annotatorsTree
* {@link TreeNode} that contains information about all classes that
* can be annotated
*/
void updateClassAnnotatorTreeForUser(User user, TreeNode annotatorsTree, boolean sbgnFormat, boolean networkLayoutAsDefault);
/**
* Method that updates information about raw {@link Project} object.
*
* @param project
* project to update
*/
void updateProject(Project project);
/**
* Returns content of the file that was used to create project given in the
* parameter.
*
* @param projectView
* view of the {@link Project} for which we are looking for an
* original source file
* @return content of the file that was used to create project given in the
* parameter
*/
byte[] getInputDataForLayout(ProjectView projectView);
}
package lcsb.mapviewer.services.interfaces;
import java.util.List;
import lcsb.mapviewer.model.Project;
import lcsb.mapviewer.model.user.User;
import lcsb.mapviewer.services.utils.CreateProjectParams;
import lcsb.mapviewer.services.view.ProjectView;
import org.primefaces.model.TreeNode;
/**
* Service that manages projects.
*
* @author Piotr Gawron
*
*/
public interface IProjectService {
/**
* Returns a project with a give {@link Project#projectId project identifier}.
*
* @param projectId
* {@link Project#projectId project identifier}
* @return project with an identifier given as parameter. Null if such project
* doesn't exist.
*/
Project getProjectByProjectId(String projectId);
/**
* Checks if project with a given {@link Project#projectId identifier} exists.
*
* @param projectId
* {@link Project#projectId project identifier}
* @return <code>true</code> if the project with the given name exists,
* <code>false</code> otherwise
*/
boolean projectExists(String projectId);
/**
* Returns list of all projects.
*
* @return list of all projects.
*/
List<Project> getAllProjects();
/**
* Returns a list of Project views for all projects.
*
* @return list of Project views for all projects
*/
List<ProjectView> getAllProjectViews();
/**
* Updates project.
*
* @param projectView
* project view with the data to update
*/
void updateProject(ProjectView projectView);
/**
* Removes project from the system.
*
* @param homeDir
* directory where the system is deployed
*
* @param projectView
* information about project to remove
* @param async
* should the operation be done asynchronously
*/
void removeProject(ProjectView projectView, String homeDir, boolean async);
/**
* Removes project from the system.
*
* @param homeDir
* directory where the system is deployed
* @param project
* object to remove
* @param async
* should the operation be done asynchronously
*/
void removeProject(Project project, String homeDir, boolean async);
/**
* Gets view of the project by the {@link Project#projectId project
* identifier}.
*
* @param projectId
* {@link Project#projectId project identifier}
* @return view of the project
*/
ProjectView getProjectViewByProjectId(String projectId);
/**
* Adds project to the system.
*
* @param project
* object to add
*/
void addProject(Project project);
/**
* Return the view of the project identified by database identifier.
*
* @param id
* database identifier of the project
* @return project view
*/
ProjectView getProjectViewById(Integer id);
/**
* Creates project using give parameters. See {@link CreateProjectParams}.
*
* @param params
* information about project to create
*/
void createProject(CreateProjectParams params);
/**
* Creates empty {@link ProjectView}.
*
* @return empty {@link ProjectView}
*/
ProjectView createEmpty();
/**
* Creates {@link TreeNode} that contains information about all classes that
* can be annotated and associate set of
* {@link lcsb.mapviewer.annotation.services.annotators.ElementAnnotator
* ElementAnnotator} valid for these classes.
*
* @param user
* for which information should be retrieved
* @return {@link TreeNode} that contains information about all classes that
* can be annotated
*/
TreeNode createClassAnnotatorTree(User user);
/**
* Update default set of annotators, lists of required/valid annotations for a
* given user and default params used when creating project.
*
* @param user
* user for which we updte information
* @param sbgnFormat
* new
* {@link lcsb.mapviewer.model.user.UserAnnotationSchema#sbgnFormat}
* value
* @param networkLayoutAsDefault
* new
* {@link lcsb.mapviewer.model.user.UserAnnotationSchema#networkLayoutAsDefault}
* value
* @param annotatorsTree
* {@link TreeNode} that contains information about all classes that
* can be annotated
*/
void updateClassAnnotatorTreeForUser(User user, TreeNode annotatorsTree, boolean sbgnFormat, boolean networkLayoutAsDefault);
/**
* Method that updates information about raw {@link Project} object.
*
* @param project
* project to update
*/
void updateProject(Project project);
/**
* Returns content of the file that was used to create project given in the
* parameter.
*
* @param projectView
* view of the {@link Project} for which we are looking for an
* original source file
* @return content of the file that was used to create project given in the
* parameter
*/
byte[] getInputDataForProject(ProjectView projectView);
}
......@@ -1439,7 +1439,7 @@ public class ProjectBean extends AbstractManagedBean implements Serializable {
*/
public void downloadInputData(ProjectView projectView) throws IOException {
// get input data from database
byte[] data = projectService.getInputDataForLayout(projectView);
byte[] data = projectService.getInputDataForProject(projectView);
Project project = projectService.getProjectByProjectId(projectView.getProjectId());
String string = new String(data, StandardCharsets.UTF_8);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment