edu.internet2.middleware.grouper.app.boxProvisioner.BoxProvisionerConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grouper Show documentation
Show all versions of grouper Show documentation
Internet2 Groups Management Toolkit
package edu.internet2.middleware.grouper.app.boxProvisioner;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import edu.internet2.middleware.grouper.app.config.GrouperConfigurationModuleAttribute;
import edu.internet2.middleware.grouper.app.provisioning.ProvisionerStartWithBase;
import edu.internet2.middleware.grouper.app.provisioning.ProvisioningConfiguration;
import edu.internet2.middleware.grouper.cfg.dbConfig.ConfigFileName;
import edu.internet2.middleware.grouper.cfg.text.GrouperTextContainer;
import edu.internet2.middleware.grouper.util.GrouperUtil;
public class BoxProvisionerConfiguration extends ProvisioningConfiguration {
public final static Set startWithConfigClassNames = new LinkedHashSet();
static {
startWithConfigClassNames.add(BoxProvisioningStartWith.class.getName());
}
@Override
public List getStartWithConfigClasses() {
List result = new ArrayList();
for (String className: startWithConfigClassNames) {
try {
Class configClass = (Class) GrouperUtil.forName(className);
ProvisionerStartWithBase config = GrouperUtil.newInstance(configClass);
result.add(config);
} catch (Exception e) {
//TODO
}
}
return result;
}
@Override
public ConfigFileName getConfigFileName() {
return ConfigFileName.GROUPER_LOADER_PROPERTIES;
}
@Override
public String getConfigItemPrefix() {
if (StringUtils.isBlank(this.getConfigId())) {
throw new RuntimeException("Must have configId!");
}
return "provisioner." + this.getConfigId() + ".";
}
@Override
public String getConfigIdRegex() {
return "^(provisioner)\\.([^.]+)\\.(.*)$";
}
@Override
public String getPropertySuffixThatIdentifiesThisConfig() {
return "class";
}
@Override
public String getPropertyValueThatIdentifiesThisConfig() {
return GrouperBoxProvisioner.class.getName();
}
private void assignCacheConfig() {
}
@Override
public void insertConfig(boolean fromUi, StringBuilder message,
List errorsToDisplay, Map validationErrorsToDisplay, List actionsPerformed) {
assignCacheConfig();
super.insertConfig(fromUi, message, errorsToDisplay, validationErrorsToDisplay, actionsPerformed);
}
@Override
public void editConfig(boolean fromUi, StringBuilder message, List errorsToDisplay, Map validationErrorsToDisplay, List actionsPerformed) {
assignCacheConfig();
super.editConfig(fromUi, message, errorsToDisplay, validationErrorsToDisplay, actionsPerformed);
}
@Override
public void validatePreSave(boolean isInsert, List errorsToDisplay,
Map validationErrorsToDisplay) {
super.validatePreSave(isInsert, errorsToDisplay, validationErrorsToDisplay);
if (errorsToDisplay.size() > 0 || validationErrorsToDisplay.size() > 0) {
return;
}
GrouperConfigurationModuleAttribute numberOfGroupAttributes = this.retrieveAttributes().get("numberOfGroupAttributes");
int numberOfGroupAttributesLength = 0;
boolean groupNameThere = false;
boolean groupIdThere = false;
if (numberOfGroupAttributes != null) {
numberOfGroupAttributesLength = GrouperUtil.intValue(numberOfGroupAttributes.getValueOrExpressionEvaluation(), 0);
for (int i=0; i