Rev 3213 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package in.shop2020.support.utils;import java.util.List;import org.apache.thrift.TException;import in.shop2020.thrift.clients.HelperServiceClient;import in.shop2020.utils.Report;public class ReportsUtils {public static final String USER_NAME = "username", PASSWORD = "password", ROLE = "role";private static HelperServiceClient hsc;static {try {hsc = new HelperServiceClient();} catch (Exception e) {e.printStackTrace();}}public static boolean canAccessReport(long role, String reportStr) {if(reportStr.startsWith("/")) {reportStr = reportStr.substring(1, reportStr.length());}List<Report> reports = getReports(role);for(Report r : reports) {if(r.getController().equals(reportStr))return true;}return false;}public static List<Report> getReports(long role) {List<Report> reports = null;try {reports = hsc.getClient().getReports(role);} catch (TException e) {e.printStackTrace();}return reports;}}