[java-identity-provider] 31/51: IDP-1121 Separate AttributeDependencies from old dependency class
Rod Widdowson
rdw at steadingsoftware.com
Wed Feb 6 08:43:02 EST 2019
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch master
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=532e0699f1e794b773aaf536d25a6f4e4bb4898b
commit 532e0699f1e794b773aaf536d25a6f4e4bb4898b
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue Jan 22 16:58:18 2019 +0000
IDP-1121 Separate AttributeDependencies from old dependency class
https://issues.shibboleth.net/jira/browse/IDP-1121
---
.../ResolverAttributeDefinitionDependency.java | 94 ++++++++++++++++++++--
1 file changed, 89 insertions(+), 5 deletions(-)
diff --git a/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/ResolverAttributeDefinitionDependency.java b/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/ResolverAttributeDefinitionDependency.java
index 748364f..d91b17c 100644
--- a/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/ResolverAttributeDefinitionDependency.java
+++ b/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/ResolverAttributeDefinitionDependency.java
@@ -17,20 +17,104 @@
package net.shibboleth.idp.attribute.resolver;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import com.google.common.base.MoreObjects;
+
+import java.util.Arrays;
+import java.util.Objects;
+
import net.shibboleth.utilities.java.support.annotation.ParameterName;
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+import net.shibboleth.utilities.java.support.logic.Constraint;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
/**
* A Dependency that references to an Attribute Definition.
*/
-public final class ResolverAttributeDefinitionDependency extends ResolverPluginDependency {
+public final class ResolverAttributeDefinitionDependency {
+
+ /** ID of the plugin that will produce the attribute. */
+ @Nonnull @NotEmpty private final String dependencyPluginId;
+
+ /** ID of the attribute, produced by the identified plugin, whose values will be used by the dependent plugin. */
+ @Nullable private String dependencyAttributeId;
/**
* Constructor.
- *
- * @param pluginId ID of dependency
+ *
+ * @param pluginId ID of the plugin that will produce the attribute, never null or empty
+ */
+ public ResolverAttributeDefinitionDependency(
+ @Nonnull @NotEmpty @ParameterName(name="pluginId") final String pluginId) {
+ dependencyPluginId =
+ Constraint.isNotNull(StringSupport.trimOrNull(pluginId),
+ "Dependency plugin ID may not be null or empty");
+ }
+
+ /**
+ * Gets the ID of the plugin that will produce the attribute.
+ *
+ * @return ID of the plugin that will produce the attribute, never null or empty
+ */
+ @Nonnull public String getDependencyPluginId() {
+ return dependencyPluginId;
+ }
+
+ /**
+ * Set the attributeId.
+ *
+ * @param attributeId ID of the attribute, produced by the identified plugin, whose values will be used by the
+ * dependent plugin
*/
- public ResolverAttributeDefinitionDependency(@ParameterName(name="pluginId") final String pluginId) {
- super(pluginId);
+ public void setDependencyAttributeId(@Nullable final String attributeId) {
+ dependencyAttributeId = StringSupport.trimOrNull(attributeId);
}
+ /**
+ * Gets the ID of the attribute, produced by the identified plugin, whose values will be used by the dependent
+ * plugin.
+ *
+ * @return ID of the attribute, produced by the identified plugin, whose values will be used by the dependent
+ * plugin, never null or empty
+ */
+ @Nullable public String getDependencyAttributeId() {
+ return dependencyAttributeId;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public int hashCode() {
+ final int[] input = {getDependencyPluginId().hashCode(),
+ getDependencyAttributeId()!=null?getDependencyAttributeId().hashCode(): 0};
+ return Arrays.hashCode(input);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (obj == null) {
+ return false;
+ }
+
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ final ResolverAttributeDefinitionDependency other = (ResolverAttributeDefinitionDependency) obj;
+ return Objects.equals(getDependencyPluginId(), other.getDependencyPluginId())
+ && Objects.equals(getDependencyAttributeId(), other.getDependencyAttributeId());
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this).add("pluginId", dependencyPluginId)
+ .add("attributeId", dependencyAttributeId).toString();
+ }
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list