<commit_before>/*
 *  Copyright (C) 2010-2018 <NAME> (Akvo Foundation)
 *
 *  This file is part of Akvo FLOW.
 *
 *  Akvo FLOW is free software: you can redistribute it and modify it under the terms of
 *  the GNU Affero General Public License (AGPL) as published by the Free Software Foundation,
 *  either version 3 of the License or any later version.
 *
 *  Akvo FLOW is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 *  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *  See the GNU Affero General Public License included below for more details.
 *
 *  The full license text can also be seen at <http://www.gnu.org/licenses/agpl.html>.
 */

package com.gallatinsystems.framework.dao;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;

import javax.jdo.JDOObjectNotFoundException;
import javax.jdo.PersistenceManager;

import net.sf.jsr107cache.CacheException;

import org.akvo.flow.domain.SecuredObject;
import org.datanucleus.store.appengine.query.JDOCursorHelper;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

import com.gallatinsystems.common.Constants;
import com.gallatinsystems.framework.domain.BaseDomain;
import com.gallatinsystems.framework.servlet.PersistenceFilter;
import com.gallatinsystems.survey.domain.Survey;
import com.gallatinsystems.survey.domain.SurveyGroup;
import com.gallatinsystems.user.dao.UserAuthorizationDAO;
import com.gallatinsystems.user.dao.UserDao;
import com.gallatinsystems.user.domain.User;
import com.gallatinsystems.user.domain.UserAuthorization;
import com.google.appengine.api.datastore.Cursor;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

import net.sf.jsr107cache.CacheException;

import org.akvo.flow.domain.SecuredObject;
import org.datanucleus.store.appengine.query.JDOCursorHelper;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

import javax.jdo.JDOObjectNotFoundException;
import javax.jdo.PersistenceManager;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;

/**
 * This is a reusable data access object that supports basic operations (save, find by property,
 * list).
 *
 * @author <NAME>
 * @param <T> a persistent class that extends BaseDomain
 */
public class BaseDAO<T extends BaseDomain> {
    public static final int DEFAULT_RESULT_COUNT = 20;
    protected static final int RETRY_INTERVAL_MILLIS = 200;
    protected static final String STRING_TYPE = "String";
    protected static final String NOT_EQ_OP = "!=";
    protected static final String EQ_OP = " == ";
    protected static final String GTE_OP = " >= ";
    protected static final String LTE_OP = " <= ";
    private static final int MAX_ALLOWED_FILTERED_ITEMS = 30;

    private Class<T> concreteClass;
    protected Logger log;

    public enum CURSOR_TYPE {
        all
    };

    public BaseDAO(Class<T> e) {
        setDomainClass(e);
        log = Logger.getLogger(this.getClass().getName());
    }<commit_msg>[#2406] Fix imports<commit_after>/*
 *  Copyright (C) 2010-2018 <NAME> (Akvo Foundation)
 *
 *  This file is part of Akvo FLOW.
 *
 *  Akvo FLOW is free software: you can redistribute it and modify it under the terms of
 *  the GNU Affero General Public License (AGPL) as published by the Free Software Foundation,
 *  either version 3 of the License or any later version.
 *
 *  Akvo FLOW is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 *  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *  See the GNU Affero General Public License included below for more details.
 *
 *  The full license text can also be seen at <http://www.gnu.org/licenses/agpl.html>.
 */

package com.gallatinsystems.framework.dao;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;

import javax.jdo.JDOObjectNotFoundException;
import javax.jdo.PersistenceManager;

import net.sf.jsr107cache.CacheException;

import org.akvo.flow.domain.SecuredObject;
import org.datanucleus.store.appengine.query.JDOCursorHelper;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

import com.gallatinsystems.common.Constants;
import com.gallatinsystems.framework.domain.BaseDomain;
import com.gallatinsystems.framework.servlet.PersistenceFilter;
import com.gallatinsystems.survey.domain.Survey;
import com.gallatinsystems.survey.domain.SurveyGroup;
import com.gallatinsystems.user.dao.UserAuthorizationDAO;
import com.gallatinsystems.user.dao.UserDao;
import com.gallatinsystems.user.domain.User;
import com.gallatinsystems.user.domain.UserAuthorization;
import com.google.appengine.api.datastore.Cursor;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

/**
 * This is a reusable data access object that supports basic operations (save, find by property,
 * list).
 *
 * @author <NAME>
 * @param <T> a persistent class that extends BaseDomain
 */
public class BaseDAO<T extends BaseDomain> {
    public static final int DEFAULT_RESULT_COUNT = 20;
    protected static final int RETRY_INTERVAL_MILLIS = 200;
    protected static final String STRING_TYPE = "String";
    protected static final String NOT_EQ_OP = "!=";
    protected static final String EQ_OP = " == ";
    protected static final String GTE_OP = " >= ";
    protected static final String LTE_OP = " <= ";
    private static final int MAX_ALLOWED_FILTERED_ITEMS = 30;

    private Class<T> concreteClass;
    protected Logger log;

    public enum CURSOR_TYPE {
        all
    };

    public BaseDAO(Class<T> e) {
        setDomainClass(e);
        log = Logger.getLogger(this.getClass().getName());
    }
{'fraction_non_alphanumeric': 0.0906855210574854, 'fraction_numerical': 0.006916692284045497, 'mean_word_length': 4.585407725321889, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1688151', 'n_tokens_mistral': 2003, 'n_tokens_neox': 1920, 'n_words': 548}