edu.internet2.middleware.grouper.grouperUi.beans.ui.DeprovisioningContainer 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
The newest version!
package edu.internet2.middleware.grouper.grouperUi.beans.ui;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import edu.internet2.middleware.grouper.Group;
import edu.internet2.middleware.grouper.GrouperSession;
import edu.internet2.middleware.grouper.Stem;
import edu.internet2.middleware.grouper.StemFinder;
import edu.internet2.middleware.grouper.app.deprovisioning.GrouperDeprovisioningAffiliation;
import edu.internet2.middleware.grouper.app.deprovisioning.GrouperDeprovisioningAttributeValue;
import edu.internet2.middleware.grouper.app.deprovisioning.GrouperDeprovisioningConfiguration;
import edu.internet2.middleware.grouper.app.deprovisioning.GrouperDeprovisioningLogic;
import edu.internet2.middleware.grouper.app.deprovisioning.GrouperDeprovisioningOverallConfiguration;
import edu.internet2.middleware.grouper.app.deprovisioning.GrouperDeprovisioningSettings;
import edu.internet2.middleware.grouper.attr.AttributeDef;
import edu.internet2.middleware.grouper.exception.GrouperSessionException;
import edu.internet2.middleware.grouper.grouperUi.beans.api.GuiAttributeDef;
import edu.internet2.middleware.grouper.grouperUi.beans.api.GuiDeprovisioningMembershipSubjectContainer;
import edu.internet2.middleware.grouper.grouperUi.beans.api.GuiGroup;
import edu.internet2.middleware.grouper.grouperUi.beans.api.GuiMember;
import edu.internet2.middleware.grouper.grouperUi.beans.api.GuiStem;
import edu.internet2.middleware.grouper.grouperUi.beans.api.deprovisioning.GuiGrouperDeprovisioningAttributeValue;
import edu.internet2.middleware.grouper.misc.GrouperSessionHandler;
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.subject.Source;
import edu.internet2.middleware.subject.Subject;
/**
*
*/
public class DeprovisioningContainer {
/**
* group to email to if applicable
*/
private GuiGroup grouperDeprovisioningEmailGuiGroup;
/**
* group to email to if applicable
* @return the grouperDeprovisioningEmailGuiGroup
*/
public GuiGroup getGrouperDeprovisioningEmailGuiGroup() {
return this.grouperDeprovisioningEmailGuiGroup;
}
/**
* group to email to if applicable
* @param grouperDeprovisioningEmailGuiGroup1 the grouperDeprovisioningEmailGuiGroup to set
*/
public void setGrouperDeprovisioningEmailGuiGroup(GuiGroup grouperDeprovisioningEmailGuiGroup1) {
this.grouperDeprovisioningEmailGuiGroup = grouperDeprovisioningEmailGuiGroup1;
}
/**
*
* @return the gui value
*/
public GuiGrouperDeprovisioningAttributeValue getGuiGrouperDeprovisioningAttributeValueNew() {
return new GuiGrouperDeprovisioningAttributeValue(this.getGrouperDeprovisioningAttributeValueNew());
}
/**
* get the new deprovisioning settings
* @return the new configuration
*/
public GrouperDeprovisioningAttributeValue getGrouperDeprovisioningAttributeValueNew() {
if (StringUtils.isBlank(this.getAffiliation())) {
return null;
}
this.grouperDeprovisioningOverallConfiguration = this.getGrouperDeprovisioningOverallConfiguration();
GrouperDeprovisioningConfiguration grouperDeprovisioningConfiguration = this.grouperDeprovisioningOverallConfiguration.getAffiliationToConfiguration().get(this.affiliation);
if (grouperDeprovisioningConfiguration == null) {
grouperDeprovisioningConfiguration = new GrouperDeprovisioningConfiguration();
grouperDeprovisioningConfiguration.setGrouperDeprovisioningOverallConfiguration(this.grouperDeprovisioningOverallConfiguration);
this.grouperDeprovisioningOverallConfiguration.getAffiliationToConfiguration().put(this.affiliation, grouperDeprovisioningConfiguration);
}
GrouperDeprovisioningAttributeValue grouperDeprovisioningAttributeValue = grouperDeprovisioningConfiguration.getNewConfig();
// if theres no configuration, or if the configuration is inherited, then clear it out
if (grouperDeprovisioningAttributeValue == null) {
grouperDeprovisioningAttributeValue = new GrouperDeprovisioningAttributeValue();
grouperDeprovisioningAttributeValue.setAffiliationString(this.affiliation);
grouperDeprovisioningAttributeValue.setGrouperDeprovisioningConfiguration(grouperDeprovisioningConfiguration);
grouperDeprovisioningConfiguration.setNewConfig(grouperDeprovisioningAttributeValue);
}
return grouperDeprovisioningAttributeValue;
}
// /**
// * get the new deprovisioning settings
// * @return the new configuration
// */
// public GrouperDeprovisioningAttributeValue getGrouperDeprovisioningAttributeValueNewForEdit() {
//
// if (StringUtils.isBlank(this.getAffiliation())) {
// return null;
// }
//
// GrouperDeprovisioningConfiguration grouperDeprovisioningConfiguration = this.grouperDeprovisioningOverallConfiguration.getAffiliationToConfiguration().get(this.affiliation);
//
// GrouperDeprovisioningAttributeValue grouperDeprovisioningAttributeValue = this.getGrouperDeprovisioningAttributeValueNew();
//
// // if theres no configuration, or if the configuration is inherited, then clear it out
// if (grouperDeprovisioningAttributeValue == null || !grouperDeprovisioningAttributeValue.isDirectAssignment()) {
// grouperDeprovisioningAttributeValue = new GrouperDeprovisioningAttributeValue();
// grouperDeprovisioningAttributeValue.setAffiliationString(this.affiliation);
// grouperDeprovisioningConfiguration.setNewConfig(grouperDeprovisioningAttributeValue);
// grouperDeprovisioningAttributeValue.setDeprovision(true);
// }
//
// return grouperDeprovisioningAttributeValue;
// }
/**
* get the grouper deprovisioning attribute values for all affiliations
* @return the map
*/
public Map getGrouperDeprovisioningAttributeValuesAll() {
Map affiliationNameToConfiguration = new TreeMap();
this.attributeAssignableHelper();
for (String theAffiliation : GrouperDeprovisioningAffiliation.retrieveAllAffiliations().keySet()) {
GrouperDeprovisioningConfiguration grouperDeprovisioningConfiguration = this.grouperDeprovisioningOverallConfiguration == null ? null
: this.grouperDeprovisioningOverallConfiguration.getAffiliationToConfiguration().get(theAffiliation);
GrouperDeprovisioningAttributeValue grouperDeprovisioningAttributeValue = grouperDeprovisioningConfiguration == null ? null
: grouperDeprovisioningConfiguration.getOriginalConfig();
if (grouperDeprovisioningAttributeValue == null) {
grouperDeprovisioningAttributeValue = new GrouperDeprovisioningAttributeValue();
grouperDeprovisioningAttributeValue.setAffiliationString(theAffiliation);
}
affiliationNameToConfiguration.put(theAffiliation, grouperDeprovisioningAttributeValue);
}
return affiliationNameToConfiguration;
}
/**
* if this object or any parent object has deprovisioning
* @return if there is deprovisioning
*/
public boolean isHasDeprovisioningOnThisObjectOrParent() {
this.attributeAssignableHelper();
if (this.grouperDeprovisioningOverallConfiguration == null || GrouperUtil.length(this.grouperDeprovisioningOverallConfiguration) == 0) {
return false;
}
for (GrouperDeprovisioningConfiguration grouperDeprovisioningConfiguration : this.grouperDeprovisioningOverallConfiguration.getAffiliationToConfiguration().values()) {
if (grouperDeprovisioningConfiguration.getOriginalConfig() != null && !StringUtils.isBlank(grouperDeprovisioningConfiguration.getOriginalConfig().getAffiliationString())) {
return true;
}
}
return false;
}
/**
* if root has deprovisioning attributes for any of the affiliations
* @return is there is deprovisioning on root stem
*/
public boolean isHasRootDeprovisioningAttributes() {
Stem rootStem = StemFinder.findRootStem(GrouperSession.staticGrouperSession().internal_getRootSession());
GrouperDeprovisioningOverallConfiguration rootOverallConfig = GrouperDeprovisioningOverallConfiguration.retrieveConfiguration(rootStem);
for (GrouperDeprovisioningConfiguration grouperDeprovisioningConfiguration : rootOverallConfig.getAffiliationToConfiguration().values()) {
if (grouperDeprovisioningConfiguration.getOriginalConfig() != null && !StringUtils.isBlank(grouperDeprovisioningConfiguration.getOriginalConfig().getAffiliationString())) {
return true;
}
}
return false;
}
/**
* overall configuration for this user and this object (group, folder, attributeDef)
*/
private GrouperDeprovisioningOverallConfiguration grouperDeprovisioningOverallConfiguration;
/**
* @return the grouperDeprovisioningOverallConfiguration
*/
public GrouperDeprovisioningOverallConfiguration getGrouperDeprovisioningOverallConfiguration() {
this.attributeAssignableHelper();
return this.grouperDeprovisioningOverallConfiguration;
}
/**
* access that a user has
*/
private Set guiDeprovisioningMembershipSubjectContainers;
/**
* access that a user has
* @return the containers
*/
public Set getGuiDeprovisioningMembershipSubjectContainers() {
this.attributeAssignableHelper();
return this.guiDeprovisioningMembershipSubjectContainers;
}
/**
* access that a user has
* @param guiDeprovisioningMembershipSubjectContainers1
*/
public void setGuiDeprovisioningMembershipSubjectContainers(
Set guiDeprovisioningMembershipSubjectContainers1) {
this.guiDeprovisioningMembershipSubjectContainers = guiDeprovisioningMembershipSubjectContainers1;
}
/**
* get sources to pick which source
* @return the sources
*/
public Set