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();
-        }
-    }
-
-}
diff --git a/full/Changes b/full/Changes
index 65b5d4c..49d53bd 100644
--- a/full/Changes
+++ b/full/Changes
@@ -16,6 +16,8 @@
 11/12/2018
    - Implemented revoking all tokens of a user client via a super client
    (margaretha)   
+   - Removed document controllers and KustvaktResource (margaretha)
+
    
 # version 0.61.3
 17/10/2018
diff --git a/full/src/main/java/de/ids_mannheim/korap/cache/ResourceCache.java b/full/src/main/java/de/ids_mannheim/korap/cache/ResourceCache.java
deleted file mode 100644
index 45f0ce7..0000000
--- a/full/src/main/java/de/ids_mannheim/korap/cache/ResourceCache.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package de.ids_mannheim.korap.cache;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-import de.ids_mannheim.korap.config.KustvaktCacheable;
-import de.ids_mannheim.korap.resources.KustvaktResource;
-import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.Element;
-
-/**
- * @author hanl
- * @date 23/03/2014
- * 
- * @author margaretha
- * @date 01/03/2018
- * 
- * EM: removed resource related code, keep cache
- */
-
-//todo: use interface (maybe a cachable interface?) and bean instanceing
-// todo: if cachable, data integrity needs to be checked! either remove caching or check integrity!
-@SuppressWarnings("all")
-public class ResourceCache extends KustvaktCacheable {
-
-    private static Logger jlog = LogManager.getLogger(ResourceCache.class);
-
-    public ResourceCache () {
-        super("resources", "key:resources");
-    }
-
-
-    @Deprecated
-    public <T extends KustvaktResource> T getCache (Object id, Class<T> cz) {
-        Element e = CacheManager.getInstance().getCache("resources").get(id);
-        if (e != null)
-            return (T) e.getObjectValue();
-        else
-            return null;
-    }
-
-
-    @Deprecated
-    public <R extends KustvaktResource> void cache (R resource) {
-        CacheManager.getInstance().getCache("resources")
-                .put(new Element(resource.getPersistentID(), resource));
-    }
-}
diff --git a/full/src/main/java/de/ids_mannheim/korap/handlers/DocumentDao.java b/full/src/main/java/de/ids_mannheim/korap/handlers/DocumentDao.java
deleted file mode 100644
index 9cdc277..0000000
--- a/full/src/main/java/de/ids_mannheim/korap/handlers/DocumentDao.java
+++ /dev/null
@@ -1,296 +0,0 @@
-package de.ids_mannheim.korap.handlers;
-
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.exceptions.StatusCodes;
-import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
-import de.ids_mannheim.korap.interfaces.db.ResourceOperationIface;
-import de.ids_mannheim.korap.resources.Document;
-import de.ids_mannheim.korap.resources.KustvaktResource;
-import de.ids_mannheim.korap.user.User;
-import de.ids_mannheim.korap.utils.BooleanUtils;
-import de.ids_mannheim.korap.utils.StringUtils;
-import edu.emory.mathcs.backport.java.util.Collections;
-import org.springframework.dao.DataAccessException;
-import org.springframework.dao.EmptyResultDataAccessException;
-import org.springframework.jdbc.core.RowMapper;
-import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
-import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
-
-import javax.print.Doc;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author hanl
- * @date 05/11/2014
- */
-// todo: error handling
-@Deprecated
-public class DocumentDao implements ResourceOperationIface<Document> {
-
-    private NamedParameterJdbcTemplate jdbcTemplate;
-
-
-    public DocumentDao (PersistenceClient client) {
-        this.jdbcTemplate = (NamedParameterJdbcTemplate) client.getSource();
-    }
-
-
-    @Override
-    public Document findbyId (Integer id, User user) throws KustvaktException {
-        MapSqlParameterSource s = new MapSqlParameterSource();
-        s.addValue("id", id);
-        String sql = "select id, persistent_id, disabled, strftime('%s', created) as created from doc_store where id=:id";
-        try {
-            return this.jdbcTemplate.queryForObject(sql, s,
-                    new RowMapper<Document>() {
-                        @Override
-                        public Document mapRow (ResultSet rs, int rowNum)
-                                throws SQLException {
-                            Document doc = null;
-                            if (!rs.isClosed()) {
-                                String s = rs.getString("persistent_id");
-                                System.out.println("VALUE IS " + s);
-                                doc = new Document(rs
-                                        .getString("persistent_id"));
-                                doc.setId(rs.getInt("id"));
-                                doc.setCreated(rs.getTimestamp("created")
-                                        .getTime());
-                                doc.setDisabled(rs.getBoolean("disabled"));
-                            }
-
-                            return doc;
-                        }
-                    });
-        }
-        catch (DataAccessException e) {
-            throw new KustvaktException(StatusCodes.CONNECTION_ERROR);
-        }
-    }
-
-
-    // todo: search for partial matches if entire document is disabled
-    // document id, consisting of corpus sigle, substring key and text number
-    @Override
-    public Document findbyId (String id, User user) throws KustvaktException {
-        MapSqlParameterSource s = new MapSqlParameterSource();
-        s.addValue("id", id);
-        s.addValue("docSigle", StringUtils.getDocSigle(id));
-
-        String sql = "select id, persistent_id, disabled, created from doc_store where persistent_id=:id or persistent_id like :docSigle;";
-        try {
-            return this.jdbcTemplate.queryForObject(sql, s,
-                    new RowMapper<Document>() {
-                        @Override
-                        public Document mapRow (ResultSet rs, int rowNum)
-                                throws SQLException {
-                            Document doc = null;
-                            if (!rs.isClosed()) {
-                                doc = new Document(rs
-                                        .getString("persistent_id"));
-                                doc.setId(rs.getInt("id"));
-                                doc.setCreated(rs.getLong("created"));
-                                doc.setDisabled(rs.getBoolean("disabled"));
-                            }
-
-                            return doc;
-                        }
-                    });
-        }
-        catch (EmptyResultDataAccessException em) {
-            return null;
-        }
-        catch (DataAccessException e) {
-            throw new KustvaktException(StatusCodes.CONNECTION_ERROR);
-        }
-    }
-
-
-    @Override
-    public List<Document> findbyPartialId (String id, User user)
-            throws KustvaktException {
-        MapSqlParameterSource s = new MapSqlParameterSource();
-        s.addValue("id", id + "%");
-
-        String sql = "select id, persistent_id, disabled, created from doc_store where persistent_id like :id;";
-        try {
-            return this.jdbcTemplate.query(sql, s, new RowMapper<Document>() {
-                @Override
-                public Document mapRow (ResultSet rs, int rowNum)
-                        throws SQLException {
-                    Document doc = null;
-                    if (!rs.isClosed()) {
-                        doc = new Document(rs.getString("persistent_id"));
-                        doc.setId(rs.getInt("id"));
-                        doc.setCreated(rs.getLong("created"));
-                        doc.setDisabled(rs.getBoolean("disabled"));
-                    }
-
-                    return doc;
-                }
-            });
-        }
-        catch (EmptyResultDataAccessException em) {
-            return null;
-        }
-        catch (DataAccessException e) {
-            e.printStackTrace();
-            throw new KustvaktException(StatusCodes.CONNECTION_ERROR);
-        }
-    }
-
-
-    //todo:
-    @Override
-    public List<Document> getResources (Collection<Object> ids, User user)
-            throws KustvaktException {
-        return null;
-    }
-
-
-    @Override
-    public int updateResource (Document document, User user)
-            throws KustvaktException {
-        MapSqlParameterSource source = new MapSqlParameterSource();
-        source.addValue("pid", document.getPersistentID());
-        source.addValue("dis", BooleanUtils.getBoolean(document.isDisabled()));
-        final String sql = "UPDATE doc_store set disabled=:dis where persistent_id=:pid;";
-        try {
-            return this.jdbcTemplate.update(sql, source);
-        }
-        catch (DataAccessException e) {
-            throw new KustvaktException(StatusCodes.CONNECTION_ERROR);
-        }
-    }
-
-
-    @Override
-    public int[] updateResources (List<Document> resources, User user)
-            throws KustvaktException {
-        return new int[0];
-    }
-
-
-    //todo: remove and introduce partial match search of persistent id!
-    @Deprecated
-    public List<Document> findbyCorpus (String corpus, int offset, int index)
-            throws KustvaktException {
-        MapSqlParameterSource source = new MapSqlParameterSource();
-        source.addValue("corpus", corpus + "%");
-        source.addValue("offset", (offset * index));
-        source.addValue("limit", offset);
-        final String sql = "select id, persistent_id, disabled, created from doc_store where (persistent_id like :corpus) limit :offset, :limit";
-        try {
-            return this.jdbcTemplate.query(sql, source,
-                    new RowMapper<Document>() {
-                        @Override
-                        public Document mapRow (ResultSet rs, int rowNum)
-                                throws SQLException {
-                            // todo: test on empty/closed resultset!
-                            if (!rs.isClosed()) {
-                                Document doc = new Document(rs
-                                        .getString("persistent_id"));
-                                doc.setId(rs.getInt("id"));
-                                doc.setCreated(rs.getTimestamp("created")
-                                        .getTime());
-                                doc.setDisabled(rs.getBoolean("disabled"));
-                                return doc;
-                            }
-                            return null;
-                        }
-                    });
-        }
-        catch (EmptyResultDataAccessException em) {
-            em.printStackTrace();
-            return Collections.emptyList();
-        }
-        catch (DataAccessException e) {
-            throw new KustvaktException(StatusCodes.CONNECTION_ERROR);
-        }
-    }
-
-
-    @Deprecated
-    public List<String> findbyCorpus (String corpus, boolean disabled)
-            throws KustvaktException {
-        MapSqlParameterSource s = new MapSqlParameterSource();
-        s.addValue("corpus", corpus + "%");
-        s.addValue("dis", BooleanUtils.getBoolean(disabled));
-        String sql = "SELECT persistent_id FROM doc_store WHERE (persistent_id like :corpus) AND disabled=:dis;";
-        try {
-            return this.jdbcTemplate.queryForList(sql, s, String.class);
-        }
-        catch (EmptyResultDataAccessException em) {
-            em.printStackTrace();
-            return Collections.emptyList();
-        }
-        catch (DataAccessException e) {
-            throw new KustvaktException(StatusCodes.CONNECTION_ERROR);
-        }
-    }
-
-
-    // parent is disabled here
-    @Override
-    public int storeResource (Document resource, User user)
-            throws KustvaktException {
-        MapSqlParameterSource s = new MapSqlParameterSource();
-        s.addValue("id", resource.getPersistentID());
-        s.addValue("corpus", resource.getCorpus());
-        s.addValue("dis", BooleanUtils.getBoolean(resource.isDisabled()));
-
-        String sql = "INSERT INTO doc_store (persistent_id, disabled) VALUES (:id, :dis)";
-        try {
-            return this.jdbcTemplate.update(sql, s);
-        }
-        catch (DataAccessException e) {
-            e.printStackTrace();
-            throw new KustvaktException(StatusCodes.ILLEGAL_ARGUMENT,
-                    "illegal argument given", resource.getPersistentID());
-        }
-    }
-
-
-    @Override
-    public int deleteResource (String id, User user) throws KustvaktException {
-        MapSqlParameterSource s = new MapSqlParameterSource();
-        s.addValue("id", id);
-        String sql = "delete from doc_store where persistent_id=:id;";
-        try {
-            return this.jdbcTemplate.update(sql, s);
-        }
-        catch (DataAccessException e) {
-            throw new KustvaktException(StatusCodes.CONNECTION_ERROR);
-        }
-
-    }
-
-
-    @Override
-    public int size () {
-        return -1;
-    }
-
-
-    @Override
-    public int truncate () {
-        String sql = "delete from doc_store;";
-        try {
-            return this.jdbcTemplate.update(sql, new HashMap<String, Object>());
-        }
-        catch (DataAccessException e) {
-            return -1;
-        }
-    }
-
-
-    @Override
-    public Class<Document> type () {
-        return Document.class;
-    }
-
-}
diff --git a/full/src/main/java/de/ids_mannheim/korap/rewrite/FullRewriteHandler.java b/full/src/main/java/de/ids_mannheim/korap/rewrite/FullRewriteHandler.java
index b18ce0c..f4c2f49 100644
--- a/full/src/main/java/de/ids_mannheim/korap/rewrite/FullRewriteHandler.java
+++ b/full/src/main/java/de/ids_mannheim/korap/rewrite/FullRewriteHandler.java
@@ -4,7 +4,6 @@
 
 import de.ids_mannheim.korap.config.FullConfiguration;
 import de.ids_mannheim.korap.resource.rewrite.CollectionCleanRewrite;
-import de.ids_mannheim.korap.resource.rewrite.DocMatchRewrite;
 // import de.ids_mannheim.korap.resource.rewrite.IdWriter;
 import de.ids_mannheim.korap.resource.rewrite.RewriteHandler;
 
@@ -28,7 +27,6 @@
         this.addProcessor(vcRewrite);
         this.add(CollectionRewrite.class);
         // this.add(IdWriter.class);
-        this.add(DocMatchRewrite.class);
         this.add(CollectionCleanRewrite.class);
     }
 }
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/DocumentController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/DocumentController.java
deleted file mode 100644
index ccd2b6d..0000000
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/DocumentController.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package de.ids_mannheim.korap.web.controller;
-
-import java.util.List;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-
-import com.sun.jersey.spi.container.ResourceFilters;
-
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.handlers.DocumentDao;
-import de.ids_mannheim.korap.resources.Document;
-import de.ids_mannheim.korap.server.KustvaktServer;
-import de.ids_mannheim.korap.utils.JsonUtils;
-import de.ids_mannheim.korap.web.KustvaktResponseHandler;
-import de.ids_mannheim.korap.web.APIVersionFilter;
-import de.ids_mannheim.korap.web.filter.AdminFilter;
-
-/**
- * EM: To Do: restructure codes regarding service and controller layers
- * 
- * @author hanl
- * @date 19/11/2014
- */
-@Deprecated
-@Controller
-@Path("/v0.1/doc")
-@ResourceFilters({APIVersionFilter.class, AdminFilter.class })
-@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
-public class DocumentController {
-
-    @Autowired
-    private KustvaktResponseHandler kustvaktResponseHandler;
-
-    private static Logger jlog =
-            LogManager.getLogger(DocumentController.class);
-    private DocumentDao documentDao;
-
-
-    @POST
-    @Path("{doc}")
-    public Response store (@PathParam("doc") String docid,
-            @QueryParam("disabled") Boolean disabled) {
-        Document doc = new Document(docid);
-        doc.setDisabled(disabled);
-        try {
-            this.documentDao.storeResource(doc, null);
-        }
-        catch (KustvaktException e) {
-            throw kustvaktResponseHandler.throwit(e);
-        }
-        return Response.ok().build();
-    }
-
-
-    //todo: pipe add document to index endpoint
-
-    @GET
-    @Path("{corpus}")
-    public Response get (@PathParam("corpus") String corpus,
-            @QueryParam("index") Integer index,
-            @QueryParam("offset") Integer length) {
-        if (index == null) index = 1;
-        if (length == null) length = 25;
-        try {
-            List docs = this.documentDao.findbyCorpus(corpus, length, index);
-            //todo: serialize to document json
-            return Response.ok(JsonUtils.toJSON(docs)).build();
-        }
-        catch (KustvaktException e) {
-            throw kustvaktResponseHandler.throwit(e);
-        }
-    }
-
-}
diff --git a/full/src/main/resources/default-config.xml b/full/src/main/resources/default-config.xml
index d0c3576..948b2f7 100644
--- a/full/src/main/resources/default-config.xml
+++ b/full/src/main/resources/default-config.xml
@@ -241,10 +241,6 @@
 		<constructor-arg ref="kustvakt_db" />
 	</bean>
 
-	<bean id="document_provider" class="de.ids_mannheim.korap.handlers.DocumentDao">
-		<constructor-arg ref="kustvakt_db" />
-	</bean>
-
 	<bean name="kustvakt_encryption" class="de.ids_mannheim.korap.encryption.KustvaktEncryption">
 		<constructor-arg ref="kustvakt_config" />
 	</bean>
@@ -305,7 +301,6 @@
 
 	<util:list id="kustvakt_resources"
 		value-type="de.ids_mannheim.korap.interfaces.db.ResourceOperationIface">
-		<ref bean="document_provider" />
 	</util:list>
 
 	<!-- specify type for constructor argument -->
diff --git a/full/src/main/resources/lite-config.xml b/full/src/main/resources/lite-config.xml
deleted file mode 100644
index b342c59..0000000
--- a/full/src/main/resources/lite-config.xml
+++ /dev/null
@@ -1,182 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
-	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
-	xsi:schemaLocation="http://www.springframework.org/schema/beans
-           http://www.springframework.org/schema/beans/spring-beans.xsd
-           http://www.springframework.org/schema/tx
-           http://www.springframework.org/schema/tx/spring-tx.xsd
-           http://www.springframework.org/schema/context
-           http://www.springframework.org/schema/context/spring-context.xsd
-           http://www.springframework.org/schema/util
-           http://www.springframework.org/schema/util/spring-util.xsd">
-
-
-	<context:component-scan
-		base-package="de.ids_mannheim.korap.web.filter, de.ids_mannheim.korap.web.utils,
-		de.ids_mannheim.korap.authentication.http" />
-	<context:annotation-config />
-
-	<bean id="placeholders"
-		class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
-		<property name="ignoreResourceNotFound" value="true" />
-		<property name="locations">
-			<array>
-				<value>classpath:properties/lite-jdbc.properties</value>
-				<value>file:./lite-jdbc.properties</value>
-				<value>classpath:properties/hibernate.properties</value>
-				<value>classpath:kustvakt-lite.conf</value>
-				<value>file:./kustvakt-lite.conf</value>
-			</array>
-		</property>
-	</bean>
-
-	<bean id="properties"
-		class="org.springframework.beans.factory.config.PropertiesFactoryBean">
-		<property name="ignoreResourceNotFound" value="true" />
-		<property name="locations">
-			<array>
-				<value>classpath:kustvakt-lite.conf</value>
-				<value>file:./kustvakt-lite.conf</value>
-			</array>
-		</property>
-	</bean>
-
-	<bean id="config" class="de.ids_mannheim.korap.config.KustvaktConfiguration">
-		<constructor-arg index="0" name="properties" ref="properties" />
-	</bean>
-
-	<!-- Database -->
-
-	<bean id="sqliteDataSource"
-		class="org.springframework.jdbc.datasource.SingleConnectionDataSource"
-		lazy-init="true">
-		<property name="driverClassName" value="${jdbc.driverClassName}" />
-		<property name="url" value="${jdbc.url}" />
-		<property name="username" value="${jdbc.username}" />
-		<property name="password" value="${jdbc.password}" />
-		<property name="connectionProperties">
-			<props>
-				<prop key="date_string_format">yyyy-MM-dd HH:mm:ss</prop>
-			</props>
-		</property>
-
-		<!-- relevant for single connection datasource and sqlite -->
-		<property name="suppressClose">
-			<value>true</value>
-		</property>
-		<!--<property name="initialSize" value="2"/> -->
-		<!--<property name="poolPreparedStatements" value="true"/> -->
-	</bean>
-
-	<bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
-		<property name="baselineOnMigrate" value="true" />
-		<!-- <property name="validateOnMigrate" value="false" /> -->
-		<!-- <property name="cleanOnValidationError" value="true" /> -->
-		<property name="locations" value="${jdbc.schemaPath}" />
-		<property name="dataSource" ref="sqliteDataSource" />
-	</bean>
-
-	<bean id="entityManagerFactory"
-		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
-		<property name="dataSource" ref="sqliteDataSource" />
-
-		<property name="packagesToScan">
-			<array>
-				<value>de.ids_mannheim.korap.entity</value>
-				<value>de.ids_mannheim.korap.oauth2.entity</value>
-			</array>
-		</property>
-		<property name="jpaVendorAdapter">
-			<bean id="jpaVendorAdapter"
-				class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
-				<property name="databasePlatform" value="${hibernate.dialect}" />
-			</bean>
-		</property>
-		<property name="jpaProperties">
-			<props>
-				<prop key="hibernate.dialect">${hibernate.dialect}</prop>
-				<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
-				<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
-				<prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop>
-				<prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache}
-				</prop>
-				<prop key="hibernate.cache.provider_class">${hibernate.cache.provider}</prop>
-				<prop key="hibernate.cache.region.factory_class">${hibernate.cache.region.factory}</prop>
-				<prop key="hibernate.jdbc.time_zone">${hibernate.jdbc.time_zone}</prop>
-			</props>
-		</property>
-	</bean>
-	<tx:annotation-driven proxy-target-class="true"
-		transaction-manager="transactionManager" />
-
-	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
-		<property name="entityManagerFactory" ref="entityManagerFactory" />
-	</bean>
-
-	<bean id="transactionTemplate"
-		class="org.springframework.transaction.support.TransactionTemplate">
-		<constructor-arg ref="transactionManager" />
-	</bean>
-	<bean id="txManager"
-		class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
-		<property name="dataSource" ref="sqliteDataSource" />
-	</bean>
-
-	<!-- Initialization -->
-	<bean id="initializator" class="de.ids_mannheim.de.init.LiteInitializatorImpl"
-		init-method="init">
-	</bean>
-	<bean id="annotationParser" class="de.ids_mannheim.korap.annotation.AnnotationParser"
-		scope="singleton" />
-
-	<!-- Krill -->
-	<bean id="search_krill" class="de.ids_mannheim.korap.web.SearchKrill">
-		<constructor-arg value="${krill.indexDir}" />
-	</bean>
-
-	<!-- Filters -->
-	<bean id="APIVersionFilter" class="de.ids_mannheim.korap.web.APIVersionFilter"
-		scope="singleton" />
-
-	<!-- Authentication -->
-	<bean id="authenticationManager"
-		class="de.ids_mannheim.korap.authentication.DummyAuthenticationManager" />
-
-	<!-- Response handler -->
-	<bean id="kustvaktResponseHandler" class="de.ids_mannheim.korap.web.KustvaktResponseHandler">
-		<constructor-arg index="0" name="iface" ref="kustvakt_auditing" />
-	</bean>
-
-	<!-- Controllers -->
-	<bean id="annotationController"
-		class="de.ids_mannheim.korap.web.controller.AnnotationController" />
-	<bean id="searchController" class="de.ids_mannheim.korap.web.controller.SearchController" />
-	<bean id="statisticController"
-		class="de.ids_mannheim.korap.web.controller.StatisticController" />
-
-	<!-- Services -->
-	<bean id="annotationService" class="de.ids_mannheim.korap.service.AnnotationService"></bean>
-	<bean id="scopeService"
-		class="de.ids_mannheim.korap.oauth2.service.DummyOAuth2ScopeServiceImpl" />
-	<bean id="searchService" class="de.ids_mannheim.korap.service.SearchService"></bean>
-
-	<!-- DAO -->
-	<bean id="adminDao" class="de.ids_mannheim.korap.dao.DummyAdminDaoImpl" />
-	<bean id="annotationDao" class="de.ids_mannheim.korap.dao.AnnotationDao" />
-
-	<!-- DTO Converter -->
-	<bean id="annotationConverter" class="de.ids_mannheim.korap.dto.converter.AnnotationConverter" />
-
-	<!-- Rewrite -->
-	<bean id="rewriteHandler" class="de.ids_mannheim.korap.resource.rewrite.RewriteHandler">
-		<constructor-arg ref="config" />
-	</bean>
-
-
-
-	<bean id="kustvakt_auditing"
-		class="de.ids_mannheim.korap.interfaces.defaults.DefaultAuditing">
-	</bean>
-
-</beans>
\ No newline at end of file
diff --git a/full/src/test/java/de/ids_mannheim/korap/config/TestBeans.java b/full/src/test/java/de/ids_mannheim/korap/config/TestBeans.java
index bb1923d..7994ef5 100644
--- a/full/src/test/java/de/ids_mannheim/korap/config/TestBeans.java
+++ b/full/src/test/java/de/ids_mannheim/korap/config/TestBeans.java
@@ -6,7 +6,6 @@
 import de.ids_mannheim.korap.interfaces.EncryptionIface;
 import de.ids_mannheim.korap.interfaces.EntityHandlerIface;
 import de.ids_mannheim.korap.interfaces.db.AuditingIface;
-import de.ids_mannheim.korap.interfaces.db.ResourceOperationIface;
 import de.ids_mannheim.korap.interfaces.db.UserDataDbIface;
 
 /**
@@ -21,8 +20,6 @@
 	
 	public  AuditingIface getAuditingDao();
 
-	public  List<ResourceOperationIface> getResourceDaos();
-
 	public  List<UserDataDbIface> getUserdataDaos();
 
 	public  EncryptionIface getCrypto();
diff --git a/full/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java b/full/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java
deleted file mode 100644
index c19e0dc..0000000
--- a/full/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package de.ids_mannheim.korap.handlers;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import de.ids_mannheim.korap.config.BeanConfigTest;
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.resources.Document;
-
-/**
- * @author hanl
- * @date 12/11/2015
- */
-@Ignore
-@Deprecated
-public class DocumentDaoTest extends BeanConfigTest {
-
-    @Autowired
-    private DocumentDao dao;
-
-
-    @After
-    public void clear () {
-        dao.truncate();
-    }
-
-
-    @Test
-    public void testSet () throws KustvaktException {
-        Document doc = new Document("BRZ13_APR.00001");
-        doc.setDisabled(true);
-        dao.storeResource(doc, null);
-    }
-
-
-    @Test
-    public void testGet () throws KustvaktException {
-        Document doc = new Document("BRZ13_APR.00002");
-        doc.setDisabled(true);
-        dao.storeResource(doc, null);
-        Document doc1 = dao.findbyId(doc.getPersistentID(), null);
-        assertNotNull(doc1);
-        assertTrue(doc.isDisabled());
-    }
-
-
-    @Test
-    public void testRemove () throws KustvaktException {
-        Document doc = new Document("BRZ13_APR.00003");
-        doc.setDisabled(true);
-        dao.storeResource(doc, null);
-        Document doc1 = dao.findbyId(doc.getPersistentID(), null);
-        assertEquals(1, dao.deleteResource(doc.getPersistentID(), null));
-        doc1 = dao.findbyId(doc.getPersistentID(), null);
-        Assert.assertNull(doc1);
-    }
-
-
-    @Test
-    public void testEmptyFind () throws KustvaktException {
-        List<String> dc = dao.findbyCorpus("WPD", true);
-        assertNotNull(dc);
-        assertEquals("should be empty", 0, dc.size());
-    }
-
-
-    @Test
-    public void testFindText () throws KustvaktException {
-        int length = 10;
-        for (int i = 0; i < length; i++) {
-            Document doc = new Document("WPD_APR.0000" + i);
-            doc.setDisabled(true);
-            dao.storeResource(doc, null);
-        }
-        List<String> dc = dao.findbyCorpus("WPD", true);
-
-        assertNotNull(dc);
-        assertNotSame("should not be empty", 0, dc.size());
-        assertEquals("not all found", length, dc.size());
-    }
-
-
-    @Test
-    public void testFindDocByText () throws KustvaktException {
-        Document doc = new Document("WPD_AAA", "WPD_AAA.02439");
-        doc.setDisabled(true);
-        dao.storeResource(doc, null);
-
-        Document dfind = dao.findbyId(doc.getPersistentID(), null);
-        assertNotNull(dfind);
-        assertEquals(doc.getPersistentID(), dfind.getPersistentID());
-    }
-
-
-    @Test
-    public void testFindDocByPartial () throws KustvaktException {
-        Document doc = new Document("WPD_AAA.02439");
-        doc.setDisabled(true);
-        Document doc1 = new Document("WPD_AAA.02343");
-        dao.storeResource(doc, null);
-        dao.storeResource(doc1, null);
-
-        List<Document> dfind = dao.findbyPartialId(doc.getDocSigle(), null);
-        assertNotNull(dfind);
-        assertNotEquals(0, dfind.size());
-        assertEquals(2, dfind.size());
-        assertEquals(doc.getDocSigle(), dfind.get(0).getDocSigle());
-
-        dfind = dao.findbyPartialId(doc.getCorpus(), null);
-        assertNotNull(dfind);
-        assertNotEquals(0, dfind.size());
-        assertEquals(2, dfind.size());
-        assertEquals(doc.getDocSigle(), dfind.get(0).getDocSigle());
-    }
-
-
-    @Override
-    public void initMethod () throws KustvaktException {
-        dao = new DocumentDao(helper().getContext().getPersistenceClient());
-    }
-}
diff --git a/full/src/test/java/de/ids_mannheim/korap/misc/BeanInjectTest.java b/full/src/test/java/de/ids_mannheim/korap/misc/BeanInjectTest.java
index 155e8be..c5814e4 100644
--- a/full/src/test/java/de/ids_mannheim/korap/misc/BeanInjectTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/misc/BeanInjectTest.java
@@ -9,10 +9,8 @@
 import org.springframework.aop.support.AopUtils;
 
 import de.ids_mannheim.korap.config.BeansFactory;
-import de.ids_mannheim.korap.handlers.DocumentDao;
 import de.ids_mannheim.korap.handlers.UserDetailsDao;
 import de.ids_mannheim.korap.handlers.UserSettingsDao;
-import de.ids_mannheim.korap.resources.Document;
 import de.ids_mannheim.korap.user.UserDetails;
 import de.ids_mannheim.korap.user.UserSettings;
 
@@ -37,17 +35,4 @@
         BeansFactory.closeApplication();
     }
 
-
-    @Test
-    public void testResourceBeans () {
-        BeansFactory.loadClasspathContext("test-config.xml");
-        Collection coll = BeansFactory.getKustvaktContext()
-                .getResourceProviders();
-        assertFalse(coll.isEmpty());
-        Object o = BeansFactory.getTypeFactory().getTypeInterfaceBean(coll,
-                Document.class);
-        assertEquals(DocumentDao.class, AopUtils.getTargetClass(o));
-
-        BeansFactory.closeApplication();
-    }
 }
diff --git a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/ResultRewriteTest.java b/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/ResultRewriteTest.java
index 53e28df..32deec8 100644
--- a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/ResultRewriteTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/ResultRewriteTest.java
@@ -1,30 +1,19 @@
 package de.ids_mannheim.korap.resource.rewrite;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
 
-import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
-import com.fasterxml.jackson.databind.JsonNode;
-
 import de.ids_mannheim.korap.config.BeanConfigTest;
 import de.ids_mannheim.korap.config.TestVariables;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.handlers.DocumentDao;
-import de.ids_mannheim.korap.resources.Document;
+import de.ids_mannheim.korap.rewrite.CollectionRewrite;
 import de.ids_mannheim.korap.utils.JsonUtils;
-import net.sf.ehcache.CacheManager;
 
 /**
- * EM: To do: not implemented in the new DB yet
  * @author hanl
  * @date 12/11/2015
  */
-@Ignore
 public class ResultRewriteTest extends BeanConfigTest {
 
     @Override
@@ -32,63 +21,16 @@
 
     }
 
-
-    // otherwise cache will maintain values not relevant for other tests
-    @Before
-    public void before () {
-        CacheManager.getInstance().getCache("documents").removeAll();
-        DocumentDao dao = new DocumentDao(helper().getContext()
-                .getPersistenceClient());
-        dao.truncate();
-    }
-
-
     @Test
     public void testPostRewriteNothingToDo () throws KustvaktException {
         RewriteHandler ha = new RewriteHandler();
         ha.insertBeans(helper().getContext());
         assertEquals("Handler could not be added to rewrite handler instance!",
-                true, ha.add(DocMatchRewrite.class));
+                true, ha.add(CollectionRewrite.class));
 
-        DocumentDao dao = new DocumentDao(helper().getContext()
-                .getPersistenceClient());
-        Document d = dao.findbyId("BRZ13_APR.00014", null);
-        assertNull(d);
         String v = ha.processResult(TestVariables.RESULT, null);
         assertEquals("results do not match",
                 JsonUtils.readTree(TestVariables.RESULT), JsonUtils.readTree(v));
     }
 
-
-    @Test
-    public void testResultRewriteRemoveDoc () throws KustvaktException {
-        DocumentDao dao = new DocumentDao(helper().getContext()
-                .getPersistenceClient());
-
-        Document doc = new Document("WPD_AAA.02439");
-        doc.setDisabled(true);
-        dao.storeResource(doc, null);
-
-        RewriteHandler ha = new RewriteHandler();
-        ha.insertBeans(helper().getContext());
-        assertEquals("Handler could not be added to rewrite handler instance!",
-                true, ha.add(DocMatchRewrite.class));
-
-        JsonNode check = JsonUtils.readTree(TestVariables.RESULT);
-        assertNotNull(check);
-        int check_size = check.at("/matches").size();
-
-        String v = ha.processResult(TestVariables.RESULT, null);
-        JsonNode node = JsonUtils.readTree(v);
-
-        assertNotNull(node);
-        int size = node.at("/matches").size();
-        assertNotEquals("documents were not removed", check_size, size);
-        assertEquals("result does not contain required matches", 22, size);
-
-        dao.deleteResource(doc.getPersistentID(), null);
-        Document d = dao.findbyId(doc.getPersistentID(), null);
-        assertNull("document should not exist anymore!", d);
-    }
-
 }
diff --git a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteBenchmarkTest.java b/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteBenchmarkTest.java
deleted file mode 100644
index 405bd6b..0000000
--- a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteBenchmarkTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package de.ids_mannheim.korap.resource.rewrite;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import org.joda.time.DateTime;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.springframework.test.annotation.DirtiesContext;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-import de.ids_mannheim.korap.config.BeanConfigTest;
-import de.ids_mannheim.korap.config.TestVariables;
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.handlers.DocumentDao;
-import de.ids_mannheim.korap.resources.Document;
-import de.ids_mannheim.korap.utils.JsonUtils;
-import de.ids_mannheim.korap.utils.TimeUtils;
-
-/** EM: DocumentDao is not available anymore.
- * Created by hanl on 30.05.16.
- */
-@Deprecated
-@Ignore
-public class RewriteBenchmarkTest extends BeanConfigTest {
-
-
-    private static int THRESHOLD = 1000;
-
-
-    @Test
-    public void testDocMatchRewriteByTextSigle () throws KustvaktException {
-        DocumentDao dao = new DocumentDao(helper().getContext()
-                .getPersistenceClient());
-
-        int i = 999;
-        for (int j = 100; j < i; j++) {
-            Document doc = new Document("WPD_AAA.02" + j);
-            doc.setDisabled(true);
-            dao.storeResource(doc, null);
-        }
-        RewriteHandler ha = new RewriteHandler();
-        ha.insertBeans(helper().getContext());
-        assertEquals("Handler could not be added to rewrite handler instance!",
-                true, ha.add(DocMatchRewrite.class));
-
-        DateTime now = TimeUtils.getNow();
-        String v = ha.processResult(TestVariables.RESULT, null);
-        long diff = TimeUtils.calcDiff(now, new DateTime());
-        assertTrue(diff < THRESHOLD);
-        JsonNode node = JsonUtils.readTree(v);
-
-        JsonNode check = JsonUtils.readTree(TestVariables.RESULT);
-        assertNotNull(check);
-        int check_size = check.at("/matches").size();
-
-        assertNotNull(node);
-        int size = node.at("/matches").size();
-        assertNotEquals("documents were not removed", check_size, size);
-
-        dao.truncate();
-    }
-
-
-    @Test
-    public void testDocMatchRewriteByDocSigle () throws KustvaktException {
-        DocumentDao dao = new DocumentDao(helper().getContext()
-                .getPersistenceClient());
-
-        Document doc = new Document("WPD_AAA");
-        doc.setDisabled(true);
-        dao.storeResource(doc, null);
-
-        RewriteHandler ha = new RewriteHandler();
-        ha.insertBeans(helper().getContext());
-        assertEquals("Handler could not be added to rewrite handler instance!",
-                true, ha.add(DocMatchRewrite.class));
-
-        DateTime now = TimeUtils.getNow();
-        String v = ha.processResult(TestVariables.RESULT, null);
-        long diff = TimeUtils.calcDiff(now, new DateTime());
-        assertTrue(diff < THRESHOLD);
-        JsonNode node = JsonUtils.readTree(v);
-
-        JsonNode check = JsonUtils.readTree(TestVariables.RESULT);
-        assertNotNull(check);
-        int check_size = check.at("/matches").size();
-
-        assertNotNull(node);
-        int size = node.at("/matches").size();
-        assertNotEquals("documents were not removed", check_size, size);
-        assertEquals(0, size);
-        dao.truncate();
-    }
-
-
-    @Test
-    public void testCollectionRewriteInject () {
-
-    }
-
-
-    @Test
-    public void testCollectionRewriteRemoval () {
-
-    }
-
-
-    @Override
-    public void initMethod () throws KustvaktException {}
-}
diff --git a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java b/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java
index 81430c6..67f74bd 100644
--- a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java
@@ -25,7 +25,6 @@
  * @author hanl
  * @date 21/10/2015
  */
-@Ignore
 public class RewriteHandlerTest extends BeanConfigTest {
 
     @Test
@@ -33,7 +32,6 @@
         RewriteHandler handler = new RewriteHandler();
         handler.insertBeans(helper().getContext());
         assertTrue(handler.add(FoundryInject.class));
-        assertTrue(handler.add(DocMatchRewrite.class));
         assertTrue(handler.add(CollectionCleanRewrite.class));
         assertTrue(handler.add(IdWriter.class));
     }
@@ -95,18 +93,18 @@
                 node.at("/query/wrap/operands/1/foundry").asText());
     }
 
-
+ // EM: Fix me usersetting
     @Override
     public void initMethod () throws KustvaktException {
-        helper().setupAccount();
-        UserDataDbIface settingsdao = BeansFactory.getTypeFactory()
-                .getTypeInterfaceBean(
-                        helper().getContext().getUserDataProviders(),
-                        UserSettings.class);
-        assertNotNull(settingsdao);
-        UserSettings s = (UserSettings) settingsdao.get(helper().getUser());
-        s.setField(Attributes.DEFAULT_LEMMA_FOUNDRY, "tt_test");
-        settingsdao.update(s);
+//        helper().setupAccount();
+//        UserDataDbIface settingsdao = BeansFactory.getTypeFactory()
+//                .getTypeInterfaceBean(
+//                        helper().getContext().getUserDataProviders(),
+//                        UserSettings.class);
+//        assertNotNull(settingsdao);
+//        UserSettings s = (UserSettings) settingsdao.get(helper().getUser());
+//        s.setField(Attributes.DEFAULT_LEMMA_FOUNDRY, "tt_test");
+//        settingsdao.update(s);
     }
 
 
diff --git a/full/src/test/resources/test-config.xml b/full/src/test/resources/test-config.xml
index a0bc2ce..00361de 100644
--- a/full/src/test/resources/test-config.xml
+++ b/full/src/test/resources/test-config.xml
@@ -220,10 +220,6 @@
 		<constructor-arg ref="kustvakt_db" />
 	</bean>
 
-	<bean id="document_provider" class="de.ids_mannheim.korap.handlers.DocumentDao">
-		<constructor-arg ref="kustvakt_db" />
-	</bean>
-
 	<bean name="kustvakt_encryption" class="de.ids_mannheim.korap.encryption.KustvaktEncryption">
 		<constructor-arg ref="kustvakt_config" />
 	</bean>
@@ -288,7 +284,6 @@
 
 	<util:list id="kustvakt_resources"
 		value-type="de.ids_mannheim.korap.interfaces.db.ResourceOperationIface">
-		<ref bean="document_provider" />
 	</util:list>
 
 	<!-- specify type for constructor argument -->