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

pl.edu.icm.unity.engine.bulk.GlobalSystemData Maven / Gradle / Ivy

/*
 * Copyright (c) 2018 Bixbit - Krzysztof Benedyczak. All rights reserved.
 * See LICENCE.txt file for licensing information.
 */
package pl.edu.icm.unity.engine.bulk;

import java.util.Collection;
import java.util.Collections;
import java.util.Map;

import pl.edu.icm.unity.base.attribute.AttributeType;
import pl.edu.icm.unity.base.attribute.AttributesClass;
import pl.edu.icm.unity.base.authn.CredentialDefinition;
import pl.edu.icm.unity.base.authn.CredentialRequirements;
import pl.edu.icm.unity.base.group.Group;
import pl.edu.icm.unity.base.registration.EnquiryForm;
import pl.edu.icm.unity.engine.api.mvel.CachingMVELGroupProvider;

/**
 * Information about global state of the system, not group specific.
 */
class GlobalSystemData
{
	private Map attributeTypes;
	private Map groups;
	private Map attributeClasses;
	private Collection credentials;
	private Map credentialRequirements;
	private Map enquiryForms;
	private CachingMVELGroupProvider cachingMVELGroupProvider;
	
	private GlobalSystemData() 
	{
	}
	
	static Builder builder()
	{
		return new Builder();
	}
	
	Map getAttributeTypes()
	{
		return attributeTypes;
	}

	Map getGroups()
	{
		return groups;
	}
	
	CachingMVELGroupProvider getCachingMVELGroupProvider()
	{
		return cachingMVELGroupProvider;
	}

	Map getAttributeClasses()
	{
		return attributeClasses;
	}

	Map getCredentialRequirements()
	{
		return credentialRequirements;
	}

	Collection getCredentials()
	{
		return credentials;
	}

	Map getEnquiryForms()
	{
		return enquiryForms;
	}

	static class Builder
	{
		GlobalSystemData obj = new GlobalSystemData();
		
		Builder withAttributeTypes(Map attributeTypes)
		{
			obj.attributeTypes = Collections.unmodifiableMap(attributeTypes);
			return this;
		}

		Builder withGroups(Map groups)
		{
			obj.groups = Collections.unmodifiableMap(groups);
			return this;
		}
		
		Builder withAttributeClasses(Map attributeClasses)
		{
			obj.attributeClasses = Collections.unmodifiableMap(attributeClasses);
			return this;
		}
		
		Builder withCredentialRequirements(Map credRequirements)
		{
			obj.credentialRequirements = Collections.unmodifiableMap(credRequirements);
			return this;
		}
		
		Builder withEnquiryForms(Map enquiryForms)
		{
			obj.enquiryForms = Collections.unmodifiableMap(enquiryForms);
			return this;
		}
		
		Builder withCredentials(Collection credentials)
		{
			obj.credentials = Collections.unmodifiableCollection(credentials);
			return this;
		}
		
		GlobalSystemData build()
		{
			GlobalSystemData ret = obj;
			ret.cachingMVELGroupProvider = new CachingMVELGroupProvider(ret.groups);
			obj = new GlobalSystemData();
			return ret;
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy