All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.internet2.middleware.grouper.grouperUi.beans.ui.ProvisionerConfigurationContainer Maven / Gradle / Ivy

The newest version!
package edu.internet2.middleware.grouper.grouperUi.beans.ui;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.logging.Log;

import edu.internet2.middleware.grouper.app.provisioning.GrouperProvisioningError;
import edu.internet2.middleware.grouper.app.provisioning.GrouperProvisioningErrorSummary;
import edu.internet2.middleware.grouper.app.provisioning.ProvisionerStartWithBase;
import edu.internet2.middleware.grouper.app.provisioning.ProvisioningConfiguration;
import edu.internet2.middleware.grouper.grouperUi.beans.api.GuiGroup;
import edu.internet2.middleware.grouper.grouperUi.beans.api.GuiStem;
import edu.internet2.middleware.grouper.grouperUi.beans.json.GuiPaging;
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.jdbc.tableSync.GcGrouperSyncErrorCode;
import edu.internet2.middleware.grouperClient.jdbc.tableSync.GcGrouperSyncGroup;
import edu.internet2.middleware.grouperClient.jdbc.tableSync.GcGrouperSyncJob;
import edu.internet2.middleware.grouperClient.jdbc.tableSync.GcGrouperSyncMember;
import edu.internet2.middleware.grouperClient.jdbc.tableSync.GcGrouperSyncMembership;
import org.apache.commons.lang3.StringUtils;
import edu.internet2.middleware.subject.Subject;

public class ProvisionerConfigurationContainer {
  
  /** logger */
  private static final Log LOG = GrouperUtil.getLog(ProvisionerConfigurationContainer.class);

  /**
   * provisioner configuration user is currently viewing/editing/adding
   */
  private GuiProvisionerConfiguration guiProvisionerConfiguration;
  
  /**
   * all configured provisioning configurations
   */
  private List guiProvisionerConfigurations = new ArrayList();
  
  /**
   * logs for a provisioner
   */
  private List guiProvisionerLogs = new ArrayList();

  /**
   * groups that are provisionable for a provisioner
   */
  private List guiGroupsProvisionable = new ArrayList();
  
  private int totalProvisionableGroups;
  
  private List guiProvisioningAssignments = new ArrayList<>();
  private int totalProvisioningAssignments;
  
  /**
   * jobs for a provisioner
   */
  private List provisionerJobs = new ArrayList();
  
  /**
   * job details for one job 
   */
  private GcGrouperSyncJob grouperSyncJob;
  
  /**
   * provisioner config object type (group, entity or membership)
   */
  private String provisionerConfigObjectType; 
  
  /**
   * activity for group for one provisioner
   */
  private List activityForGroup;

  /**
   * activity for member for one provisioner
   */
  private List activityForMember;
  
  /**
   * activity for membership for one provisioner
   */
  private List activityForMembership;
  
  /**
   * total activity for one provisioner
   */
  private List provisionerActivity;
  
  /**
   * current grouped config index we are looping through
   */
  private int index;
  
  /**
   * 
   * @return all configured provisioning configurations
   */
  public List getGuiProvisionerConfigurations() {
    return guiProvisionerConfigurations;
  }

  /**
   * all configured provisioning configurations
   * @param guiProvisionerConfigurations
   */
  public void setGuiProvisionerConfigurations(List guiProvisionerConfigurations) {
    this.guiProvisionerConfigurations = guiProvisionerConfigurations;
  }
  

  /**
   * @return provisioner configuration user is currently viewing/editing/adding
   */
  public GuiProvisionerConfiguration getGuiProvisionerConfiguration() {
    return guiProvisionerConfiguration;
  }

  /**
   * provisioner configuration user is currently viewing/editing/adding
   * @param guiProvisionerConfiguration
   */
  public void setGuiProvisionerConfiguration(GuiProvisionerConfiguration guiProvisionerConfiguration) {
    this.guiProvisionerConfiguration = guiProvisionerConfiguration;
  }
  
  /**
   * @return logs for a provisioner
   */
  public List getGuiProvisionerLogs() {
    return guiProvisionerLogs;
  }

  /**
   * logs for a provisioner
   * @param guiProvisionerLogs
   */
  public void setGuiProvisionerLogs(List guiProvisionerLogs) {
    this.guiProvisionerLogs = guiProvisionerLogs;
  }
  
  
  public List getGuiGroupsProvisionable() {
    return guiGroupsProvisionable;
  }

  
  public void setGuiGroupsProvisionable(List guiGroupsProvisionable) {
    this.guiGroupsProvisionable = guiGroupsProvisionable;
  }

  
  public List getGuiProvisioningAssignments() {
    return guiProvisioningAssignments;
  }

  
  public void setGuiProvisioningAssignments(
      List guiProvisioningAssignments) {
    this.guiProvisioningAssignments = guiProvisioningAssignments;
  }

  
  public int getTotalProvisioningAssignments() {
    return totalProvisioningAssignments;
  }

  
  public void setTotalProvisioningAssignments(int totalProvisioningAssignments) {
    this.totalProvisioningAssignments = totalProvisioningAssignments;
  }

  /**
   * @return jobs for a provisioner
   */
  public List getProvisionerJobs() {
    return provisionerJobs;
  }

  /**
   * jobs for a provisioner
   * @param provisionerJobs
   */
  public void setProvisionerJobs(List provisionerJobs) {
    this.provisionerJobs = provisionerJobs;
  }
  
  /**
   * job details for one job 
   * @return
   */
  public GcGrouperSyncJob getGrouperSyncJob() {
    return grouperSyncJob;
  }

  /**
   * job details for one job 
   * @param grouperSyncJob
   */
  public void setGrouperSyncJob(GcGrouperSyncJob grouperSyncJob) {
    this.grouperSyncJob = grouperSyncJob;
  }

  
  /**
   * @param provisionerConfigId
   * @return true if the logged in subject can view the given provisioner config
   */
  public boolean isCanViewProvisionerConfiguration(String provisionerConfigId) {
    
    if (isCanEditProvisionerConfiguration()) {
      return true;
    }
    
    Subject loggedInSubject = GrouperUiFilter.retrieveSubjectLoggedIn();
    
    List allViewableProvisioningConfigurations = ProvisioningConfiguration.retrieveAllViewableProvisioningConfigurations(loggedInSubject);
    
    for (ProvisioningConfiguration provisioningConfiguration: allViewableProvisioningConfigurations) {
      if (StringUtils.equals(provisionerConfigId, provisioningConfiguration.getConfigId())) {
        return true;
      }
    }
    
    return false;
    
  }
  
  /**
   * @return true if the logged in subject can view at least one provisioner configuration
   */
  public boolean isCanViewProvisionerConfiguration() {
    
    if (isCanEditProvisionerConfiguration()) {
      return true;
    }
    
    Subject loggedInSubject = GrouperUiFilter.retrieveSubjectLoggedIn();
    
    if (ProvisioningConfiguration.retrieveAllViewableProvisioningConfigurations(loggedInSubject).size() > 0) {
      return true;
    }
    
    return false;
  }
  
  /**
   * 
   * @return true if the logged in user can edit/add/delete provisioner configs
   */
  public boolean isCanEditProvisionerConfiguration() {
    
    Subject loggedInSubject = GrouperUiFilter.retrieveSubjectLoggedIn();
    if (PrivilegeHelper.isWheelOrRoot(loggedInSubject)) {
      return true;
    }
    
    return false;
  }
  
  public List getAllProvisionerConfigurationTypes() {
    return ProvisioningConfiguration.retrieveAllProvisioningConfigurationTypes();
  }
  
  /**
   * keep track of the paging on the config history screen
   */
  private GuiPaging guiPaging = null;

  
  /**
   * keep track of the paging on the config history screen
   * @return the paging object, init if not there...
   */
  public GuiPaging getGuiPaging() {
    if (this.guiPaging == null) {
      this.guiPaging = new GuiPaging();
    }
    return this.guiPaging;
  }

  
  public void setGuiPaging(GuiPaging guiPaging) {
    this.guiPaging = guiPaging;
  }

  
  public String getProvisionerConfigObjectType() {
    return provisionerConfigObjectType;
  }

  
  public void setProvisionerConfigObjectType(String provisionerConfigObjectType) {
    this.provisionerConfigObjectType = provisionerConfigObjectType;
  }

  
  public List getActivityForGroup() {
    return activityForGroup;
  }

  
  public void setActivityForGroup(List activityForGroup) {
    this.activityForGroup = activityForGroup;
  }

  
  public List getActivityForMember() {
    return activityForMember;
  }

  
  public void setActivityForMember(List activityForMember) {
    this.activityForMember = activityForMember;
  }

  
  public List getActivityForMembership() {
    return activityForMembership;
  }

  
  public void setActivityForMembership(List activityForMembership) {
    this.activityForMembership = activityForMembership;
  }

  private String cacheGroupAttributePrefix;


  
  
  public String getCacheGroupAttributePrefix() {
    
    if (this.cacheGroupAttributePrefix == null) {
      this.cacheGroupAttributePrefix = TextContainer.textOrNull("config.GenericConfiguration.attribute.option.targetGroupAttribute.i.groupAttributePrefix");
    }
    
    return cacheGroupAttributePrefix;
  }

  
  public String getCacheEntityAttributePrefix() {
    if (this.cacheEntityAttributePrefix == null) {
      this.cacheEntityAttributePrefix = TextContainer.textOrNull("config.GenericConfiguration.attribute.option.targetEntityAttribute.i.entityAttributePrefix");
    }
    return cacheEntityAttributePrefix;
  }

  
  public String getCacheAttributePrefix() {
    if (this.cacheAttributePrefix == null) {
      this.cacheAttributePrefix = TextContainer.textOrNull("config.GenericConfiguration.attribute.option.targetGroupAttribute.i.attributePrefix");
    }
    return cacheAttributePrefix;
  }

  
  public String getCacheFieldPrefix() {
    if (this.cacheFieldPrefix == null) {
      this.cacheFieldPrefix = TextContainer.textOrNull("config.GenericConfiguration.attribute.option.targetGroupAttribute.i.fieldPrefix");
    }
    return cacheFieldPrefix;
  }

  private String cacheEntityAttributePrefix;
  private String cacheAttributePrefix;
  private String cacheFieldPrefix;
  
  private String currentConfigSuffix;

  private List startWithConfigClasses;

  private ProvisionerStartWithBase provisionerStartWith;
  
  private boolean blankStartWithSelected;
  
  private boolean showStartWithSection;

  private String startWithSessionId;
  
  private String selectedErrorCode;
  
  private String provisionerConfigErrorDuration;
  
  private String provisionerConfigErrorGroup;

  private String provisionerConfigErrorEntity;

  private GrouperProvisioningErrorSummary grouperProvisioningErrorSummary;
  
  private List grouperProvisioningErrors;
  
  
  public List getGrouperProvisioningErrors() {
    return grouperProvisioningErrors;
  }

  
  public void setGrouperProvisioningErrors(
      List grouperProvisioningErrors) {
    this.grouperProvisioningErrors = grouperProvisioningErrors;
  }

  public GrouperProvisioningErrorSummary getGrouperProvisioningErrorSummary() {
    return grouperProvisioningErrorSummary;
  }

  
  public void setGrouperProvisioningErrorSummary(
      GrouperProvisioningErrorSummary grouperProvisioningErrorSummary) {
    this.grouperProvisioningErrorSummary = grouperProvisioningErrorSummary;
  }

  public String getProvisionerConfigErrorDuration() {
    return provisionerConfigErrorDuration;
  }

  
  public void setProvisionerConfigErrorDuration(String provisionerConfigErrorDuration) {
    this.provisionerConfigErrorDuration = provisionerConfigErrorDuration;
  }
  
  public String getProvisionerConfigErrorGroup() {
    return provisionerConfigErrorGroup;
  }

  
  public void setProvisionerConfigErrorGroup(String provisionerConfigErrorGroup) {
    this.provisionerConfigErrorGroup = provisionerConfigErrorGroup;
  }
  
  public String getProvisionerConfigErrorEntity() {
    return provisionerConfigErrorEntity;
  }

  
  public void setProvisionerConfigErrorEntity(String provisionerConfigErrorEntity) {
    this.provisionerConfigErrorEntity = provisionerConfigErrorEntity;
  }
  

  public String getSelectedErrorCode() {
    return selectedErrorCode;
  }

  
  public void setSelectedErrorCode(String selectedErrorCode) {
    this.selectedErrorCode = selectedErrorCode;
  }

  public List getAllGcGrouperSyncErrorCodes() {
    GcGrouperSyncErrorCode[] values = GcGrouperSyncErrorCode.values();
    List errorCodes = new ArrayList<>();
    for (GcGrouperSyncErrorCode errorCode: values) {
      errorCodes.add(errorCode.name());
    }
    return errorCodes;
  }

  public String getCurrentConfigSuffix() {
    return currentConfigSuffix;
  }

  
  public void setCurrentConfigSuffix(String currentConfigSuffix) {
    this.currentConfigSuffix = currentConfigSuffix;
  }

  public int getIndex() {
    return index;
  }

  
  public void setIndex(int index) {
    this.index = index;
  }

  public void setStartWithConfigClasses(List startWithConfigClasses) {
    this.startWithConfigClasses = startWithConfigClasses;
  }

  
  public List getStartWithConfigClasses() {
    return startWithConfigClasses;
  }

  
  public void setProvisionerStartWith(ProvisionerStartWithBase provisionerStartWith) {
    this.provisionerStartWith = provisionerStartWith;
  }

  
  public ProvisionerStartWithBase getProvisionerStartWith() {
    return provisionerStartWith;
  }

  
  public boolean isShowStartWithSection() {
    return showStartWithSection;
  }

  
  public void setShowStartWithSection(boolean showStartWithSection) {
    this.showStartWithSection = showStartWithSection;
  }

  public void setStartWithSessionId(String startWithSessionId) {
    this.startWithSessionId = startWithSessionId;
  }

  
  public String getStartWithSessionId() {
    return startWithSessionId;
  }

  
  public boolean isBlankStartWithSelected() {
    return blankStartWithSelected;
  }

  
  public void setBlankStartWithSelected(boolean blankStartWithSelected) {
    this.blankStartWithSelected = blankStartWithSelected;
  }

  
  public int getTotalProvisionableGroups() {
    return totalProvisionableGroups;
  }

  
  public void setTotalProvisionableGroups(int totalProvisionableGroups) {
    this.totalProvisionableGroups = totalProvisionableGroups;
  }

  
  public List getProvisionerActivity() {
    return provisionerActivity;
  }

  
  public void setProvisionerActivity(List provisionerActivity) {
    this.provisionerActivity = provisionerActivity;
  }
  
  
  
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy