List of usage examples for javax.servlet.http HttpServletRequest getRemoteUser
public String getRemoteUser();
null
if the user has not been authenticated. From source file:org.akaza.openclinica.control.core.SecureController.java
License:asdf
private void process(HttpServletRequest request, HttpServletResponse response) throws OpenClinicaException, UnsupportedEncodingException { request.setCharacterEncoding("UTF-8"); session = request.getSession();//w w w .j av a2 s . c om // BWP >> 1/8/2008 try { // YW 10-03-2007 << session.setMaxInactiveInterval(Integer.parseInt(SQLInitServlet.getField("max_inactive_interval"))); String smURL = CoreResources.getField("smURL"); if (StringUtils.isNotEmpty(smURL)) { int index = smURL.indexOf("//"); String protocol = smURL.substring(0, index) + "//"; String subDomain = smURL.substring(smURL.indexOf("//") + 2, smURL.indexOf("/", protocol.length())); String crossStorageURL = protocol + subDomain + "/hub/hub.html"; session.setAttribute("crossStorageURL", crossStorageURL); } // YW >> } catch (NumberFormatException nfe) { // BWP>>3600 is the datainfo.properties maxInactiveInterval on // 1/8/2008 session.setMaxInactiveInterval(3600); } // If the session already has a value with key SUPPORT_URL don't reset if (session.getAttribute(SUPPORT_URL) == null) { session.setAttribute(SUPPORT_URL, SQLInitServlet.getSupportURL()); } // If the session already has a value with key WALKME_URL don't reset if (session.getAttribute(WALKME_URL) == null) { session.setAttribute(WALKME_URL, CoreResources.getField("walkme.url")); } // If the session already has a value with key PIWIK_URL don't reset if (session.getAttribute(PIWIK_URL) == null) { session.setAttribute(PIWIK_URL, CoreResources.getField("piwik.url")); } ub = (UserAccountBean) session.getAttribute(USER_BEAN_NAME); currentStudy = (StudyBean) session.getAttribute("study"); currentPublicStudy = (StudyBean) session.getAttribute("publicStudy"); currentRole = (StudyUserRoleBean) session.getAttribute("userRole"); // Set current language preferences Locale locale = LocaleResolver.getLocale(request); ResourceBundleProvider.updateLocale(locale); resadmin = ResourceBundleProvider.getAdminBundle(locale); resaudit = ResourceBundleProvider.getAuditEventsBundle(locale); resexception = ResourceBundleProvider.getExceptionsBundle(locale); resformat = ResourceBundleProvider.getFormatBundle(locale); restext = ResourceBundleProvider.getTextsBundle(locale); resterm = ResourceBundleProvider.getTermsBundle(locale); resword = ResourceBundleProvider.getWordsBundle(locale); respage = ResourceBundleProvider.getPageMessagesBundle(locale); resworkflow = ResourceBundleProvider.getWorkflowBundle(locale); local_df = I18nFormatUtil.getDateFormat(locale); try { String userName = request.getRemoteUser(); // BWP 1/8/08<< the sm variable may already be set with a mock // object, // from the perspective of // JUnit servlets tests /* * if(sm==null && (!StringUtil.isBlank(userName))) {//check if user logged in, then create a new * sessionmanger to * get ub //create a new sm in order to get a new ub object sm = new SessionManager(ub, userName); } */ // BWP 01/08 >> // sm = new SessionManager(ub, userName); sm = new SessionManager(ub, userName, SpringServletAccess.getApplicationContext(context)); if (ub == null || StringUtils.isEmpty(ub.getName())) { UserAccountDAO uDAO = new UserAccountDAO(sm.getDataSource()); ub = (UserAccountBean) uDAO.findByEmail(userName); session.setAttribute("userBean", ub); } request.setAttribute("userBean", ub); StudyDAO sdao = new StudyDAO(sm.getDataSource()); if (currentPublicStudy == null || currentPublicStudy.getId() <= 0) { UserAccountDAO uDAO = new UserAccountDAO(sm.getDataSource()); ub = (UserAccountBean) uDAO.findByUserName(ub.getName()); session.setAttribute(USER_BEAN_NAME, ub); if (ub.getId() > 0 && ub.getActiveStudyId() > 0) { CoreResources.setRequestSchema(request, "public"); StudyParameterValueDAO spvdao = new StudyParameterValueDAO(sm.getDataSource()); currentPublicStudy = (StudyBean) sdao.findByPK(ub.getActiveStudyId()); ArrayList studyParameters = spvdao.findParamConfigByStudy(currentPublicStudy); currentPublicStudy.setStudyParameters(studyParameters); // set up the panel here, tbh panel.reset(); /* * panel.setData("Study", currentPublicStudy.getName()); panel.setData("Summary", * currentPublicStudy.getSummary()); * panel.setData("Start Date", sdf.format(currentPublicStudy.getDatePlannedStart())); * panel.setData("End Date", * sdf.format(currentPublicStudy.getDatePlannedEnd())); panel.setData("Principal Investigator", * currentPublicStudy.getPrincipalInvestigator()); */ session.setAttribute(STUDY_INFO_PANEL, panel); } else { currentPublicStudy = new StudyBean(); } session.setAttribute("publicStudy", currentPublicStudy); request.setAttribute("requestSchema", currentPublicStudy.getSchemaName()); currentStudy = (StudyBean) sdao.findByUniqueIdentifier(currentPublicStudy.getIdentifier()); if (currentStudy != null) { currentStudy.setParentStudyName(currentPublicStudy.getParentStudyName()); StudyConfigService scs = new StudyConfigService(sm.getDataSource()); if (currentStudy.getParentStudyId() <= 0) {// top study scs.setParametersForStudy(currentStudy); } else { // YW << currentStudy.setParentStudyName( ((StudyBean) sdao.findByPK(currentStudy.getParentStudyId())).getName()); // YW >> scs.setParametersForSite(currentStudy); } } request.setAttribute("requestSchema", "public"); session.setAttribute("study", currentStudy); } else if (currentPublicStudy.getId() > 0) { // YW 06-20-2007<< set site's parentstudy name when site is // restored if (currentPublicStudy.getParentStudyId() > 0) { currentPublicStudy.setParentStudyName( ((StudyBean) sdao.findByPK(currentPublicStudy.getParentStudyId())).getName()); request.setAttribute("requestSchema", currentPublicStudy.getSchemaName()); currentStudy.setParentStudyName( ((StudyBean) sdao.findByPK(currentStudy.getParentStudyId())).getName()); request.setAttribute("requestSchema", "public"); } // YW >> } if (currentPublicStudy.getParentStudyId() > 0) { /* * The Role decription will be set depending on whether the user logged in at study lever or site level. * issue-2422 */ List roles = Role.toArrayList(); for (Iterator it = roles.iterator(); it.hasNext();) { Role role = (Role) it.next(); switch (role.getId()) { case 2: role.setDescription("site_Study_Coordinator"); break; case 3: role.setDescription("site_Study_Director"); break; case 4: role.setDescription("site_investigator"); break; case 5: role.setDescription("site_Data_Entry_Person"); break; case 6: role.setDescription("site_monitor"); break; case 7: role.setDescription("site_Data_Entry_Person2"); break; default: // logger.info("No role matched when setting role description"); } } } else { /* * If the current study is a site, we will change the role description. issue-2422 */ List roles = Role.toArrayList(); for (Iterator it = roles.iterator(); it.hasNext();) { Role role = (Role) it.next(); switch (role.getId()) { case 2: role.setDescription("Study_Coordinator"); break; case 3: role.setDescription("Study_Director"); break; case 4: role.setDescription("Investigator"); break; case 5: role.setDescription("Data_Entry_Person"); break; case 6: role.setDescription("Monitor"); break; default: // logger.info("No role matched when setting role description"); } } } if (currentRole == null || currentRole.getId() <= 0) { // if (ub.getId() > 0 && currentPublicStudy.getId() > 0) { // if current study has been "removed", current role will be // kept as "invalid" -- YW 06-21-2007 if (ub.getId() > 0 && currentPublicStudy.getId() > 0 && !currentPublicStudy.getStatus().getName().equals("removed")) { currentRole = ub.getRoleByStudy(currentPublicStudy.getId()); if (currentPublicStudy.getParentStudyId() > 0) { // Checking if currentPublicStudy has been removed or not will // ge good enough -- YW 10-17-2007 StudyUserRoleBean roleInParent = ub.getRoleByStudy(currentPublicStudy.getParentStudyId()); // inherited role from parent study, pick the higher // role currentRole.setRole(Role.max(currentRole.getRole(), roleInParent.getRole())); } // logger.info("currentRole:" + currentRole.getRoleName()); } else { currentRole = new StudyUserRoleBean(); } session.setAttribute("userRole", currentRole); } // YW << For the case that current role is not "invalid" but current // active study has been removed. else if (currentRole.getId() > 0 && (currentPublicStudy.getStatus().equals(Status.DELETED) || currentPublicStudy.getStatus().equals(Status.AUTO_DELETED))) { currentRole.setRole(Role.INVALID); currentRole.setStatus(Status.DELETED); session.setAttribute("userRole", currentRole); } // YW 06-19-2007 >> request.setAttribute("isAdminServlet", getAdminServlet()); this.request = request; this.response = response; // java.util.Enumeration en_session = session.getAttributeNames(); // java.util.Enumeration en_request = request.getAttributeNames(); // // // logging added to find problems with adding subjects, tbh // 102007 // String ss_names = "session names: "; // while (en_session.hasMoreElements()) { // ss_names += " - " + en_session.nextElement(); // } // logger.info(ss_names); // // // also added tbh, 102007 // String rq_names = "request names: "; // while (en_request.hasMoreElements()) { // rq_names += " - " + en_request.nextElement(); // } // logger.info(rq_names); if (!request.getRequestURI().endsWith("ResetPassword")) { passwdTimeOut(); } request.setAttribute("requestSchema", getRequestSchema(request)); mayProceed(); // pingJobServer(request); processRequest(); } catch (InconsistentStateException ise) { ise.printStackTrace(); logger.warn("InconsistentStateException: org.akaza.openclinica.control.SecureController: " + ise.getMessage()); addPageMessage(ise.getOpenClinicaMessage()); forwardPage(ise.getGoTo()); } catch (InsufficientPermissionException ipe) { ipe.printStackTrace(); logger.warn("InsufficientPermissionException: org.akaza.openclinica.control.SecureController: " + ipe.getMessage()); // addPageMessage(ipe.getOpenClinicaMessage()); forwardPage(ipe.getGoTo()); } catch (OutOfMemoryError ome) { ome.printStackTrace(); long heapSize = Runtime.getRuntime().totalMemory(); session.setAttribute("ome", "yes"); } catch (Exception e) { e.printStackTrace(); logger.error(SecureController.getStackTrace(e)); forwardPage(Page.ERROR); } }
From source file:com.gtwm.pb.model.manageSchema.DatabaseDefn.java
public void setChartFilterField(HttpServletRequest request, BaseReportInfo report, ReportFieldInfo reportField) throws SQLException, DisallowedException, ObjectNotFoundException, CantDoThatException { if (!(this.authManager.getAuthenticator().loggedInUserAllowedTo(request, PrivilegeType.MANAGE_TABLE, report.getParentTable()))) { throw new DisallowedException(this.authManager.getLoggedInUser(request), PrivilegeType.MANAGE_TABLE, report.getParentTable()); }//from www .j av a 2s . co m ChartInfo chart = report.getChart(); HibernateUtil.activateObject(chart); chart.setFilterReportField(reportField); this.dataManagement.logLastSchemaChangeTime(request); // Test change by selecting rows from the database CompanyInfo company = this.getAuthManager().getCompanyForLoggedInUser(request); Map<BaseField, String> blankFilterValues = new HashMap<BaseField, String>(); ChartDataInfo reportSummaryData = this.getDataManagement().getChartData(company, report.getChart(), blankFilterValues, false); UsageLogger usageLogger = new UsageLogger(this.relationalDataSource); AppUserInfo user = this.authManager.getUserByUserName(request, request.getRemoteUser()); usageLogger.logReportSchemaChange(user, report, AppAction.SET_CHART_FILTER_FIELD, "report field: " + reportField); UsageLogger.startLoggingThread(usageLogger); }
From source file:com.gtwm.pb.model.manageSchema.DatabaseDefn.java
public void setChartFilter(HttpServletRequest request, BaseReportInfo report, SummaryFilter chartFilter) throws SQLException, DisallowedException, ObjectNotFoundException, CantDoThatException { if (!(this.authManager.getAuthenticator().loggedInUserAllowedTo(request, PrivilegeType.MANAGE_TABLE, report.getParentTable()))) { throw new DisallowedException(this.authManager.getLoggedInUser(request), PrivilegeType.MANAGE_TABLE, report.getParentTable()); }// w w w.ja va 2 s .co m ChartInfo reportSummary = report.getChart(); HibernateUtil.activateObject(reportSummary); reportSummary.setChartFilter(chartFilter); this.dataManagement.logLastSchemaChangeTime(request); // Test change by selecting rows from the database CompanyInfo company = this.getAuthManager().getCompanyForLoggedInUser(request); Map<BaseField, String> blankFilterValues = new HashMap<BaseField, String>(); ChartDataInfo reportSummaryData = this.getDataManagement().getChartData(company, report.getChart(), blankFilterValues, false); UsageLogger usageLogger = new UsageLogger(this.relationalDataSource); AppUserInfo user = this.authManager.getUserByUserName(request, request.getRemoteUser()); usageLogger.logReportSchemaChange(user, report, AppAction.SET_CHART_FILTER, "chart filter: " + chartFilter); UsageLogger.startLoggingThread(usageLogger); }
From source file:com.gtwm.pb.model.manageSchema.DatabaseDefn.java
public ReportFieldInfo addFieldToReport(HttpServletRequest request, Connection conn, SimpleReportInfo report, SimpleReportInfo sourceReport, BaseField field) throws SQLException, DisallowedException, InconsistentStateException, CantDoThatException, CodingErrorException, ObjectNotFoundException { if (!(this.authManager.getAuthenticator().loggedInUserAllowedTo(request, PrivilegeType.MANAGE_TABLE, report.getParentTable()))) { throw new DisallowedException(this.authManager.getLoggedInUser(request), PrivilegeType.MANAGE_TABLE, report.getParentTable()); }//from ww w . ja v a2 s . co m ReportFieldInfo newReportField = null; HibernateUtil.activateObject(report); if (sourceReport == null) { newReportField = report.addTableField(field); } else { ReportFieldInfo reportField = sourceReport.getReportField(field.getInternalFieldName()); newReportField = report.addReportField(reportField); } this.updateViewDbAction(conn, report, request); // this.dataManagement.logLastSchemaChangeTime(request); UsageLogger usageLogger = new UsageLogger(this.relationalDataSource); AppUserInfo user = this.authManager.getUserByUserName(request, request.getRemoteUser()); usageLogger.logReportSchemaChange(user, report, AppAction.ADD_FIELD_TO_REPORT, "field: " + field); UsageLogger.startLoggingThread(usageLogger); return newReportField; }
From source file:com.gtwm.pb.model.manageSchema.DatabaseDefn.java
public void setChartRange(HttpServletRequest request, BaseReportInfo report, int rangePercent, boolean rangeDirection) throws SQLException, DisallowedException, ObjectNotFoundException, CantDoThatException { if (!(this.authManager.getAuthenticator().loggedInUserAllowedTo(request, PrivilegeType.MANAGE_TABLE, report.getParentTable()))) { throw new DisallowedException(this.authManager.getLoggedInUser(request), PrivilegeType.MANAGE_TABLE, report.getParentTable()); }//ww w . java 2 s. com ChartInfo chart = report.getChart(); HibernateUtil.activateObject(chart); chart.setRangePercent(rangePercent); chart.setRangeDirection(rangeDirection); this.dataManagement.logLastSchemaChangeTime(request); // Test change by selecting rows from the database CompanyInfo company = this.getAuthManager().getCompanyForLoggedInUser(request); Map<BaseField, String> blankFilterValues = new HashMap<BaseField, String>(); ChartDataInfo reportSummaryData = this.getDataManagement().getChartData(company, report.getChart(), blankFilterValues, false); UsageLogger usageLogger = new UsageLogger(this.relationalDataSource); AppUserInfo user = this.authManager.getUserByUserName(request, request.getRemoteUser()); String logString = ""; if (rangePercent < 100) { if (rangeDirection) { logString = "Upper "; } else { logString = "Lower "; } } logString += rangePercent + "%"; usageLogger.logReportSchemaChange(user, report, AppAction.SET_CHART_RANGE, logString); UsageLogger.startLoggingThread(usageLogger); }
From source file:com.gtwm.pb.model.manageSchema.DatabaseDefn.java
public void removeChart(HttpServletRequest request, ChartInfo reportSummary) throws DisallowedException, CantDoThatException, ObjectNotFoundException { if (!(this.authManager.getAuthenticator().loggedInUserAllowedTo(request, PrivilegeType.MANAGE_TABLE, reportSummary.getReport().getParentTable()))) { throw new DisallowedException(this.authManager.getLoggedInUser(request), PrivilegeType.MANAGE_TABLE, reportSummary.getReport().getParentTable()); }//from ww w . j a v a 2 s. c o m BaseReportInfo report = reportSummary.getReport(); if (reportSummary.equals(report.getChart())) { throw new CantDoThatException("The default report summary can't be removed"); } HibernateUtil.activateObject(report); report.removeSavedChart(reportSummary); // Move the saved summary definition back to the default summary ChartInfo oldDefaultChart = report.getChart(); ((BaseReportDefn) report).setChart(reportSummary); report.removeSavedChart(oldDefaultChart); HibernateUtil.currentSession().delete(oldDefaultChart); this.dataManagement.logLastSchemaChangeTime(request); UsageLogger usageLogger = new UsageLogger(this.relationalDataSource); AppUserInfo user = this.authManager.getUserByUserName(request, request.getRemoteUser()); usageLogger.logReportSchemaChange(user, report, AppAction.REMOVE_CHART, "title: " + reportSummary.getTitle()); UsageLogger.startLoggingThread(usageLogger); }
From source file:com.openkm.servlet.admin.BenchmarkServlet.java
/** * Copy documents into repository several times *//*from w w w . j av a 2 s . c om*/ private void okmCopy(HttpServletRequest request, HttpServletResponse response) throws IOException { log.debug("okmCopy({}, {})", new Object[] { request, response }); String src = WebUtils.getString(request, "param1"); String dst = WebUtils.getString(request, "param2"); int times = WebUtils.getInt(request, "param3"); PrintWriter out = response.getWriter(); ContentInfo cInfo = new ContentInfo(); long tBegin = 0, tEnd = 0; response.setContentType(MimeTypeConfig.MIME_HTML); header(out, "OpenKM copy documents", breadcrumb); out.flush(); try { cInfo = OKMFolder.getInstance().getContentInfo(null, src); out.println("<b>- Source:</b> " + src + "<br/>"); out.println("<b>- Destination:</b> " + dst + "<br/>"); out.println("<b>- Size:</b> " + FormatUtil.formatSize(cInfo.getSize()) + "<br/>"); out.println("<b>- Mails:</b> " + cInfo.getMails() + "<br/>"); out.println("<b>- Folders:</b> " + cInfo.getFolders() + "<br/>"); out.println("<b>- Documents:</b> " + cInfo.getDocuments() + "<br/>"); out.flush(); tBegin = System.currentTimeMillis(); for (int i = 0; i < times; i++) { out.println("<h2>Iteration " + i + "</h2>"); out.flush(); long begin = System.currentTimeMillis(); Folder fld = new Folder(); fld.setPath(dst + "/" + i); OKMFolder.getInstance().create(null, fld); OKMFolder.getInstance().copy(null, src, fld.getPath()); long end = System.currentTimeMillis(); out.println("<b>Time:</b> " + FormatUtil.formatSeconds(end - begin) + "<br/>"); out.flush(); } tEnd = System.currentTimeMillis(); } catch (PathNotFoundException e) { out.println("<div class=\"warn\">PathNotFoundException: " + e.getMessage() + "</div>"); out.flush(); } catch (ItemExistsException e) { out.println("<div class=\"warn\">ItemExistsException: " + e.getMessage() + "</div>"); out.flush(); } catch (AccessDeniedException e) { out.println("<div class=\"warn\">AccessDeniedException: " + e.getMessage() + "</div>"); out.flush(); } catch (RepositoryException e) { out.println("<div class=\"warn\">RepositoryException: " + e.getMessage() + "</div>"); out.flush(); } catch (DatabaseException e) { out.println("<div class=\"warn\">DatabaseException: " + e.getMessage() + "</div>"); out.flush(); } catch (UserQuotaExceededException e) { out.println("<div class=\"warn\">UserQuotaExceededException: " + e.getMessage() + "</div>"); out.flush(); } catch (ExtensionException e) { out.println("<div class=\"warn\">ExtensionException: " + e.getMessage() + "</div>"); out.flush(); } catch (AutomationException e) { out.println("<div class=\"warn\">AutomationException: " + e.getMessage() + "</div>"); out.flush(); } out.println("<hr/>"); out.println("<b>Total size:</b> " + FormatUtil.formatSize(cInfo.getSize() * times) + "<br/>"); out.println("<b>Total mails:</b> " + cInfo.getMails() * times + "<br/>"); out.println("<b>Total folders:</b> " + cInfo.getFolders() * times + "<br/>"); out.println("<b>Total documents:</b> " + cInfo.getDocuments() * times + "<br/>"); out.println("<b>Total time:</b> " + FormatUtil.formatSeconds(tEnd - tBegin) + "<br/>"); footer(out); out.flush(); out.close(); // Activity log UserActivity.log(request.getRemoteUser(), "ADMIN_BENCHMARK_OKM_COPY", null, null, "Size: " + FormatUtil.formatSize(cInfo.getSize() * times) + ", Folders: " + cInfo.getMails() * times + ", Documents: " + cInfo.getDocuments() * times + ", Time: " + FormatUtil.formatSeconds(tEnd - tBegin)); log.debug("okmCopy: void"); }
From source file:com.gtwm.pb.model.manageSchema.DatabaseDefn.java
public void removeGroupingFromChart(HttpServletRequest request, ReportFieldInfo groupingReportField) throws DisallowedException, ObjectNotFoundException, SQLException, CantDoThatException { BaseReportInfo report = groupingReportField.getParentReport(); if (!(this.authManager.getAuthenticator().loggedInUserAllowedTo(request, PrivilegeType.MANAGE_TABLE, report.getParentTable()))) { throw new DisallowedException(this.authManager.getLoggedInUser(request), PrivilegeType.MANAGE_TABLE, report.getParentTable()); }/*from w w w . j av a 2s. c o m*/ ChartInfo chart = report.getChart(); HibernateUtil.activateObject(chart); ChartGroupingInfo removedGrouping = chart.removeGrouping(groupingReportField); this.dataManagement.logLastSchemaChangeTime(request); // Test change by selecting rows from the database CompanyInfo company = this.getAuthManager().getCompanyForLoggedInUser(request); Map<BaseField, String> blankFilterValues = new HashMap<BaseField, String>(); ChartDataInfo reportSummaryData = this.getDataManagement().getChartData(company, report.getChart(), blankFilterValues, false); UsageLogger usageLogger = new UsageLogger(this.relationalDataSource); AppUserInfo user = this.authManager.getUserByUserName(request, request.getRemoteUser()); usageLogger.logReportSchemaChange(user, report, AppAction.REMOVE_GROUPING_FROM_CHART, "field: " + groupingReportField); UsageLogger.startLoggingThread(usageLogger); }
From source file:com.gtwm.pb.model.manageSchema.DatabaseDefn.java
public void removeFunctionFromChart(HttpServletRequest request, BaseReportInfo report, String internalAggregateName) throws DisallowedException, CantDoThatException, ObjectNotFoundException, SQLException { if (!(this.authManager.getAuthenticator().loggedInUserAllowedTo(request, PrivilegeType.MANAGE_TABLE, report.getParentTable()))) { throw new DisallowedException(this.authManager.getLoggedInUser(request), PrivilegeType.MANAGE_TABLE, report.getParentTable()); }//w ww. j av a2 s. com ChartInfo chart = report.getChart(); HibernateUtil.activateObject(chart); ChartAggregateInfo removedFunction = chart.removeFunction(internalAggregateName); this.dataManagement.logLastSchemaChangeTime(request); // Test change by selecting rows from the database CompanyInfo company = this.getAuthManager().getCompanyForLoggedInUser(request); Map<BaseField, String> blankFilterValues = new HashMap<BaseField, String>(); ChartDataInfo reportSummaryData = this.getDataManagement().getChartData(company, report.getChart(), blankFilterValues, false); HibernateUtil.currentSession().delete(removedFunction); UsageLogger usageLogger = new UsageLogger(this.relationalDataSource); AppUserInfo user = this.authManager.getUserByUserName(request, request.getRemoteUser()); usageLogger.logReportSchemaChange(user, report, AppAction.REMOVE_FUNCTION_FROM_CHART, "function: " + removedFunction); UsageLogger.startLoggingThread(usageLogger); }
From source file:com.gtwm.pb.model.manageSchema.DatabaseDefn.java
public void addGroupingToChart(HttpServletRequest request, ReportFieldInfo groupingReportField, SummaryGroupingModifier groupingModifer) throws DisallowedException, CantDoThatException, ObjectNotFoundException, SQLException { HibernateUtil.activateObject(groupingReportField); BaseReportInfo report = groupingReportField.getParentReport(); if (!(this.authManager.getAuthenticator().loggedInUserAllowedTo(request, PrivilegeType.MANAGE_TABLE, report.getParentTable()))) { throw new DisallowedException(this.authManager.getLoggedInUser(request), PrivilegeType.MANAGE_TABLE, report.getParentTable()); }//w ww . j av a2 s .c om ChartInfo chart = report.getChart(); HibernateUtil.activateObject(chart); chart.addGrouping(groupingReportField, groupingModifer); this.dataManagement.logLastSchemaChangeTime(request); // Test change by selecting rows from the database CompanyInfo company = this.getAuthManager().getCompanyForLoggedInUser(request); Map<BaseField, String> blankFilterValues = new HashMap<BaseField, String>(); ChartDataInfo reportSummaryData = this.getDataManagement().getChartData(company, report.getChart(), blankFilterValues, false); UsageLogger usageLogger = new UsageLogger(this.relationalDataSource); AppUserInfo user = this.authManager.getUserByUserName(request, request.getRemoteUser()); usageLogger.logReportSchemaChange(user, report, AppAction.ADD_GROUPING_TO_CHART, "field: " + groupingReportField); UsageLogger.startLoggingThread(usageLogger); }