edu.internet2.middleware.grouper.grouperUi.beans.ui.GrouperReportContainer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grouper-ui Show documentation
Show all versions of grouper-ui Show documentation
Internet2 Groups Management User Interface
package edu.internet2.middleware.grouper.grouperUi.beans.ui;
import java.util.ArrayList;
import java.util.List;
import edu.internet2.middleware.grouper.app.loader.db.DatabaseGrouperExternalSystem;
import edu.internet2.middleware.grouper.app.reports.GrouperReportConfigurationBean;
import edu.internet2.middleware.grouper.app.reports.GrouperReportSettings;
import edu.internet2.middleware.grouper.app.reports.ReportConfigFormat;
import edu.internet2.middleware.grouper.app.reports.ReportConfigType;
import edu.internet2.middleware.grouper.grouperUi.beans.api.GuiGrouperReportConfig;
import edu.internet2.middleware.grouper.privs.PrivilegeHelper;
import edu.internet2.middleware.grouper.ui.GrouperUiFilter;
import edu.internet2.middleware.grouper.util.GrouperUtil;
import edu.internet2.middleware.grouperClient.collections.MultiKey;
import edu.internet2.middleware.subject.Subject;
public class GrouperReportContainer {
/**
* list of gui report configs
*/
private List guiGrouperReportConfigs = new ArrayList();
/**
* report config bean user is currently working on
*/
private GrouperReportConfigurationBean configBean;
/**
* list of report configs for one stem/group
*/
private List reportConfigBeans = new ArrayList();
/**
* report configs for gui
*/
private List guiReportConfigs = new ArrayList();
/**
* encapsulates config and all instances together
*/
private GrouperReportConfigInstance grouperReportConfigInstance;
/**
* one report instance details
*/
private GuiReportInstance guiReportInstance;
/**
* can logged in subject make changes to grouper report configs
* @return
*/
public boolean isCanWriteGrouperReports() {
Subject loggedInSubject = GrouperUiFilter.retrieveSubjectLoggedIn();
return PrivilegeHelper.isWheelOrRoot(loggedInSubject);
}
/**
* @return list of gui report configs
*/
public List getGuiGrouperReportConfigs() {
return guiGrouperReportConfigs;
}
/**
* @return all the report config types (eg: SQL)
*/
public List getAllReportConfigTypes() {
List reportConfigTypes = new ArrayList();
for (ReportConfigType type: ReportConfigType.values()) {
reportConfigTypes.add(type.name());
}
return reportConfigTypes;
}
/**
* @return all the report config formats (eg: CSV)
*/
public List getAllReportConfigFormats() {
List reportConfigFormats = new ArrayList();
for (ReportConfigFormat format: ReportConfigFormat.values()) {
reportConfigFormats.add(format.name());
}
return reportConfigFormats;
}
public List getAllSqlConfigs() {
List sqlConfigs = new ArrayList();
DatabaseGrouperExternalSystem databaseGrouperExternalSystem = new DatabaseGrouperExternalSystem();
List keysAndLabels = databaseGrouperExternalSystem.retrieveKeysAndLabels();
for (MultiKey multiKey : keysAndLabels) {
sqlConfigs.add(GrouperUtil.stringValue(multiKey.getKey(0)));
}
return sqlConfigs;
}
/**
* @return report config bean user is currently working on
*/
public GrouperReportConfigurationBean getConfigBean() {
return configBean;
}
/**
* report config bean user is currently working on
* @param configBean
*/
public void setConfigBean(GrouperReportConfigurationBean configBean) {
this.configBean = configBean;
}
/**
* @return list of report configs for one stem/group
*/
public List getReportConfigBeans() {
return reportConfigBeans;
}
/**
* list of report configs for one stem/group
* @param reportConfigBeans
*/
public void setReportConfigBeans(List reportConfigBeans) {
this.reportConfigBeans = reportConfigBeans;
}
/**
* @return report configs for gui
*/
public List getGuiReportConfigs() {
return guiReportConfigs;
}
/**
* report configs for gui
* @param guiReportConfigs
*/
public void setGuiReportConfigs(List guiReportConfigs) {
this.guiReportConfigs = guiReportConfigs;
}
/**
* @return encapsulates config and all instances together
*/
public GrouperReportConfigInstance getGrouperReportConfigInstance() {
return grouperReportConfigInstance;
}
/**
* encapsulates config and all instances together
* @param grouperReportConfigInstance
*/
public void setGrouperReportConfigInstance(GrouperReportConfigInstance grouperReportConfigInstance) {
this.grouperReportConfigInstance = grouperReportConfigInstance;
}
/**
* @return one report instance details
*/
public GuiReportInstance getGuiReportInstance() {
return guiReportInstance;
}
/**
* one report instance details
* @param guiReportInstance
*/
public void setGuiReportInstance(GuiReportInstance guiReportInstance) {
this.guiReportInstance = guiReportInstance;
}
/**
* @return should the partial encryption key be shown
*/
public boolean isShowPartialEncryptionKey() {
Subject loggedInSubject = GrouperUiFilter.retrieveSubjectLoggedIn();
return PrivilegeHelper.isWheelOrRoot(loggedInSubject);
}
/**
* @return is the global reporting enabled
*/
public boolean isReportingEnabled() {
return GrouperReportSettings.grouperReportsEnabled();
}
}