Posts

Showing posts with the label address

Auditing the sucessful logged-in users in liferay

In Liferay we have some events to like application startup, global events, login events and many more. If we want to audit the login user on which IP address he logged-in in liferay we have events like 1.login.events.pre 2.login.events.post login.events.pre : Which Executes Before Login Action. login.events.post: Which Excutes After Login. we want to track the user login on which IP Address used so we will write the login.events.post which will be execute after login completes. In Portal.Properties login.events.post = com.sample.hook.LoginSuccessAudit. Create a class called LoginSuccessAudit public class LoginSuccessAudit extends Action { @Override public void run(HttpServletRequest request, HttpServletResponse response) throws ActionException {                    User user = PortalUtil.getUser(request);                    System.out.println("IP Address ...

Adding address for Organization

Image
1.Adding Address List<ListType> addressTypes = ListTypeServiceUtil.getListTypes(Organization.class.getName()+ ListTypeConstants.ADDRESS); Here retrieving the all the address for the organization. Below screen is the available address for the organization. ( 1.Billing, 2.Other, 3.P.O.Box, 4.Shipping ) .Hence " addressTypes " contains all these address As an example we will add address as "Billing" type. so we will iterate all for the listtypes to get Billing type. for (ListType addressType : addressTypes) { String addressTypeName = addressType.getName(); if(addressTypeName.equalsIgnoreCase("Billing")) { personalAddressTypeId = addressType.getListTypeId(); } } Then adding the adddress AddressLocalServiceUtil.addAddress(userId, Organization.class.getName(), organization.getOrganizationId(), street1, street2, street3, city, zip,regionId, countryId, personalAddressTypeId, true, true); Here we need to add the country and region also,...