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

org.wildfly.swarm.config.management.access.SensitivityClassificationConstraint Maven / Gradle / Ivy

The newest version!
package org.wildfly.swarm.config.management.access;

import org.wildfly.swarm.config.runtime.AttributeDocumentation;
import org.wildfly.swarm.config.runtime.ResourceDocumentation;
import org.wildfly.swarm.config.runtime.SingletonResource;
import org.wildfly.swarm.config.runtime.Address;
import org.wildfly.swarm.config.runtime.ResourceType;
import org.wildfly.swarm.config.runtime.Implicit;
import java.beans.PropertyChangeSupport;
import java.beans.PropertyChangeListener;
import java.util.List;
import org.wildfly.swarm.config.runtime.Subresource;
import org.wildfly.swarm.config.management.access.constraint.TypeConsumer;
import org.wildfly.swarm.config.management.access.constraint.TypeSupplier;
import org.wildfly.swarm.config.management.access.constraint.Type;
import org.wildfly.swarm.config.runtime.SubresourceInfo;
import org.wildfly.swarm.config.runtime.ModelNodeBinding;

/**
 * The sensitivity classification constraints.
 */
@Address("/core-service=management/access=authorization/constraint=sensitivity-classification")
@ResourceType("constraint")
@Implicit
public class SensitivityClassificationConstraint>
		implements
			org.wildfly.swarm.config.runtime.Keyed {

	private String key;
	private PropertyChangeSupport pcs;
	private SensitivityClassificationConstraintResources subresources = new SensitivityClassificationConstraintResources();

	public SensitivityClassificationConstraint() {
		super();
		this.key = "sensitivity-classification";
		this.pcs = new PropertyChangeSupport(this);
	}

	public String getKey() {
		return this.key;
	}

	/**
	 * Adds a property change listener
	 */
	public void addPropertyChangeListener(PropertyChangeListener listener) {
		if (null == this.pcs)
			this.pcs = new PropertyChangeSupport(this);
		this.pcs.addPropertyChangeListener(listener);
	}

	/**
	 * Removes a property change listener
	 */
	public void removePropertyChangeListener(
			java.beans.PropertyChangeListener listener) {
		if (this.pcs != null)
			this.pcs.removePropertyChangeListener(listener);
	}

	public SensitivityClassificationConstraintResources subresources() {
		return this.subresources;
	}

	/**
	 * Add all Type objects to this subresource
	 * 
	 * @return this
	 * @param value
	 *            List of Type objects.
	 */
	@SuppressWarnings("unchecked")
	public T types(java.util.List value) {
		this.subresources.types = value;
		return (T) this;
	}

	/**
	 * Add the Type object to the list of subresources
	 * 
	 * @param value
	 *            The Type to add
	 * @return this
	 */
	@SuppressWarnings("unchecked")
	public T type(Type value) {
		this.subresources.types.add(value);
		return (T) this;
	}

	/**
	 * Create and configure a Type object to the list of subresources
	 * 
	 * @param key
	 *            The key for the Type resource
	 * @param config
	 *            The TypeConsumer to use
	 * @return this
	 */
	@SuppressWarnings("unchecked")
	public T type(java.lang.String childKey, TypeConsumer consumer) {
		Type child = new Type<>(childKey);
		if (consumer != null) {
			consumer.accept(child);
		}
		type(child);
		return (T) this;
	}

	/**
	 * Create and configure a Type object to the list of subresources
	 * 
	 * @param key
	 *            The key for the Type resource
	 * @return this
	 */
	@SuppressWarnings("unchecked")
	public T type(java.lang.String childKey) {
		type(childKey, null);
		return (T) this;
	}

	/**
	 * Install a supplied Type object to the list of subresources
	 */
	@SuppressWarnings("unchecked")
	public T type(TypeSupplier supplier) {
		type(supplier.get());
		return (T) this;
	}

	/**
	 * Child mutators for SensitivityClassificationConstraint
	 */
	public static class SensitivityClassificationConstraintResources {
		/**
		 * The sensitivity classifications by type. Type is either 'core' or the
		 * name of a subsystem.
		 */
		@ResourceDocumentation("The sensitivity classifications by type. Type is either 'core' or the name of a subsystem.")
		@SubresourceInfo("type")
		private List types = new java.util.ArrayList<>();

		/**
		 * Get the list of Type resources
		 * 
		 * @return the list of resources
		 */
		@Subresource
		public List types() {
			return this.types;
		}

		public Type type(java.lang.String key) {
			return this.types.stream().filter(e -> e.getKey().equals(key))
					.findFirst().orElse(null);
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy