--- /dev/null
+/*****************************************************************************
+ * Copyright Igor Barma, Eric Brun, Alexandre Desoubeaux, Christian Martel,
+ * (2 décembre 2008)
+ *
+ * Ce logiciel est un programme informatique servant à l'évaluation des
+ * compétences.
+ *
+ * Ce logiciel est régi par la licence CeCILL soumise au droit français et
+ * respectant les principes de diffusion des logiciels libres. Vous pouvez
+ * utiliser, modifier et/ou redistribuer ce programme sous les conditions
+ * de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
+ * sur le site "http://www.cecill.info".
+ *
+ * En contrepartie de l'accessibilité au code source et des droits de copie,
+ * de modification et de redistribution accordés par cette licence, il n'est
+ * offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
+ * seule une responsabilité restreinte pèse sur l'auteur du programme, le
+ * titulaire des droits patrimoniaux et les concédants successifs.
+ *
+ * A cet égard l'attention de l'utilisateur est attirée sur les risques
+ * associés au chargement, à l'utilisation, à la modification et/ou au
+ * développement et à la reproduction du logiciel par l'utilisateur étant
+ * donné sa spécificité de logiciel libre, qui peut le rendre complexe à
+ * manipuler et qui le réserve donc à des développeurs et des professionnels
+ * avertis possédant des connaissances informatiques approfondies. Les
+ * utilisateurs sont donc invités à charger et tester l'adéquation du
+ * logiciel à leurs besoins dans des conditions permettant d'assurer la
+ * sécurité de leurs systèmes et ou de leurs données et, plus généralement,
+ * à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.
+ *
+ * Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
+ * pris connaissance de la licence CeCILL, et que vous en avez accepté les
+ * termes.
+ *******************************************************************************/
+package com.pentila.evalcomp.domain.transit;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This class is used to represent nodes of type folder in the jackrabbits
+ * repository. A ResourceFolder object can have multiple other ResourceFolder's
+ * and can also have multiple ResourceFile's. Each of these are represented by a
+ * list of List of ResourceFolder respectively List of ResourceFile.
+ */
+public class RessourceFolder implements RessourceItem, Serializable {
+
+ /** The date. */
+ private Date date;
+
+ /** The editable. */
+ private boolean editable = true;
+
+ /** The folder list. */
+ private List<RessourceFolder> folderList = new ArrayList<RessourceFolder>();
+
+ /** item list of this ResourceFolder. */
+ private List<RessourceItem> itemList = new ArrayList<RessourceItem>();
+
+ /** The name. */
+ private String name;
+
+ /** The owners. */
+ private Set<String> owners;
+
+ /** The path. */
+ private String ressourceKey;
+
+ /** The plugin key. */
+ private String pluginKey;
+
+ /** The shareds. */
+ private Set<String> shareds;
+
+ /** The url. */
+ private String url = null;
+
+ /** The Constant RESSOURCE. */
+ public static final Integer RESSOURCE = 0;
+
+ /** The Constant NULLRESSOURCE. */
+ public static final Integer NULLRESSOURCE = 1;
+ /** The my type. */
+ private static String myType = "RessourceFolder";
+
+ /** The state. */
+ private Integer state = RESSOURCE;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.pentila.evalcomp.domain.ResourceItem#addOwner(java.lang.String,
+ * java.lang.String)
+ */
+ public void addOwner(String path, String owner) {
+ if (owner != null && owner.length() > 0) {
+ owners.add(owner);
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.pentila.evalcomp.domain.ResourceItem#addShared(java.lang.String,
+ * java.lang.String)
+ */
+ public void addShared(String path, String share) {
+ if (share != null && share.length() > 0) {
+ shareds.add(share);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.pentila.evalcomp.domain.transit.RessourceItem#getDate()
+ */
+ public Date getDate() {
+ // TODO Auto-generated method stub
+ return this.date;
+ }
+
+ /**
+ * get ResourceFolder's in this ResourceFolder.
+ *
+ * @return the list of ResourceFolder's
+ */
+ public List<RessourceFolder> getFolderList() {
+ return folderList;
+ }
+
+ /**
+ * get all item in this ResourceFolder.
+ *
+ * @return list of ResourceItem.
+ */
+ public List<RessourceItem> getItemList() {
+ return itemList;
+ }
+
+ /**
+ * get name of the ResourceFolder.
+ *
+ * @return ResourceFolder name.
+ */
+ public String getName() {
+ return name;
+ };
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.pentila.evalcomp.domain.transit.RessourceItem#getOwners()
+ */
+ public Set<String> getOwners() {
+ return owners;
+ }
+
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.pentila.evalcomp.domain.transit.RessourceItem#getPluginKey()
+ */
+ public String getPluginKey() {
+ return pluginKey;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.pentila.evalcomp.domain.transit.RessourceItem#getRessourceKey()
+ */
+ public String getRessourceKey() {
+ // TODO Auto-generated method stub
+ return this.ressourceKey;
+ };
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.pentila.evalcomp.domain.transit.RessourceItem#getShareds()
+ */
+ public Set<String> getShareds() {
+ return shareds;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.pentila.evalcomp.domain.transit.RessourceItem#getType()
+ */
+ public String getType() {
+ // TODO Auto-generated method stub
+ return myType;
+ }
+
+ /**
+ * Gets the url.
+ *
+ * @return the url
+ */
+ public String getUrl() {
+ return url;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.pentila.evalcomp.domain.transit.RessourceItem#isEditable()
+ */
+ public boolean isEditable() {
+ return editable;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.pentila.evalcomp.domain.transit.RessourceItem#setDate(java.util.Date)
+ */
+ public void setDate(Date t) {
+ // TODO Auto-generated method stub
+ this.date = t;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.pentila.evalcomp.domain.transit.RessourceItem#setEditable(boolean)
+ */
+ public void setEditable(boolean editable) {
+ this.editable = editable;
+ }
+
+ /**
+ * set ResourceFolder list.
+ *
+ * @param folderList
+ * the folder list
+ */
+ public void setFolderList(List<RessourceFolder> folderList) {
+ this.folderList = folderList;
+ }
+
+ /**
+ * Sets the item list.
+ *
+ * @param itemList
+ * the item list
+ */
+ public void setItemList(List<RessourceItem> itemList) {
+ this.itemList = itemList;
+ }
+
+ /**
+ * set the current folder name.
+ *
+ * @param name
+ * the name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.pentila.evalcomp.domain.transit.RessourceItem#setOwners(java.util
+ * .Set)
+ */
+ public void setOwners(Set<String> owners) {
+ this.owners = owners;
+ }
+
+ /**
+ * Method to set the path of the current ResourceFolder. Usage:
+ * folder1/folder2/folder3 NOT /folder1/folder2 notice the first "/"
+ * character.
+ *
+ * @param path
+ * of the folder.
+ */
+ public void setRessourceKey(String path) {
+ this.ressourceKey = path;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.pentila.evalcomp.domain.transit.RessourceItem#setPluginKey(java.lang
+ * .String)
+ */
+ public void setPluginKey(String pluginKey) {
+ this.pluginKey = pluginKey;
+ for (RessourceItem ri : this.getItemList()) {
+ ri.setPluginKey(pluginKey);
+ }
+ for (RessourceItem ri : this.getFolderList()) {
+ ri.setPluginKey(pluginKey);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.pentila.evalcomp.domain.transit.RessourceItem#setShareds(java.util
+ * .Set)
+ */
+ public void setShareds(Set<String> shareds) {
+ this.shareds = shareds;
+ }
+
+ /**
+ * Sets the url.
+ *
+ * @param url
+ * the new url
+ */
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ /**
+ * Gets the state.
+ *
+ * @return the state
+ */
+ public Integer getState() {
+ return state;
+ }
+
+ /**
+ * Sets the state.
+ *
+ * @param state the new state
+ */
+ public void setState(Integer state) {
+ this.state = state;
+ }
+
+ /**
+ * Checks if is null ressource.
+ *
+ * @return true, if is null ressource
+ */
+ public boolean isNullRessource() {
+ return state.equals(NULLRESSOURCE);
+ }
+
+}