Skip to content

Commit

Permalink
Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-stastny committed Feb 11, 2025
1 parent eadffee commit 183964f
Show file tree
Hide file tree
Showing 8 changed files with 417 additions and 398 deletions.

This file was deleted.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ public interface ReharvestManager {
* Registers a new reharvest item.
*
* @param item The ReharvestItem to be registered.
* @param registerIfAlreadyExists TA flag indicating whether registration is allowed if the PID is already in the reharvesting list.
* @throws AlreadyRegistedPidsException If the PID is already registered.
*/
public void register(ReharvestItem item) throws AlreadyRegistedPidsException;
public void register(ReharvestItem item, boolean registerIfAlreadyExists ) throws AlreadyRegistedPidsException;

/**
* Updates an existing reharvest item.
Expand Down

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ public SolrReharvestManagerImpl() {
}

@Override
public void register(ReharvestItem item) throws AlreadyRegistedPidsException {
public void register(ReharvestItem item, boolean registerIfAlreadyExists ) throws AlreadyRegistedPidsException {
try {
String reharvest = KConfiguration.getInstance().getSolrReharvestHost();
List<String> pids = findAllRegistredPids(reharvest);
if (!pids.contains(item.getPid())) {
if (!pids.contains(item.getPid()) || registerIfAlreadyExists ) {
WebResource updateResource = this.client.resource(reharvest + "/update/json/docs?split=/&commit=true");
String updated = updateResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON)
.entity(item.toJSON().toString(), MediaType.APPLICATION_JSON).post(String.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public Response buildForwardResponseGET(String url, String pid, boolean deleteTr

public Response buildForwardResponseGET(String url, String mimetype, String pid, boolean deleteTrigger, boolean shibHeaders)
throws ProxyHandlerException {
// tady se konstruuje klient, predavaji se hlavicky
WebResource.Builder b = buidForwardResponse(url, shibHeaders);
ClientResponse response =null;
try {
Expand Down Expand Up @@ -328,7 +329,7 @@ public boolean acceptElement(Element element) {
reharvestItem.setLibraries(new ArrayList<>( map.keySet()) );
//reharvestItem.setLibraries(pair.getRight());
reharvestItem.setState("waiting_for_approve");
this.reharvestManager.register(reharvestItem);
this.reharvestManager.register(reharvestItem,false);
}
} catch (DOMException e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
Expand Down Expand Up @@ -409,6 +410,7 @@ protected WebResource.Builder buidForwardResponse(String url, boolean headers) {
header = prefixHeaders + header;
}


LOGGER.fine(String.format("Requesting %s", url));
WebResource r = client.resource(url);
if (headers) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,38 +1,24 @@
package cz.incad.kramerius.rest.apiNew.client.v70.filter;

import static org.easymock.EasyMock.createMockBuilder;

import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Stack;
import java.util.stream.Collectors;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;

import org.apache.commons.io.IOUtils;
import org.easymock.EasyMock;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;

import cz.incad.kramerius.rest.apiNew.admin.v70.reharvest.ReharvestManager;
import cz.incad.kramerius.rest.apiNew.admin.v70.reharvest.impl.MemoryReharvestManagerImpl;
import cz.incad.kramerius.rest.apiNew.client.v70.libs.OneInstance;
import cz.incad.kramerius.rest.apiNew.client.v70.libs.OneInstance.TypeOfChangedStatus;
import cz.incad.kramerius.rest.apiNew.client.v70.libs.properties.DefaultOnePropertiesInstance;
import cz.incad.kramerius.rest.apiNew.client.v70.libs.properties.DefaultPropertiesInstances;
import cz.incad.kramerius.utils.XMLUtils;


Expand Down

0 comments on commit 183964f

Please sign in to comment.