I have two methods in the same class, the first method isgetEventByEventId and the second method is addEventUserRealtionMapping. I need to call the getEventByEventId method from the addEventUserRelationMapping method. How can I get that done?
public EventBO getEventByEventId(long eventId) throws UserServiceException {
try {
EventDO eventDO = eventDAOImpl.getEventByEventId(eventId);
EventBO eventBO = mapper.mapEventDOToBO(eventDO, new EventBO());
return eventBO;
} catch (UserDataException uExp) {
throw new UserServiceException("Error while getting event for event id " + eventId, uExp);
}
}
public int addEventUserRealtionMapping(ArrayList<UserBO> userBOs, long eventId) throws UserServiceException {
List<EventUserRelationDO> totalAddedCount;
ArrayList<UserDO> userDOs = new ArrayList<>();
try {
for (UserBO userBO : userBOs) {
UserDO userDO = mapper.mapUserBOToDO(userBO, new UserDO());
userDOs.add(userDO);
}
EventBO eventBO =new EventBO();
eventBO =getEventByEventId(eventId);//I am try that while call method1 but it doesn't work
MessageBO messageBO = new MessageBO();
messageBO.setEventId(eventBO.getEventId());
messageBO.setEventTitle(eventBO.getText());
messageBO.setMessage(eventBO.getText());
messageBO.setRingeeUserId(eventBO.getRingeeUserId());
messageBO.setMessageType(IRingeeConstants.MESSAGE_TYPE_INVITATION);
totalAddedCount = eventDAOImpl.addEventUserRelationMapping(userDOs, eventId);
if (totalAddedCount.size() == userDOs.size()) {
manageMessageService.sendMessageToGroup(userBOs, messageBO);
}
} catch (UserDataException dExp) {
throw new UserServiceException(" exception while adding user relationship for eventId " + eventId, dExp);
}
return totalAddedCount.size();
}