Commit 31895628 authored by Maxym Borodenko's avatar Maxym Borodenko

Admin action: relink dataset accessions

parent 2c057440
......@@ -28,6 +28,7 @@ import javax.persistence.PersistenceContext;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.lang.time.StopWatch;
import org.genesys.catalog.service.DatasetService;
import org.genesys2.server.persistence.AccessionRepository;
import org.genesys2.server.service.ContentService;
import org.genesys2.server.service.CountryNamesUpdater;
......@@ -94,6 +95,9 @@ public class AdminController {
@Autowired
private CropService cropService;
@Autowired
private DatasetService datasetService;
@PersistenceContext
private EntityManager entityManager;
......@@ -154,6 +158,12 @@ public class AdminController {
return "redirect:/admin/";
}
@RequestMapping(method = RequestMethod.POST, value = "/relinkDatasetAccessions")
public String rematchDatasetAccessions() {
datasetService.rematchDatasetAccessions();
return "redirect:/admin/";
}
@RequestMapping(method = RequestMethod.POST, value = "/updateSGSV")
public String updateSGSV() {
sgsvUpdater.updateSGSV();
......
......@@ -30,7 +30,6 @@ import org.genesys.catalog.persistence.PartnerRepository;
import org.genesys.catalog.persistence.dataset.DatasetRepository;
import org.genesys.catalog.persistence.traits.DescriptorListRepository;
import org.genesys.catalog.persistence.traits.DescriptorRepository;
import org.genesys.catalog.service.DatasetService;
import org.genesys2.server.model.UserRole;
import org.genesys2.server.model.impl.User;
import org.genesys2.server.persistence.UserRepository;
......@@ -111,11 +110,9 @@ public class ApplicationStartup implements InitializingBean, ApplicationListener
*/
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
rematchDatasetAccessions();
aclService.cleanupAcl();
if (reindexElastic) {
if (reindexElastic) {
reindexElasticsearch();
}
}
......@@ -133,7 +130,6 @@ public class ApplicationStartup implements InitializingBean, ApplicationListener
ensure1OAuthClient();
}
@Autowired
private PasswordEncoder passwordEncoder;
......@@ -205,8 +201,6 @@ public class ApplicationStartup implements InitializingBean, ApplicationListener
// aclService.removeAclAwareModel(descriptor));
descriptorRepository.findAll().stream().forEach(descriptor -> aclService.addCreatorPermissions(descriptor));
}
@Autowired
private ElasticsearchService elasticsearch;
......@@ -217,12 +211,4 @@ public class ApplicationStartup implements InitializingBean, ApplicationListener
private void reindexElasticsearch() {
elasticsearch.reindexAll();
}
@Autowired
private DatasetService datasetService;
private void rematchDatasetAccessions() {
datasetService.rematchDatasetAccessions();
}
}
......@@ -87,6 +87,14 @@
<!-- CSRF protection -->
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
</form>
<h3>Dataset</h3>
<form method="post" action="<c:url value="/admin/relinkDatasetAccessions" />">
<input type="submit" class="btn btn-default" class="btn btn-default" value="Relink dataset accessions" />
<!-- CSRF protection -->
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
</form>
<h3>C&amp;E</h3>
<form method="post" action="<c:url value="/admin/refreshMetadataMethods" />">
<input type="submit" class="btn btn-default" class="btn btn-default" value="Recalculate metadata methods" />
......
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