Removed document controllers and KustvaktResource.
Change-Id: I5347a3d68a3d4f09debe6bca850523c9f148062f
diff --git a/core/Changes b/core/Changes
index d312b29..eb77c1b 100644
--- a/core/Changes
+++ b/core/Changes
@@ -1,11 +1,21 @@
version 0.61.4
-30/11/2018
+14/11/2018
- Integrated lite and full services and controllers in core (margaretha)
+29/11/2018
+ - Added OAuth2 scope for listing user clients (margaretha)
+30/11/2018
- Updated sample-index to Krill v0.58.1 (diewald)
+06/12/2018
+ - Fixed KoralNode at method (margaretha)
+11/12/2018
+ - Removed document controllers and KustvaktResource (margaretha)
version 0.61.3
22/10/2018
- Updated jetty, spring and hibernate versions (margaretha)
+13/11/2018
+ - Moved secureRandomAlgorithm and messageDigestAlgorithm configuration
+ to full (margaretha)
version 0.61.2
12/09/2018
@@ -13,9 +23,17 @@
13/09/2018
- Updated KoralNode and enforced order of RewriteTask (margaretha)
14/09/2018
- - Added a status code for nonunique results (margaretha)
+ - Added a status code for non-unique results (margaretha)
+19/09/2018
+ - Updated supported version configuration (margaretha)
+22/10/2018
+ - Updated spring, jetty and hibernate versions (margaretha)
+24/10/2018
+ - Moved license regex configuration to full (margaretha)
+ - Added defaultRewriteConstraints (margaretha)
29/10/2018
- - Added javax.servlet-api
+ - Added javax.servlet-api (margaretha)
+ - Updated koral version (margaretha)
version 0.61.1
28/08/2018
diff --git a/core/src/main/java/de/ids_mannheim/korap/config/ContextHolder.java b/core/src/main/java/de/ids_mannheim/korap/config/ContextHolder.java
index 5b716a6..9205c54 100644
--- a/core/src/main/java/de/ids_mannheim/korap/config/ContextHolder.java
+++ b/core/src/main/java/de/ids_mannheim/korap/config/ContextHolder.java
@@ -10,7 +10,6 @@
import de.ids_mannheim.korap.interfaces.ValidatorIface;
import de.ids_mannheim.korap.interfaces.db.AuditingIface;
import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
-import de.ids_mannheim.korap.interfaces.db.ResourceOperationIface;
import de.ids_mannheim.korap.interfaces.db.UserDataDbIface;
import de.ids_mannheim.korap.interfaces.defaults.ApacheValidator;
import de.ids_mannheim.korap.web.CoreResponseHandler;
@@ -94,31 +93,6 @@
return getBean(KUSTVAKT_USERDATA);
}
-
-// public EncryptionIface getEncryption () {
-// return getBean(KUSTVAKT_ENCRYPTION);
-// }
-
-
-// public AuthenticationManagerIface getAuthenticationManager () {
-// return getBean(KUSTVAKT_AUTHENTICATION_MANAGER);
-// }
-
-
-// public EntityHandlerIface getUserDBHandler () {
-// return getBean(KUSTVAKT_USERDB);
-// }
-
-// public Collection<AuthenticationIface> getAuthProviders () {
-// return getBean(KUSTVAKT_AUTHPROVIDERS);
-// }
-
-
- public Collection<ResourceOperationIface> getResourceProviders () {
- return getBean(KUSTVAKT_RESOURCES);
- }
-
-
public ValidatorIface getValidator() {
try {
return new ApacheValidator();
diff --git a/core/src/main/java/de/ids_mannheim/korap/interfaces/db/ResourceOperationIface.java b/core/src/main/java/de/ids_mannheim/korap/interfaces/db/ResourceOperationIface.java
deleted file mode 100644
index c27f3b6..0000000
--- a/core/src/main/java/de/ids_mannheim/korap/interfaces/db/ResourceOperationIface.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package de.ids_mannheim.korap.interfaces.db;
-
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.interfaces.KustvaktBaseDaoInterface;
-import de.ids_mannheim.korap.interfaces.KustvaktTypeInterface;
-import de.ids_mannheim.korap.resources.KustvaktResource;
-import de.ids_mannheim.korap.user.User;
-
-import java.util.Collection;
-import java.util.List;
-
-// todo: for transaction to work this should go into core module!?!
-// todo: user instance only required for auditing pointcut operations
-public interface ResourceOperationIface<T extends KustvaktResource> extends
- KustvaktTypeInterface<T>, KustvaktBaseDaoInterface {
-
- <T extends KustvaktResource> T findbyId (String id, User user)
- throws KustvaktException;
-
-
- <T extends KustvaktResource> T findbyId (Integer id, User user)
- throws KustvaktException;
-
-
- // todo: regex should be considered here to consider determination of partial id offset information
- <T extends KustvaktResource> List<T> findbyPartialId (String id, User user)
- throws KustvaktException;
-
-
- List<T> getResources (Collection<Object> ids, User user)
- throws KustvaktException;
-
-
- int updateResource (T resource, User user) throws KustvaktException;
-
-
- int[] updateResources (List<T> resources, User user)
- throws KustvaktException;
-
-
- /**
- * store a resource and return the id of the inserted value
- *
- * @param resource
- * @return
- * @throws KustvaktException
- */
- int storeResource (T resource, User user) throws KustvaktException;
-
-
- // public void deleteResource(Integer id, User user) throws KorAPException;
- int deleteResource (String id, User user) throws KustvaktException;
-}
diff --git a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/DocMatchRewrite.java b/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/DocMatchRewrite.java
deleted file mode 100644
index 8cfebc8..0000000
--- a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/DocMatchRewrite.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package de.ids_mannheim.korap.resource.rewrite;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import de.ids_mannheim.korap.config.*;
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.interfaces.db.ResourceOperationIface;
-import de.ids_mannheim.korap.resources.Document;
-import de.ids_mannheim.korap.user.User;
-
-/**
- * @author hanl
- * @date 12/11/2015
- */
-//todo : test
-public class DocMatchRewrite extends KustvaktCacheable implements RewriteTask.IterableRewritePath,
- BeanInjectable {
-
- private ResourceOperationIface<Document> docDao;
-
- public DocMatchRewrite () {
- super("documents", "key:doc");
- }
-
-
- @Override
- public void insertBeans (ContextHolder beans) {
- this.docDao = BeansFactory.getTypeFactory().getTypeInterfaceBean(
- beans.getResourceProviders(), Document.class);
- }
-
-
- //todo: benchmark: see if retrieval and and get docs for all ids at once is better --> outside this rewrite handler
- @Override
- public JsonNode rewriteResult (KoralNode node) throws KustvaktException {
- Document doc;
- if (this.docDao == null)
- throw new RuntimeException("Document dao must be set!");
-
- if (node.has(Attributes.TEXT_SIGLE)) {
- String textSigle = node.get(Attributes.TEXT_SIGLE);
- Object o = this.getCacheValue(textSigle);
- if (o == null) {
- doc = docDao.findbyId(textSigle, null);
- if (doc != null)
- this.storeInCache(textSigle, doc);
- }
- else
- doc = (Document) o;
-
- if (doc != null && doc.isDisabled())
- node.removeNode(new KoralNode.RewriteIdentifier(
- Attributes.TEXT_SIGLE, doc.getPersistentID()));
- }
- return node.rawNode();
- }
-
-
- @Override
- public String path () {
- return "matches";
- }
-
-
- @Override
- public JsonNode rewriteQuery (KoralNode node, KustvaktConfiguration config,
- User user) {
- return null;
- }
-}
diff --git a/core/src/main/java/de/ids_mannheim/korap/resources/Document.java b/core/src/main/java/de/ids_mannheim/korap/resources/Document.java
deleted file mode 100644
index 20f6be8..0000000
--- a/core/src/main/java/de/ids_mannheim/korap/resources/Document.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package de.ids_mannheim.korap.resources;
-
-
-import de.ids_mannheim.korap.utils.StringUtils;
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * @author hanl
- * @date 05/11/2014
- */
-// todo: distinguish between document and text!
-@Getter
-@Setter
-public class Document extends KustvaktResource {
-
- private String corpus;
- private boolean disabled;
- private String docSigle;
-
-
- public Document (String textSigle) {
- this.setPersistentID(textSigle);
- this.docSigle = StringUtils.getDocSigle(textSigle);
- this.corpus = StringUtils.getCorpusSigle(textSigle);
- }
-
-
- public Document (String docSigle, String textSigle) {
- this.setId(-1);
- this.setPersistentID(textSigle);
- this.docSigle = docSigle;
- this.corpus = StringUtils.getCorpusSigle(textSigle);
- this.setDisabled(true);
- }
-
-
- public Document (String docsigle, String textSigle, boolean disabled) {
- this(docsigle, textSigle);
- this.setDisabled(disabled);
- }
-
-
- public boolean isText () {
- return this.getPersistentID().contains(".");
- }
-
-
- @Override
- public String toString () {
- return "Document{" + "id='" + this.getId() + "'" + "persistentid='"
- + this.getPersistentID() + "'" + "corpus='" + corpus + '\''
- + ", disabled=" + disabled + '}';
- }
-
-
- @Override
- public boolean equals (Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
-
- Document document = (Document) o;
-
- if (disabled != document.disabled)
- return false;
- if (!getPersistentID().equals(document.getPersistentID()))
- return false;
-
- return true;
- }
-
-
- @Override
- public int hashCode () {
- int result = getPersistentID().hashCode();
- result = 31 * result + (disabled ? 1 : 0);
- return result;
- }
-}
diff --git a/core/src/main/java/de/ids_mannheim/korap/resources/KustvaktResource.java b/core/src/main/java/de/ids_mannheim/korap/resources/KustvaktResource.java
deleted file mode 100644
index 90e294d..0000000
--- a/core/src/main/java/de/ids_mannheim/korap/resources/KustvaktResource.java
+++ /dev/null
@@ -1,245 +0,0 @@
-package de.ids_mannheim.korap.resources;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.joda.time.DateTime;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.databind.JsonNode;
-
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.utils.JsonUtils;
-import de.ids_mannheim.korap.utils.TimeUtils;
-import lombok.AccessLevel;
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * Created by hanl on 5/21/14.
- */
-@Getter
-@Setter
-public abstract class KustvaktResource {
-
- @JsonIgnore
- private Integer id;
- private String persistentID;
- private String name;
- private String description;
- // todo: manage creator over policies!
-
- // @JsonIgnore
- // @Deprecated
- // private Integer owner;
- protected long created;
- @Deprecated
- private boolean managed;
- @Deprecated
- private boolean shared;
- private String path;
- // parents persistentid
- private String parentID;
-
- @Getter(AccessLevel.PROTECTED)
- private Map<String, Object> fields;
-
-
- public KustvaktResource () {
- this.created = TimeUtils.getNow().getMillis();
- this.id = -1;
- this.parentID = null;
- this.fields = new HashMap<>();
- }
-
-
- public KustvaktResource (Integer id) {
- this.created = TimeUtils.getNow().getMillis();
- this.id = id;
- this.parentID = null;
- this.fields = new HashMap<>();
- }
-
-
- // todo: move creator to builder instance for policies
- public KustvaktResource (String persistentID) {
- this();
- this.persistentID = persistentID;
- }
-
-
- // public void setData(int type, Object data) {
- // this.data = new Object[2];
- // this.data[0] = type;
- // this.data[1] = data;
- // }
-
- // public int getDataType() {
- // return this.data != null ? (int) this.data[0] : -1;
- // }
-
- public void addField (String key, Object value) {
- this.fields.put(key, value);
- }
-
-
- public void setFields (Map<String, Object> fields) {
- this.fields = fields;
- }
-
-
- public void setFields (String fields) {
- Map s = null;
- try {
- s = JsonUtils.convertToClass(fields, Map.class);
- }
- catch (KustvaktException e) {
- throw new RuntimeException(
- "Fields could not be read for resource '" + persistentID
- + "'!");
- }
- this.fields = s;
- }
-
-
- public Object getField (String key) {
- return this.fields.get(key);
- }
-
-
- public JsonNode getData () {
- return JsonUtils.valueToTree(this.fields);
- }
-
-
- public String getStringData () throws KustvaktException {
- return JsonUtils.toJSON(this.fields);
- }
-
-
- @Override
- public boolean equals (Object other) {
- return other instanceof KustvaktResource
- && this.id.equals(((KustvaktResource) other).getId());
- }
-
-
- @Override
- public int hashCode () {
- int result = id.hashCode();
- return result;
- }
-
-
- /**
- * Merges another resource with this resource instance
- * Every implementation of KorAPResource should override this
- * method!
- *
- * @param other
- */
- public void merge (KustvaktResource other) {
- if (other == null)
- return;
-
- this.setId(this.getId() == null || this.getId() == -1 ? other.getId()
- : other.getId());
- this.setPersistentID(this.getPersistentID() == null ? other
- .getPersistentID() : this.getPersistentID());
- this.setName(this.getName() == null || this.getName().isEmpty() ? other
- .getName() : this.getName());
- this.setDescription(this.getDescription() == null
- || this.getDescription().isEmpty() ? other.getDescription()
- : this.getDescription());
- this.setCreated(this.getCreated() < other.getCreated() ? this
- .getCreated() : other.getCreated());
- this.setPath(this.getPath() == null ? other.getPath() : this.getPath());
- // this.setOwner(
- // this.getOwner() == null ? other.getOwner() : this.getOwner());
- // this.setManaged(
- // !this.isManaged() ? other.isManaged() : this.isManaged());
- // this.setShared(!this.isShared() ? other.isShared() : this.isShared());
- }
-
-
- /**
- * Checks this instance for null parameter and replaces them with
- * default values.
- * Every implementation of KorAPResource should override this
- * method!
- *
- * @return
- */
- public void checkNull () {
- setCreated(this.getCreated() == 0L ? TimeUtils.getNow().getMillis()
- : this.getCreated());
- setName(this.getName() == null ? "" : this.getName());
- }
-
-
- /**
- * this method is used to return field information about the class
- * All subclasses should override this method
- *
- * @return
- */
- public Map toMap () {
- Map m = new HashMap();
- m.put("id", persistentID);
- m.put("name", name);
- //todo: fix!
- // m.put("path", path);
- m.put("description", description);
- m.put("created", TimeUtils.format(new DateTime(created)));
- m.put("data", this.fields);
- // deprecated
- // todo:
- // m.put("managed", managed);
- // m.put("shared", shared);
- return m;
- }
-
-
- @Override
- public String toString () {
- return "Resource{" + "id='" + id + '\'' + "persistentID='"
- + persistentID + '\'' + ", name='" + name + '\'' + ", created="
- + created + ", path=" + path + '}';
- }
-
- //fixme: make private in respective areas
- @Getter
- public static class Container {
- private final Class type;
- private final String persistentID;
- private final boolean set;
-
-
- public Container (String persistentID, Class type) {
- this.type = type;
- this.set = true;
- this.persistentID = persistentID;
- }
-
-
- public Container (Class type) {
- this.type = type;
- this.set = true;
- this.persistentID = null;
- }
-
-
- public Container () {
- this.set = false;
- this.type = null;
- this.persistentID = null;
- }
-
-
- @Override
- public String toString () {
- return persistentID + "@" + type.getSimpleName();
- }
- }
-
-}