Permalink
Browse files

Cavabunga-lib have added as maven dependency(as in maven.test.itu.edu…

….tr)

Service layer have re-implemented
  • Loading branch information...
dgkncelik committed Jul 1, 2018
1 parent d5bfb2a commit 0e41e682f0eac1a98bf06582c88029b3539e570f
View
19 pom.xml
@@ -62,13 +62,24 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>tr.edu.itu</groupId>
<groupId>tr.edu.itu.cavabunga</groupId>
<artifactId>cavabunga-lib</artifactId>
<version>1.0.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/cavabunga-lib.jar</systemPath>
<version>1.0.2-SNAPSHOT</version>
</dependency>
</dependencies>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</releases>
<id>cavabunga</id>
<name>cavabunga-lib</name>
<url>http://maven.test.itu.edu.tr</url>
<layout>default</layout>
</repository>
</repositories>
<build>
<plugins>
@@ -1,4 +1,4 @@
package edu.itu.cavabunga.client;
package tr.edu.itu.cavabunga.client;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -1,4 +1,4 @@
package edu.itu.cavabunga.client.configuration;
package tr.edu.itu.cavabunga.client.configuration;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
@@ -1,13 +1,10 @@
package edu.itu.cavabunga.client.controller;
package tr.edu.itu.cavabunga.client.controller;
import edu.itu.cavabunga.client.service.CavabungaClientService;
import edu.itu.cavabunga.client.service.ParticipantRestService;
import edu.itu.cavabunga.lib.entity.Component;
import edu.itu.cavabunga.lib.entity.Participant;
import tr.edu.itu.cavabunga.client.service.CavabungaClientService;
import tr.edu.itu.cavabunga.lib.entity.Component;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@@ -1,4 +1,4 @@
package edu.itu.cavabunga.client.exception;
package tr.edu.itu.cavabunga.client.exception;
public class ClientException extends RuntimeException {
public ClientException(){}
@@ -1,4 +1,4 @@
package edu.itu.cavabunga.client.exception;
package tr.edu.itu.cavabunga.client.exception;
public class JsonParseException extends RuntimeException {
public JsonParseException(){}
@@ -1,6 +1,6 @@
package edu.itu.cavabunga.client.http;
package tr.edu.itu.cavabunga.client.http;
import edu.itu.cavabunga.client.exception.ClientException;
import tr.edu.itu.cavabunga.client.exception.ClientException;
import lombok.Data;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -1,18 +1,16 @@
package edu.itu.cavabunga.client.http;
package tr.edu.itu.cavabunga.client.http;
import com.fasterxml.jackson.databind.ObjectMapper;
import edu.itu.cavabunga.client.exception.ClientException;
import edu.itu.cavabunga.client.exception.JsonParseException;
import edu.itu.cavabunga.lib.entity.Parameter;
import edu.itu.cavabunga.lib.entity.Participant;
import edu.itu.cavabunga.lib.entity.Property;
import edu.itu.cavabunga.lib.http.*;
import tr.edu.itu.cavabunga.client.exception.JsonParseException;
import tr.edu.itu.cavabunga.lib.entity.Parameter;
import tr.edu.itu.cavabunga.lib.entity.Participant;
import tr.edu.itu.cavabunga.lib.entity.Property;
import tr.edu.itu.cavabunga.lib.http.*;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.PropertyResourceBundle;
@Data
@Component
@@ -32,7 +30,7 @@ public String mapParticipantToJson(Participant participant){
}
}
public String mapComponentToJson(edu.itu.cavabunga.lib.entity.Component component){
public String mapComponentToJson(tr.edu.itu.cavabunga.lib.entity.Component component){
try {
return mapper.writeValueAsString(component);
}catch (Exception e){
@@ -73,15 +71,15 @@ public Participant mapFromJsonToParticipant(String jsonInput){
}
}
public edu.itu.cavabunga.lib.entity.Component mapFromJsonToComponent(String jsonInput){
public tr.edu.itu.cavabunga.lib.entity.Component mapFromJsonToComponent(String jsonInput){
try {
return mapper.readValue(jsonInput, edu.itu.cavabunga.lib.entity.Component.class);
return mapper.readValue(jsonInput, tr.edu.itu.cavabunga.lib.entity.Component.class);
}catch (Exception e){
throw new JsonParseException("There is something wrong in toComponent mapping: " + e.getMessage());
}
}
public List<edu.itu.cavabunga.lib.entity.Component> mapFromJsonToComponentResponseList(String jsonInput){
public List<tr.edu.itu.cavabunga.lib.entity.Component> mapFromJsonToComponentResponseList(String jsonInput){
try{
return mapper.readValue(jsonInput,ComponentResponse.class).getData();
}catch (Exception e){
@@ -1,9 +1,9 @@
package edu.itu.cavabunga.client.service;
package tr.edu.itu.cavabunga.client.service;
import edu.itu.cavabunga.client.exception.ClientException;
import edu.itu.cavabunga.lib.entity.Component;
import edu.itu.cavabunga.lib.entity.Participant;
import edu.itu.cavabunga.lib.entity.component.Calendar;
import tr.edu.itu.cavabunga.client.exception.ClientException;
import tr.edu.itu.cavabunga.lib.entity.Component;
import tr.edu.itu.cavabunga.lib.entity.Participant;
import tr.edu.itu.cavabunga.lib.entity.component.Calendar;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -1,14 +1,13 @@
package edu.itu.cavabunga.client.service;
package tr.edu.itu.cavabunga.client.service;
import edu.itu.cavabunga.client.configuration.CavabungaClientConfiguration;
import edu.itu.cavabunga.client.exception.ClientException;
import edu.itu.cavabunga.client.http.HttpAdapter;
import edu.itu.cavabunga.client.http.JsonObjectMapper;
import tr.edu.itu.cavabunga.client.configuration.CavabungaClientConfiguration;
import tr.edu.itu.cavabunga.client.http.HttpAdapter;
import tr.edu.itu.cavabunga.client.http.JsonObjectMapper;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMethod;
import tr.edu.itu.cavabunga.lib.entity.Component;
import java.util.List;
@@ -29,15 +28,15 @@ public ComponentRestService(HttpAdapter httpAdapter,
this.jsonObjectMapper = jsonObjectMapper;
}
public String sendComponentToServer(edu.itu.cavabunga.lib.entity.Component component,
public String sendComponentToServer(tr.edu.itu.cavabunga.lib.entity.Component component,
RequestMethod requestMethod,
String apiUri){
return this.httpAdapter.doRequest(this.cavabungaClientConfiguration.getCavabungaServerUrl() + ":" + this.cavabungaClientConfiguration.getCavabungaServerPort() + "/" + apiUri,
requestMethod,
this.jsonObjectMapper.mapComponentToJson(component));
}
public List<edu.itu.cavabunga.lib.entity.Component> recieveComponentFromServer(String apiUri, RequestMethod requestMethod){
public List<Component> recieveComponentFromServer(String apiUri, RequestMethod requestMethod){
return this.jsonObjectMapper.mapFromJsonToComponentResponseList( this.httpAdapter.doRequest(this.cavabungaClientConfiguration.getCavabungaServerUrl() + ":" + this.cavabungaClientConfiguration.getCavabungaServerPort() + "/" + apiUri,
requestMethod, ""));
}
@@ -1,9 +1,9 @@
package edu.itu.cavabunga.client.service;
package tr.edu.itu.cavabunga.client.service;
import edu.itu.cavabunga.client.configuration.CavabungaClientConfiguration;
import edu.itu.cavabunga.client.http.HttpAdapter;
import edu.itu.cavabunga.client.http.JsonObjectMapper;
import edu.itu.cavabunga.lib.entity.Parameter;
import tr.edu.itu.cavabunga.client.configuration.CavabungaClientConfiguration;
import tr.edu.itu.cavabunga.client.http.HttpAdapter;
import tr.edu.itu.cavabunga.client.http.JsonObjectMapper;
import tr.edu.itu.cavabunga.lib.entity.Parameter;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -1,14 +1,11 @@
package edu.itu.cavabunga.client.service;
package tr.edu.itu.cavabunga.client.service;
import edu.itu.cavabunga.client.CavabungaClient;
import edu.itu.cavabunga.client.configuration.CavabungaClientConfiguration;
import edu.itu.cavabunga.client.http.HttpAdapter;
import edu.itu.cavabunga.client.http.JsonObjectMapper;
import edu.itu.cavabunga.lib.entity.Component;
import edu.itu.cavabunga.lib.entity.Participant;
import tr.edu.itu.cavabunga.client.configuration.CavabungaClientConfiguration;
import tr.edu.itu.cavabunga.client.http.HttpAdapter;
import tr.edu.itu.cavabunga.client.http.JsonObjectMapper;
import tr.edu.itu.cavabunga.lib.entity.Participant;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.client.HttpComponentsAsyncClientHttpRequestFactory;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -1,10 +1,9 @@
package edu.itu.cavabunga.client.service;
package tr.edu.itu.cavabunga.client.service;
import edu.itu.cavabunga.client.configuration.CavabungaClientConfiguration;
import edu.itu.cavabunga.client.http.HttpAdapter;
import edu.itu.cavabunga.client.http.JsonObjectMapper;
import edu.itu.cavabunga.lib.entity.Component;
import edu.itu.cavabunga.lib.entity.Property;
import tr.edu.itu.cavabunga.client.configuration.CavabungaClientConfiguration;
import tr.edu.itu.cavabunga.client.http.HttpAdapter;
import tr.edu.itu.cavabunga.client.http.JsonObjectMapper;
import tr.edu.itu.cavabunga.lib.entity.Property;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

0 comments on commit 0e41e68

Please sign in to comment.