Revision 672:163de098320c
b/.classpath | ||
---|---|---|
182 | 182 |
<classpathentry kind="lib" path="dependencies/gwt-incubator-20100204-r1747.jar"/> |
183 | 183 |
<classpathentry kind="lib" path="dependencies/gwt-gears-1.3.0/gwt-gears.jar"/> |
184 | 184 |
<classpathentry kind="lib" path="dependencies/gwt-visualization-1.1.0/gwt-visualization.jar"/> |
185 |
<classpathentry kind="lib" path="war/WEB-INF/lib/mongo-2.1.jar"/> |
|
186 |
<classpathentry kind="lib" path="war/WEB-INF/lib/guice-2.0.jar"/> |
|
185 | 187 |
<classpathentry kind="output" path="bin"/> |
186 | 188 |
</classpath> |
b/.hgignore | ||
---|---|---|
7 | 7 |
^tomcat |
8 | 8 |
.swp$ |
9 | 9 |
^dependencies |
10 |
^war/WEB-INF/lib/guice-2.0.jar$ |
|
11 |
^war/WEB-INF/lib/mongo-2.1.jar$ |
b/BUILD.txt | ||
---|---|---|
96 | 96 |
|
97 | 97 |
You need to have Shibboleth authentication set up in order to authenticate. The first step in the Shibboleth authentication process is a redirection to a WAYF (Where Are You From) server, for selecting the Identity Provider that has your credentials. You can read more about Shibboleth here: |
98 | 98 |
|
99 |
http://en.wikipedia.org/wiki/Shibboleth |
|
99 |
http://en.wikipedia.org/wiki/Shibboleth_(Internet2)
|
|
100 | 100 |
|
101 | 101 |
Then point a browser to http://127.0.0.1:8080/pithos/ in order to connect to the service. |
102 | 102 |
|
b/build.xml | ||
---|---|---|
36 | 36 |
<property name="gwt-visualization.download.url" value="http://gwt-google-apis.googlecode.com/files/gwt-visualization-1.1.0.zip"/> |
37 | 37 |
<property name="gwt-incubator.filename" value="gwt-incubator-20100204-r1747.jar"/> |
38 | 38 |
<property name="gwt-incubator.download.url" value="http://google-web-toolkit-incubator.googlecode.com/files/gwt-incubator-20100204-r1747.jar"/> |
39 |
<property name="guice.path" value="${deps.dir}/guice-2.0" /> |
|
40 |
<property name="guice.filename" value="guice-2.0.zip/"/> |
|
41 |
<property name="guice.download.url" value="http://google-guice.googlecode.com/files/guice-2.0.zip"/> |
|
42 |
<property name="mongo.filename" value="mongo-2.1.jar/"/> |
|
43 |
<property name="mongo.download.url" value="http://github.com/downloads/mongodb/mongo-java-driver/mongo-2.1.jar"/> |
|
39 | 44 |
|
40 | 45 |
<!-- Source and runtime layout configuration --> |
41 | 46 |
<property name="jboss_run_configuration" value="default" /> |
... | ... | |
108 | 113 |
<pathelement location="${jboss.lib.dir}/jbosssx.jar"/> |
109 | 114 |
<pathelement location="${ear.lib.dir}/commons-codec-1.4.jar"/> |
110 | 115 |
<pathelement location="${ear.lib.dir}/commons-configuration-1.6.jar"/> |
111 |
<pathelement location="${war.lib.dir}/commons-fileupload-1.2.jar"/> |
|
112 | 116 |
<pathelement location="${ear.lib.dir}/commons-httpclient-3.1.jar"/> |
113 | 117 |
<pathelement location="${ear.lib.dir}/commons-lang.jar"/> |
114 | 118 |
<pathelement location="${ear.lib.dir}/ldap.jar"/> |
119 |
<pathelement location="${war.lib.dir}/commons-fileupload-1.2.jar"/> |
|
120 |
<pathelement location="${war.lib.dir}/guice-2.0.jar"/> |
|
121 |
<pathelement location="${war.lib.dir}/mongo-2.1.jar"/> |
|
115 | 122 |
<pathelement location="${junit.path}/junit.jar"/> |
116 | 123 |
<pathelement location="${deps.dir}/${gwt-dnd.filename}"/> |
117 | 124 |
<pathelement location="${gwt-gears.path}/gwt-gears.jar"/> |
... | ... | |
123 | 130 |
<available file="${jboss.home}" type="dir" property="jboss.home.present"/> |
124 | 131 |
</target> |
125 | 132 |
|
126 |
<target name="fetch-dependencies" description="Fetch the dpendencies" unless="jboss.home.present" depends="check-jboss">
|
|
133 |
<target name="fetch-deps" description="Fetch the dpendencies" unless="jboss.home.present" depends="check-jboss"> |
|
127 | 134 |
<mkdir dir="${deps.dir}"/> |
128 | 135 |
<get src="${gwt.download.url}" dest="${deps.dir}/${gwt.filename}" usetimestamp="true"/> |
129 | 136 |
<get src="${gwt-dnd.download.url}" dest="${deps.dir}/${gwt-dnd.filename}" usetimestamp="true"/> |
130 | 137 |
<get src="${gwt-gears.download.url}" dest="${deps.dir}/${gwt-gears.filename}" usetimestamp="true"/> |
131 | 138 |
<get src="${gwt-visualization.download.url}" dest="${deps.dir}/${gwt-visualization.filename}" usetimestamp="true"/> |
132 | 139 |
<get src="${gwt-incubator.download.url}" dest="${deps.dir}/${gwt-incubator.filename}" usetimestamp="true"/> |
140 |
<get src="${guice.download.url}" dest="${deps.dir}/${guice.filename}" usetimestamp="true"/> |
|
141 |
<get src="${mongo.download.url}" dest="${deps.dir}/${mongo.filename}" usetimestamp="true"/> |
|
133 | 142 |
<get src="${hornetq.download.url}" dest="${deps.dir}/${hornetq.filename}" usetimestamp="true"/> |
134 | 143 |
<get src="${junit.download.url}" dest="${deps.dir}/${junit.filename}" usetimestamp="true"/> |
135 | 144 |
<get src="${jboss.download.url}" dest="${deps.dir}/${jboss.filename}" usetimestamp="true"/> |
136 | 145 |
<unzip src="${deps.dir}/${gwt.filename}" dest="${deps.dir}"/> |
137 | 146 |
<unzip src="${deps.dir}/${gwt-gears.filename}" dest="${deps.dir}"/> |
138 | 147 |
<unzip src="${deps.dir}/${gwt-visualization.filename}" dest="${deps.dir}"/> |
148 |
<unzip src="${deps.dir}/${guice.filename}" dest="${deps.dir}"/> |
|
139 | 149 |
<unzip src="${deps.dir}/${hornetq.filename}" dest="${deps.dir}"/> |
140 | 150 |
<unzip src="${deps.dir}/${junit.filename}" dest="${deps.dir}"/> |
141 | 151 |
<unzip src="${deps.dir}/${jboss.filename}" dest="${jboss.home}/.."/> |
142 | 152 |
</target> |
143 | 153 |
|
144 |
<target name="install" depends="fetch-dependencies" description="Installs the configuration files of the application server"> |
|
154 |
<target name="update-deps" depends="deinstall,fetch-deps" |
|
155 |
description="Fetch any newly-introduced dependencies"> |
|
156 |
</target> |
|
157 |
|
|
158 |
<target name="install" depends="fetch-deps" description="Installs the configuration files of the application server"> |
|
145 | 159 |
<!-- Install HornetQ configuration --> |
146 | 160 |
<copy todir="${jboss.run_conf.lib.dir}"> |
147 | 161 |
<fileset dir="${hornetq.path}/lib"> |
... | ... | |
160 | 174 |
<mkdir dir="${jboss.bin.dir}/META-INF/lib/linux2/x64"/> |
161 | 175 |
<copy todir="${jboss.bin.dir}/META-INF/lib/linux2/x86" file="${hornetq.path}/bin/libHornetQAIO32.so"/> |
162 | 176 |
<copy todir="${jboss.bin.dir}/META-INF/lib/linux2/x64" file="${hornetq.path}/bin/libHornetQAIO64.so"/> |
177 |
<!-- Install Guice --> |
|
178 |
<copy todir="${war.lib.dir}"> |
|
179 |
<fileset dir="${guice.path}"> |
|
180 |
<include name="guice-2.0.jar"/> |
|
181 |
</fileset> |
|
182 |
</copy> |
|
183 |
<!-- Install Mongo driver --> |
|
184 |
<copy todir="${war.lib.dir}"> |
|
185 |
<fileset dir="${deps.dir}"> |
|
186 |
<include name="mongo-2.1.jar"/> |
|
187 |
</fileset> |
|
188 |
</copy> |
|
163 | 189 |
<!-- Install gss configuration --> |
164 | 190 |
<copy todir="${jboss.bin.dir}" overwrite="true" failonerror="false"> |
165 | 191 |
<fileset dir="${jboss.project}/bin"/> |
b/src/gr/ebs/gss/mbeans/Solr.java | ||
---|---|---|
1 | 1 |
/* |
2 |
* Copyright 2008, 2009 Electronic Business Systems Ltd. |
|
2 |
* Copyright 2008, 2009, 2010 Electronic Business Systems Ltd.
|
|
3 | 3 |
* |
4 | 4 |
* This file is part of GSS. |
5 | 5 |
* |
... | ... | |
18 | 18 |
*/ |
19 | 19 |
package gr.ebs.gss.mbeans; |
20 | 20 |
|
21 |
import static gr.ebs.gss.server.configuration.GSSConfigurationFactory.getConfiguration;
|
|
22 |
import gr.ebs.gss.server.ejb.ExternalAPIRemote;
|
|
21 |
import gr.ebs.gss.server.ejb.ExternalAPI;
|
|
22 |
import gr.ebs.gss.server.ejb.ExternalAPIBean;
|
|
23 | 23 |
|
24 | 24 |
import javax.management.JMRuntimeException; |
25 |
import javax.naming.InitialContext; |
|
26 |
import javax.naming.NamingException; |
|
27 |
import javax.rmi.PortableRemoteObject; |
|
28 | 25 |
|
29 | 26 |
import org.jboss.system.ServiceMBeanSupport; |
30 | 27 |
|
... | ... | |
38 | 35 |
@Override |
39 | 36 |
public void rebuildIndex() { |
40 | 37 |
try { |
41 |
InitialContext ctx = new InitialContext(); |
|
42 |
Object ref = ctx.lookup(getConfiguration().getString("externalApiPath")); |
|
43 |
ExternalAPIRemote service = (ExternalAPIRemote) PortableRemoteObject.narrow(ref, ExternalAPIRemote.class); |
|
38 |
ExternalAPI service = new ExternalAPIBean(); |
|
44 | 39 |
service.rebuildSolrIndex(); |
45 | 40 |
} catch (ClassCastException e) { |
46 | 41 |
throw new JMRuntimeException(e.getMessage()); |
47 |
} catch (NamingException e) { |
|
48 |
throw new JMRuntimeException(e.getMessage()); |
|
49 | 42 |
} |
50 | 43 |
} |
51 | 44 |
} |
b/src/gr/ebs/gss/server/BaseServlet.java | ||
---|---|---|
21 | 21 |
import static gr.ebs.gss.server.configuration.GSSConfigurationFactory.getConfiguration; |
22 | 22 |
import gr.ebs.gss.client.exceptions.RpcException; |
23 | 23 |
import gr.ebs.gss.server.ejb.ExternalAPI; |
24 |
import gr.ebs.gss.server.ejb.ExternalAPIBean; |
|
24 | 25 |
|
25 | 26 |
import java.io.UnsupportedEncodingException; |
26 | 27 |
import java.net.URLEncoder; |
27 | 28 |
import java.util.Formatter; |
28 | 29 |
|
29 |
import javax.naming.Context; |
|
30 |
import javax.naming.InitialContext; |
|
31 |
import javax.naming.NamingException; |
|
32 |
import javax.rmi.PortableRemoteObject; |
|
33 | 30 |
import javax.servlet.http.HttpServlet; |
34 | 31 |
|
35 |
import org.apache.commons.logging.Log; |
|
36 |
import org.apache.commons.logging.LogFactory; |
|
37 |
|
|
38 | 32 |
/** |
39 | 33 |
* The base servlet contains a collection of helper methods. |
40 | 34 |
* |
... | ... | |
53 | 47 |
private static final long serialVersionUID = 1L; |
54 | 48 |
|
55 | 49 |
/** |
56 |
* The logger. |
|
57 |
*/ |
|
58 |
private static Log logger = LogFactory.getLog(BaseServlet.class); |
|
59 |
|
|
60 |
/** |
|
61 | 50 |
* A helper method that retrieves a reference to the ExternalAPI bean and |
62 | 51 |
* stores it for future use. |
63 | 52 |
* |
... | ... | |
65 | 54 |
* @throws RpcException in case an error occurs |
66 | 55 |
*/ |
67 | 56 |
protected ExternalAPI getService() throws RpcException { |
68 |
try { |
|
69 |
final Context ctx = new InitialContext(); |
|
70 |
final Object ref = ctx.lookup(getConfiguration().getString("externalApiPath")); |
|
71 |
return (ExternalAPI) PortableRemoteObject.narrow(ref, ExternalAPI.class); |
|
72 |
} catch (final NamingException e) { |
|
73 |
logger.error("Unable to retrieve the ExternalAPI EJB", e); |
|
74 |
throw new RpcException("An error occurred while contacting the naming service"); |
|
75 |
} |
|
57 |
return new ExternalAPIBean(); |
|
76 | 58 |
} |
77 | 59 |
|
78 | 60 |
/** |
b/src/gr/ebs/gss/server/ejb/ExternalAPI.java | ||
---|---|---|
44 | 44 |
import java.util.List; |
45 | 45 |
import java.util.Set; |
46 | 46 |
|
47 |
import javax.ejb.Local; |
|
48 | 47 |
import javax.ejb.TransactionAttribute; |
49 | 48 |
import javax.ejb.TransactionAttributeType; |
50 | 49 |
|
... | ... | |
53 | 52 |
* |
54 | 53 |
* @author past |
55 | 54 |
*/ |
56 |
@Local |
|
57 | 55 |
public interface ExternalAPI { |
58 | 56 |
|
59 | 57 |
/** |
... | ... | |
1261 | 1259 |
* Delete the actual file in the specified file system path. |
1262 | 1260 |
*/ |
1263 | 1261 |
public void deleteActualFile(String path); |
1262 |
|
|
1263 |
/** |
|
1264 |
* @param fileId |
|
1265 |
* @param delete |
|
1266 |
*/ |
|
1267 |
public void indexFile(Long fileId, boolean delete); |
|
1264 | 1268 |
} |
b/src/gr/ebs/gss/server/ejb/ExternalAPIBean.java | ||
---|---|---|
1 | 1 |
/* |
2 |
* Copyright 2007, 2008, 2009 Electronic Business Systems Ltd. |
|
2 |
* Copyright 2007, 2008, 2009, 2010 Electronic Business Systems Ltd.
|
|
3 | 3 |
* |
4 | 4 |
* This file is part of GSS. |
5 | 5 |
* |
... | ... | |
64 | 64 |
import java.util.Set; |
65 | 65 |
import java.util.StringTokenizer; |
66 | 66 |
|
67 |
import javax.ejb.EJB; |
|
68 | 67 |
import javax.ejb.EJBException; |
69 | 68 |
import javax.ejb.EJBTransactionRolledbackException; |
70 |
import javax.ejb.Stateless; |
|
71 | 69 |
import javax.ejb.TransactionAttribute; |
72 | 70 |
import javax.ejb.TransactionAttributeType; |
73 | 71 |
import javax.jms.Connection; |
... | ... | |
120 | 118 |
* |
121 | 119 |
* @author past |
122 | 120 |
*/ |
123 |
@Stateless |
|
124 |
public class ExternalAPIBean implements ExternalAPI, ExternalAPIRemote { |
|
121 |
public class ExternalAPIBean implements ExternalAPI { |
|
125 | 122 |
/** |
126 | 123 |
* The default MIME type for files without an explicit one. |
127 | 124 |
*/ |
... | ... | |
141 | 138 |
/** |
142 | 139 |
* Injected reference to the GSSDAO data access facade. |
143 | 140 |
*/ |
144 |
@EJB |
|
145 |
private GSSDAO dao; |
|
141 |
private GSSDAO dao = new GSSDAOBean(); |
|
146 | 142 |
|
147 | 143 |
|
148 | 144 |
/** |
... | ... | |
520 | 516 |
return createFile(userId, folderId, name, mimeType, file.length(), file.getAbsolutePath()); |
521 | 517 |
} |
522 | 518 |
|
523 |
/* (non-Javadoc) |
|
524 |
* @see gr.ebs.gss.server.ejb.ExternalAPIRemote#indexFile(java.lang.Long, boolean) |
|
525 |
*/ |
|
526 | 519 |
@Override |
527 | 520 |
public void indexFile(Long fileId, boolean delete) { |
528 | 521 |
Connection qConn = null; |
/dev/null | ||
---|---|---|
1 |
/* |
|
2 |
* Copyright 2007, 2008, 2009 Electronic Business Systems Ltd. |
|
3 |
* |
|
4 |
* This file is part of GSS. |
|
5 |
* |
|
6 |
* GSS is free software: you can redistribute it and/or modify |
|
7 |
* it under the terms of the GNU General Public License as published by |
|
8 |
* the Free Software Foundation, either version 3 of the License, or |
|
9 |
* (at your option) any later version. |
|
10 |
* |
|
11 |
* GSS is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with GSS. If not, see <http://www.gnu.org/licenses/>. |
|
18 |
*/ |
|
19 |
package gr.ebs.gss.server.ejb; |
|
20 |
|
|
21 |
import gr.ebs.gss.client.exceptions.DuplicateNameException; |
|
22 |
import gr.ebs.gss.client.exceptions.GSSIOException; |
|
23 |
import gr.ebs.gss.client.exceptions.InsufficientPermissionsException; |
|
24 |
import gr.ebs.gss.client.exceptions.ObjectNotFoundException; |
|
25 |
import gr.ebs.gss.client.exceptions.QuotaExceededException; |
|
26 |
import gr.ebs.gss.server.domain.User; |
|
27 |
import gr.ebs.gss.server.domain.dto.FileHeaderDTO; |
|
28 |
import gr.ebs.gss.server.domain.dto.FolderDTO; |
|
29 |
import gr.ebs.gss.server.domain.dto.GroupDTO; |
|
30 |
import gr.ebs.gss.server.domain.dto.PermissionDTO; |
|
31 |
import gr.ebs.gss.server.domain.dto.UserDTO; |
|
32 |
|
|
33 |
import java.io.InputStream; |
|
34 |
import java.util.Date; |
|
35 |
import java.util.List; |
|
36 |
import java.util.Set; |
|
37 |
|
|
38 |
import javax.ejb.Remote; |
|
39 |
|
|
40 |
/** |
|
41 |
* The External API for GSS clients. |
|
42 |
* |
|
43 |
* @author chstath |
|
44 |
*/ |
|
45 |
@Remote |
|
46 |
public interface ExternalAPIRemote { |
|
47 |
|
|
48 |
/** |
|
49 |
* Retrieves the root folder for the specified user. The caller must ensure |
|
50 |
* that the userId exists. |
|
51 |
* |
|
52 |
* @param userId |
|
53 |
* @return Folder |
|
54 |
* @throws ObjectNotFoundException if no Folder or user was found |
|
55 |
*/ |
|
56 |
public FolderDTO getRootFolder(Long userId) throws ObjectNotFoundException; |
|
57 |
|
|
58 |
/** |
|
59 |
* Retrieve the folder with the specified ID. |
|
60 |
* |
|
61 |
* @param userId the ID of the current user |
|
62 |
* @param folderId the ID of the folder to retrieve |
|
63 |
* @return the folder found |
|
64 |
* @throws ObjectNotFoundException if the folder or the user was not found |
|
65 |
* @throws InsufficientPermissionsException if ther user does not have read permissions for folder |
|
66 |
*/ |
|
67 |
public FolderDTO getFolder(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException; |
|
68 |
|
|
69 |
/** |
|
70 |
* Returns the user with the specified ID. |
|
71 |
* |
|
72 |
* @param userId The ID of the User to be found |
|
73 |
* @return The User object |
|
74 |
* @throws ObjectNotFoundException if the user cannot be found |
|
75 |
*/ |
|
76 |
public User getUser(Long userId) throws ObjectNotFoundException; |
|
77 |
|
|
78 |
/** |
|
79 |
* Returns the user with the specified ID. |
|
80 |
* |
|
81 |
* @param userId The ID of the User to be found |
|
82 |
* @return The User object |
|
83 |
* @throws ObjectNotFoundException if the user cannot be found |
|
84 |
*/ |
|
85 |
public UserDTO getUserDTO(Long userId) throws ObjectNotFoundException; |
|
86 |
|
|
87 |
/** |
|
88 |
* Returns the group with the specified ID. |
|
89 |
* |
|
90 |
* @param groupId The ID of the Group to be found |
|
91 |
* @return The Group object |
|
92 |
* @throws ObjectNotFoundException if the group cannot be found |
|
93 |
*/ |
|
94 |
public GroupDTO getGroup(Long groupId) throws ObjectNotFoundException; |
|
95 |
|
|
96 |
/** |
|
97 |
* Retrieve the list of groups for a particular user. |
|
98 |
* |
|
99 |
* @param userId the ID of the User |
|
100 |
* @return a List of Groups that belong to the specified User |
|
101 |
* @throws ObjectNotFoundException if the user was not found |
|
102 |
*/ |
|
103 |
public List<GroupDTO> getGroups(Long userId) throws ObjectNotFoundException; |
|
104 |
|
|
105 |
/** |
|
106 |
* Returns a list of files contained in the folder specified by its id. |
|
107 |
* |
|
108 |
* @param userId the ID of the User |
|
109 |
* @param folderId the ID of the folder containing the files |
|
110 |
* @param ignoreDeleted |
|
111 |
* @return the list of file header objects |
|
112 |
* @throws ObjectNotFoundException if the user or the folder cannot be found |
|
113 |
* @throws InsufficientPermissionsException |
|
114 |
*/ |
|
115 |
public List<FileHeaderDTO> getFiles(Long userId, Long folderId, boolean ignoreDeleted) throws ObjectNotFoundException, InsufficientPermissionsException; |
|
116 |
|
|
117 |
/** |
|
118 |
* Returns a list of users for the specified group |
|
119 |
* |
|
120 |
* @param userId the ID of the User |
|
121 |
* @param groupId the ID of the requested group |
|
122 |
* @return List<UserDTO> |
|
123 |
* @throws ObjectNotFoundException if the user or group was not found, with |
|
124 |
* the exception message mentioning the precise problem |
|
125 |
*/ |
|
126 |
public List<UserDTO> getUsers(Long userId, Long groupId) throws ObjectNotFoundException; |
|
127 |
|
|
128 |
/** |
|
129 |
* Returns a list of users for the specified username |
|
130 |
* |
|
131 |
* @param username the username of the User |
|
132 |
* @return List<UserDTO> |
|
133 |
*/ |
|
134 |
public List<UserDTO> getUsersByUserNameLike(String username); |
|
135 |
|
|
136 |
/** |
|
137 |
* Creates a new folder with the specified owner, parent folder and name. |
|
138 |
* New folder has the same permissions as its parent |
|
139 |
* |
|
140 |
* @param userId |
|
141 |
* @param parentId |
|
142 |
* @param name |
|
143 |
* @return the new folder |
|
144 |
* @throws DuplicateNameException if the specified name already exists in |
|
145 |
* the parent folder, as either a folder or file |
|
146 |
* @throws ObjectNotFoundException if the user or parent folder was not |
|
147 |
* found, with the exception message mentioning the precise |
|
148 |
* problem |
|
149 |
* @throws InsufficientPermissionsException |
|
150 |
*/ |
|
151 |
public FolderDTO createFolder(Long userId, Long parentId, String name) throws DuplicateNameException, ObjectNotFoundException, InsufficientPermissionsException; |
|
152 |
|
|
153 |
/** |
|
154 |
* Deletes the specified folder if the specified user has the appropriate |
|
155 |
* permission |
|
156 |
* |
|
157 |
* @param userId |
|
158 |
* @param folderId |
|
159 |
* @throws InsufficientPermissionsException if the user does not have the |
|
160 |
* appropriate privileges |
|
161 |
* @throws ObjectNotFoundException if the user or folder was not found, with |
|
162 |
* the exception message mentioning the precise problem |
|
163 |
*/ |
|
164 |
public void deleteFolder(Long userId, Long folderId) throws InsufficientPermissionsException, ObjectNotFoundException; |
|
165 |
|
|
166 |
/** |
|
167 |
* Retrieve the subfolders of the specified folder. |
|
168 |
* |
|
169 |
* @param userId the ID of the current user |
|
170 |
* @param folderId the ID of the folder to retrieve |
|
171 |
* @return the list of subfolders found |
|
172 |
* @throws ObjectNotFoundException if the folder or user was not found |
|
173 |
* @throws InsufficientPermissionsException |
|
174 |
*/ |
|
175 |
public List<FolderDTO> getSubfolders(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException; |
|
176 |
|
|
177 |
|
|
178 |
/** |
|
179 |
* Retrieve the subfolders of the specified folder that are shared to others. |
|
180 |
* |
|
181 |
* @param userId the ID of the current user |
|
182 |
* @param folderId the ID of the folder to retrieve |
|
183 |
* @return the list of subfolders found |
|
184 |
* @throws ObjectNotFoundException if the folder or user was not found |
|
185 |
*/ |
|
186 |
public List<FolderDTO> getSharedSubfolders(Long userId, Long folderId) throws ObjectNotFoundException; |
|
187 |
|
|
188 |
/** |
|
189 |
* Modifies the specified folder if the specified user has the appropriate |
|
190 |
* permission. |
|
191 |
* |
|
192 |
* @param userId the ID of the current user |
|
193 |
* @param folderId the ID of the folder to retrieve |
|
194 |
* @param folderName |
|
195 |
* @param readForAll |
|
196 |
* @param permissions |
|
197 |
* @return the updated folder |
|
198 |
* @throws InsufficientPermissionsException if the user does not have the |
|
199 |
* appropriate privileges |
|
200 |
* @throws ObjectNotFoundException if the user or folder was not found, with |
|
201 |
* the exception message mentioning the precise problem |
|
202 |
* @throws DuplicateNameException if the specified name already exists in |
|
203 |
* the parent folder, as either a folder or file |
|
204 |
*/ |
|
205 |
public FolderDTO updateFolder(Long userId, Long folderId, String folderName, |
|
206 |
Boolean readForAll, |
|
207 |
Set<PermissionDTO> permissions) |
|
208 |
throws InsufficientPermissionsException, ObjectNotFoundException, |
|
209 |
DuplicateNameException; |
|
210 |
|
|
211 |
/** |
|
212 |
* Adds a user to the specified group |
|
213 |
* |
|
214 |
* @param userId the ID of the current user |
|
215 |
* @param groupId the id of the new group |
|
216 |
* @param userToAddId the id of the user to add |
|
217 |
* @throws DuplicateNameException if the user already exists in group |
|
218 |
* @throws ObjectNotFoundException if the user or group was not found, with |
|
219 |
* the exception message mentioning the precise problem |
|
220 |
* @throws InsufficientPermissionsException |
|
221 |
*/ |
|
222 |
public void addUserToGroup(Long userId, Long groupId, Long userToAddId) throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException; |
|
223 |
|
|
224 |
/** |
|
225 |
* Creates a new group with the specified owner and name. |
|
226 |
* |
|
227 |
* @param userId the ID of the current user |
|
228 |
* @param name the name of the new group |
|
229 |
* @throws DuplicateNameException if the new group name already exists |
|
230 |
* @throws ObjectNotFoundException if the user or group was not found, with |
|
231 |
* the exception message mentioning the precise problem |
|
232 |
*/ |
|
233 |
public void createGroup(Long userId, String name) throws ObjectNotFoundException, DuplicateNameException; |
|
234 |
|
|
235 |
/** |
|
236 |
* Deletes the specified group in the specified user's namespace. |
|
237 |
* |
|
238 |
* @param userId the ID of the current user |
|
239 |
* @param groupId the ID of the group to delete |
|
240 |
* @throws ObjectNotFoundException if the user or group was not found, with |
|
241 |
* the exception message mentioning the precise problem |
|
242 |
* @throws InsufficientPermissionsException |
|
243 |
*/ |
|
244 |
public void deleteGroup(Long userId, Long groupId) throws ObjectNotFoundException, InsufficientPermissionsException; |
|
245 |
|
|
246 |
/** |
|
247 |
* Creates a new file with the specified owner, parent folder and name. The |
|
248 |
* new file has the same permissions as its parent folder. The file contents |
|
249 |
* are read from the input stream to a new File object. |
|
250 |
* |
|
251 |
* @param userId the ID of the current user |
|
252 |
* @param folderId the ID of the parent folder |
|
253 |
* @param name the name of the new file |
|
254 |
* @param mimeType the MIME type of the file |
|
255 |
* @param stream the input stream with the file contents |
|
256 |
* @return The FileHeaderDTO created |
|
257 |
* @throws DuplicateNameException if the specified name already exists in |
|
258 |
* the parent folder, as either a folder or file |
|
259 |
* @throws ObjectNotFoundException if the user or parent folder was not |
|
260 |
* found, with the exception message mentioning the precise |
|
261 |
* problem |
|
262 |
* @throws GSSIOException if there was an error while storing the file contents |
|
263 |
* @throws InsufficientPermissionsException |
|
264 |
*/ |
|
265 |
public FileHeaderDTO createFile(Long userId, Long folderId, String name, String mimeType, InputStream stream) throws DuplicateNameException, ObjectNotFoundException, GSSIOException, InsufficientPermissionsException, QuotaExceededException; |
|
266 |
|
|
267 |
/** |
|
268 |
* Deletes the specified file in the specified user's namespace. |
|
269 |
* |
|
270 |
* @param userId the ID of the current user |
|
271 |
* @param fileId the ID of the file to delete |
|
272 |
* @throws ObjectNotFoundException if the user or file was not found, with |
|
273 |
* the exception message mentioning the precise problem |
|
274 |
* @throws InsufficientPermissionsException if the user does not have the |
|
275 |
* appropriate privileges |
|
276 |
*/ |
|
277 |
public void deleteFile(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException; |
|
278 |
|
|
279 |
/** |
|
280 |
* Creates a new tag for the specified user and file. |
|
281 |
* |
|
282 |
* @param userId the creator of the tag |
|
283 |
* @param fileHeaderId the file that is tagged |
|
284 |
* @param tag the tag |
|
285 |
* @throws ObjectNotFoundException if the user or the file was not found |
|
286 |
*/ |
|
287 |
public void createTag(Long userId, Long fileHeaderId, String tag) throws ObjectNotFoundException; |
|
288 |
|
|
289 |
/** |
|
290 |
* Returns all tags defined by the specified user |
|
291 |
* |
|
292 |
* @param userId |
|
293 |
* @return Set<String> |
|
294 |
* @throws ObjectNotFoundException if the user was null |
|
295 |
*/ |
|
296 |
public Set<String> getUserTags(final Long userId) throws ObjectNotFoundException; |
|
297 |
|
|
298 |
/** |
|
299 |
* Updates the attributes of the specified file. |
|
300 |
* |
|
301 |
* @param userId |
|
302 |
* @param fileId |
|
303 |
* @param name |
|
304 |
* @param tagSet a String that contains tags separated by comma |
|
305 |
* @param modificationDate the modification date |
|
306 |
* @param versioned the new value of the versioned flag |
|
307 |
* @param readForAll |
|
308 |
* @param permissions |
|
309 |
* @throws DuplicateNameException |
|
310 |
* @throws ObjectNotFoundException |
|
311 |
* @throws InsufficientPermissionsException |
|
312 |
*/ |
|
313 |
public void updateFile(Long userId, Long fileId, String name, String tagSet, |
|
314 |
Date modificationDate, Boolean versioned, Boolean readForAll, |
|
315 |
Set<PermissionDTO> permissions) |
|
316 |
throws DuplicateNameException, ObjectNotFoundException, InsufficientPermissionsException; |
|
317 |
|
|
318 |
/** |
|
319 |
* Retrieve the contents of the current body for the file |
|
320 |
* with the specified FileHeader ID. The file contents |
|
321 |
* are provided as an InputStream from which the caller can |
|
322 |
* retrieve the raw bytes. |
|
323 |
* |
|
324 |
* @param userId the ID of the current user |
|
325 |
* @param fileId the ID of the file to retrieve |
|
326 |
* @return an InputStream from the current file body contents |
|
327 |
* @throws ObjectNotFoundException if the file or the user was not found |
|
328 |
* @throws InsufficientPermissionsException if the user does not have the |
|
329 |
* appropriate privileges |
|
330 |
*/ |
|
331 |
public InputStream getFileContents(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException; |
|
332 |
|
|
333 |
/** |
|
334 |
* Retrieve the file with the specified ID. |
|
335 |
* |
|
336 |
* @param userId the ID of the current user |
|
337 |
* @param fileId the ID of the file to retrieve |
|
338 |
* @return the file found |
|
339 |
* @throws ObjectNotFoundException if the file or the user was not found, with |
|
340 |
* the exception message mentioning the precise problem |
|
341 |
* @throws InsufficientPermissionsException |
|
342 |
*/ |
|
343 |
public FileHeaderDTO getFile(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException; |
|
344 |
|
|
345 |
/** |
|
346 |
* Get the resource (file or folder) at the specified path in |
|
347 |
* the specified user's namespace. The returned object will be of type |
|
348 |
* FileHeaderDTO or FolderDTO.<p><strong>Note:</strong> this method does not |
|
349 |
* receive the current user as a parameter, therefore it is unable to perform |
|
350 |
* the necessary permission checks and should <strong>NOT</strong> be directly |
|
351 |
* exposed to remote clients. It is the caller's responsibility to verify that |
|
352 |
* the calling user has the required privileges for performing any subsequent |
|
353 |
* action on the resource through one of the other ExternalAPI methods. |
|
354 |
* |
|
355 |
* @param ownerId the ID of the user owning the namespace |
|
356 |
* @param path the absolute path in the user's namespace |
|
357 |
* @param ignoreDeleted if true, resources that have been moved to the trash |
|
358 |
* will be ignored |
|
359 |
* @throws ObjectNotFoundException if the user or resource was not found, with |
|
360 |
* the exception message mentioning the precise problem |
|
361 |
* @return the resource found |
|
362 |
*/ |
|
363 |
public Object getResourceAtPath(Long ownerId, String path, boolean ignoreDeleted) |
|
364 |
throws ObjectNotFoundException; |
|
365 |
|
|
366 |
/** |
|
367 |
* Copy the provided file to the specified destination. |
|
368 |
* |
|
369 |
* @param userId the ID of the current user |
|
370 |
* @param fileId the IF of the provided file |
|
371 |
* @param dest the path to the destination folder |
|
372 |
* @throws ObjectNotFoundException if the user, file or destination was not |
|
373 |
* found, with the exception message mentioning the precise problem |
|
374 |
* @throws GSSIOException if there was an error while accessing the file contents |
|
375 |
* @throws DuplicateNameException if the specified name already exists in |
|
376 |
* the destination folder, as either a folder or file |
|
377 |
* @throws InsufficientPermissionsException |
|
378 |
*/ |
|
379 |
public void copyFile(Long userId, Long fileId, String dest) throws ObjectNotFoundException, DuplicateNameException, GSSIOException, InsufficientPermissionsException, QuotaExceededException; |
|
380 |
|
|
381 |
/** |
|
382 |
* Copy the provided file to the specified destination. |
|
383 |
* |
|
384 |
* @param userId the ID of the current user |
|
385 |
* @param fileId the IF of the provided file |
|
386 |
* @param destId the ID of the destination folder |
|
387 |
* @param destName the name of the new file |
|
388 |
* @throws ObjectNotFoundException if the user, file or destination was not |
|
389 |
* found, with the exception message mentioning the precise problem |
|
390 |
* @throws GSSIOException if there was an error while accessing the file contents |
|
391 |
* @throws DuplicateNameException if the specified name already exists in |
|
392 |
* the destination folder, as either a folder or file |
|
393 |
* @throws InsufficientPermissionsException |
|
394 |
*/ |
|
395 |
public void copyFile(Long userId, Long fileId, Long destId, String destName) throws ObjectNotFoundException, DuplicateNameException, GSSIOException, InsufficientPermissionsException, QuotaExceededException; |
|
396 |
|
|
397 |
/** |
|
398 |
* Copy the provided folder to the specified destination. |
|
399 |
* |
|
400 |
* @param userId the ID of the current user |
|
401 |
* @param folderId the IF of the provided folder |
|
402 |
* @param dest the path to the destination folder |
|
403 |
* @throws ObjectNotFoundException if the user, folder or destination was not |
|
404 |
* found, with the exception message mentioning the precise problem |
|
405 |
* @throws DuplicateNameException if the specified name already exists in |
|
406 |
* the destination folder, as either a folder or file |
|
407 |
* @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the |
|
408 |
* appropriate privileges |
|
409 |
*/ |
|
410 |
public void copyFolder(Long userId, Long folderId, String dest) throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException, QuotaExceededException; |
|
411 |
|
|
412 |
/** |
|
413 |
* Copy the provided folder to the specified destination. |
|
414 |
* |
|
415 |
* @param userId the ID of the current user |
|
416 |
* @param folderId the IF of the provided folder |
|
417 |
* @param destId the ID of the destination folder |
|
418 |
* @param destName the name of the new folder |
|
419 |
* @throws ObjectNotFoundException if the user, folder or destination was not |
|
420 |
* found, with the exception message mentioning the precise problem |
|
421 |
* @throws DuplicateNameException if the specified name already exists in |
|
422 |
* the destination folder, as either a folder or file |
|
423 |
* @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the |
|
424 |
* appropriate privileges |
|
425 |
*/ |
|
426 |
public void copyFolder(Long userId, Long folderId, Long destId, String destName) throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException, QuotaExceededException; |
|
427 |
|
|
428 |
/** |
|
429 |
* Copy the provided folder and all its subfolders and files to the specified destination. |
|
430 |
* |
|
431 |
* @param userId the ID of the current user |
|
432 |
* @param folderId the IF of the provided folder |
|
433 |
* @param destId the ID of the destination folder |
|
434 |
* @param destName the name of the new folder |
|
435 |
* @throws ObjectNotFoundException if the user, folder or destination was not |
|
436 |
* found, with the exception message mentioning the precise problem |
|
437 |
* @throws DuplicateNameException if the specified name already exists in |
|
438 |
* the destination folder, as either a folder or file |
|
439 |
* @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the |
|
440 |
* appropriate privileges |
|
441 |
* @throws GSSIOException |
|
442 |
*/ |
|
443 |
public void copyFolderStructure(Long userId, Long folderId, Long destId, String destName) throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException,GSSIOException, QuotaExceededException; |
|
444 |
|
|
445 |
/** |
|
446 |
* Marks the specified file as deleted in the specified user's namespace. |
|
447 |
* |
|
448 |
* @param userId the ID of the current user |
|
449 |
* @param fileId the ID of the file to delete |
|
450 |
* @throws ObjectNotFoundException if the user or file was not found, with |
|
451 |
* the exception message mentioning the precise problem |
|
452 |
* @throws InsufficientPermissionsException if the user does not have the |
|
453 |
* appropriate privileges |
|
454 |
*/ |
|
455 |
public void moveFileToTrash(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException; |
|
456 |
|
|
457 |
/** |
|
458 |
* Marks the specified deleted file as undeleted in the specified user's namespace. |
|
459 |
* |
|
460 |
* @param userId the ID of the current user |
|
461 |
* @param fileId the ID of the file to undelete |
|
462 |
* @throws ObjectNotFoundException if the user or file was not found, with |
|
463 |
* the exception message mentioning the precise problem |
|
464 |
* @throws InsufficientPermissionsException if the user does not have the |
|
465 |
* appropriate privileges |
|
466 |
*/ |
|
467 |
public void removeFileFromTrash(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException; |
|
468 |
|
|
469 |
/** |
|
470 |
* Marks the specified folder as deleted in the specified user's namespace. |
|
471 |
* |
|
472 |
* @param userId the ID of the current user |
|
473 |
* @param folderId the ID of the folder to delete |
|
474 |
* @throws ObjectNotFoundException if the user or file was not found, with |
|
475 |
* the exception message mentioning the precise problem |
|
476 |
* @throws InsufficientPermissionsException if the user does not have the |
|
477 |
* appropriate privileges |
|
478 |
*/ |
|
479 |
public void moveFolderToTrash(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException; |
|
480 |
|
|
481 |
/** |
|
482 |
* Marks the specified deleted folder as undeleted in the specified user's namespace. |
|
483 |
* |
|
484 |
* @param userId the ID of the current user |
|
485 |
* @param folderId the ID of the folder to undelete |
|
486 |
* @throws ObjectNotFoundException if the user or file was not found, with |
|
487 |
* the exception message mentioning the precise problem |
|
488 |
* @throws InsufficientPermissionsException if the user does not have the |
|
489 |
* appropriate privileges |
|
490 |
*/ |
|
491 |
public void removeFolderFromTrash(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException; |
|
492 |
|
|
493 |
/** |
|
494 |
* Move the provided folder and all its subfolders and files to the specified destination. |
|
495 |
* |
|
496 |
* @param userId the ID of the current user |
|
497 |
* @param folderId the IF of the provided folder |
|
498 |
* @param destId the ID of the destination folder |
|
499 |
* @param destName the name of the new folder |
|
500 |
* @throws ObjectNotFoundException if the user, folder or destination was not |
|
501 |
* found, with the exception message mentioning the precise problem |
|
502 |
* @throws DuplicateNameException if the specified name already exists in |
|
503 |
* the destination folder, as either a folder or file |
|
504 |
* @throws InsufficientPermissionsException if the user does not have the |
|
505 |
* appropriate privileges |
|
506 |
* @throws GSSIOException |
|
507 |
*/ |
|
508 |
public void moveFolder(Long userId, Long folderId, Long destId, String destName) throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException, GSSIOException, QuotaExceededException; |
|
509 |
|
|
510 |
/** |
|
511 |
* move the provided file to the specified destination. |
|
512 |
* |
|
513 |
* @param userId the ID of the current user |
|
514 |
* @param fileId the IF of the provided file |
|
515 |
* @param destId the ID of the destination folder |
|
516 |
* @param destName the name of the new file |
|
517 |
* @throws InsufficientPermissionsException |
|
518 |
* @throws ObjectNotFoundException if the user, file or destination was not |
|
519 |
* found, with the exception message mentioning the precise problem |
|
520 |
* @throws GSSIOException if there was an error while accessing the file contents |
|
521 |
* @throws DuplicateNameException if the specified name already exists in |
|
522 |
* the destination folder, as either a folder or file |
|
523 |
*/ |
|
524 |
public void moveFile(Long userId, Long fileId, Long destId, String destName) throws InsufficientPermissionsException, ObjectNotFoundException, DuplicateNameException, GSSIOException, QuotaExceededException; |
|
525 |
|
|
526 |
/** |
|
527 |
* Returns a list of All deleted files of a user. |
|
528 |
* |
|
529 |
* @param userId the ID of the User |
|
530 |
* * @return the list of deleted file header objects |
|
531 |
* @throws ObjectNotFoundException if the user cannot be found |
|
532 |
*/ |
|
533 |
public List<FileHeaderDTO> getDeletedFiles(Long userId) throws ObjectNotFoundException; |
|
534 |
|
|
535 |
/** |
|
536 |
* Returns a list of All deleted root folders of a user. |
|
537 |
* |
|
538 |
* @param userId the ID of the User |
|
539 |
* * @return the list of deleted file header objects |
|
540 |
* @throws ObjectNotFoundException if the user cannot be found |
|
541 |
*/ |
|
542 |
public List<FolderDTO> getDeletedRootFolders(Long userId) throws ObjectNotFoundException; |
|
543 |
|
|
544 |
/** |
|
545 |
* Empty Trash by deleting all marked as deleted files and folders |
|
546 |
* @param userId |
|
547 |
* @throws ObjectNotFoundException if something goes wrong in the delete process |
|
548 |
* @throws InsufficientPermissionsException if something goes wrong in the delete process |
|
549 |
*/ |
|
550 |
public void emptyTrash(Long userId) throws ObjectNotFoundException, InsufficientPermissionsException; |
|
551 |
|
|
552 |
/** |
|
553 |
* Restores All Trashed Items by undeleting all marked as deleted files and folders |
|
554 |
* @param userId |
|
555 |
* @throws ObjectNotFoundException if something goes wrong in the delete process |
|
556 |
* @throws InsufficientPermissionsException if the user does not have the |
|
557 |
* appropriate privileges |
|
558 |
*/ |
|
559 |
public void restoreTrash(Long userId) throws ObjectNotFoundException, InsufficientPermissionsException; |
|
560 |
|
|
561 |
/** |
|
562 |
* Search the system for a user with the specified username. |
|
563 |
* If no such user is found, the method returns null. |
|
564 |
* |
|
565 |
* @param username the username to search for |
|
566 |
* @return the User object with the specified username |
|
567 |
*/ |
|
568 |
public User findUser(String username); |
|
569 |
|
|
570 |
/** |
|
571 |
* Create a new user with the specified name, username and e-mail address. |
|
572 |
* |
|
573 |
* @param username the username of the new user |
|
574 |
* @param name the full name of the new user |
|
575 |
* @param mail the e-mail of the new user |
|
576 |
* @param idp the IdP of the new user |
|
577 |
* @param idpid the IdP ID of the new user |
|
578 |
* @return the newly-created User object |
|
579 |
* @throws DuplicateNameException if a user with the same username already exists |
|
580 |
* @throws ObjectNotFoundException if no username was provided |
|
581 |
*/ |
|
582 |
public User createUser(String username, String name, String mail, |
|
583 |
String idp, String idpid) throws DuplicateNameException, |
|
584 |
ObjectNotFoundException; |
|
585 |
|
|
586 |
/** |
|
587 |
* Updates the authentication token for the specified user. |
|
588 |
* |
|
589 |
* @param userId the ID of the user whose token should be updated |
|
590 |
* @return the updated user |
|
591 |
* @throws ObjectNotFoundException if the user could not be found |
|
592 |
*/ |
|
593 |
public User updateUserToken(Long userId) throws ObjectNotFoundException; |
|
594 |
|
|
595 |
/** |
|
596 |
* Invalidates the authentication token for the specified user. |
|
597 |
* |
|
598 |
* @param userId the ID of the user whose token should be updated |
|
599 |
* @throws ObjectNotFoundException if the user could not be found |
|
600 |
*/ |
|
601 |
public void invalidateUserToken(Long userId) throws ObjectNotFoundException; |
|
602 |
|
|
603 |
/** |
|
604 |
* Retrieve folder user and group permissions |
|
605 |
* |
|
606 |
* @param userId the ID of the user whose token should be updated |
|
607 |
* @param folderId the ID of the folder |
|
608 |
* @return the Set of permissions from requested folder |
|
609 |
* @throws ObjectNotFoundException if the user or folder could not be found |
|
610 |
* @throws InsufficientPermissionsException |
|
611 |
*/ |
|
612 |
public Set<PermissionDTO> getFolderPermissions(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException; |
|
613 |
|
|
614 |
/** |
|
615 |
* Retrieve file user and group permissions |
|
616 |
* |
|
617 |
* @param userId the ID of the user whose token should be updated |
|
618 |
* @param fileId the ID of the folder |
|
619 |
* @return the Set of permissions from requested folder |
|
620 |
* @throws ObjectNotFoundException if the user or folder could not be found |
|
621 |
* @throws InsufficientPermissionsException |
|
622 |
*/ |
|
623 |
public Set<PermissionDTO> getFilePermissions(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException; |
|
624 |
|
|
625 |
/** |
|
626 |
* Returns a list of All Shared root folders of a user. |
|
627 |
* |
|
628 |
* @param userId the ID of the User |
|
629 |
* * @return the list of shared root folders |
|
630 |
* @throws ObjectNotFoundException if the user cannot be found |
|
631 |
*/ |
|
632 |
public List<FolderDTO> getSharedRootFolders(Long userId) throws ObjectNotFoundException; |
|
633 |
|
|
634 |
/** |
|
635 |
* Returns a list of All Shared files of a user. |
|
636 |
* |
|
637 |
* @param userId the ID of the User |
|
638 |
* * @return the list of shared files |
|
639 |
* @throws ObjectNotFoundException if the user cannot be found |
|
640 |
*/ |
|
641 |
public List<FileHeaderDTO> getSharedFilesNotInSharedFolders(Long userId) throws ObjectNotFoundException; |
|
642 |
|
|
643 |
/** |
|
644 |
* Returns a list of All Shared root folders of a user that calling user has at least read permissions. |
|
645 |
* |
|
646 |
* @param ownerId the ID of the User |
|
647 |
* @return the list of shared root folders |
|
648 |
* @param callingUserId |
|
649 |
* |
|
650 |
* @throws ObjectNotFoundException if the user cannot be found |
|
651 |
*/ |
|
652 |
public List<FolderDTO> getSharedRootFolders(Long ownerId, Long callingUserId) throws ObjectNotFoundException; |
|
653 |
|
|
654 |
/** |
|
655 |
* Returns a list of All Shared files of a user that calling user has at least read permissions.. |
|
656 |
* |
|
657 |
* @param ownerId the ID of the User |
|
658 |
* @return the list of shared files |
|
659 |
* @param callingUserId |
|
660 |
* @throws ObjectNotFoundException if the user cannot be found |
|
661 |
*/ |
|
662 |
public List<FileHeaderDTO> getSharedFiles(Long ownerId, Long callingUserId) throws ObjectNotFoundException; |
|
663 |
|
|
664 |
/** |
|
665 |
* Remove a user member from a group |
|
666 |
* |
|
667 |
* @param userId the ID of the User owning the group |
|
668 |
* @param groupId the ID of the requested group |
|
669 |
* @param memberId the ID of the member to be removed |
|
670 |
* |
|
671 |
* @throws ObjectNotFoundException if the user or group was not found, with |
|
672 |
* the exception message mentioning the precise problem |
|
673 |
* @throws InsufficientPermissionsException |
|
674 |
*/ |
|
675 |
public void removeMemberFromGroup(Long userId, Long groupId, Long memberId) throws ObjectNotFoundException, InsufficientPermissionsException; |
|
676 |
|
|
677 |
/** |
|
678 |
* Retrieves the list of users sharing files to user identified by user id |
|
679 |
* @param userId |
|
680 |
* @return the List of users sharing files to user |
|
681 |
* @throws ObjectNotFoundException |
|
682 |
*/ |
|
683 |
public List<UserDTO> getUsersSharingFoldersForUser(Long userId) throws ObjectNotFoundException; |
|
684 |
|
|
685 |
/** |
|
686 |
* Indexes the file meta-data and contents. It actually sends the info to be indexed to a message queue |
|
687 |
* and the actual indexing will be done in the background |
|
688 |
* |
|
689 |
* @param fileId The id of the file to be indexed. The message processor will retreive all file data |
|
690 |
* by using this id |
|
691 |
* @param delete if true the file is removed from the index |
|
692 |
*/ |
|
693 |
public void indexFile(Long fileId, boolean delete); |
|
694 |
|
|
695 |
/** |
|
696 |
* Search Files |
|
697 |
* |
|
698 |
* @param userId |
|
699 |
* @param query |
|
700 |
* @return list of files that match query |
|
701 |
* @throws ObjectNotFoundException |
|
702 |
*/ |
|
703 |
public List<FileHeaderDTO> searchFiles(Long userId, String query) throws ObjectNotFoundException; |
|
704 |
|
|
705 |
/** |
|
706 |
* It is used by the Solr mbean to rebuild the index. |
|
707 |
*/ |
|
708 |
public void rebuildSolrIndex(); |
|
709 |
|
|
710 |
/** |
|
711 |
* Search the system for a user with the specified email address. |
|
712 |
* If no such user is found, the method returns null. |
|
713 |
*/ |
|
714 |
public User findUserByEmail(String email); |
|
715 |
|
|
716 |
/** |
|
717 |
* Update the user with the values from the supplied object. |
|
718 |
*/ |
|
719 |
public void updateUser(User user); |
|
720 |
|
|
721 |
/** |
|
722 |
* Check if the user with the specified ID has permission to read the |
|
723 |
* folder with the supplied ID. |
|
724 |
*/ |
|
725 |
public boolean canReadFolder(Long userId, Long folderId) throws ObjectNotFoundException; |
|
726 |
} |
b/src/gr/ebs/gss/server/ejb/GSSDAOBean.java | ||
---|---|---|
31 | 31 |
import gr.ebs.gss.server.domain.User; |
32 | 32 |
import gr.ebs.gss.server.domain.UserClass; |
33 | 33 |
|
34 |
import java.net.UnknownHostException; |
|
34 | 35 |
import java.util.ArrayList; |
35 | 36 |
import java.util.Calendar; |
36 | 37 |
import java.util.Date; |
... | ... | |
39 | 40 |
import java.util.List; |
40 | 41 |
import java.util.Set; |
41 | 42 |
|
42 |
import javax.ejb.Stateless; |
|
43 |
import javax.persistence.EntityManager; |
|
44 | 43 |
import javax.persistence.NoResultException; |
45 |
import javax.persistence.PersistenceContext; |
|
46 | 44 |
|
47 | 45 |
import org.apache.commons.lang.StringUtils; |
48 | 46 |
|
47 |
import com.mongodb.DB; |
|
48 |
import com.mongodb.Mongo; |
|
49 |
import com.mongodb.MongoException; |
|
50 |
|
|
49 | 51 |
/** |
50 | 52 |
* The implementation of the GSSDAO interface. |
51 | 53 |
*/ |
52 |
@Stateless |
|
53 | 54 |
public class GSSDAOBean implements GSSDAO { |
54 | 55 |
|
55 | 56 |
private static final int BANDWIDTH_TIME_PERIOD_FIELD = Calendar.MONTH; |
56 | 57 |
private static final int BANDWIDTH_TIME_PERIOD_AMOUNT = 1; |
57 | 58 |
|
58 | 59 |
/** |
59 |
* The entity manager for the persistence unit
|
|
60 |
* A reference to the MongoDB.
|
|
60 | 61 |
*/ |
61 |
@PersistenceContext(unitName = "gss") |
|
62 |
private EntityManager manager; |
|
62 |
private DB db; |
|
63 |
|
|
64 |
/** |
|
65 |
* |
|
66 |
*/ |
|
67 |
public GSSDAOBean() { |
|
68 |
// TODO we only need a single Mongo object, since it contains the connection pool. |
|
69 |
Mongo m; |
|
70 |
try { |
|
71 |
m = new Mongo("127.0.0.1"); |
|
72 |
} catch (UnknownHostException e) { |
|
73 |
// TODO Hanlde these in the Guice module. |
|
74 |
throw new RuntimeException(e); |
|
75 |
} catch (MongoException e) { |
|
76 |
// TODO Hanlde these in the Guice module. |
|
77 |
throw new RuntimeException(e); |
|
78 |
} |
|
79 |
db = m.getDB("gss"); |
|
80 |
} |
|
63 | 81 |
|
64 | 82 |
@Override |
65 | 83 |
public Folder getRootFolder(final Long userId) throws ObjectNotFoundException { |
b/test/gr/ebs/gss/server/ejb/ExternalAPITest.java | ||
---|---|---|
18 | 18 |
*/ |
19 | 19 |
package gr.ebs.gss.server.ejb; |
20 | 20 |
|
21 |
import static gr.ebs.gss.server.configuration.GSSConfigurationFactory.getConfiguration; |
|
22 | 21 |
import gr.ebs.gss.client.exceptions.DuplicateNameException; |
23 | 22 |
import gr.ebs.gss.client.exceptions.InsufficientPermissionsException; |
24 | 23 |
import gr.ebs.gss.client.exceptions.ObjectNotFoundException; |
... | ... | |
27 | 26 |
import gr.ebs.gss.server.domain.dto.GroupDTO; |
28 | 27 |
import gr.ebs.gss.server.domain.dto.UserDTO; |
29 | 28 |
|
30 |
import java.util.Hashtable; |
|
31 | 29 |
import java.util.Iterator; |
32 | 30 |
import java.util.List; |
33 | 31 |
|
34 |
import javax.naming.Context; |
|
35 |
import javax.naming.InitialContext; |
|
36 | 32 |
import javax.naming.NamingException; |
37 | 33 |
import javax.persistence.NoResultException; |
38 |
import javax.rmi.PortableRemoteObject; |
|
39 | 34 |
|
40 | 35 |
import junit.framework.Assert; |
41 | 36 |
import junit.framework.TestCase; |
... | ... | |
46 | 41 |
public class ExternalAPITest extends TestCase { |
47 | 42 |
|
48 | 43 |
/** |
49 |
* Utility method for creating and returning a NamingContext for looking |
|
50 |
* EJBs up in the JNDI |
|
44 |
* Utility method for looking up the remote service to be tested |
|
51 | 45 |
* |
52 |
* @return Context
|
|
46 |
* @return ExternalAPI
|
|
53 | 47 |
* @throws NamingException |
54 | 48 |
*/ |
55 |
private Context getInitialContext() throws NamingException { |
|
56 |
final Hashtable<String, String> env = new Hashtable<String, String>(); |
|
57 |
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); |
|
58 |
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces"); |
|
59 |
env.put(Context.PROVIDER_URL, "jnp://localhost:1099"); |
|
60 |
return new InitialContext(env); |
|
61 |
} |
|
62 |
|
|
63 |
/** |
|
64 |
* Utility method for looking up the remote service to be tested |
|
65 |
* |
|
66 |
* @return ExternalAPIRemote |
|
67 |
* @throws NamingException |
|
68 |
*/ |
|
69 |
private ExternalAPIRemote getService() throws NamingException { |
|
70 |
final Context ctx = getInitialContext(); |
|
71 |
final Object ref = ctx.lookup(getConfiguration().getString("externalApiPath")); |
|
72 |
final ExternalAPIRemote service = (ExternalAPIRemote) PortableRemoteObject.narrow(ref, ExternalAPIRemote.class); |
|
73 |
return service; |
|
49 |
private ExternalAPI getService() throws NamingException { |
|
50 |
return new ExternalAPIBean(); |
|
74 | 51 |
} |
75 | 52 |
|
76 | 53 |
/** |
... | ... | |
80 | 57 |
*/ |
81 | 58 |
public final void testGetRootFolderNormal() { |
82 | 59 |
try { |
83 |
final ExternalAPIRemote service = getService();
|
|
60 |
final ExternalAPI service = getService(); |
|
84 | 61 |
final FolderDTO f = service.getRootFolder(Long.valueOf(1)); |
85 | 62 |
Assert.assertNotNull(f); |
86 | 63 |
} catch (final Exception e) { |
... | ... | |
97 | 74 |
*/ |
98 | 75 |
public final void testGetRootFolderWithNullUserId() { |
99 | 76 |
try { |
100 |
final ExternalAPIRemote service = getService();
|
|
77 |
final ExternalAPI service = getService(); |
|
101 | 78 |
service.getRootFolder(null); |
102 | 79 |
Assert.fail(); |
103 | 80 |
} catch (final Exception e) { |
... | ... | |
116 | 93 |
*/ |
117 | 94 |
public final void testGetRootFolderWithUserWithoutFolder() { |
118 | 95 |
try { |
119 |
final ExternalAPIRemote service = getService();
|
|
96 |
final ExternalAPI service = getService(); |
|
120 | 97 |
service.getRootFolder(Long.valueOf(2)); |
121 | 98 |
Assert.fail(); |
122 | 99 |
} catch (final ObjectNotFoundException e) { |
... | ... | |
134 | 111 |
*/ |
135 | 112 |
public final void testGetRootFolderWithNonExistentUserId() { |
136 | 113 |
try { |
137 |
final ExternalAPIRemote service = getService();
|
|
114 |
final ExternalAPI service = getService(); |
|
138 | 115 |
service.getRootFolder(Long.valueOf(-1)); |
139 | 116 |
Assert.fail(); |
140 | 117 |
} catch (final ObjectNotFoundException e) { |
... | ... | |
151 | 128 |
*/ |
152 | 129 |
public final void testGetFilesNormal() { |
153 | 130 |
try { |
154 |
final ExternalAPIRemote service = getService();
|
|
131 |
final ExternalAPI service = getService(); |
|
155 | 132 |
final List<FileHeaderDTO> files = service.getFiles(new Long(1L), Long.valueOf(1), true); |
156 | 133 |
Assert.assertNotNull(files); |
157 | 134 |
Assert.assertFalse(files.isEmpty()); |
... | ... | |
169 | 146 |
*/ |
170 | 147 |
public final void testGetFilesWithEmptyFolder() { |
171 | 148 |
try { |
172 |
final ExternalAPIRemote service = getService();
|
|
149 |
final ExternalAPI service = getService(); |
|
173 | 150 |
final List<FileHeaderDTO> files = service.getFiles(new Long(1L), Long.valueOf(2), true); |
174 | 151 |
Assert.assertNotNull(files); |
175 | 152 |
Assert.assertTrue(files.isEmpty()); |
... | ... | |
187 | 164 |
*/ |
188 | 165 |
public final void testGetFilesWithNullFolderId() { |
189 | 166 |
try { |
190 |
final ExternalAPIRemote service = getService();
|
|
167 |
final ExternalAPI service = getService(); |
|
191 | 168 |
service.getFiles(new Long(1L), null, true); |
192 | 169 |
Assert.fail(); |
193 | 170 |
} catch (final Exception e) { |
... | ... | |
206 | 183 |
*/ |
207 | 184 |
public final void testGetFilesWithNonExistentFolder() { |
208 | 185 |
try { |
209 |
final ExternalAPIRemote service = getService();
|
|
186 |
final ExternalAPI service = getService(); |
|
210 | 187 |
final List<FileHeaderDTO> files = service.getFiles(new Long(1L), Long.valueOf(-1), true); |
211 | 188 |
Assert.assertNotNull(files); |
212 | 189 |
Assert.assertTrue(files.isEmpty()); |
... | ... | |
222 | 199 |
*/ |
223 | 200 |
public final void testGetGroupsNormal() { |
224 | 201 |
try { |
225 |
final ExternalAPIRemote service = getService();
|
|
202 |
final ExternalAPI service = getService(); |
|
226 | 203 |
final List<GroupDTO> groups = service.getGroups(Long.valueOf(1)); |
227 | 204 |
Assert.assertNotNull(groups); |
228 | 205 |
Assert.assertFalse(groups.isEmpty()); |
... | ... | |
238 | 215 |
*/ |
239 | 216 |
public final void testGetGroupsForUserWithNoGroups() { |
240 | 217 |
try { |
241 |
final ExternalAPIRemote service = getService();
|
|
218 |
final ExternalAPI service = getService(); |
|
242 | 219 |
final List<GroupDTO> groups = service.getGroups(Long.valueOf(2)); |
243 | 220 |
Assert.assertNotNull(groups); |
244 | 221 |
Assert.assertTrue(groups.isEmpty()); |
... | ... | |
254 | 231 |
*/ |
255 | 232 |
public final void testGetGroupsForNullUserId() { |
256 | 233 |
try { |
257 |
final ExternalAPIRemote service = getService();
|
|
234 |
final ExternalAPI service = getService(); |
|
258 | 235 |
service.getGroups(null); |
259 | 236 |
Assert.fail(); |
260 | 237 |
} catch (final Exception e) { |
... | ... | |
271 | 248 |
*/ |
272 | 249 |
public final void testGetGroupsForNonExistentUser() { |
273 | 250 |
try { |
274 |
final ExternalAPIRemote service = getService();
|
|
251 |
final ExternalAPI service = getService(); |
|
275 | 252 |
final List<GroupDTO> groups = service.getGroups(Long.valueOf(-1)); |
276 | 253 |
Assert.assertNotNull(groups); |
277 | 254 |
Assert.assertTrue(groups.isEmpty()); |
... | ... | |
287 | 264 |
*/ |
288 | 265 |
public final void testGetUsersNormal() { |
289 | 266 |
try { |
290 |
final ExternalAPIRemote service = getService();
|
|
267 |
final ExternalAPI service = getService(); |
|
291 | 268 |
final List<UserDTO> users = service.getUsers(Long.valueOf(1), Long.valueOf(1)); |
292 | 269 |
Assert.assertNotNull(users); |
293 | 270 |
Assert.assertFalse(users.isEmpty()); |
... | ... | |
303 | 280 |
*/ |
304 | 281 |
public final void testGetUsersForEmptyGroup() { |
305 | 282 |
try { |
306 |
final ExternalAPIRemote service = getService();
|
|
283 |
final ExternalAPI service = getService(); |
|
307 | 284 |
final List<UserDTO> users = service.getUsers(Long.valueOf(1L), Long.valueOf(2)); |
308 | 285 |
Assert.assertNotNull(users); |
309 | 286 |
Assert.assertTrue(users.isEmpty()); |
... | ... | |
319 | 296 |
*/ |
320 | 297 |
public final void testGetUsersNonExistentGroup() { |
321 | 298 |
try { |
322 |
final ExternalAPIRemote service = getService();
|
|
299 |
final ExternalAPI service = getService(); |
|
323 | 300 |
final List<UserDTO> users = service.getUsers(Long.valueOf(1L), Long.valueOf(-1)); |
324 | 301 |
Assert.assertNotNull(users); |
325 | 302 |
Assert.assertTrue(users.isEmpty()); |
... | ... | |
335 | 312 |
*/ |
336 | 313 |
public final void testGetUsersWithNullGroupId() { |
337 | 314 |
try { |
338 |
final ExternalAPIRemote service = getService();
|
|
315 |
final ExternalAPI service = getService(); |
|
339 | 316 |
service.getUsers(Long.valueOf(1L), null); |
340 | 317 |
Assert.fail(); |
341 | 318 |
} catch (final Exception e) { |
... | ... | |
354 | 331 |
public final void testCreateFolderNormal() { |
355 | 332 |
String name = "junitTestFolder"; |
356 | 333 |
try { |
357 |
final ExternalAPIRemote service = getService();
|
|
334 |
final ExternalAPI service = getService(); |
|
358 | 335 |
final List rootSubfolders = service.getRootFolder(Long.valueOf(1)).getSubfolders(); |
359 | 336 |
boolean ok = false; |
360 | 337 |
while (!ok) { |
... | ... | |
390 | 367 |
*/ |
391 | 368 |
public final void testCreateFolderWithExistingName() { |
392 | 369 |
try { |
393 |
final ExternalAPIRemote service = getService();
|
|
370 |
final ExternalAPI service = getService(); |
|
394 | 371 |
final List rootSubfolders = service.getRootFolder(Long.valueOf(1)).getSubfolders(); |
395 | 372 |
service.createFolder(Long.valueOf(1), Long.valueOf(1), ((FolderDTO) rootSubfolders.get(0)).getName()); |
396 | 373 |
Assert.fail(); |
... | ... | |
409 | 386 |
*/ |
410 | 387 |
public final void testCreateFolderWithEmptyName() { |
411 | 388 |
try { |
412 |
final ExternalAPIRemote service = getService();
|
|
389 |
final ExternalAPI service = getService(); |
|
413 | 390 |
service.createFolder(Long.valueOf(1), Long.valueOf(1), ""); |
414 | 391 |
Assert.fail(); |
415 | 392 |
} catch (final Exception e) { |
... | ... | |
427 | 404 |
*/ |
428 | 405 |
public final void testCreateFolderWithNullOwner() { |
429 | 406 |
try { |
430 |
final ExternalAPIRemote service = getService();
|
|
407 |
final ExternalAPI service = getService(); |
|
431 | 408 |
service.createFolder(null, Long.valueOf(1), "test"); |
432 | 409 |
Assert.fail(); |
433 | 410 |
} catch (final Exception e) { |
... | ... | |
445 | 422 |
*/ |
446 | 423 |
public final void testCreateFolderWithNonExistentOwner() { |
447 | 424 |
try { |
448 |
final ExternalAPIRemote service = getService();
|
|
425 |
final ExternalAPI service = getService(); |
|
449 | 426 |
service.createFolder(Long.valueOf(-1), Long.valueOf(1), "test"); |
450 | 427 |
Assert.fail(); |
451 | 428 |
} catch (final Exception e) { |
... | ... | |
463 | 440 |
*/ |
464 | 441 |
public final void testCreateFolderWithNullParent() { |
465 | 442 |
try { |
466 |
final ExternalAPIRemote service = getService();
|
|
443 |
final ExternalAPI service = getService(); |
|
467 | 444 |
service.createFolder(Long.valueOf(1), null, "test"); |
468 | 445 |
Assert.fail(); |
469 | 446 |
} catch (final Exception e) { |
... | ... | |
481 | 458 |
*/ |
482 | 459 |
public final void testCreateFolderWithNonExistentParent() { |
483 | 460 |
try { |
484 |
final ExternalAPIRemote service = getService();
|
|
461 |
final ExternalAPI service = getService(); |
|
485 | 462 |
service.createFolder(Long.valueOf(1), Long.valueOf(-1), "testFolder"); |
486 | 463 |
Assert.fail(); |
487 | 464 |
} catch (final Exception e) { |
... | ... | |
500 | 477 |
public final void testDeleteFolderNormal() { |
501 | 478 |
try { |
502 | 479 |
final String name = "junitTestFolder"; |
503 |
final ExternalAPIRemote service = getService();
|
|
480 |
final ExternalAPI service = getService(); |
|
504 | 481 |
final Iterator i = service.getRootFolder(Long.valueOf(1)).getSubfolders().iterator(); |
505 | 482 |
while (i.hasNext()) { |
506 | 483 |
final FolderDTO f = (FolderDTO) i.next(); |
... | ... | |
521 | 498 |
public final void testDeleteFolderWithNullUserId() { |
522 | 499 |
try { |
523 | 500 |
final String name = "deletedFolder"; |
524 |
final ExternalAPIRemote service = getService();
|
|
501 |
final ExternalAPI service = getService(); |
|
525 | 502 |
Long folderId = null; |
526 | 503 |
try { |
527 | 504 |
service.createFolder(Long.valueOf(1), Long.valueOf(1), name); |
... | ... | |
555 | 532 |
public final void testDeleteFolderWithNonExistentUser() { |
556 | 533 |
try { |
557 | 534 |
final String name = "deletedFolder"; |
558 |
final ExternalAPIRemote service = getService();
|
|
535 |
final ExternalAPI service = getService(); |
|
559 | 536 |
Long folderId = null; |
560 | 537 |
try { |
561 | 538 |
service.createFolder(Long.valueOf(1), Long.valueOf(1), name); |
... | ... | |
588 | 565 |
*/ |
589 | 566 |
public final void testDeleteFolderWithNullFolderId() { |
590 | 567 |
try { |
591 |
final ExternalAPIRemote service = getService();
|
|
568 |
final ExternalAPI service = getService(); |
|
592 | 569 |
service.deleteFolder(Long.valueOf(1), null); |
593 | 570 |
Assert.fail(); |
594 | 571 |
} catch (final Exception e) { |
... | ... | |
606 | 583 |
*/ |
607 | 584 |
public final void testDeleteFolderWithNonExistentFolder() { |
608 | 585 |
try { |
609 |
final ExternalAPIRemote service = getService();
|
|
586 |
final ExternalAPI service = getService(); |
|
610 | 587 |
service.deleteFolder(Long.valueOf(1), Long.valueOf(-1)); |
611 | 588 |
Assert.fail(); |
612 | 589 |
} catch (final Exception e) { |
... | ... | |
625 | 602 |
public final void testDeleteFolderNoPermission() { |
626 | 603 |
try { |
627 | 604 |
final String name = "deletedFolder"; |
628 |
final ExternalAPIRemote service = getService();
|
|
605 |
final ExternalAPI service = getService(); |
|
629 | 606 |
Long folderId = null; |
630 | 607 |
try { |
631 | 608 |
service.createFolder(Long.valueOf(1), Long.valueOf(1), name); |
... | ... | |
656 | 633 |
*/ |
657 | 634 |
public final void testGetUserNormal() { |
658 | 635 |
try { |
659 |
final ExternalAPIRemote service = getService();
|
|
636 |
final ExternalAPI service = getService(); |
|
660 | 637 |
final UserDTO user = service.getUserDTO(Long.valueOf(1)); |
661 | 638 |
assertNotNull(user); |
662 | 639 |
assertNotNull(user.getId()); |
... | ... | |
672 | 649 |
*/ |
673 | 650 |
public final void testGetUserNullId() { |
674 | 651 |
try { |
675 |
final ExternalAPIRemote service = getService();
|
|
652 |
final ExternalAPI service = getService(); |
|
676 | 653 |
service.getUserDTO(null); |
677 | 654 |
Assert.fail(); |
678 | 655 |
} catch (final NamingException e) { |
... | ... | |
691 | 668 |
*/ |
692 | 669 |
public final void testGetUserNonExistentId() { |
693 | 670 |
try { |
694 |
final ExternalAPIRemote service = getService();
|
|
671 |
final ExternalAPI service = getService(); |
|
695 | 672 |
service.getUserDTO(Long.valueOf(-1)); |
696 | 673 |
Assert.fail(); |
697 | 674 |
} catch (final NamingException e) { |
... | ... | |
711 | 688 |
*/ |
712 | 689 |
public final void testCreateTagNormal() { |
713 | 690 |
try { |
714 |
final ExternalAPIRemote service = getService();
|
|
691 |
final ExternalAPI service = getService(); |
|
715 | 692 |
service.createTag(Long.valueOf(1), Long.valueOf(165), "testTag"); |
716 | 693 |
} catch (final Exception e) { |
717 | 694 |
e.printStackTrace(); |
... | ... | |
725 | 702 |
*/ |
726 | 703 |
public final void testCreateTagNullUser() { |
727 | 704 |
try { |
728 |
final ExternalAPIRemote service = getService();
|
|
705 |
final ExternalAPI service = getService(); |
|
729 | 706 |
service.createTag(null, Long.valueOf(162), "testTag"); |
730 | 707 |
Assert.fail(); |
731 | 708 |
} catch (final Exception e) { |
... | ... | |
742 | 719 |
*/ |
743 | 720 |
public final void testCreateTagNullFile() { |
744 | 721 |
try { |
745 |
final ExternalAPIRemote service = getService();
|
|
722 |
final ExternalAPI service = getService(); |
|
746 | 723 |
service.createTag(Long.valueOf(1), null, "testTag"); |
747 | 724 |
Assert.fail(); |
748 | 725 |
} catch (final Exception e) { |
... | ... | |
758 | 735 |
*/ |
759 | 736 |
public final void testCreateTagNullTag() { |
760 | 737 |
try { |
761 |
final ExternalAPIRemote service = getService();
|
|
738 |
final ExternalAPI service = getService(); |
|
762 | 739 |
service.createTag(Long.valueOf(1), Long.valueOf(162), null); |
763 | 740 |
Assert.fail(); |
764 | 741 |
} catch (final Exception e) { |
... | ... | |
775 | 752 |
*/ |
776 | 753 |
public final void testCreateTagEmptyTag() { |
777 | 754 |
try { |
778 |
final ExternalAPIRemote service = getService();
|
|
755 |
final ExternalAPI service = getService(); |
|
779 | 756 |
service.createTag(Long.valueOf(1), Long.valueOf(162), ""); |
780 | 757 |
Assert.fail(); |
781 | 758 |
} catch (final Exception e) { |
... | ... | |
792 | 769 |
*/ |
793 | 770 |
public final void testCreateTagNonExistingUser() { |
794 | 771 |
try { |
795 |
final ExternalAPIRemote service = getService();
|
|
772 |
final ExternalAPI service = getService(); |
|
796 | 773 |
service.createTag(Long.valueOf(-1), Long.valueOf(162), "testTag"); |
797 | 774 |
Assert.fail(); |
798 | 775 |
} catch (final Exception e) { |
... | ... | |
809 | 786 |
*/ |
810 | 787 |
public final void testCreateTagNonExistingFile() { |
811 | 788 |
try { |
812 |
final ExternalAPIRemote service = getService();
|
|
789 |
final ExternalAPI service = getService(); |
|
813 | 790 |
service.createTag(Long.valueOf(1), Long.valueOf(-1), "testTag"); |
814 | 791 |
Assert.fail(); |
815 | 792 |
} catch (final Exception e) { |
... | ... | |
826 | 803 |
*/ |
827 | 804 |
public final void testCopyFile(){ |
Also available in: Unified diff