1   /**
2    * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.webdav;
24  
25  import java.io.InputStream;
26  
27  import java.util.Date;
28  
29  /**
30   * <a href="BaseResourceImpl.java.html"><b><i>View Source</i></b></a>
31   *
32   * @author Brian Wing Shun Chan
33   *
34   */
35  public class BaseResourceImpl implements Resource {
36  
37      public BaseResourceImpl(String href, String displayName, boolean folder) {
38          this(href, displayName, folder, null, null);
39      }
40  
41      public BaseResourceImpl(String href, String displayName, boolean folder,
42                              Date createDate, Date modifiedDate) {
43  
44          this(href, displayName, folder, createDate, modifiedDate, 0);
45      }
46  
47      public BaseResourceImpl(String href, String displayName, boolean folder,
48                              Date createDate, Date modifiedDate, int size) {
49  
50          _href = href;
51          _displayName = displayName;
52          _folder = folder;
53  
54          if (createDate == null) {
55              _createDate = new Date();
56          }
57          else {
58              _createDate = createDate;
59          }
60  
61          if (modifiedDate == null) {
62              _modifiedDate = new Date();
63          }
64          else {
65              _modifiedDate = _createDate;
66          }
67  
68          _size = size;
69      }
70  
71      public String getHREF() {
72          return _href;
73      }
74  
75      public String getDisplayName() {
76          return _displayName;
77      }
78  
79      public boolean isFolder() {
80          return _folder;
81      }
82  
83      public Date getCreateDate() {
84          return _createDate;
85      }
86  
87      public Date getModifiedDate() {
88          return _modifiedDate;
89      }
90  
91      public int getSize() {
92          return _size;
93      }
94  
95      public Object getModel() {
96          return _model;
97      }
98  
99      public void setModel(Object model) {
100         _model = model;
101     }
102 
103     public InputStream getContentAsStream() throws WebDAVException {
104         return null;
105     }
106 
107     private String _href;
108     private String _displayName;
109     private boolean _folder;
110     private Date _createDate;
111     private Date _modifiedDate;
112     private int _size;
113     private Object _model;
114 
115 }