package edu.harvard.iq.dataverse.mydata;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import edu.harvard.iq.dataverse.DatasetPage;
import edu.harvard.iq.dataverse.DataverseRoleServiceBean;
import edu.harvard.iq.dataverse.DataverseSession;
import edu.harvard.iq.dataverse.DvObject;
import static edu.harvard.iq.dataverse.DvObject.DATAFILE_DTYPE_STRING;
import static edu.harvard.iq.dataverse.DvObject.DATASET_DTYPE_STRING;
import static edu.harvard.iq.dataverse.DvObject.DATAVERSE_DTYPE_STRING;
import edu.harvard.iq.dataverse.DvObjectServiceBean;
import edu.harvard.iq.dataverse.RoleAssigneeServiceBean;
import edu.harvard.iq.dataverse.SearchServiceBean;
import edu.harvard.iq.dataverse.SolrQueryResponse;
import edu.harvard.iq.dataverse.SolrSearchResult;
import edu.harvard.iq.dataverse.authorization.DataverseRole;
import edu.harvard.iq.dataverse.authorization.DataverseRolePermissionHelper;
import edu.harvard.iq.dataverse.authorization.MyDataQueryHelperServiceBean;
import edu.harvard.iq.dataverse.search.SearchException;
import edu.harvard.iq.dataverse.search.SearchFields;
import edu.harvard.iq.dataverse.search.SortBy;
import java.io.IOException;
import static java.lang.Math.max;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;
import org.apache.commons.lang.StringUtils;
import org.primefaces.json.JSONException;
import org.primefaces.json.JSONObject;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author rmp553
 */
@ViewScoped
@Named("RolePermissionHelperPage")
public class RolePermissionHelperPage implements java.io.Serializable {
    
    private static final Logger logger = Logger.getLogger(DatasetPage.class.getCanonicalName());

    @Inject DataverseSession session;    

    @EJB
    DataverseRoleServiceBean dataverseRoleService;
    @EJB
    RoleAssigneeServiceBean roleAssigneeService;
    
    
    private DataverseRolePermissionHelper rolePermissionHelper;// = new DataverseRolePermissionHelper();
    
    
    public String init() {
       // msgt("_YE_OLDE_QUERY_COUNTER_");  // for debug purposes

        List<DataverseRole> roleList = dataverseRoleService.findAll();
        rolePermissionHelper = new DataverseRolePermissionHelper(roleList);

        
        List<String> dtypes = MyDataFilterParams.defaultDvObjectTypes;
        //List<String> dtypes = Arrays.asList(DvObject.DATAFILE_DTYPE_STRING, DvObject.DATASET_DTYPE_STRING);
        //DvObject.DATAFILE_DTYPE_STRING, DvObject.DATASET_DTYPE_STRING, DvObject.DATAVERSE_DTYPE_STRING
        
        //List<String> dtypes = new ArrayList<>();
        
     return null;
    }
    
        
    public DataverseRolePermissionHelper getRolePermissionHelper(){
        return this.rolePermissionHelper;
    }
    
    private void msg(String s){
        System.out.println(s);
    }
    
    private void msgt(String s){
        msg("-------------------------------");
        msg(s);
        msg("-------------------------------");
    }
    
}

@@ -39,79 +39,8 @@
 a;%0A%0A
-import com.google.gson.JsonElement;%0Aimport com.google.gson.JsonObject;%0A
 impo
@@ -224,923 +224,169 @@
 rse.
-DvObject;%0Aimport static edu.harvard.iq.dataverse.DvObject.DATAFILE_DTYPE_STRING;%0Aimport static edu.harvard.iq.dataverse.DvObject.DATASET_DTYPE_STRING;%0Aimport static edu.harvard.iq.dataverse.DvObject.DATAVERSE_DTYPE_STRING;%0Aimport edu.harvard.iq.dataverse.DvObjectServiceBean;%0Aimport edu.harvard.iq.dataverse.RoleAssigneeServiceBean;%0Aimport edu.harvard.iq.dataverse.SearchServiceBean;%0Aimport edu.harvard.iq.dataverse.SolrQueryResponse;%0Aimport edu.harvard.iq.dataverse.SolrSearchResult;%0Aimport edu.harvard.iq.dataverse.authorization.DataverseRole;%0Aimport edu.harvard.iq.dataverse.authorization.DataverseRolePermissionHelper;%0Aimport edu.harvard.iq.dataverse.authorization.MyDataQueryHelperServiceBean;%0Aimport edu.harvard.iq.dataverse.search.SearchException;%0Aimport edu.harvard.iq.dataverse.search.SearchFields;%0Aimport edu.harvard.iq.dataverse.search.SortBy;%0Aimport java.io.IOException;%0Aimport static java.lang.Math.max
+RoleAssigneeServiceBean;%0Aimport edu.harvard.iq.dataverse.authorization.DataverseRole;%0Aimport edu.harvard.iq.dataverse.authorization.DataverseRolePermissionHelper
 ;%0Aim
@@ -404,124 +404,14 @@
 til.
-Array
 List;%0A
-import java.util.Arrays;%0Aimport java.util.List;%0Aimport java.util.Random;%0Aimport java.util.logging.Level;%0A
 impo
@@ -555,133 +555,8 @@
 med;
-%0Aimport org.apache.commons.lang.StringUtils;%0Aimport org.primefaces.json.JSONException;%0Aimport org.primefaces.json.JSONObject;
 %0A%0A/*

remove unused imports