Commit 65582293 authored by Jie Yuan's avatar Jie Yuan
Browse files

add paging support in backend, site information fecthing by numbers

parent cd721520
......@@ -22,6 +22,8 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
import org.springframework.web.bind.annotation.ResponseBody;
......@@ -245,6 +247,52 @@ public class SiteEndpoint {
}
/**
*
* get brief reports of all sites for dpmt
*
* jie.yuan@kit.edu
*
**/
@GetMapping("/briefreport/dpmt/{startNo}/{endNo}")
public List<BriefSiteResponse> getAllDPMTSiteBriefReportWithNumber(@PathVariable("startNo") final int startNo, @PathVariable("endNo") final int endNo ){
if ( startNo > endNo ) {
return null;
}
if( startNo <=0 && endNo <= 0) {
return null;
}
Iterable<Site> allSites = this.getAllDPMTSites();
List<BriefSiteResponse> ltmp = new ArrayList<>();
int i = 0;
for ( Site tmp: allSites ) {
i++;
if ( i>=startNo && i<=endNo) {
BriefSiteResponse report = new BriefSiteResponse(tmp);
ltmp.add(report);
}
if( i > endNo) {
return ltmp;
}
//System.out.println("one site brief repot prepared" + tmp.getIdName());
}
if (ltmp.isEmpty()) {
return null;
}
//System.out.println("brief reports done");
return ltmp;
}
/**
*
* get brief reports of all sites
......@@ -268,6 +316,46 @@ public class SiteEndpoint {
return res;
}
@GetMapping("/briefreport/gocdb/{startNo}/{endNo}")
public List<BriefSiteResponse> getAllGOCDBSiteBriefReportWithNumber(@PathVariable("startNo") final int startNo, @PathVariable("endNo") final int endNo ){
if ( startNo > endNo ) {
return null;
}
if( startNo <=0 && endNo <= 0) {
return null;
}
Iterable<Site> allSites = this.getAllGOCDBSites();
List<BriefSiteResponse> ltmp = new ArrayList<>();
int i = 0;
for ( Site tmp: allSites ) {
BriefSiteResponse report = new BriefSiteResponse(tmp);
i++;
if ( i>=startNo && i<=endNo) {
ltmp.add(report);
}
if( i > endNo) {
return ltmp;
}
//System.out.println("one site brief repot prepared" + tmp.getIdName());
}
if (ltmp.isEmpty()) {
return null;
}
//System.out.println("brief reports done");
return ltmp;
}
/**
*
* get brief reports of all sites
......@@ -292,6 +380,45 @@ public class SiteEndpoint {
@GetMapping("/briefreport/{startNo}/{endNo}")
public List<BriefSiteResponse> getAllSiteBriefReportWithNumber(@PathVariable("startNo") final int startNo, @PathVariable("endNo") final int endNo ){
if ( startNo > endNo ) {
return null;
}
if( startNo <=0 && endNo <= 0) {
return null;
}
Iterable<Site> allSites = this.getAllSites();
List<BriefSiteResponse> ltmp = new ArrayList<>();
int i = 0;
for ( Site tmp: allSites ) {
BriefSiteResponse report = new BriefSiteResponse(tmp);
i++;
if ( i>=startNo && i<=endNo) {
ltmp.add(report);
}
if( i > endNo) {
return ltmp;
}
//System.out.println("one site brief repot prepared" + tmp.getIdName());
}
if (ltmp.isEmpty()) {
return null;
}
//System.out.println("brief reports done");
return ltmp;
}
/**
*
* get brief reports of all sites for dpmt
......
Markdown is supported
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