In the following example, a managed object is retrieved from an event. If the object’s PROPERTY_EMAIL attribute does not already contain a user’s email address, a default email address is created.
Example:
public int before(EventContext evtCtx) throws Exception { IMEvent evt = evtCtx.getEvent(); if (evt instanceof UserEvent) { User user = ((UserEvent) evt).getUser(); try { String userMail =user.getAttribute(User.PROPERTY_EMAIL); logDebugMessage("User Specified EMAIL "+userMail,true); logDebugMessage("Default EMAIL "+user.getFriendlyName() + email, true); if(userMail == null || userMail.length() == 0 ) { user.setAttribute(User.PROPERTY_EMAIL, user.getFriendlyName() + email); } } catch (Exception ex) { logDebugMessage("Set EMAIL exception: "+ex.getMessage() + " in event " + evt.getEventName(), true); } } return CONTINUE; }
Copyright © 2013 CA.
All rights reserved.
|
|