Package rs.etf.sab.operations
Interface UserOperations
public interface UserOperations
-
Method Summary
Modifier and TypeMethodDescriptionint
declareAdmin
(String userName) Declares the given user as an admin.int
deleteUsers
(String... userNames) Delete all users with given names.getSentPackages
(String... userNames) Returns a number of sent packages for the all users.boolean
insertUser
(String userName, String firstName, String lastName, String password) Insets new user to the system.
-
Method Details
-
insertUser
Insets new user to the system.- Parameters:
userName
- - has to be unique.firstName
- - has to start with capital letter.lastName
- - has to start with capital letter.password
- - has to be longer than 8 characters. It should contain at least one number and one letter.- Returns:
- success of the operation.
-
declareAdmin
Declares the given user as an admin.- Parameters:
userName
- - of the future admin.- Returns:
- 0 - success. 1 - already admin. 2 - failed due to lack of given user.
-
getSentPackages
Returns a number of sent packages for the all users.- Parameters:
userNames
- - of the users whose packages is to be counted.- Returns:
- Number of sent packages. If there are no such user, it should be
null
.
-
deleteUsers
Delete all users with given names.- Parameters:
userNames
- - username- Returns:
- number of deleted users.
-
getAllUsers
-