View Javadoc
1   /*
2    * Copyright (C) 2003-2017 eXo Platform SAS.
3    *
4    * This program is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Affero General Public License
6    * as published by the Free Software Foundation; either version 3
7    * of the License, or (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with this program; if not, see<http://www.gnu.org/licenses/>.
16   */
17  package org.exoplatform.wcm.ext.component.activity;
18  
19  import javax.jcr.Node;
20  
21  import org.apache.commons.lang3.StringUtils;
22  
23  import org.exoplatform.services.cms.drives.DriveData;
24  import org.exoplatform.services.wcm.core.NodeLocation;
25  
26  public class ActivityFileAttachment {
27  
28    private String             contentName;
29  
30    private String             imagePath;
31  
32    private String             mimeType;
33  
34    private String             nodeUUID;
35  
36    private String             state;
37  
38    private String             contentLink;
39  
40    private String             author;
41  
42    private String             dateCreated;
43  
44    private String             lastModified;
45  
46    private Node               contentNode;
47  
48    private NodeLocation       nodeLocation;
49  
50    private DriveData          docDrive;
51  
52    private String             docTypeName;
53  
54    private String             docTitle;
55  
56    private String             docVersion;
57  
58    private String             docSummary;
59  
60    public String              docPath;
61  
62    public String              repository;
63  
64    public String              workspace;
65  
66    private Boolean            isSymlink;
67  
68    private String             webdavURL;
69  
70    public String getContentName() {
71      return contentName;
72    }
73  
74    public ActivityFileAttachment setContentName(String contentName) {
75      this.contentName = contentName;
76      return this;
77    }
78  
79    public String getImagePath() {
80      return imagePath;
81    }
82  
83    public ActivityFileAttachment setImagePath(String imagePath) {
84      this.imagePath = imagePath;
85      return this;
86    }
87  
88    public String getMimeType() {
89      return mimeType;
90    }
91  
92    public ActivityFileAttachment setMimeType(String mimeType) {
93      this.mimeType = mimeType;
94      return this;
95    }
96  
97    public String getNodeUUID() {
98      return nodeUUID;
99    }
100 
101   public ActivityFileAttachment setNodeUUID(String nodeUUID) {
102     this.nodeUUID = nodeUUID;
103     return this;
104   }
105 
106   public String getState() {
107     return state;
108   }
109 
110   public ActivityFileAttachment setState(String state) {
111     this.state = state;
112     return this;
113   }
114 
115   public String getContentLink() {
116     return contentLink;
117   }
118 
119   public ActivityFileAttachment setContentLink(String contentLink) {
120     this.contentLink = contentLink;
121     return this;
122   }
123 
124   public String getAuthor() {
125     return author;
126   }
127 
128   public ActivityFileAttachment setAuthor(String author) {
129     this.author = author;
130     return this;
131   }
132 
133   public String getDateCreated() {
134     return dateCreated;
135   }
136 
137   public ActivityFileAttachment setDateCreated(String dateCreated) {
138     this.dateCreated = dateCreated;
139     return this;
140   }
141 
142   public String getLastModified() {
143     return lastModified;
144   }
145 
146   public ActivityFileAttachment setLastModified(String lastModified) {
147     this.lastModified = lastModified;
148     return this;
149   }
150 
151   public Node getContentNode() {
152     return contentNode;
153   }
154 
155   public ActivityFileAttachment setContentNode(Node contentNode) {
156     this.contentNode = contentNode;
157     return this;
158   }
159 
160   public NodeLocation getNodeLocation() {
161     if (nodeLocation == null && StringUtils.isNotBlank(repository) && StringUtils.isNotBlank(workspace)
162         && (StringUtils.isNotBlank(docPath) || StringUtils.isNotBlank(nodeUUID))) {
163       nodeLocation = new NodeLocation(repository, workspace, docPath, nodeUUID, false);
164     }
165     return nodeLocation;
166   }
167 
168   public ActivityFileAttachment setNodeLocation(NodeLocation nodeLocation) {
169     this.nodeLocation = nodeLocation;
170     return this;
171   }
172 
173   public DriveData getDocDrive() {
174     return docDrive;
175   }
176 
177   public ActivityFileAttachment setDocDrive(DriveData docDrive) {
178     this.docDrive = docDrive;
179     return this;
180   }
181 
182   public String getDocTypeName() {
183     return docTypeName;
184   }
185 
186   public ActivityFileAttachment setDocTypeName(String docTypeName) {
187     this.docTypeName = docTypeName;
188     return this;
189   }
190 
191   public String getDocTitle() {
192     return docTitle;
193   }
194 
195   public ActivityFileAttachment setDocTitle(String docTitle) {
196     this.docTitle = docTitle;
197     return this;
198   }
199 
200   public String getDocVersion() {
201     return docVersion;
202   }
203 
204   public ActivityFileAttachment setDocVersion(String docVersion) {
205     this.docVersion = docVersion;
206     return this;
207   }
208 
209   public String getDocSummary() {
210     return docSummary;
211   }
212 
213   public ActivityFileAttachment setDocSummary(String docSummary) {
214     this.docSummary = docSummary;
215     return this;
216   }
217 
218   public String getDocPath() {
219     return docPath == null ? (nodeLocation == null ? null : nodeLocation.getPath()) : docPath;
220   }
221 
222   public ActivityFileAttachment setDocPath(String docPath) {
223     this.docPath = docPath;
224     return this;
225   }
226 
227   public String getRepository() {
228     return StringUtils.isBlank(repository) ? (nodeLocation == null ? null : nodeLocation.getRepository()) : repository;
229   }
230 
231   public ActivityFileAttachment setRepository(String repository) {
232     this.repository = repository;
233     return this;
234   }
235 
236   public String getWorkspace() {
237     return StringUtils.isBlank(workspace) ? (nodeLocation == null ? null : nodeLocation.getWorkspace()) : workspace;
238   }
239 
240   public ActivityFileAttachment setWorkspace(String workspace) {
241     this.workspace = workspace;
242     return this;
243   }
244 
245   public boolean isSymlink() {
246     return isSymlink == null ? false : isSymlink;
247   }
248 
249   public ActivityFileAttachment setSymlink(Boolean isSymlink) {
250     this.isSymlink = isSymlink;
251     return this;
252   }
253 
254   public void setWebdavURL(String webdavURL) {
255     this.webdavURL = webdavURL;
256   }
257 
258   public String getWebdavURL() {
259     return webdavURL;
260   }
261 }