/** * Gets attribute value by name from the storage object instance. * * @param attributeName the attribute name (case insensitive) * @param storage the storage * @param required specifies whether the attribute value is mandatory * * @return the attribute value from the attribute with the attribute name, or {@code null} if this list contains no attribute with this attribute name */ public String getStorageAttributeValueByName(String attributeName, Storage storage, Boolean required) { String attributeValue = null; for (Attribute attribute : storage.getAttributes()) { if (attribute.getName().equalsIgnoreCase(attributeName)) { attributeValue = attribute.getValue(); break; } } if (required && StringUtils.isBlank(attributeValue)) { throw new IllegalStateException(String.format("Attribute \"%s\" for \"%s\" storage must be configured.", attributeName, storage.getName())); } return attributeValue; }
/** * Gets attribute value by name from the storage object instance. * * @param attributeName the attribute name (case insensitive) * @param storage the storage * @param required specifies whether the attribute value is mandatory * * @return the attribute value from the attribute with the attribute name, or {@code null} if this list contains no attribute with this attribute name */ public String getStorageAttributeValueByName(String attributeName, Storage storage, Boolean required) { String attributeValue = null; for (Attribute attribute : storage.getAttributes()) { if (attribute.getName().equalsIgnoreCase(attributeName)) { attributeValue = attribute.getValue(); break; } } if (required && StringUtils.isBlank(attributeValue)) { throw new IllegalStateException(String.format("Attribute \"%s\" for \"%s\" storage must be configured.", attributeName, storage.getName())); } return attributeValue; }
LOGGER.info(" Attributes: "); for (Attribute attribute : storage.getAttributes())
LOGGER.info(" Attributes: "); for (Attribute attribute : storage.getAttributes())
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) { { String theName; theName = this.getName(); strategy.appendField(locator, this, "name", buffer, theName, (this.name!= null)); } { String theStoragePlatformName; theStoragePlatformName = this.getStoragePlatformName(); strategy.appendField(locator, this, "storagePlatformName", buffer, theStoragePlatformName, (this.storagePlatformName!= null)); } { List<Attribute> theAttributes; theAttributes = ((this.attributes!= null)?this.getAttributes():null); strategy.appendField(locator, this, "attributes", buffer, theAttributes, (this.attributes!= null)); } return buffer; }
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) { { String theName; theName = this.getName(); strategy.appendField(locator, this, "name", buffer, theName, (this.name!= null)); } { String theStoragePlatformName; theStoragePlatformName = this.getStoragePlatformName(); strategy.appendField(locator, this, "storagePlatformName", buffer, theStoragePlatformName, (this.storagePlatformName!= null)); } { List<Attribute> theAttributes; theAttributes = ((this.attributes!= null)?this.getAttributes():null); strategy.appendField(locator, this, "attributes", buffer, theAttributes, (this.attributes!= null)); } return buffer; }
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) { { String theName; theName = this.getName(); strategy.appendField(locator, this, "name", buffer, theName, (this.name!= null)); } { String theStoragePlatformName; theStoragePlatformName = this.getStoragePlatformName(); strategy.appendField(locator, this, "storagePlatformName", buffer, theStoragePlatformName, (this.storagePlatformName!= null)); } { List<Attribute> theAttributes; theAttributes = ((this.attributes!= null)?this.getAttributes():null); strategy.appendField(locator, this, "attributes", buffer, theAttributes, (this.attributes!= null)); } return buffer; }
lhsAttributes = ((this.attributes!= null)?this.getAttributes():null); List<Attribute> rhsAttributes; rhsAttributes = ((that.attributes!= null)?that.getAttributes():null); if (!strategy.equals(LocatorUtils.property(thisLocator, "attributes", lhsAttributes), LocatorUtils.property(thatLocator, "attributes", rhsAttributes), lhsAttributes, rhsAttributes, (this.attributes!= null), (that.attributes!= null))) { return false;
lhsAttributes = ((this.attributes!= null)?this.getAttributes():null); List<Attribute> rhsAttributes; rhsAttributes = ((that.attributes!= null)?that.getAttributes():null); if (!strategy.equals(LocatorUtils.property(thisLocator, "attributes", lhsAttributes), LocatorUtils.property(thatLocator, "attributes", rhsAttributes), lhsAttributes, rhsAttributes, (this.attributes!= null), (that.attributes!= null))) { return false;
lhsAttributes = ((this.attributes!= null)?this.getAttributes():null); List<Attribute> rhsAttributes; rhsAttributes = ((that.attributes!= null)?that.getAttributes():null); if (!strategy.equals(LocatorUtils.property(thisLocator, "attributes", lhsAttributes), LocatorUtils.property(thatLocator, "attributes", rhsAttributes), lhsAttributes, rhsAttributes, (this.attributes!= null), (that.attributes!= null))) { return false;
public int hashCode(ObjectLocator locator, HashCodeStrategy2 strategy) { int currentHashCode = 1; { String theName; theName = this.getName(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "name", theName), currentHashCode, theName, (this.name!= null)); } { String theStoragePlatformName; theStoragePlatformName = this.getStoragePlatformName(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "storagePlatformName", theStoragePlatformName), currentHashCode, theStoragePlatformName, (this.storagePlatformName!= null)); } { List<Attribute> theAttributes; theAttributes = ((this.attributes!= null)?this.getAttributes():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "attributes", theAttributes), currentHashCode, theAttributes, (this.attributes!= null)); } return currentHashCode; }
public int hashCode(ObjectLocator locator, HashCodeStrategy2 strategy) { int currentHashCode = 1; { String theName; theName = this.getName(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "name", theName), currentHashCode, theName, (this.name!= null)); } { String theStoragePlatformName; theStoragePlatformName = this.getStoragePlatformName(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "storagePlatformName", theStoragePlatformName), currentHashCode, theStoragePlatformName, (this.storagePlatformName!= null)); } { List<Attribute> theAttributes; theAttributes = ((this.attributes!= null)?this.getAttributes():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "attributes", theAttributes), currentHashCode, theAttributes, (this.attributes!= null)); } return currentHashCode; }
public int hashCode(ObjectLocator locator, HashCodeStrategy2 strategy) { int currentHashCode = 1; { String theName; theName = this.getName(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "name", theName), currentHashCode, theName, (this.name!= null)); } { String theStoragePlatformName; theStoragePlatformName = this.getStoragePlatformName(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "storagePlatformName", theStoragePlatformName), currentHashCode, theStoragePlatformName, (this.storagePlatformName!= null)); } { List<Attribute> theAttributes; theAttributes = ((this.attributes!= null)?this.getAttributes():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "attributes", theAttributes), currentHashCode, theAttributes, (this.attributes!= null)); } return currentHashCode; }
@Test public void testUpdateStorage() { // Create a storage. Storage storage = storageService.createStorage(getNewStorageCreateRequest()); // Update the storage. // TODO: Update various attributes of the storage update request in the future when there is something to update. Storage result = storageService.updateStorage(new StorageKey(storage.getName()), new StorageUpdateRequest()); // Validate the results. // TODO: Add asserts to ensure fields that were update indeed got updated. assertEquals(new Storage(storage.getName(), storage.getStoragePlatformName(), storage.getAttributes()), result); }
if (attributesShouldBeCopiedAndSet == Boolean.TRUE) { List<Attribute> sourceAttributes; sourceAttributes = ((this.attributes!= null)?this.getAttributes():null); @SuppressWarnings("unchecked") List<Attribute> copyAttributes = ((List<Attribute> ) strategy.copy(LocatorUtils.property(locator, "attributes", sourceAttributes), sourceAttributes, (this.attributes!= null)));
if (attributesShouldBeCopiedAndSet == Boolean.TRUE) { List<Attribute> sourceAttributes; sourceAttributes = ((this.attributes!= null)?this.getAttributes():null); @SuppressWarnings("unchecked") List<Attribute> copyAttributes = ((List<Attribute> ) strategy.copy(LocatorUtils.property(locator, "attributes", sourceAttributes), sourceAttributes, (this.attributes!= null)));
if (attributesShouldBeCopiedAndSet == Boolean.TRUE) { List<Attribute> sourceAttributes; sourceAttributes = ((this.attributes!= null)?this.getAttributes():null); @SuppressWarnings("unchecked") List<Attribute> copyAttributes = ((List<Attribute> ) strategy.copy(LocatorUtils.property(locator, "attributes", sourceAttributes), sourceAttributes, (this.attributes!= null)));