i
Users
The model class contains the properties with its getter and setter methods, while the service class contains the operations to be performed with the model.
Content of the Model Class
A user's model contains:
•Model builder.
•Set of getter and setter methods of its attributes.
Getter methods to get user attributes
The model class for a case contains a set of getter methods for the attributes of the case.
Operation |
Description |
Parameters |
---|---|---|
getFirstName() |
Gets the user name. |
|
getLastName() |
Gets the user last name. |
|
getEmail() |
Gets the user email. |
|
getUserCode() |
Gets the user code. |
|
getAlias() |
Gets the user alias. |
|
getOrganizationalUnit() |
Gets the user organizational unit. |
|
getAuthorizedUserCode() |
Gets the authorizing user code. |
|
getCalendar() |
Gets the user calendar. |
|
getJobs() |
Gets the job positions. |
|
getDelegates() |
Gets the user delegated users. |
|
getDelegatesOf() |
Gets the users where the user is defined as a delegate. |
|
getActive() |
Gets the user state.
Possible values: 1 - Active 0- Inactive |
|
getExpiration() |
Gets the user expiration date. |
|
getUserDurationDays() |
Gets the number of days the password expires since the user was created.
Possible values: 0 - Never 30 - 30 days 60 - 60 days 90 - 90 days |
|
getLicenses() |
Returns a list of licensed products for the user. |
|
getPermissions() |
Returns a list with the user permissions.
|
|
getRoles() |
Returns a list with the user roles. |
|
getIdentificationType() |
Gets the identification type of the user personal data. |
|
getIdentificationNumber() |
Gets the identification number of the user personal data. |
|
getPhone() |
Gets the user phone number. |
|
getExtensionNumber() |
Gets the user phone extension number. |
|
getNationality() |
Gets the user nationality. |
|
getBirthday() |
Gets the user birthdate. |
|
getCountry() |
Gets the user country. |
|
getState() |
Gets the user state |
|
getCity() |
Gets the user city. |
|
getZipCode() |
Gets the user zip code. |
|
getStreetName() |
Gets the user street name. |
|
getStreetNumber() |
Gets the user street number. |
|
getDepartament() |
Gets the user department code. |
|
getLinkedinAccount() |
Gets the linkedin user code. |
|
getTwitterAccount() |
Gets the twitter user code. |
|
getFacebookAccount() |
Gets the facebook user code. |
|
getYouTubeAccount() |
Gets the youtube user code. |
|
getSkypeAccount() |
Gets the skype user code. |
|
getObservation() |
Gets the user observations. |
Service Class Content
The service allows the following operations to be performed:
Operation |
Description |
Parameters |
---|---|---|
read(user) |
Reads an instance. |
User user: User code to read |
getUserImage(user) |
Gets the user profile image. |
User user: User code to read |
getThumbnail(user) |
Gets the thumbnail image of the user profile. |
User user: User code to read |
verifySecurity(user,function) |
Returns true if the user has the security function specified as a parameter in his permissions, and false if otherwise. |
User user: User code to read
String function: Code of the specified safety function |
search(searchCriteria) |
Returns a list of instances of the model class with specified search criteria |
SearchCriteria searchCriteria: Search criteria |
Example of Use
The examples use the Deyel user object and each example contains the use of the "User" model class and the "UserService" service class.
1.Service creation
This service is created only once in the rule and is reused in different operations.
UserService userService = new UserService(getApiClient());
|
2.User reading
In this example, a user with the userCode property with "JPAZ" value is read, using the read(user) method of the "UserService" service class. The value of the lastName property is obtained with the getter method of the "User" model class.
User user = new User(); user.setUserCode("AFARIAS"); user = userService.read(user);
|
3.Get the user profile image
In this example, a user with the userCode property with "AFARIAS" value is read and its profile image is obtained through the getUserImage(user) method of the "UserService" service class.
User user = new User(); user.setUserCode("AFARIAS"); userService.getUserImage(user);
|
4.Get user profile image
In this example, a user with the userCode property with "AFARIAS" value is read and its profile image is obtained through the getUserImage(user) method of the "UserService" service class.
User user = new User(); user.setUserCode("AFARIAS"); userService.getThumbnail(user);
|
5.Security check
In this example it is verified if a user with the userCode property with “AFARIAS' value has the “DUU0C001” security function defined. The verifySecurity((user, “DuU0C001”) method of the “UserService” service class is used with a user that has been read using the read(user) method and the specified security function, as parameters.
User user = new User(); user.setUserCode("AFARIAS"); user = userService.read(user); boolean userHasAccess = userService.verifySecurity(user, "DUU0C001");
|
6.Search
This example retrieves a list with users whose dsEmail property contains the word "gmail" and the cdOrgUnit property has the "0000000007" value. The results are sorted by last name in ascending order. The list is scrolled displaying the first and last names of the users. Same criteria as for form searches are used.
SearchCriteria searchCriteria = new SearchCriteria(); Criteria criteria1 = Criteria.like("dsEmail", "gmail"); Criteria criteria2 = Criteria.eq("cdOrgUnit", "0000000007"); searchCriteria.addCriteria(criteria1); searchCriteria.addCriteria(criteria2); searchCriteria.addOrderAsc("dsLastName"); List list = userService.search(searchCriteria); Iterator it = list.iterator(); while (it.hasNext()) { User user = (User) it.next(); log(user.getFirstName() + " " + user.getLastName()); }
|