/*
- * Copyright 2007, 2008, 2009 Electronic Business Systems Ltd.
+ * Copyright 2007, 2008, 2009, 2010 Electronic Business Systems Ltd.
*
* This file is part of GSS.
*
import gr.ebs.gss.client.exceptions.DuplicateNameException;
import gr.ebs.gss.client.exceptions.GSSIOException;
import gr.ebs.gss.client.exceptions.InsufficientPermissionsException;
+import gr.ebs.gss.client.exceptions.InvitationUsedException;
import gr.ebs.gss.client.exceptions.ObjectNotFoundException;
import gr.ebs.gss.client.exceptions.QuotaExceededException;
import gr.ebs.gss.server.domain.FileUploadStatus;
+import gr.ebs.gss.server.domain.Invitation;
import gr.ebs.gss.server.domain.Nonce;
import gr.ebs.gss.server.domain.User;
+import gr.ebs.gss.server.domain.UserClass;
import gr.ebs.gss.server.domain.dto.FileBodyDTO;
import gr.ebs.gss.server.domain.dto.FileHeaderDTO;
import gr.ebs.gss.server.domain.dto.FolderDTO;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.net.MalformedURLException;
import java.util.Date;
import java.util.List;
import java.util.Set;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
+import org.apache.commons.configuration.Configuration;
+import org.apache.solr.client.solrj.SolrServerException;
+
/**
* The External API for GSS clients.
*
* @param userId the ID of the current user
* @param folderId the ID of the folder to retrieve
* @param folderName
+ * @param readForAll
+ * @param permissions
* @return the updated folder
* @throws InsufficientPermissionsException if the user does not have the
* appropriate privileges
* @throws DuplicateNameException if the specified name already exists in
* the parent folder, as either a folder or file
*/
- public FolderDTO modifyFolder(Long userId, Long folderId, String folderName)
+ public FolderDTO updateFolder(Long userId, Long folderId, String folderName,
+ Boolean readForAll,
+ Set<PermissionDTO> permissions)
throws InsufficientPermissionsException, ObjectNotFoundException, DuplicateNameException;
/**
* @param name
* @param tagSet a String that contains tags separated by comma
* @param modificationDate the modification date
+ * @param versioned the new value of the versioned flag
+ * @param readForAll
+ * @param permissions
+ * @throws DuplicateNameException
* @throws ObjectNotFoundException
* @throws InsufficientPermissionsException
*/
- public void updateFile(Long userId, Long fileId, String name, String tagSet, Date modificationDate)
- throws ObjectNotFoundException, InsufficientPermissionsException;
+ public void updateFile(Long userId, Long fileId, String name, String tagSet,
+ Date modificationDate, Boolean versioned, Boolean readForAll,
+ Set<PermissionDTO> permissions)
+ throws DuplicateNameException, ObjectNotFoundException, InsufficientPermissionsException;
/**
* Retrieve the contents of the current body for the file
* Create a new user with the specified name, username and e-mail address.
*
* @param username the username of the new user
- * @param name the full name of the new user
+ * @param name the name of the new user
* @param mail the e-mail of the new user
+ * @param idp the IdP of the new user
+ * @param idpid the IdP identifier of the new user
* @return the newly-created User object
* @throws DuplicateNameException if a user with the same username already exists
* @throws ObjectNotFoundException if no username was provided
*/
- public User createUser(String username, String name, String mail)
+ public User createUser(String username, String name, String mail, String idp, String idpid)
throws DuplicateNameException, ObjectNotFoundException;
/**
- * Update the user with the specified username with the provided name
- * and e-mail address.
- *
- * @param username the username of the user
- * @param name the modified full name of the user
- * @param mail the modified e-mail of the user
- * @return the updated User object
- * @throws ObjectNotFoundException if no username was provided
- */
- public User updateUser(String username, String name, String mail) throws ObjectNotFoundException;
-
- /**
* Updates the authentication token for the specified user.
*
* @param userId the ID of the user whose token should be updated
throws ObjectNotFoundException, InsufficientPermissionsException;
/**
- * update folder permissions
- * @param userId
- * @param folderId
- * @param permissions
- * @throws ObjectNotFoundException
- * @throws InsufficientPermissionsException
- */
- public void setFolderPermissions(Long userId, Long folderId, Set<PermissionDTO> permissions)
- throws ObjectNotFoundException, InsufficientPermissionsException;
-
- /**
* Retrieve file user and group permissions
*
* @param userId the ID of the user whose token should be updated
public Set<PermissionDTO> getFilePermissions(Long userId, Long fileId)
throws ObjectNotFoundException, InsufficientPermissionsException;
-
- /**
- * update file permissions
- * @param userId
- * @param fileId
- * @param readForAll
- * @param permissions
- * @throws ObjectNotFoundException
- * @throws InsufficientPermissionsException
- */
- public void setFilePermissions(Long userId, Long fileId, Boolean readForAll,
- Set<PermissionDTO> permissions)
- throws ObjectNotFoundException, InsufficientPermissionsException;
-
/**
* Returns a list of all shared root folders of a user.
*
throws ObjectNotFoundException, InsufficientPermissionsException;
/**
- * Toggle between file being versioned or not.
- *
- * @param userId the ID of the user
- * @param fileId the ID of the file
- * @param versioned the new value of the flag
- *
- * @throws ObjectNotFoundException
- * @throws InsufficientPermissionsException
- *
- */
- public void toggleFileVersioning(Long userId, Long fileId, boolean versioned)
- throws ObjectNotFoundException, InsufficientPermissionsException;
-
- /**
* It is used by the Solr mbean to rebuild the index.
*/
public void rebuildSolrIndex();
/**
+ * It is used by the Solr mbean to refresh the index. It does not delete anything just re-add everything in the index
+ */
+ public void refreshSolrIndex();
+
+ /**
* Creates a new file with the specified owner, parent folder and name. The
* new file has the same permissions as its parent folder. The file contents
* are already uploaded outside of externalAPI and the uploaded file is used as a parameter.
*/
public String resetWebDAVPassword(Long userId) throws ObjectNotFoundException;
+ /**
+ * Find the invite for the specified invitation code.
+ *
+ * @param code the invitation code
+ * @return the Invitation or null if not found
+ */
+ public Invitation findInvite(String code);
+
+ /**
+ * Create a new user in the connected IdP.
+ *
+ * @param username the username of the new user
+ * @param firstname the first name of the new user
+ * @param lastname the last name of the new user
+ * @param email the e-mail of the new user
+ * @param password the password of the new user
+ */
+ public void createLdapUser(String username, String firstname, String lastname, String email, String password);
+
+ /**
+ * Retrieves the available user classes.
+ */
+ public List<UserClass> getUserClasses();
+
+ /**
+ * Upgrades the user class to the default "coupon bearer" class and marks
+ * the provided coupon as used.
+ *
+ * @param username the username of the user
+ * @param code the coupon code
+ * @return the new user class
+ * @throws InvitationUsedException when trying to reuse an already used invitation
+ * @throws ObjectNotFoundException if the user was not found
+ */
+ public UserClass upgradeUserClass(String username, String code)
+ throws ObjectNotFoundException, InvitationUsedException;
+
+ /**
+ * Retrieve the user class for coupon-bearing users.
+ */
+ public UserClass getCouponUserClass();
+
+ /**
+ * Delete the actual file in the specified file system path.
+ */
+ public void deleteActualFile(String path);
+
+ /**
+ * Posts the file specified by id to solr indexing server
+ *
+ * @param id
+ */
+ public void postFileToSolr(Long id);
}