public static <T extends CapabilityType> boolean hasNativeCapability(CapabilitiesType capabilities, Class<T> capabilityClass) { if (capabilities == null) { return false; } CapabilityCollectionType nativeCaps = capabilities.getNative(); if (nativeCaps == null) { return false; } return getCapability(nativeCaps.getAny(), capabilityClass) != null; } }
/** * Create an instance of {@link CapabilityCollectionType } * */ public CapabilityCollectionType createCapabilityCollectionType() { return new CapabilityCollectionType(); }
public CapabilityCollectionType clone() { CapabilityCollectionType object = new CapabilityCollectionType(); PrismContainerValue value = asPrismContainerValue().clone(); object.setupContainerValue(value); return object; }
throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException { if (capType.getNative() != null && !capType.getNative().getAny().isEmpty()) { if (!forceRefresh) { CachingMetadataType cachingMetadata = capType.getCachingMetadata(); CapabilityCollectionType nativeCapType = new CapabilityCollectionType(); capType.setNative(nativeCapType); nativeCapType.getAny().addAll(retrievedCapabilities);
@Override public boolean equals(Object object) { if (!(object instanceof CapabilityCollectionType)) { return false; } CapabilityCollectionType other = ((CapabilityCollectionType) object); return asPrismContainerValue().equivalent(other.asPrismContainerValue()); }
public CapabilityCollectionType(PrismContext prismContext) { setupContainerValue(new PrismContainerValueImpl<>(this, prismContext)); }
@XmlAnyElement(lax = true) public List<Object> getAny() { return PrismForJAXBUtil.getAny(asPrismContainerValue(), Object.class); }
@NotNull public static Collection<Class<? extends CapabilityType>> getNativeCapabilityClasses(ResourceType resource) { Set<Class<? extends CapabilityType>> rv = new HashSet<>(); if (resource.getCapabilities() == null || resource.getCapabilities().getNative() == null) { return rv; } for (Object o : resource.getCapabilities().getNative().getAny()) { rv.add(CapabilityUtil.asCapabilityType(o).getClass()); } return rv; }
/** * Create an instance of {@link CapabilityCollectionType } * */ public CapabilityCollectionType createCapabilityCollectionType() { return new CapabilityCollectionType(); }
@Override public String toString() { return asPrismContainerValue().toString(); }
/** * Returns collection of capabilities. Note: there is difference between empty set and null. * Empty set means that we know the resource has no capabilities. Null means that the * capabilities were not yet determined. */ public static Collection<Object> getNativeCapabilitiesCollection(ResourceType resource) { if (resource.getCapabilities() == null) { // No capabilities, not initialized return null; } CapabilityCollectionType nativeCap = resource.getCapabilities().getNative(); if (nativeCap == null) { return null; } return nativeCap.getAny(); }
/** * Create an instance of {@link CapabilityCollectionType } * */ public CapabilityCollectionType createCapabilityCollectionType() { return new CapabilityCollectionType(); }
@Override public int hashCode() { return asPrismContainerValue().hashCode(); }
public static <T extends CapabilityType> T getEffectiveCapability(CapabilitiesType capabilitiesType, Class<T> capabilityClass) { if (capabilitiesType == null) { return null; } if (capabilitiesType.getConfigured() != null) { T configuredCapability = CapabilityUtil.getCapability(capabilitiesType.getConfigured().getAny(), capabilityClass); if (configuredCapability != null) { return configuredCapability; } // No configured capability entry, fallback to native capability } if (capabilitiesType.getNative() != null) { T nativeCapability = CapabilityUtil.getCapability(capabilitiesType.getNative().getAny(), capabilityClass); if (nativeCapability != null) { return nativeCapability; } } return null; }
public CapabilityCollectionType beginConfigured() { CapabilityCollectionType value = new CapabilityCollectionType(); configured(value); return value; }
public void setConfigured(CapabilityCollectionType value) { PrismContainerValue fieldContainerValue = ((value!= null)?value.asPrismContainerValue():null); PrismForJAXBUtil.setFieldContainerValue(asPrismContainerValue(), F_CONFIGURED, fieldContainerValue); }
private static List<Object> getEffectiveCapabilities(ResourceType resource, boolean includeDisabled) throws SchemaException { List<Object> rv = new ArrayList<>(); if (resource.getCapabilities() == null) { return rv; } List<Object> configuredCaps = resource.getCapabilities().getConfigured() != null ? resource.getCapabilities().getConfigured().getAny() : Collections.emptyList(); List<Object> nativeCaps = resource.getCapabilities().getNative() != null ? resource.getCapabilities().getNative().getAny() : Collections.emptyList(); for (Object configuredCapability : configuredCaps) { if (includeDisabled || CapabilityUtil.isCapabilityEnabled(configuredCapability)) { rv.add(configuredCapability); } } for (Object nativeCapability: nativeCaps) { if (!CapabilityUtil.containsCapabilityWithSameElementName(configuredCaps, nativeCapability)) { if (includeDisabled || CapabilityUtil.isCapabilityEnabled(nativeCapability)) { rv.add(nativeCapability); } } } return rv; }
public CapabilityCollectionType beginConfiguredCapabilities() { CapabilityCollectionType value = new CapabilityCollectionType(); configuredCapabilities(value); return value; }
public void setNative(CapabilityCollectionType value) { PrismContainerValue fieldContainerValue = ((value!= null)?value.asPrismContainerValue():null); PrismForJAXBUtil.setFieldContainerValue(asPrismContainerValue(), F_NATIVE, fieldContainerValue); }
public static boolean hasResourceNativeActivationCapability(ResourceType resource) { ActivationCapabilityType activationCapability = null; // check resource native capabilities. if resource cannot do // activation, it sholud be null.. if (resource.getCapabilities() != null && resource.getCapabilities().getNative() != null) { activationCapability = CapabilityUtil.getCapability(resource.getCapabilities().getNative().getAny(), ActivationCapabilityType.class); } if (activationCapability == null) { return false; } return true; }