/*
- * Copyright 2007, 2008, 2009 Electronic Business Systems Ltd.
+ * Copyright 2007, 2008, 2009, 2010 Electronic Business Systems Ltd.
*
* This file is part of GSS.
*
package gr.ebs.gss.server.ejb;
import gr.ebs.gss.client.exceptions.ObjectNotFoundException;
+import gr.ebs.gss.server.domain.AccountingInfo;
import gr.ebs.gss.server.domain.FileBody;
import gr.ebs.gss.server.domain.FileHeader;
import gr.ebs.gss.server.domain.FileUploadStatus;
import gr.ebs.gss.server.domain.Folder;
import gr.ebs.gss.server.domain.Group;
+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.UserLogin;
import java.util.Date;
import java.util.List;
public List<Group> getGroups(Long userId) throws ObjectNotFoundException;
/**
+ * Retrieves the root folder id for the specified user. The caller must ensure
+ * that the userId exists.
+ *
+ * @param userId
+ * @return Long The id
+ * @throws ObjectNotFoundException if no Folder was found
+ */
+ public Long getRootFolderId(final Long userId) throws ObjectNotFoundException;
+
+ /**
* Retrieves the root folder for the specified user. The caller must ensure
* that the userId exists.
*
public List<User> getUsersByUserNameLike(String username);
/**
+ * Returns a list of users matching specified username or email
+ * @param query
+ * @return List<User>
+ */
+ public List<User> getUsersByUserNameOrEmailLike(String query);
+
+ /**
* Returns a list of All Shared root folders of a user.
*
* @param userId the ID of the User
public Nonce getNonce(String nonce, Long userId) throws ObjectNotFoundException;
/**
- * Loads the file for indexing. That means the file is loaded with the lazy fields needed for inedexing, initialized.
- * For now only the tags need to be initialized
- *
- * @param id
- * @return the {@link FileHeader} with initialized tags
- * @throws ObjectNotFoundException when a file with the specified id does not exist
- */
- public FileHeader getFileForIndexing(Long id) throws ObjectNotFoundException;
-
- /**
* Calculates total file size of user.
*
* @param userId the ID of the user
* negative for subtraction (e.g. to rollback)
*/
public void updateAccounting(User user, Date date, long bandwidthDiff);
+
+ /**
+ * Retrieves available user classes.
+ *
+ */
+ public List<UserClass> getUserClasses();
+
+ /**
+ * 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);
+
+ /**
+ * Retrieve the user class for coupon-bearing users.
+ */
+ public UserClass findCouponUserClass();
+
+ /**
+ * Gets the user count.
+ *
+ * @param userClass the user class to use or null to retrieve system statistics
+ * @return the user count
+ */
+ public Long getUserCount(UserClass userClass);
+
+ /**
+ * Gets the file count.
+ *
+ * @param userClass the user class to use or null to retrieve system statistics
+ * @return the file count
+ */
+ public Long getFileCount(UserClass userClass);
+
+ /**
+ * Gets the file size.
+ *
+ * @param userClass the user class to use or null to retrieve system statistics
+ * @return the file size
+ */
+ public Long getFileSize(UserClass userClass);
+
+ public List<User> getUsersByLastLogin(Date lastLoginDate);
+
+ public List<User> getUsersByLastLogin(Date lastLoginDate, int firstResult, int maxResult);
+
+ public Long getCountUsersByLastLogin(Date lastLoginDate);
+
+ public List<User> getInactiveUsers();
+
+ public List<FileHeader> searchFileByFilename(String filename);
+
+ public Long getBandwithUsed(UserClass userClass, Date date);
+
+ public List<AccountingInfo> getAccountingInfo(User user);
+
+ public AccountingInfo getAccountingInfo(User user, Date date);
+
+ /**
+ * Returns a list of files of user with permissions for specified group
+ *
+ * @param userId the ID of the User
+ * @return the list of shared root files
+ * @param groupId
+ * @throws ObjectNotFoundException if the user cannot be found
+ */
+ public List<FileHeader> getFilesPermittedForGroup(Long userId, Long groupId) throws ObjectNotFoundException;
+
+ /**
+ * Gets a file with tags initialized, cause indexing does not always run within a transaction (e.g. during rebuild)
+ *
+ * @param id
+ * @return
+ * @throws ObjectNotFoundException
+ */
+ public FileHeader getFileForIndexing(Long id) throws ObjectNotFoundException;
+
+ /**
+ * @param userId
+ * @return
+ */
+ List<FileHeader> getSharingFilesForUser(Long userId);
+
+ /**
+ * @param userId
+ * @return
+ */
+ List<Folder> getSharingFoldersForUser(Long userId);
+
+ /**
+ * @param userId
+ * @return
+ */
+ List<Group> getGroupsContainingUser(Long userId);
+
+ /**
+ * @param userId
+ * @return
+ */
+ List<FileUploadStatus> getUploadStatus(Long userId);
+
+ /**
+ * @param userId
+ * @return
+ */
+ int deletePermissionsNotCorrespondingToFilesAndFolders(Long userId);
+
+ /**
+ * Returns a list of the top two entries related to the date that a user logged in the service.
+ * The first entry is related to the current session user login
+ * and the latter is related to the user's last login
+ *
+ * @param userId
+ * @return a list of last user login and the current session user login
+ */
+ public List<UserLogin> getLoginsForUser (Long userId);
+
+ /**
+ * Returns a list of all entries related to the date that a user logged in the service.
+ *
+ * @param userId
+ * @return a list of last user login and the current session user login
+ */
+ public List<UserLogin> getAllLoginsForUser (Long userId);
+
+ /**
+ * Returns the user matching with the specified username
+ *
+ * @param username the email of the User
+ * @return User
+ */
+ public User getUserByUserName(String username);
+
}