Commit e9793d99 authored by Mathieu Gicquel's avatar Mathieu Gicquel
Browse files

Added methods and docs - Fix #24

parent 3f64e9ea
......@@ -5,6 +5,9 @@ import fr.alma.gtd.server.core.*;
import java.util.ArrayList;
import java.util.List;
/**
* Class storing projects, contexts, users, tags, ideas and tasks
*/
public class Facade {
private static Facade instance = null;
......
......@@ -10,6 +10,26 @@ public class FacadeFactory {
throw new IllegalStateException("Factory class");
}
/**
* Create a project
* @return project
*/
static IProject getProject() {
Project p = new Project();
Facade.getInstance().getProjects().add(p);
return p;
}
/**
* Create a project
* @param idServeur idServeur
* @param progress progress
* @param projectName projectName
* @return project
*/
static IProject getProject(String idServeur, Progress progress, String projectName) {
Project p = new Project(idServeur, progress, projectName);
Facade.getInstance().getProjects().add(p);
......@@ -17,6 +37,22 @@ public class FacadeFactory {
return p;
}
/**
* Create a context
* @return context
*/
static IContext getContext() {
Context c = new Context();
Facade.getInstance().getContexts().add(c);
return c;
}
/**
* Create a context
* @param name name of context
* @return context
*/
static IContext getContext(final String name) {
Context c = new Context(name);
Facade.getInstance().getContexts().add(c);
......@@ -24,6 +60,10 @@ public class FacadeFactory {
return c;
}
/**
* Create an user
* @return user
*/
static IParticipant getUser() {
Utilisateur u = new Utilisateur();
Facade.getInstance().getUser().add(u);
......@@ -31,6 +71,11 @@ public class FacadeFactory {
return u;
}
/**
* Create an user
* @param login login
* @return user
*/
static IParticipant getUser(String login) {
IParticipant u1 = FacadeFactory.getUser();
......@@ -38,6 +83,22 @@ public class FacadeFactory {
return u1;
}
/**
* Create a tag
* @return tag
*/
static ITag getTag() {
Tag tag = new Tag();
Facade.getInstance().getTags().add(tag);
return tag;
}
/**
* Create a tag
* @param name tag name
* @return tag
*/
static ITag getTag(String name) {
Tag tag = new Tag();
Facade.getInstance().getTags().add(tag);
......@@ -46,6 +107,23 @@ public class FacadeFactory {
return tag;
}
/**
* Create a tag
* @param name tag name
* @param creator creator
* @return tag
*/
static ITag getTag(String name,IParticipant creator) {
ITag tag = FacadeFactory.getTag(name);
tag.setCreator(creator);
return tag;
}
/**
* Create an idea
* @return idea
*/
static IIdea getIdea() {
Idea idea = new Idea();
Facade.getInstance().getIdeas().add(idea);
......@@ -53,6 +131,13 @@ public class FacadeFactory {
return idea;
}
/**
* Create an idea
* @param name idea's name
* @param description idea's description
* @param idServeur idea's idServeur
* @return idea
*/
static IIdea getIdea(String name, String description, String idServeur) {
IIdea idea = FacadeFactory.getIdea();
......@@ -62,6 +147,10 @@ public class FacadeFactory {
return idea;
}
/**
* Create a task
* @return task
*/
static ITask getTask() {
Task task = new Task();
Facade.getInstance().getTasks().add(task);
......@@ -69,6 +158,11 @@ public class FacadeFactory {
return new Task();
}
/**
* Create a task
* @param name task's name
* @return task
*/
static ITask getTask(String name) {
ITask task = FacadeFactory.getTask();
task.setName(name);
......
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