Skip to content

Commit

Permalink
updating to correct presenter id
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasrob committed May 16, 2015
1 parent d65b521 commit 33c948c
Showing 1 changed file with 50 additions and 51 deletions.
Expand Up @@ -19,72 +19,71 @@
*/
public class ConferenceSessionBuilder {

public static List<ConferenceSessionView> build(Collection<ConferenceSession> datas) {
if (CollectionUtils.isEmpty(datas)) {
return new ArrayList<>();
}

List<ConferenceSessionView> views = new ArrayList<>();
for (ConferenceSession data : datas) {
views.add(build(data));
}
return views;
}


public static ConferenceSessionView build(ConferenceSession data) {
if (data == null)
return null;

ConferenceSessionView view = new ConferenceSessionView();

view.setId(data.getId());
view.setName(data.getName());
view.setConferenceId(data.getConference().getId());
view.setDurationMinutes(data.getDuration());
view.setShortDesc(data.getShortDesc());
view.setFullDesc(data.getFullDesc());
view.setCreateDttm(data.getCreateDttm());
view.setLastUpdateDttm(data.getLastUpdateDttm());
Set<Integer> cspIds = new HashSet<>();
for(ConferenceSessionPresenter csp: data.getConferenceSessionPresenters()){
cspIds.add(csp.getId());
}

view.setConferenceSessionType(toConferenceSessionTypeView(data.getConferenceSessionType()));

view.setPresenterIds(new ArrayList<>(cspIds));
view.setRoomId(data.getRoom().getId());
view.setStartDttm(data.getStartDttm());

return view;
}


private static ConferenceSessionTypeView toConferenceSessionTypeView(ConferenceSessionType conferenceSessionType) {

public static List<ConferenceSessionView> build(
Collection<ConferenceSession> datas) {
if (CollectionUtils.isEmpty(datas)) {
return new ArrayList<>();
}

List<ConferenceSessionView> views = new ArrayList<>();
for (ConferenceSession data : datas) {
views.add(build(data));
}
return views;
}

public static ConferenceSessionView build(ConferenceSession data) {
if (data == null)
return null;

ConferenceSessionView view = new ConferenceSessionView();

view.setId(data.getId());
view.setName(data.getName());
view.setConferenceId(data.getConference().getId());
view.setDurationMinutes(data.getDuration());
view.setShortDesc(data.getShortDesc());
view.setFullDesc(data.getFullDesc());
view.setCreateDttm(data.getCreateDttm());
view.setLastUpdateDttm(data.getLastUpdateDttm());
Set<Integer> cspIds = new HashSet<>();
for (ConferenceSessionPresenter csp : data
.getConferenceSessionPresenters()) {
cspIds.add(csp.getPresenter().getId());
}

view.setConferenceSessionType(toConferenceSessionTypeView(data
.getConferenceSessionType()));

view.setPresenterIds(new ArrayList<>(cspIds));
view.setRoomId(data.getRoom().getId());
view.setStartDttm(data.getStartDttm());

return view;
}

private static ConferenceSessionTypeView toConferenceSessionTypeView(
ConferenceSessionType conferenceSessionType) {

if (conferenceSessionType == null) {
return toDefaultConferenceSessionTypeView();
}
ConferenceSessionTypeView confSessionTypeView = new ConferenceSessionTypeView();

confSessionTypeView.setId(conferenceSessionType.getId());
confSessionTypeView.setName(conferenceSessionType.getName());
confSessionTypeView.setDescription(conferenceSessionType.getDesc());
return confSessionTypeView;
}


private static ConferenceSessionTypeView toDefaultConferenceSessionTypeView() {
ConferenceSessionTypeView confSessionTypeView = new ConferenceSessionTypeView();

confSessionTypeView.setId(6);
confSessionTypeView.setName("Onsite");
confSessionTypeView.setDescription("Onsite");

return confSessionTypeView;
}



}
}

0 comments on commit 33c948c

Please sign in to comment.