Commit 4cde66be authored by Elias Englmeier's avatar Elias Englmeier
Browse files

removed deprecated mapapi

parent 2c8b4746
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin"/>
</classpath>
.gradle/
build/
target/
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>mapApi</name>
<comment>Project mapApi created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>com.liferay.ide.core.liferayNature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
#Thu Dec 14 14:01:58 CET 2017
connection.arguments=
containers=org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/
connection.jvm.arguments=
build.commands=org.eclipse.jdt.core.javabuilder
connection.project.dir=../..
natures=org.eclipse.jdt.core.javanature
eclipse.preferences.version=1
connection.java.home=null
derived.resources=.gradle,build
project.path=\:modules\:mapApi
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
contextPath=/mapApi
authVerifierProperties=auth.verifier.BasicAuthHeaderAuthVerifier.urls.includes=*
\ No newline at end of file
contextPaths=/mapApi
jaxRsServiceFilterStrings=(component.name=mapApi.application.MapApiApplication)
\ No newline at end of file
Bundle-Name: mapApi
Bundle-SymbolicName: mapApi
Bundle-Version: 1.0.0
Liferay-Configuration-Path: /configuration
\ No newline at end of file
dependencies {
compileOnly group: "javax.ws.rs", name: "javax.ws.rs-api", version: "2.0.1"
compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations", version: "1.3.0"
compile project (":modules:ideaService:ideaService-api")
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "2.0.0"
compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
compileOnly group: "javax.servlet", name: "javax.servlet-api", version: "3.0.1"
compileOnly group: "jstl", name: "jstl", version: "1.2"
compileOnly group: "org.osgi", name: "osgi.cmpn", version: "6.0.0"
}
package mapApi.application;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.MediaType;
import org.osgi.service.component.annotations.Component;
import com.liferay.portal.kernel.exception.PortalException;
import ideaService.model.Ideas;
import ideaService.service.IdeasLocalServiceUtil;
/**
* @author englmeier
*/
@ApplicationPath("/mapService")
@Component(immediate = true, service = Application.class)
public class MapApiApplication extends Application {
public Set<Object> getSingletons() {
return Collections.<Object>singleton(this);
}
Map<Integer, Marker> markers = new HashMap<Integer,Marker>();
public MapApiApplication(){
testInit();
}
public void testInit(){
Marker m1 = new Marker();
m1.setDescription("desM1");
m1.setId(1);
m1.setLatitude(48.174882);
m1.setLongitude(11.602710);
m1.setTitle("Nordfriedhof");
markers.put(m1.getId(), m1);
Marker m2 = new Marker();
m2.setDescription("desM2");
m2.setId(2);
m2.setLatitude(48.176571);
m2.setLongitude(11.593055);
m2.setTitle("Highlight Towers");
markers.put(m2.getId(), m2);
}
@GET
@Path("/markers/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Ideas getIdeaById(@PathParam("id") String id) throws NumberFormatException, PortalException {
return IdeasLocalServiceUtil.getIdeas(Integer.parseInt(id));
}
//http://localhost:8080/o/mapApi/mapService/markers
@GET
@Path("/markers")
@Produces(MediaType.APPLICATION_JSON)
public List<Marker> getAllMarkers(){
List<Ideas> allIdeas = IdeasLocalServiceUtil.getIdeases(0, IdeasLocalServiceUtil.getIdeasesCount());
List<Marker> markers = new ArrayList<Marker>();
for(Ideas i : allIdeas){
markers.add(toMarker(i));
}
return markers;
}
private Marker toMarker(Ideas i){
Marker m = new Marker();
m.setTitle(i.getTitle());
m.setLatitude(i.getLatitude());
m.setLongitude(i.getLongitude());
m.setDescription(i.getDescription());
return m;
}
}
\ No newline at end of file
package mapApi.application;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "Marker")
public class Marker {
private int id;
private String title;
private String description;
private double latitude;
private double longitude;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}
contextPath=/mapApi
authVerifierProperties=auth.verifier.BasicAuthHeaderAuthVerifier.urls.includes=*
\ No newline at end of file
contextPaths=/mapApi
jaxRsServiceFilterStrings=(component.name=mapApi.application.MapApiApplication)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment