Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
digicom5
api
Commits
6ddca2e7
Commit
6ddca2e7
authored
Jan 21, 2016
by
David Koch
Browse files
Initial commit
parent
3fc63d99
Changes
18
Hide whitespace changes
Inline
Side-by-side
.classpath
0 → 100644
View file @
6ddca2e7
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry
kind=
"src"
output=
"target/classes"
path=
"src/main/java"
>
<attributes>
<attribute
name=
"optional"
value=
"true"
/>
<attribute
name=
"maven.pomderived"
value=
"true"
/>
</attributes>
</classpathentry>
<classpathentry
excluding=
"**"
kind=
"src"
output=
"target/classes"
path=
"src/main/resources"
>
<attributes>
<attribute
name=
"maven.pomderived"
value=
"true"
/>
</attributes>
</classpathentry>
<classpathentry
kind=
"src"
output=
"target/test-classes"
path=
"src/test/java"
>
<attributes>
<attribute
name=
"optional"
value=
"true"
/>
<attribute
name=
"maven.pomderived"
value=
"true"
/>
</attributes>
</classpathentry>
<classpathentry
excluding=
"**"
kind=
"src"
output=
"target/test-classes"
path=
"src/test/resources"
>
<attributes>
<attribute
name=
"maven.pomderived"
value=
"true"
/>
</attributes>
</classpathentry>
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"
>
<attributes>
<attribute
name=
"maven.pomderived"
value=
"true"
/>
</attributes>
</classpathentry>
<classpathentry
kind=
"con"
path=
"org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"
>
<attributes>
<attribute
name=
"maven.pomderived"
value=
"true"
/>
</attributes>
</classpathentry>
<classpathentry
kind=
"output"
path=
"target/classes"
/>
</classpath>
.project
0 → 100644
View file @
6ddca2e7
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>
api
</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>
org.eclipse.jdt.core.javabuilder
</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>
org.eclipse.m2e.core.maven2Builder
</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>
org.eclipse.jdt.core.javanature
</nature>
<nature>
org.eclipse.m2e.core.maven2Nature
</nature>
</natures>
</projectDescription>
.settings/org.eclipse.core.resources.prefs
0 → 100644
View file @
6ddca2e7
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8
.settings/org.eclipse.jdt.core.prefs
0 → 100644
View file @
6ddca2e7
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7
.settings/org.eclipse.m2e.core.prefs
0 → 100644
View file @
6ddca2e7
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
pom.xml
0 → 100644
View file @
6ddca2e7
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
de.uniko.digicom.carsandco
</groupId>
<artifactId>
carsandco-api
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<name>
External Cars and Co API
</name>
<description>
External API for business partners of Cars and Co Inc.
</description>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<java.version>
1.7
</java.version>
<!-- plugins -->
<maven.compiler.version>
3.3
</maven.compiler.version>
<java.source-plugin.version>
2.2.1
</java.source-plugin.version>
<maven.ssh-extension.version>
2.10
</maven.ssh-extension.version>
<!-- dependencies -->
<gson.version>
1.7.1
</gson.version>
<http.client.version>
4.5.1
</http.client.version>
</properties>
<build>
<sourceDirectory>
src/main/java
</sourceDirectory>
<testSourceDirectory>
src/test/java
</testSourceDirectory>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
${maven.compiler.version}
</version>
<configuration>
<source>
${java.version}
</source>
<target>
${java.version}
</target>
<encoding>
${project.build.sourceEncoding}
</encoding>
<showWarnings>
true
</showWarnings>
<showDeprecation>
true
</showDeprecation>
</configuration>
</plugin>
<!-- attach source code -->
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-source-plugin
</artifactId>
<version>
${java.source-plugin.version}
</version>
<executions>
<execution>
<id>
attach-sources
</id>
<goals>
<goal>
jar
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<extensions>
<!-- SSH extension to deploy via SCP -->
<extension>
<groupId>
org.apache.maven.wagon
</groupId>
<artifactId>
wagon-ssh
</artifactId>
<version>
${maven.ssh-extension.version}
</version>
</extension>
</extensions>
</build>
<repositories>
<!-- Cars and Co repository to resolve dependencies from -->
<repository>
<id>
carsandco
</id>
<url>
http://camunda-carsandco.iwvi.uni-koblenz.de/mvn
</url>
</repository>
<!-- Capitol Inc. repository -->
<repository>
<id>
capitol
</id>
<url>
http://camunda-capitol.iwvi.uni-koblenz.de/mvn
</url>
</repository>
</repositories>
<distributionManagement>
<!-- Capitol repository to deploy artifacts to -->
<repository>
<id>
carsandco
</id>
<uniqueVersion>
false
</uniqueVersion>
<url>
scp://camunda-carsandco.iwvi.uni-koblenz.de/mvn/
</url>
<layout>
default
</layout>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>
org.apache.httpcomponents
</groupId>
<artifactId>
httpclient
</artifactId>
<version>
${http.client.version}
</version>
</dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
<version>
1.7.1
</version>
</dependency>
<dependency>
<groupId>
de.uniko.digicom.capitol
</groupId>
<artifactId>
capitol-api
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
src/main/java/de/uniko/digicom/carsandco/client/CarsandcoApiClient.java
0 → 100644
View file @
6ddca2e7
package
de.uniko.digicom.carsandco.client
;
import
java.io.BufferedReader
;
import
java.io.InputStreamReader
;
import
java.io.OutputStreamWriter
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
com.google.gson.Gson
;
import
de.uniko.digicom.carsandco.messages.PaymentNotification
;
import
de.uniko.digicom.carsandco.messages.RepairContract
;
public
class
CarsandcoApiClient
{
/**
* This method sends a new RepairContract to Cars and Co and starts their processes for a car reparation.
* @param contract The RepairContract Object filled with all the contract data
*/
public
void
sendContract
(
RepairContract
contract
){
Gson
gson
=
new
Gson
();
String
newContract
=
gson
.
toJson
(
contract
);
try
{
URL
url
=
new
URL
(
"http://camunda-carsandco.iwvi.uni-koblenz.de:8080/carsandco/api/contract/new"
);
URLConnection
connection
=
url
.
openConnection
();
connection
.
setDoOutput
(
true
);
connection
.
setRequestProperty
(
"Content-Type"
,
"application/json"
);
connection
.
setConnectTimeout
(
5000
);
connection
.
setReadTimeout
(
5000
);
OutputStreamWriter
out
=
new
OutputStreamWriter
(
connection
.
getOutputStream
());
out
.
write
(
newContract
);
out
.
close
();
BufferedReader
in
=
new
BufferedReader
(
new
InputStreamReader
(
connection
.
getInputStream
()));
while
(
in
.
readLine
()
!=
null
)
{
}
System
.
out
.
println
(
"Cars and Co Contract-REST Service Invoked Successfully.."
);
in
.
close
();
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Error while calling Cars and Co Contract-REST Service"
);
System
.
out
.
println
(
e
);
}
}
/**
* This method sends a notification that an invoice is payed to Cars and Co.
* @param note The PaymentNotification Object to send
*/
public
void
sendPaymentNotification
(
PaymentNotification
note
){
Gson
gson
=
new
Gson
();
String
paymentNote
=
gson
.
toJson
(
note
);
try
{
URL
url
=
new
URL
(
"http://camunda-carsandco.iwvi.uni-koblenz.de:8080/carsandco/api/contract/payment"
);
URLConnection
connection
=
url
.
openConnection
();
connection
.
setDoOutput
(
true
);
connection
.
setRequestProperty
(
"Content-Type"
,
"application/json"
);
connection
.
setConnectTimeout
(
5000
);
connection
.
setReadTimeout
(
5000
);
OutputStreamWriter
out
=
new
OutputStreamWriter
(
connection
.
getOutputStream
());
out
.
write
(
paymentNote
);
out
.
close
();
BufferedReader
in
=
new
BufferedReader
(
new
InputStreamReader
(
connection
.
getInputStream
()));
while
(
in
.
readLine
()
!=
null
)
{
}
System
.
out
.
println
(
"Cars and Co Payment-Notification-REST Service Invoked Successfully.."
);
in
.
close
();
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Error while calling Cars and Co Payment-Notification-REST Service"
);
System
.
out
.
println
(
e
);
}
}
}
src/main/java/de/uniko/digicom/carsandco/messages/PaymentNotification.java
0 → 100644
View file @
6ddca2e7
package
de.uniko.digicom.carsandco.messages
;
import
java.util.Date
;
public
class
PaymentNotification
{
/**
* Creates an object to notify Cars and Co about an executed payment of an invoice
* @param transactionKey key to identify transactions
*/
public
PaymentNotification
(
String
transactionKey
){
this
.
setTransactionKey
(
transactionKey
);
}
/**
* Unique key to identify the transaction the request/response belongs to
*/
private
String
transactionKey
;
/**
* The ID of the invoice that was received from Cars and Co and is now payed.
*/
private
int
invoiceID
;
/**
* The date and time when they payment was performed
*/
//Just use Date dateOfPayment = new Date();
private
Date
dateOfPayment
;
//Getter-Setter below
public
String
getTransactionKey
()
{
return
transactionKey
;
}
public
void
setTransactionKey
(
String
transactionKey
)
{
this
.
transactionKey
=
transactionKey
;
}
public
int
getInvoiceID
()
{
return
invoiceID
;
}
public
void
setInvoiceID
(
int
invoiceID
)
{
this
.
invoiceID
=
invoiceID
;
}
public
Date
getDateOfPayment
()
{
return
dateOfPayment
;
}
public
void
setDateOfPayment
(
Date
dateOfPayment
)
{
this
.
dateOfPayment
=
dateOfPayment
;
}
}
src/main/java/de/uniko/digicom/carsandco/messages/RepairContract.java
0 → 100644
View file @
6ddca2e7
package
de.uniko.digicom.carsandco.messages
;
import
de.uniko.digicom.capitol.api.contracting.Car
;
public
class
RepairContract
{
/**
* Creates an object for a new repair contract with Cars and Co
* @param transactionKey key to identify transactions
*/
public
RepairContract
(
String
transactionKey
){
this
.
setTransactionKey
(
transactionKey
);
}
/**
* Unique key to identify the transaction the request/response belongs to
*/
private
String
transactionKey
;
/**
* The reference to the customer that places a repair/maintainance order
*/
private
int
customerID
;
// maybe Customer-Object?
/**
* A car Object from Capitol-Api
*/
private
Car
car
;
/**
* The licence plate content
*/
private
String
licencePlate
;
/**
* The current location (ONLY city name) of the car, used to calculate the next service
* station of Cars & Co. E.G. "Koblenz"
*/
private
String
carLocationCity
;
/**
* A textual description of the problem the car has.
*/
private
String
problemDescription
;
// Getter-Setter-Methods below
public
int
getCustomerID
()
{
return
customerID
;
}
public
void
setCustomerID
(
int
customerID
)
{
this
.
customerID
=
customerID
;
}
public
Car
getCar
()
{
return
car
;
}
public
void
setCar
(
Car
car
)
{
this
.
car
=
car
;
}
public
String
getLicencePlate
()
{
return
licencePlate
;
}
public
void
setLicencePlate
(
String
licencePlate
)
{
this
.
licencePlate
=
licencePlate
;
}
public
String
getCarLocationCity
()
{
return
carLocationCity
;
}
public
void
setCarLocationCity
(
String
carLocationCity
)
{
this
.
carLocationCity
=
carLocationCity
;
}
public
String
getProblemDescription
()
{
return
problemDescription
;
}
public
void
setProblemDescription
(
String
problemDescription
)
{
this
.
problemDescription
=
problemDescription
;
}
public
String
getTransactionKey
()
{
return
transactionKey
;
}
public
void
setTransactionKey
(
String
transactionKey
)
{
this
.
transactionKey
=
transactionKey
;
}
}
target/carsandco-api-0.0.1-SNAPSHOT-sources.jar
0 → 100644
View file @
6ddca2e7
File added
target/carsandco-api-0.0.1-SNAPSHOT.jar
0 → 100644
View file @
6ddca2e7
File added
target/classes/de/uniko/digicom/carsandco/client/CarsandcoApiClient.class
0 → 100644
View file @
6ddca2e7
File added
target/classes/de/uniko/digicom/carsandco/messages/PaymentNotification.class
0 → 100644
View file @
6ddca2e7
File added
target/classes/de/uniko/digicom/carsandco/messages/RepairContract.class
0 → 100644
View file @
6ddca2e7
File added
target/maven-archiver/pom.properties
0 → 100644
View file @
6ddca2e7
#Generated by Maven
#Thu Jan 21 20:10:38 CET 2016
version
=
0.0.1-SNAPSHOT
groupId
=
de.uniko.digicom.carsandco
artifactId
=
carsandco-api
target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
0 → 100644
View file @
6ddca2e7
de\uniko\digicom\carsandco\messages\RepairContract.class
de\uniko\digicom\carsandco\client\CarsandcoApiClient.class
de\uniko\digicom\carsandco\messages\PaymentNotification.class
target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
0 → 100644
View file @
6ddca2e7
C:\Users\David\Documents\workspace\api\src\main\java\de\uniko\digicom\carsandco\messages\PaymentNotification.java
C:\Users\David\Documents\workspace\api\src\main\java\de\uniko\digicom\carsandco\messages\RepairContract.java
C:\Users\David\Documents\workspace\api\src\main\java\de\uniko\digicom\carsandco\client\CarsandcoApiClient.java
target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
0 → 100644
View file @
6ddca2e7
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment