public class UserDataSample extends Object
package com.avaya.collaboration.data.api.sample.UserDataSample; import java.util.List; import java.util.Map; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import com.avaya.collaboration.dal.factory.CollaborationDataFactory; import com.avaya.collaboration.data.api.AddressType; import com.avaya.collaboration.data.api.EmailType; import com.avaya.collaboration.data.api.MobileType; import com.avaya.collaboration.data.api.UserData; import com.avaya.common.logging.client.Logger; This class is needed if you are trying to write a JAX-RS based web service. You can enhance this as needed for the application. For applications which provide call related features only and web service is not required, remove this class. @Path("/userData") public class UserDataSample{ private Logger log = Logger.getLogger(UserDataSample.class); @GET public String doGet() { return "This is CE User Data REST Service"; } @GET @Path("/getAllCommunicationAddresses/{enterpriseId}") @Produces("application/json")public Map<String, Map<AddressType, List<String>>>
getAllCommunicationAddresses(@PathParam("enterpriseId") String enterpriseId){Map<String, Map<AddressType, List<String>>> commAddrMap = null;
try{ log.info("Getting All Communication Addresses..."); UserData ud = CollaborationDataFactory.getUserData(); commAddrMap = ud.getAllCommunicationAddresses(enterpriseId); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return commAddrMap; } @GET @Path("/getEmails/{enterpriseId}") @Produces("application/json")public Map<String, Map<EmailType, List<String>>>
getEmails(@PathParam("enterpriseId") String enterpriseId){Map<String, Map<EmailType, List<String>>> emailyTypeListMap = null;
try{ log.info("Getting E-Mail Addresses..."); UserData ud = CollaborationDataFactory.getUserData(); emailyTypeListMap = ud.getEmails(enterpriseId); } catch (Exception e) { e.printStackTrace(); } return emailyTypeListMap; } @GET @Path("/getLoginNameByParticipant/{participantHandle}/{participantDomain}") @Produces("text/html") public String getLoginNameByParticipant(@PathParam("participantHandle") String participantHandle, @PathParam("participantDomain") String participantDomain){ String participantName = null; try{ log.info("Getting Login Name By Participant..."); UserData ud = CollaborationDataFactory.getUserData(); participantName = ud.getLoginNameByParticipant(participantHandle, participantDomain); log.info("participantName = " + participantName); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } if(participantName == null){ return "participantName is null"; } return participantName; } }
Copyright © 2014 Avaya. All Rights Reserved.