<attribute name="javadoc_location" value="http://commons.apache.org/codec/api-release/"/>
</attributes>
</classpathentry>
- <classpathentry kind="lib" path="dependencies/gwt-2.1.1/gwt-user.jar" sourcepath="/home/kman/.m2/repository/com/google/gwt/gwt-user/2.1.0/gwt-user-2.1.0-sources.jar"/>
- <classpathentry kind="lib" path="dependencies/gwt-2.0.4/gwt-user.jar"/>
++ <classpathentry kind="lib" path="dependencies/gwt-2.1.1/gwt-user.jar" />
<classpathentry kind="lib" path="dependencies/junit4.8.1/junit-4.8.1.jar"/>
<classpathentry kind="lib" path="dependencies/jboss-5.1.0.GA/lib/concurrent.jar"/>
<classpathentry kind="lib" path="dependencies/jboss-5.1.0.GA/lib/dom4j.jar"/>
<classpathentry kind="lib" path="dependencies/jboss-5.1.0.GA/common/lib/slf4j-jboss-logging.jar"/>
<classpathentry kind="lib" path="dependencies/jboss-5.1.0.GA/common/lib/xnio-api.jar"/>
<classpathentry kind="lib" path="dependencies/gwt-dnd-3.0.1.jar"/>
- <classpathentry kind="lib" path="dependencies/gwt-incubator-20100204-r1747.jar"/>
++ <classpathentry kind="lib" path="dependencies/gwt-incubator-20101117-r1766.jar"/>
<classpathentry kind="lib" path="dependencies/gwt-gears-1.3.0/gwt-gears.jar"/>
<classpathentry kind="lib" path="dependencies/gwt-visualization-1.1.0/gwt-visualization.jar"/>
<classpathentry kind="lib" path="dependencies/apache-solr-1.4.1/dist/apache-solr-solrj-1.4.1.jar"/>
<classpathentry kind="lib" path="dependencies/apache-solr-1.4.1/lib/lucene-analyzers-2.9.3.jar"/>
<classpathentry kind="lib" path="dependencies/apache-solr-1.4.1/lib/lucene-core-2.9.3.jar"/>
<classpathentry kind="lib" path="dependencies/apache-solr-1.4.1/dist/apache-solr-core-1.4.1.jar"/>
+ <classpathentry kind="lib" path="lib/draggable-plugin-1.0.2.jar"/>
+ <classpathentry kind="lib" path="lib/droppable-plugin-1.0.2.jar"/>
+ <classpathentry kind="lib" path="lib/gwtquery-1.0.0-20110116.074055-7.jar"/>
<classpathentry kind="lib" path="dependencies/selenium-server-standalone-2.0b1.jar"/>
- <classpathentry kind="lib" path="dependencies/gwt-incubator-20101117-r1766.jar"/>
+ <classpathentry kind="lib" path="webdav/WEB-INF/lib/commons-fileupload-1.2.1.jar"/>
+ <classpathentry kind="lib" path="ear/lib/commons-io-1.1.jar"/>
+ <classpathentry kind="lib" path="ear/lib/jdom-1.1.jar"/>
+ <classpathentry kind="lib" path="ear/lib/milton-api-1.5.7-SNAPSHOT.jar"/>
+ <classpathentry kind="lib" path="webdav/WEB-INF/lib/milton-console-1.5.7-SNAPSHOT.jar"/>
+ <classpathentry kind="lib" path="webdav/WEB-INF/lib/milton-servlet-1.5.7-SNAPSHOT.jar"/>
+ <classpathentry kind="lib" path="ear/lib/mime-util-2.1.3.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<pathelement location="${jboss.common.lib.dir}/jbosssx.jar"/>
<pathelement location="${jboss.common.lib.dir}/hibernate-core.jar"/>
<pathelement location="${jboss.common.lib.dir}/hibernate-annotations.jar"/>
- <pathelement location="${jboss.common.lib.dir}/jboss-remoting.jar"/>
++ <pathelement location="${jboss.common.lib.dir}/jboss-remoting.jar"/>
+ <pathelement location="${jboss.common.lib.dir}/slf4j-api.jar"/>
<pathelement location="${jboss.lib.dir}/jboss-j2se.jar"/>
<pathelement location="${jboss.lib.dir}/jboss-kernel.jar"/>
<pathelement location="${jboss.lib.dir}/jboss-system-jmx.jar"/>
<pathelement location="${ear.lib.dir}/commons-httpclient-3.1.jar"/>
<pathelement location="${ear.lib.dir}/commons-lang.jar"/>
<pathelement location="${ear.lib.dir}/ldap.jar"/>
- <pathelement location="${ear.lib.dir}/milton-api-1.5.7-SNAPSHOT.jar"/>
++ <pathelement location="${ear.lib.dir}/milton-api-1.5.7-SNAPSHOT.jar"/>
+ <pathelement location="${ear.lib.dir}/commons-io-1.1.jar"/>
<pathelement location="${junit.path}/junit.jar"/>
<pathelement location="${deps.dir}/${gwt-dnd.filename}"/>
<pathelement location="${gwt-gears.path}/gwt-gears.jar"/>
<pathelement location="${solr.dist}/${solrj.jar}"/>
<pathelement location="${solr.dist}/apache-solr-core-1.4.1.jar"/>
<pathelement location="${solr.lib}/lucene-core-2.9.3.jar"/>
- <pathelement location="${solr.lib}/lucene-analyzers-2.9.3.jar"/>
- <pathelement location="${deps.dir}/${selenium-server.filename}"/>
- <pathelement location="${webdav.war.lib.dir}/milton-servlet-1.5.7-SNAPSHOT.jar"/>
+ <pathelement location="${solr.lib}/lucene-analyzers-2.9.3.jar"/>
+ <pathelement location="${deps.dir}/${selenium-server.filename}"/>
++ <pathelement location="${webdav.war.lib.dir}/milton-servlet-1.5.7-SNAPSHOT.jar"/>
+ <pathelement location="${webdav.war.lib.dir}/milton-console-1.5.7-SNAPSHOT.jar"/>
</path>
<target name="check-jboss">
contextMenu.addItem(trashItem);
contextMenu.addItem(deleteItem);
- MenuItem refreshItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
- refreshItem.getElement().setId("fileContextMenu.refresh");
+ MenuItem refresh = new MenuItem("<span id='fileContextMenu.refresh'>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
- // refresh.getElement().setId("fileContextMenu.refresh");
++ refresh.getElement().setId("fileContextMenu.refresh");
+ contextMenu.addItem(refresh);
- contextMenu.addItem(refreshItem);
contextMenu.addItem(sharingItem);
contextMenu.addItem(propItem);
}
public void postFileToSolr(CommonsHttpSolrServer solr, Long id);
/**
+ * @param folder
+ * @throws ObjectNotFoundException
+ */
+ public Folder expandFolder(Folder folder) throws ObjectNotFoundException;
+
+ /**
+ * @param folder
+ * @return
+ * @throws ObjectNotFoundException
+ */
+ FileHeader expandFile(FileHeader folder) throws ObjectNotFoundException;
+
+ /**
+ * @param folder
+ * @return
+ * @throws ObjectNotFoundException
+ */
+ Group expandGroup(Group folder) throws ObjectNotFoundException;
+
+ /**
+ * @param username
+ * @return
+ */
+ User getUserByUserName(String username);
+
+ /**
+ * @param lock
+ * @return
+ */
+ FileLock saveOrUpdateLock(FileLock lock);
+
+ /**
+ * @param lock
+ */
+ void removeLock(FileLock lock);
+
+ /**
+ * @param tokenId
+ * @return
+ */
+ FileLock getLockByToken(String tokenId);
+
+ /**
+ * @param id
+ * @return
+ */
+ FileLock getLockById(String id);
+
+ /**
+ * @param userId
+ * @param folderId
+ * @param name
+ * @return
+ * @throws DuplicateNameException
+ * @throws ObjectNotFoundException
+ * @throws GSSIOException
+ * @throws InsufficientPermissionsException
+ * @throws QuotaExceededException
+ */
+ FileHeader createEmptyFile(Long userId, Long folderId, String name) throws DuplicateNameException, ObjectNotFoundException, GSSIOException, InsufficientPermissionsException, QuotaExceededException;
+
+ /**
+ * @param nonce
+ * @return
+ */
+ WebDavNonce saveOrUpdateWebDavNonce(WebDavNonce nonce);
+
+ /**
+ * @param nonce
+ */
+ void removeWebDavNonce(WebDavNonce nonce);
+
+ /**
+ * @param tokenId
+ * @return
+ */
+ WebDavNonce getWebDavNonce(String tokenId);
++
++ /**
+ * Returns a user that matches the given full username
+ *
+ * @param username the username of the User
+ * @return UserDTO
+ */
+ public UserDTO getUserByUserName(String username);
+
}
return text.replaceAll(":", "\\\\:");
}
+ /*** NEW METHODS IN ORDER TO AVOID LAZY loading exception in json render
+ ****/
+ @Override
+ public Folder expandFolder(Folder folder) throws ObjectNotFoundException{
+ Folder result = dao.getEntityById(Folder.class, folder.getId());
+ result.getSubfolders().size();
+ result.getFiles().size();
+ result.getPermissions().size();
+ return result;
+ }
+
+ @Override
+ public FileHeader expandFile(FileHeader folder) throws ObjectNotFoundException{
+ FileHeader result = dao.getEntityById(FileHeader.class, folder.getId());
+ result.getFolder();
+ result.getPermissions().size();
+ result.getFileTags().size();
+ return result;
+ }
+
+ @Override
+ public Group expandGroup(Group folder) throws ObjectNotFoundException{
+ Group result = dao.getEntityById(Group.class, folder.getId());
+ result.getMembers().size();
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see gr.ebs.gss.server.ejb.ExternalAPI#getUsersByUserNameLike(java.lang.String)
+ */
+ @Override
+ public User getUserByUserName(String username) {
+ User result = dao.getUserByUserName(username);
+ return result;
+ }
+
+ /*WEBDAV CREATE EMPTY FILE*/
+ @Override
+ public FileHeader createEmptyFile(Long userId, Long folderId, String name)
+ throws DuplicateNameException, ObjectNotFoundException, GSSIOException,
+ InsufficientPermissionsException, QuotaExceededException {
+ // Validate.
+ if (userId == null)
+ throw new ObjectNotFoundException("No user specified");
+ if (folderId == null)
+ throw new ObjectNotFoundException("No folder specified");
+ String contentType = DEFAULT_MIME_TYPE;
+ if (StringUtils.isEmpty(name))
+ throw new ObjectNotFoundException("No file name specified");
+ if (dao.existsFolderOrFile(folderId, name))
+ throw new DuplicateNameException("A folder or file with the name '" + name +
+ "' already exists at this level");
+
+ // Do the actual work.
+ Folder parent = null;
+ try {
+ parent = dao.getEntityById(Folder.class, folderId);
+ } catch (final ObjectNotFoundException onfe) {
+ // Supply a more accurate problem description.
+ throw new ObjectNotFoundException("Parent folder not found");
+ }
+ final User owner = dao.getEntityById(User.class, userId);
+ if (!parent.hasWritePermission(owner))
+ throw new InsufficientPermissionsException("You don't have the permissions to write to this folder");
+ final FileHeader file = new FileHeader();
+ file.setName(name);
+ parent.addFile(file);
+ // set file owner to folder owner
+ file.setOwner(parent.getOwner());
+ //set file's readForAll value according to parent folder readForAll value
+ file.setReadForAll(parent.isReadForAll());
+
+ final Date now = new Date();
+ final AuditInfo auditInfo = new AuditInfo();
+ auditInfo.setCreatedBy(owner);
+ auditInfo.setCreationDate(now);
+ auditInfo.setModifiedBy(owner);
+ auditInfo.setModificationDate(now);
+ file.setAuditInfo(auditInfo);
+ // TODO set the proper versioning flag on creation
+ file.setVersioned(false);
+
+ for (final Permission p : parent.getPermissions()) {
+ final Permission permission = new Permission();
+ permission.setGroup(p.getGroup());
+ permission.setUser(p.getUser());
+ permission.setRead(p.getRead());
+ permission.setWrite(p.getWrite());
+ permission.setModifyACL(p.getModifyACL());
+ file.addPermission(permission);
+ }
+ // Create the file body.
+ try {
+ createEmptyFileBody(name, contentType, 0, file, auditInfo);
+ } catch (FileNotFoundException e) {
+ throw new GSSIOException(e);
+ }
+ touchParentFolders(parent, owner, new Date());
+ dao.flush();
+ return file;
+ }
+
+ private void createEmptyFileBody(String name, String mimeType, long fileSize,
+ FileHeader header, AuditInfo auditInfo)
+ throws FileNotFoundException, QuotaExceededException, ObjectNotFoundException {
+
+ long currentTotalSize = 0;
+ if (!header.isVersioned() && header.getCurrentBody() != null && header.getBodies() != null)
+ currentTotalSize = header.getTotalSize();
+ Long quotaLeft = getQuotaLeft(header.getOwner().getId());
+
+
+ FileBody body = new FileBody();
+
+ // if no mime type or the generic mime type is defined by the client, then try to identify it from the filename extension
+ if (StringUtils.isEmpty(mimeType) || "application/octet-stream".equals(mimeType)
+ || "application/download".equals(mimeType) || "application/force-download".equals(mimeType)
+ || "octet/stream".equals(mimeType) || "application/unknown".equals(mimeType))
+ body.setMimeType(identifyMimeType(name));
+ else
+ body.setMimeType(mimeType);
+ body.setAuditInfo(auditInfo);
+ body.setFileSize(fileSize);
+ body.setOriginalFilename(name);
+ body.setStoredFilePath(generateRepositoryFilePath());
+ //CLEAR OLD VERSION IF FILE IS NOT VERSIONED AND GETS UPDATED
+ if(!header.isVersioned() && header.getCurrentBody() != null){
+ header.setCurrentBody(null);
+ if (header.getBodies() != null) {
+ Iterator<FileBody> it = header.getBodies().iterator();
+ while(it.hasNext()){
+ FileBody bo = it.next();
+ deleteActualFile(bo.getStoredFilePath());
+ it.remove();
+ dao.delete(bo);
+ }
+ }
+ }
+
+ dao.flush();
+ header.addBody(body);
+ header.setAuditInfo(auditInfo);
+
+ dao.create(body);
+ }
+ /*** WEBDAV LOCK **/
+ @Override
+ public FileLock getLockById(String id) {
+ return dao.getLockById(id);
+ }
+
+ @Override
+ public FileLock getLockByToken(String tokenId) {
+ return dao.getLockByToken(tokenId);
+ }
+
+ @Override
+ public void removeLock(FileLock lock) {
+ dao.removeLock(lock);
+ }
+
+ @Override
+ public FileLock saveOrUpdateLock(FileLock lock) {
+ return dao.saveOrUpdateLock(lock);
+ }
+
+ @Override
+ public WebDavNonce getWebDavNonce(String tokenId) {
+ return dao.getWebDavNonce(tokenId);
+ }
+
+ @Override
+ public void removeWebDavNonce(WebDavNonce nonce) {
+ dao.removeWebDavNonce(nonce);
+ }
+
+ @Override
+ public WebDavNonce saveOrUpdateWebDavNonce(WebDavNonce nonce) {
+ return dao.saveOrUpdateWebDavNonce(nonce);
+ }
++
+ /* (non-Javadoc)
+ * @see gr.ebs.gss.server.ejb.ExternalAPI#getUsersByUserNameLike(java.lang.String)
+ */
+ @Override
+ public UserDTO getUserByUserName(String username) {
+ User result = dao.getUserByUserName(username);
+ return result.getDTO();
+ }
+
}
.getResultList();
return res;
}
+
+ @Override
+ public User getUserByUserName(String username) {
+ return (User) manager.createQuery("select u from User u where u.username=:username").
+ setParameter("username", username).getSingleResult();
+
+ }
+
+
+ /** WEBDAV LOCK API **/
+ @Override
+ public FileLock getLockById(String id) {
+ return manager.find(FileLock.class, id);
+ }
+
+ @Override
+ public FileLock getLockByToken(String tokenId) {
+ return (FileLock) manager.createQuery("select c from FileLock c where c.tokenId=:tokenId").setParameter("tokenId", tokenId).getSingleResult();
+ }
+
+ @Override
+ public void removeLock(FileLock lock) {
+ lock =getLockById(lock.getId());
+ if(lock!=null)
+ manager.remove(lock);
+ }
+
+ @Override
+ public FileLock saveOrUpdateLock(FileLock lock) {
+ if(getLockById(lock.getId())!=null)
+ manager.merge(lock);
+ else
+ manager.persist(lock);
+ manager.flush();
+ return lock;
+ }
+
+ @Override
+ public WebDavNonce getWebDavNonce(String tokenId) {
+ return manager.find(WebDavNonce.class, tokenId);
+ }
+
+ @Override
+ public void removeWebDavNonce(WebDavNonce nonce) {
+ nonce =getWebDavNonce(nonce.getId());
+ if(nonce!=null)
+ manager.remove(nonce);
+ }
+
+ @Override
+ public WebDavNonce saveOrUpdateWebDavNonce(WebDavNonce nonce) {
+ if(getWebDavNonce(nonce.getId())!=null)
+ manager.merge(nonce);
+ else
+ manager.persist(nonce);
+ manager.flush();
+ return nonce;
+ }
+
+ @Override
+ public User getUserByUserName(String username) {
+ return (User) manager.createQuery("select u from User u where u.username=:username").
+ setParameter("username", username).getSingleResult();
+
+ }
}