This repository has been archived by the owner on Oct 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from academic/feature/oai-endpoint
Feature/oai endpoint
- Loading branch information
Showing
10 changed files
with
157 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package io.academic.config; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.servlet.config.annotation.EnableWebMvc; | ||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; | ||
|
||
@Configuration | ||
@EnableWebMvc | ||
public class WebConfig extends WebMvcConfigurerAdapter { | ||
|
||
@Override | ||
public void addResourceHandlers(ResourceHandlerRegistry registry) { | ||
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); | ||
} | ||
|
||
} |
57 changes: 57 additions & 0 deletions
57
src/main/java/io/academic/controller/DataproviderformController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package io.academic.controller; | ||
|
||
|
||
import io.academic.dao.OaiDataProviderDao; | ||
import io.academic.dao.SearchDao; | ||
import io.academic.entity.OaiDataProvider; | ||
import io.academic.entity.OaiDataProviderRepository; | ||
import io.academic.service.OaiDataProviderService; | ||
import io.academic.service.OaiService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.PageRequest; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.ui.Model; | ||
import org.springframework.ui.ModelMap; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.ModelAttribute; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
|
||
@Controller | ||
public class DataproviderformController { | ||
|
||
private OaiDataProviderService oaiDataProviderService; | ||
@Autowired | ||
private OaiDataProviderRepository oaiDataProviderRepository; | ||
|
||
public DataproviderformController(OaiDataProviderService oaiDataProviderService) { | ||
this.oaiDataProviderService=oaiDataProviderService; | ||
} | ||
|
||
|
||
@GetMapping("/dataproviderform") | ||
public String addForm(ModelMap modelMap) { | ||
modelMap.addAttribute("dataproviderForm", new OaiDataProviderDao()); | ||
return "dataproviderform"; | ||
} | ||
|
||
@PostMapping("/dataproviderform") | ||
public String greetingSubmit(Model model, @ModelAttribute("dataproviderForm")OaiDataProviderDao oaiDataProviderDao) throws IOException { | ||
|
||
System.out.println(oaiDataProviderDao.getName()); | ||
System.out.println(oaiDataProviderDao.getUrl()); | ||
System.out.println(oaiDataProviderDao.getIdentifier()); | ||
oaiDataProviderService.queue(oaiDataProviderDao); | ||
model.addAttribute("oaiDataProviderDao",oaiDataProviderDao); | ||
Page<OaiDataProvider>providers= oaiDataProviderRepository.findAll(new PageRequest(0,10)); | ||
model.addAttribute("providers",providers); | ||
return "dataproviderresult"; | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!DOCTYPE HTML> | ||
<html xmlns:th="http://www.thymeleaf.org"> | ||
<head> | ||
<title>Data Provider List</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||
<!-- Bootstrap --> | ||
<link href="webjars/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" media="screen"> </link> | ||
</head> | ||
<body> | ||
<h1>Data Provider Added</h1> | ||
<p th:text="'name: ' + ${oaiDataProviderDao.name}"/> | ||
<p th:text="'url: ' + ${oaiDataProviderDao.url}"/> | ||
<p th:text="'identifier: ' + ${oaiDataProviderDao.identifier}"/> | ||
<a href="/dataproviderform">Submit another data provider</a> | ||
<h1>Current Data Provider List</h1> | ||
<div> | ||
<table class="table table-striped"> | ||
<caption >Current Data Provider List</caption> | ||
<thead> | ||
<tr> | ||
<th scope="col">Name</th> | ||
<th scope="col" >First URL</th> | ||
<th scope="col">Identifier</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr th:each="provider : ${providers}"> | ||
<td th:text="${provider.name}">Name ...</td> | ||
<td><a href="${provider.url}" th:text="${provider.url}">URL ...</a></td> | ||
<td th:text="${provider.identifier}">Identifier ...</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
<script src="webjars/bootstrap/4.0.0/js/bootstrap.min.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters