Commit 74945789 authored by Jean-Mael BOIS's avatar Jean-Mael BOIS
Browse files

Change fields visibility of anstract classes - Fix #27

parent 1dbfefc7
......@@ -11,25 +11,13 @@ public abstract class AbstractContact extends AbstractServerObject implements IC
*/
private static final long serialVersionUID = 1L;
/**
* Address linked to this contact.
*/
protected String address;
private String address;
/**
* Email linked to this contact.
*/
protected String email;
private String email;
/**
* Name linked to this contact.
*/
protected String name;
private String name;
/**
* Phone number linked to this contact.
*/
protected String phoneNumber;
private String phoneNumber;
/**
* Default constructor.
......@@ -47,10 +35,10 @@ public abstract class AbstractContact extends AbstractServerObject implements IC
*/
protected AbstractContact(final String name, final String email, final String address, final String phoneNumber) {
super();
this.name = name;
this.email = email;
this.address = address;
this.phoneNumber = phoneNumber;
this.setName(name);
this.setEmail(email);
this.setAddress(address);
this.setPhoneNumber(phoneNumber);
}
/**
......@@ -60,22 +48,20 @@ public abstract class AbstractContact extends AbstractServerObject implements IC
protected AbstractContact(final IContact contact) {
super();
}
/**
* Copy a contact.
* @param contact contact to copy.
*/
public void copy(final IContact contact) {
this.serverIdentifier = contact.getServerIdentifier();
this.lastModificationDate = contact.getLastModificationDate();
this.name = contact.getName();
this.email = contact.getEmail();
this.address = contact.getAdress();
this.phoneNumber = contact.getPhone();
this.setServerIdentifier(contact.getServerIdentifier());
this.setLastModificationDate(contact.getLastModificationDate());
this.setName(contact.getName());
this.setEmail(contact.getEmail());
this.setAddress(contact.getAdress());
this.setPhoneNumber(contact.getPhone());
}
@Override
public void setAddress(final String address) {
this.address = address;
......@@ -93,7 +79,40 @@ public abstract class AbstractContact extends AbstractServerObject implements IC
@Override
public void setPhone(final String phoneNumber) {
this.phoneNumber = phoneNumber;
this.setPhoneNumber(phoneNumber);
}
/**
* Address linked to this contact.
*/
public String getAddress() {
return address;
}
/**
* Email linked to this contact.
*/
@Override
public String getEmail() {
return email;
}
/**
* Name linked to this contact.
*/
@Override
public String getName() {
return name;
}
/**
* Phone number linked to this contact.
*/
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
}
......@@ -11,15 +11,9 @@ public abstract class AbstractContext extends AbstractServerObject implements IC
*/
private static final long serialVersionUID = 2868136479716970129L;
/**
* Name.
*/
protected String name;
private String name;
/**
* Creator.
*/
protected IParticipant creator;
private IParticipant creator;
/**
* Default constructor.
......@@ -34,7 +28,7 @@ public abstract class AbstractContext extends AbstractServerObject implements IC
*/
protected AbstractContext(final String name) {
super();
this.name = name;
this.setName(name);
}
/**
......@@ -50,9 +44,9 @@ public abstract class AbstractContext extends AbstractServerObject implements IC
* @param ctx context to copy.
*/
public void copy(final IContext ctx) {
this.name = ctx.getName();
this.creator = ctx.getCreator();
this.lastModificationDate = ctx.getLastModificationDate();
this.setName(ctx.getName());
this.setCreator(ctx.getCreator());
this.setLastModificationDate(ctx.getLastModificationDate());
}
@Override
......@@ -64,4 +58,20 @@ public abstract class AbstractContext extends AbstractServerObject implements IC
public final void setCreator(final IParticipant c) {
this.creator = c;
}
/**
* Name.
*/
@Override
public String getName() {
return name;
}
/**
* Creator.
*/
@Override
public IParticipant getCreator() {
return creator;
}
}
......@@ -13,44 +13,25 @@ public abstract class AbstractIdea extends AbstractServerObject implements IIdea
*/
private static final long serialVersionUID = -3818784391851861129L;
/**
* Name.
*/
protected String name;
/**
* Description.
*/
protected String description;
private String name;
private String description;
/**
* Indicates if the idea is in the trash.
*/
protected boolean isTrash;
private boolean isTrash;
/**
* Indicates if the idea has been archived.
*/
protected boolean isArchived;
private boolean isArchived;
/**
* Last modification date
*/
protected Date lastModificationDate;
private Date lastModificationDate;
/**
* Creator.
*/
protected IParticipant creator;
private IParticipant creator;
/**
* Initialization of the variables.
*/
{
this.isTrash = false;
this.isArchived = false;
this.lastModificationDate = new Date();
this.setTrash(false);
this.setArchived(false);
this.setLastModificationDate(new Date());
}
/**
......@@ -68,9 +49,9 @@ public abstract class AbstractIdea extends AbstractServerObject implements IIdea
*/
protected AbstractIdea(final String n, final String desc, final IParticipant c) {
super();
this.name = n;
this.description = desc;
this.creator = c;
this.setName(n);
this.setDescription(desc);
this.setCreator(c);
}
......@@ -83,13 +64,13 @@ public abstract class AbstractIdea extends AbstractServerObject implements IIdea
}
public void copy(final IIdea idea) {
this.name = idea.getName();
this.creator = idea.getCreator();
this.lastModificationDate = idea.getLastModificationDate();
this.serverIdentifier = idea.getServerIdentifier();
this.description = idea.getDescription();
this.isTrash = idea.isTrash();
this.isArchived = idea.isArchived();
this.setName(idea.getName());
this.setCreator(idea.getCreator());
this.setLastModificationDate(idea.getLastModificationDate());
this.setServerIdentifier(idea.getServerIdentifier());
this.setDescription(idea.getDescription());
this.setTrash(idea.isTrash());
this.setArchived(idea.isArchived());
}
@Override
......@@ -109,11 +90,59 @@ public abstract class AbstractIdea extends AbstractServerObject implements IIdea
@Override
public final void setArchived(final boolean isArchived) {
this.isArchived = this.isArchived;
this.isArchived = isArchived;
}
@Override
public final void setCreator(final IParticipant c) {
this.creator = c;
}
/**
* Name.
*/
@Override
public String getName() {
return name;
}
/**
* Description.
*/
@Override
public String getDescription() {
return description;
}
/**
* Indicates if the idea is in the trash.
*/
@Override
public boolean isTrash() {
return isTrash;
}
/**
* Indicates if the idea has been archived.
*/
@Override
public boolean isArchived() {
return isArchived;
}
/**
* Last modification date
*/
@Override
public Date getLastModificationDate() {
return lastModificationDate;
}
/**
* Creator.
*/
@Override
public IParticipant getCreator() {
return creator;
}
}
......@@ -13,13 +13,10 @@ public abstract class AbstractParticipant extends AbstractServerObject implement
*/
private static final long serialVersionUID = 8682719518429571480L;
/**
* Pseudonym.
*/
protected String pseudonym;
private String pseudonym;
{
this.lastModificationDate = new Date();
this.setLastModificationDate(new Date());
}
/**
......@@ -31,34 +28,43 @@ public abstract class AbstractParticipant extends AbstractServerObject implement
/**
* Constructor allowing the initialization of the pseudonym.
*
* @param pseudonym selected pseudonym.
*/
protected AbstractParticipant(final String pseudonym) {
super();
this.pseudonym = pseudonym;
this.setPseudonym(pseudonym);
}
/**
* Constructor to copy a participant.
*
* @param p participant to copy.
*/
protected AbstractParticipant(final IParticipant p) {
this.copy(p);
}
/**
* Copy a participant.
* @param p participant to copy.
*/
public void copy(final IParticipant p){
this.pseudonym = p.getPseudonym();
this.lastModificationDate = p.getLastModificationDate();
this.serverIdentifier = p.getServerIdentifier();
this.setPseudonym(p.getPseudonym());
this.setLastModificationDate(p.getLastModificationDate());
this.setServerIdentifier(p.getServerIdentifier());
}
@Override
public final void setPseudonym(final String pseudo) {
this.pseudonym = pseudo;
}
/**
* Pseudonym.
*/
@Override
public String getPseudonym() {
return pseudonym;
}
}
......@@ -15,69 +15,39 @@ public abstract class AbstractProject extends AbstractServerObject implements IP
*/
private static final long serialVersionUID = -1035410260532175513L;
/**
* Name project.
*/
protected String name;
private String name;
/**
* Progress of the project.
*/
protected Progress progress;
private Progress progress;
/**
* The default context for tasks added to the project.
*/
protected IContext defaultContext;
private IContext defaultContext;
/**
* List of tasks.
*/
protected List<ITask> tasksList;
private List<ITask> tasksList;
/**
* List of participants.
*/
protected List<IParticipant> participantsList;
private List<IParticipant> participantsList;
/**
* Creator of the project.
*/
protected IParticipant creator;
private IParticipant creator;
/**
* Indicates if the project is in the trash.
*/
protected boolean isTrash;
private boolean isTrash;
/**
* Indicates if the project is in the archives
*/
protected boolean isArchived;
private boolean isArchived;
/**
* List of contacts associated with this project.
*/
protected List<IContact> contacts;
private List<IContact> contacts;
/**
* List of sub-projects associated with this project.
*/
protected List<IProject> subprojectsList;
private List<IProject> subprojectsList;
/**
* Initialisation des variables.
*/
{
this.isTrash = false;
this.isArchived = false;
this.lastModificationDate = new Date();
this.setTrash(false);
this.setArchived(false);
this.setLastModificationDate(new Date());
this.tasksList = new ArrayList<ITask>();
this.participantsList = new ArrayList<IParticipant>();
this.subprojectsList = new ArrayList<IProject>();
this.contacts = new ArrayList<IContact>();
this.progress = Progress.TODO;
this.setParticipantsList(new ArrayList<IParticipant>());
this.setSubprojectsList(new ArrayList<IProject>());
this.setContacts(new ArrayList<IContact>());
this.setProgress(Progress.TODO);
}
/**
......@@ -95,9 +65,9 @@ public abstract class AbstractProject extends AbstractServerObject implements IP
*/
protected AbstractProject(final String n, final IContext context, final IParticipant c) {
super();
this.name = n;
this.defaultContext = context;
this.creator = c;
this.setName(n);
this.setDefaultContext(context);
this.setCreator(c);
}
/**
......@@ -113,17 +83,17 @@ public abstract class AbstractProject extends AbstractServerObject implements IP
* @param p Project to copy
*/
public void copy(final IProject p){
this.name = p.getName();
this.creator = p.getCreator();
this.lastModificationDate = p.getLastModificationDate();
this.serverIdentifier = p.getServerIdentifier();
this.defaultContext = p.getDefaultContext();
this.tasksList = p.getTasksList();
this.participantsList = p.getParticipantsList();
this.progress = p.getProgress();
this.isTrash = p.isTrash();
this.contacts = p.getContactsList();
this.subprojectsList = p.getSubprojectsList();
this.setName(p.getName());
this.setCreator(p.getCreator());
this.setLastModificationDate(p.getLastModificationDate());
this.setServerIdentifier(p.getServerIdentifier());
this.setDefaultContext(p.getDefaultContext());
this.setTasksList(p.getTasksList());
this.setParticipantsList(p.getParticipantsList());
this.setProgress(p.getProgress());
this.setTrash(p.isTrash());
this.setContacts(p.getContactsList());
this.setSubprojectsList(p.getSubprojectsList());
}
@Override
......@@ -143,7 +113,7 @@ public abstract class AbstractProject extends AbstractServerObject implements IP
@Override
public final void archive() throws IllegalStateException {
if(this.isArchived) throw new IllegalStateException("cannot archive an archived task");
if(this.isArchived()) throw new IllegalStateException("cannot archive an archived task");
this.getTasksList().forEach(ITask::archive);
this.setArchived(true);
......@@ -209,11 +179,98 @@ public abstract class AbstractProject extends AbstractServerObject implements IP
@Override
public final void setContactsList(final List<IContact> contacts){
this.contacts = contacts;
this.setContacts(contacts);
}
@Override
public void setArchived(boolean archived) {
this.isArchived = archived;
}
/**
* Name project.
*/
@Override
public String getName() {
return name;
}
/**
* Progress of the project.
*/
@Override
public Progress getProgress() {
return progress;
}
/**
* The default context for tasks added to the project.
*/
@Override
public IContext getDefaultContext() {
return defaultContext;
}
/**
* List of tasks.
*/
@Override
public List<ITask> getTasksList() {
return tasksList;
}
public void setTasksList(List<ITask> tasksList) {
this.tasksList = tasksList;
}
/**
* List of participants.
*/
@Override
public List<IParticipant> getParticipantsList() {
return participantsList;
}
/**