Skip to content

Commit

Permalink
Merge branch 'release/0.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
chenry committed Feb 14, 2015
2 parents 14889e4 + 1aad9b0 commit 8277644
Show file tree
Hide file tree
Showing 21 changed files with 569 additions and 178 deletions.
17 changes: 15 additions & 2 deletions README.md
@@ -1,6 +1,7 @@
[![Build Status](https://travis-ci.org/Google-IO-Extended-Grand-Rapids/conference_web.svg?branch=develop)](https://travis-ci.org/Google-IO-Extended-Grand-Rapids/conference_web)
[![Coverage Status](https://coveralls.io/repos/Google-IO-Extended-Grand-Rapids/conference_web/badge.svg?branch=develop)](https://coveralls.io/r/Google-IO-Extended-Grand-Rapids/conference_web?branch=develop)


# Development Environment
* [VirtualBox v4.3.20+](https://www.virtualbox.org/wiki/Downloads)
* [Vagrant v1.7.2+](https://www.vagrantup.com/downloads.html)
Expand All @@ -21,12 +22,13 @@ In order to allow this, you must destroy the Vagrant container so the appropriat
- Port: 5432
- username: postgres

# Vagrant Startup
# Vagrant Startup with Database Only configured
If you do not want to run the web docker container, and instead would prefer to only startup the database container, then please follow the instructions below
After making these modifications, when you perform the vagrant commands (up, halt), it will only be for the db
- Copy the vagrant_config.yml.template to vagrant_config.yml
- adjust the "start-web" to be false
- Start the application using the application-no-web.properties file so it will point to the appropriate postgres machine locally.
- Run the application with the following and it will connect to postgres using the local information
-- mvn clean install -PlocalDB && java -jar target/*.jar

# Database commands
Here is a list of database commands that can be ran as maven
Expand All @@ -44,3 +46,14 @@ To run stuff locally and hit the postgres container in vagrant, use the 'travis'
```
$ mvn clean install -Ptravis
```

# Available API
Here is a list of the available apis in the system

- /api/conference - will retrieve all conferences
- /api/conference/{id} - will retrieve conference by id
- /api/conference/{id}/conferenceSessions - will retrieve the sessions by conference id
- /api/conferenceSession - will retrieve all conference sessions
- /api/conferenceSession/{id} - will retrieve conference session by id
- /api/presenter - will retrieve all presenters
- /api/presenter/{id} - will retrieve presenter by id
2 changes: 2 additions & 0 deletions contributors.txt
@@ -1 +1,3 @@
Dan Mikita
Dan McCracken
Carlus Henry
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -47,7 +47,7 @@
</dependency>
</dependencies>
<properties>
<start-class>hello.Application</start-class>
<start-class>com.ioextendedgr.web.Application</start-class>
<java.version>1.7</java.version>
<jetty.version>9.1.0.v20131115</jetty.version>
<servlet-api.version>3.1.0</servlet-api.version>
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/com/ioextendedgr/web/Application.java
@@ -0,0 +1,15 @@
package com.ioextendedgr.web;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;

@ComponentScan(basePackages = {"com.ioextendedgr.web"})
@EnableAutoConfiguration
public class Application {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}

}
@@ -1,19 +1,36 @@
package com.ioextendedgr.web.controller;

import java.util.List;
import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ioextendedgr.web.util.StubFactory;
import com.ioextendedgr.web.service.ConferenceService;
import com.ioextendedgr.web.viewDto.ConferenceSessionView;
import com.ioextendedgr.web.viewDto.ConferenceView;

@RestController
@RequestMapping("/api")
public class ConferenceController {

@Autowired
private ConferenceService conferenceService;

@RequestMapping("/conference")
public List<ConferenceView> findAllConferences() {
return StubFactory.createConferenceViews();
public Collection<ConferenceView> findAllConferences() {
return conferenceService.findAllConferences();
}

@RequestMapping("/conference/{id}")
public ConferenceView findConferenceById(@PathVariable("id") Long id) {
return conferenceService.findConferenceById(id);
}

@RequestMapping("/conference/{id}/conferenceSessions")
public Collection<ConferenceSessionView> findConferenceSessionsByConferenceId(@PathVariable("id") Long id) {
return conferenceService.findConferenceSessionsByConferenceId(id);
}


Expand Down
@@ -0,0 +1,29 @@
package com.ioextendedgr.web.controller;

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ioextendedgr.web.service.ConferenceService;
import com.ioextendedgr.web.viewDto.ConferenceSessionView;

@RestController
@RequestMapping("/api")
public class ConferenceSessionController {

@Autowired
private ConferenceService conferenceService;

@RequestMapping("/conferenceSession")
public Collection<ConferenceSessionView> findAllConferenceSessions() {
return conferenceService.findAllConferenceSessions();
}

@RequestMapping("/conferenceSession/{id}")
public ConferenceSessionView findConferenceSessionById(@PathVariable("id") Long id) {
return conferenceService.findConferenceSessionById(id);
}
}
@@ -0,0 +1,29 @@
package com.ioextendedgr.web.controller;

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ioextendedgr.web.service.ConferenceService;
import com.ioextendedgr.web.viewDto.PresenterView;

@RestController
@RequestMapping("/api")
public class PresenterController {

@Autowired
private ConferenceService conferenceService;

@RequestMapping("/presenter")
public Collection<PresenterView> findAllPresenters() {
return conferenceService.findAllPresenters();
}

@RequestMapping("/presenter/{id}")
public PresenterView findPresenterById(@PathVariable("id") Long id) {
return conferenceService.findPresenterById(id);
}
}
47 changes: 47 additions & 0 deletions src/main/java/com/ioextendedgr/web/service/ConferenceService.java
@@ -0,0 +1,47 @@
package com.ioextendedgr.web.service;

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.ioextendedgr.web.util.StubFactory;
import com.ioextendedgr.web.viewDto.ConferenceSessionView;
import com.ioextendedgr.web.viewDto.ConferenceView;
import com.ioextendedgr.web.viewDto.PresenterView;

@Component
public class ConferenceService {

@Autowired
private StubFactory stubFactory;

public Collection<ConferenceView> findAllConferences() {
return stubFactory.findAllConferences();
}

public ConferenceView findConferenceById(Long id) {
return stubFactory.findConferenceById(id);
}

public Collection<PresenterView> findAllPresenters() {
return stubFactory.findAllPresenters();
}

public PresenterView findPresenterById(Long id) {
return stubFactory.findPresenterById(id);
}

public Collection<ConferenceSessionView> findAllConferenceSessions() {
return stubFactory.findAllConferenceSessions();
}

public ConferenceSessionView findConferenceSessionById(Long id) {
return stubFactory.findConferenceSessionById(id);
}

public Collection<ConferenceSessionView> findConferenceSessionsByConferenceId(Long id) {
return stubFactory.findConferenceSessionsByConferenceId(id);
}

}
@@ -0,0 +1,26 @@
package com.ioextendedgr.web.util;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

public class DateTimeISO8601Serializer extends JsonSerializer<Date> {

@Override
public void serialize(Date value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
if (value == null) {
jgen.writeString("");
return;
}

SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
String formattedDate = formatter.format(value);
jgen.writeString(formattedDate);
}

}

0 comments on commit 8277644

Please sign in to comment.