001/*
002 * (C) Copyright 2006-2007 Nuxeo SAS (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Nuxeo - initial API and implementation
016 *
017 * $Id: JOOoConvertPluginImpl.java 18651 2007-05-13 20:28:53Z sfermigier $
018 */
019
020package org.nuxeo.ecm.webapp.documentsLists;
021
022import java.io.Serializable;
023import java.util.ArrayList;
024import java.util.List;
025
026import org.nuxeo.common.xmap.annotation.XNode;
027import org.nuxeo.common.xmap.annotation.XNodeList;
028import org.nuxeo.common.xmap.annotation.XObject;
029import org.nuxeo.ecm.platform.web.common.vh.VirtualHostHelper;
030import org.nuxeo.runtime.api.Framework;
031
032@XObject(value = "documentsList")
033public class DocumentsListDescriptor implements Serializable {
034
035    private static final long serialVersionUID = 187652786580987097L;
036
037    @XNode("@name")
038    private String name;
039
040    @XNode("category")
041    private String category = "";
042
043    @XNode("defaultInCategory")
044    private boolean defaultInCategory;
045
046    @XNodeList(value = "events/event", type = ArrayList.class, componentType = String.class)
047    private List<String> eventsName;
048
049    private String imageURL;
050
051    @XNode("supportAppends")
052    boolean supportAppends = true;
053
054    @XNode("readOnly")
055    boolean readOnly;
056
057    @XNode("isSession")
058    boolean isSession = true;
059
060    @XNode("title")
061    String title = "";
062
063    @XNode("@enabled")
064    boolean enabled = true;
065
066    @XNode("persistent")
067    boolean persistent;
068
069    // empty constructor needed for descriptor instantiation
070    public DocumentsListDescriptor() {
071        eventsName = new ArrayList<String>();
072        imageURL = VirtualHostHelper.getContextPathProperty() + "/icons/clipboard.gif";
073    }
074
075    public DocumentsListDescriptor(String listName) {
076        this();
077    }
078
079    public String getCategory() {
080        return category;
081    }
082
083    public void setCategory(String category) {
084        this.category = category;
085    }
086
087    public boolean getDefaultInCategory() {
088        return defaultInCategory;
089    }
090
091    public void setDefaultInCategory(boolean defaultInCategory) {
092        this.defaultInCategory = defaultInCategory;
093    }
094
095    public List<String> getEventsName() {
096        return eventsName;
097    }
098
099    public void setEvenstName(List<String> eventsName) {
100        this.eventsName = eventsName;
101    }
102
103    public boolean getReadOnly() {
104        return readOnly;
105    }
106
107    public void setReadOnly(boolean readOnly) {
108        this.readOnly = readOnly;
109    }
110
111    public boolean getSupportAppends() {
112        return supportAppends;
113    }
114
115    public void setSupportAppends(boolean supportAppends) {
116        this.supportAppends = supportAppends;
117    }
118
119    public String getImageURL() {
120        return imageURL;
121    }
122
123    @XNode("imageURL")
124    public void setImageURL(String imageURL) {
125        this.imageURL = Framework.expandVars(imageURL);
126    }
127
128    public String getTitle() {
129        return title;
130    }
131
132    public void setTitle(String title) {
133        this.title = title;
134    }
135
136    public String getName() {
137        return name;
138    }
139
140    public void setName(String listName) {
141        name = listName;
142    }
143
144    public boolean getEnabled() {
145        return enabled;
146    }
147
148    public void setEnabled(boolean enabled) {
149        this.enabled = enabled;
150    }
151
152    public boolean getIsSession() {
153        return isSession;
154    }
155
156    public void setIsSession(boolean isSession) {
157        this.isSession = isSession;
158    }
159
160    public boolean getPersistent() {
161        if (!isSession) {
162            return false; // XXX conversation scoped list can't be persistent
163        }
164        return persistent;
165    }
166
167    public void setPersistent(boolean persistent) {
168        this.persistent = persistent;
169    }
170
171}