001/*
002 * (C) Copyright 2006-2007 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nuxeo - initial API and implementation
018 *
019 * $Id: JOOoConvertPluginImpl.java 18651 2007-05-13 20:28:53Z sfermigier $
020 */
021
022package org.nuxeo.ecm.webapp.documentsLists;
023
024import java.io.Serializable;
025import java.util.ArrayList;
026import java.util.List;
027
028import org.nuxeo.common.xmap.annotation.XNode;
029import org.nuxeo.common.xmap.annotation.XNodeList;
030import org.nuxeo.common.xmap.annotation.XObject;
031import org.nuxeo.ecm.platform.web.common.vh.VirtualHostHelper;
032import org.nuxeo.runtime.api.Framework;
033
034@XObject(value = "documentsList")
035public class DocumentsListDescriptor implements Serializable {
036
037    private static final long serialVersionUID = 187652786580987097L;
038
039    @XNode("@name")
040    private String name;
041
042    @XNode("category")
043    private String category = "";
044
045    @XNode("defaultInCategory")
046    private boolean defaultInCategory;
047
048    @XNodeList(value = "events/event", type = ArrayList.class, componentType = String.class)
049    private List<String> eventsName;
050
051    private String imageURL;
052
053    @XNode("supportAppends")
054    boolean supportAppends = true;
055
056    @XNode("readOnly")
057    boolean readOnly;
058
059    @XNode("isSession")
060    boolean isSession = true;
061
062    @XNode("title")
063    String title = "";
064
065    @XNode("@enabled")
066    boolean enabled = true;
067
068    @XNode("persistent")
069    boolean persistent;
070
071    // empty constructor needed for descriptor instantiation
072    public DocumentsListDescriptor() {
073        eventsName = new ArrayList<String>();
074        imageURL = VirtualHostHelper.getContextPathProperty() + "/icons/clipboard.gif";
075    }
076
077    public DocumentsListDescriptor(String listName) {
078        this();
079    }
080
081    public String getCategory() {
082        return category;
083    }
084
085    public void setCategory(String category) {
086        this.category = category;
087    }
088
089    public boolean getDefaultInCategory() {
090        return defaultInCategory;
091    }
092
093    public void setDefaultInCategory(boolean defaultInCategory) {
094        this.defaultInCategory = defaultInCategory;
095    }
096
097    public List<String> getEventsName() {
098        return eventsName;
099    }
100
101    public void setEvenstName(List<String> eventsName) {
102        this.eventsName = eventsName;
103    }
104
105    public boolean getReadOnly() {
106        return readOnly;
107    }
108
109    public void setReadOnly(boolean readOnly) {
110        this.readOnly = readOnly;
111    }
112
113    public boolean getSupportAppends() {
114        return supportAppends;
115    }
116
117    public void setSupportAppends(boolean supportAppends) {
118        this.supportAppends = supportAppends;
119    }
120
121    public String getImageURL() {
122        return imageURL;
123    }
124
125    @XNode("imageURL")
126    public void setImageURL(String imageURL) {
127        this.imageURL = Framework.expandVars(imageURL);
128    }
129
130    public String getTitle() {
131        return title;
132    }
133
134    public void setTitle(String title) {
135        this.title = title;
136    }
137
138    public String getName() {
139        return name;
140    }
141
142    public void setName(String listName) {
143        name = listName;
144    }
145
146    public boolean getEnabled() {
147        return enabled;
148    }
149
150    public void setEnabled(boolean enabled) {
151        this.enabled = enabled;
152    }
153
154    public boolean getIsSession() {
155        return isSession;
156    }
157
158    public void setIsSession(boolean isSession) {
159        this.isSession = isSession;
160    }
161
162    public boolean getPersistent() {
163        if (!isSession) {
164            return false; // XXX conversation scoped list can't be persistent
165        }
166        return persistent;
167    }
168
169    public void setPersistent(boolean persistent) {
170        this.persistent = persistent;
171    }
172
173}