-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
conference session and some test work
- Loading branch information
Showing
13 changed files
with
275 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
INSERT INTO conf_admin.location( | ||
name, short_desc, full_desc, parking_info, create_dttm, last_update_dttm) | ||
VALUES ('Sample Location', 'short', 'full', 'no parking', CURRENT_DATE, CURRENT_DATE); | ||
|
||
INSERT INTO conf_admin.conference( | ||
name, short_desc, full_desc, start_date, end_date, location_id, | ||
create_dttm, last_update_dttm) | ||
select 'Sample Conference', 'short desc', 'full desc', CURRENT_DATE - 1, CURRENT_DATE, location.id, | ||
CURRENT_TIMESTAMP, CURRENT_TIMESTAMP | ||
from conf_admin.location where location.name = 'Sample Location'; | ||
|
||
INSERT INTO conf_admin.room( | ||
short_desc, full_desc, conference_id) | ||
select 'Short Description', 'Full Description', conference.id | ||
from conf_admin.conference where conference.name = 'Sample Conference'; | ||
|
||
INSERT INTO conf_admin.presenter( | ||
user_id, short_bio, job_title, company_affiliation_id) | ||
VALUES (null, 'short bio', 'sample title', null); | ||
|
||
INSERT INTO conf_admin.conference_session( | ||
name, short_desc, full_desc, conference_id, conference_session_type_id, | ||
room_id, start_dttm, duration, create_dttm, last_update_dttm, | ||
conference_session_presenter_id) | ||
SELECT 'Session name', 'short desc', 'full desc', conference.id, null, | ||
room.id, CURRENT_DATE, 30, CURRENT_DATE, CURRENT_DATE, | ||
null | ||
from conf_admin.conference,conf_admin.room where conference.name = 'Sample Conference' and room.short_desc = 'Short Description'; | ||
|
||
INSERT INTO conf_admin.conference_session_presenter( | ||
conference_session_id, presenter_id) | ||
select conference_session.id, presenter.id | ||
from conf_admin.presenter, conf_admin.conference_session | ||
where presenter.job_title = 'sample title' and conference_session.name = 'Session name'; | ||
|
||
|
||
|
||
/* | ||
select * from conf_admin.conference; | ||
select * from conf_admin.location; | ||
select * from conf_admin.presenter; | ||
select * from conf_admin.room; | ||
select * from conf_admin.conference_session; | ||
select * from conf_admin.conference_session_presenter; | ||
select * from conf_admin.conference; | ||
delete from conf_admin.conference_session_presenter cascade; | ||
delete from conf_admin.conference_session cascade; | ||
delete from conf_admin.room cascade; | ||
delete from conf_admin.conference cascade; | ||
delete from conf_admin.location cascade; | ||
delete from conf_admin.presenter cascade; | ||
delete from conf_admin.conference cascade; | ||
*/ | ||
|
57 changes: 57 additions & 0 deletions
57
src/main/java/com/ioextendedgr/web/builder/ConferenceSessionBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.ioextendedgr.web.builder; | ||
|
||
import com.ioextendedgr.web.data.Conference; | ||
import com.ioextendedgr.web.data.ConferenceSession; | ||
import com.ioextendedgr.web.data.ConferenceSessionPresenter; | ||
import com.ioextendedgr.web.viewDto.ConferenceSessionView; | ||
import com.ioextendedgr.web.viewDto.ConferenceView; | ||
import org.springframework.util.CollectionUtils; | ||
|
||
import java.util.*; | ||
|
||
/** | ||
* Created by Scott Williams on 3/4/2015. | ||
*/ | ||
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.setPresenterIds(new ArrayList<>(cspIds)); | ||
view.setRoomId(data.getRoom().getId()); | ||
view.setStartDttm(data.getStartDttm()); | ||
|
||
return view; | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/java/com/ioextendedgr/web/repository/ConferenceSessionRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.ioextendedgr.web.repository; | ||
|
||
import com.ioextendedgr.web.data.ConferenceSession; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Created by Scott Williams on 3/4/2015. | ||
*/ | ||
public interface ConferenceSessionRepository extends JpaRepository<ConferenceSession, Integer> { | ||
|
||
public List<ConferenceSession> findByConferenceId(Integer id); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.