mirror of https://github.com/apache/jclouds.git
Added CatalogClient domain objects
This commit is contained in:
parent
8da728488a
commit
c8148751ff
|
@ -0,0 +1,239 @@
|
|||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Container for references to VappTemplate and Media objects.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="CatalogType" />
|
||||
* </pre>
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Catalog")
|
||||
public class Catalog extends EntityType<Catalog> {
|
||||
|
||||
public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromCatalog(this);
|
||||
}
|
||||
|
||||
public static class Builder extends EntityType.Builder<Catalog> {
|
||||
|
||||
private Entity owner;
|
||||
private CatalogItems catalogItems;
|
||||
private Boolean isPublished;
|
||||
|
||||
/**
|
||||
* @see Catalog#getOwner()
|
||||
*/
|
||||
public Builder owner(Entity owner) {
|
||||
this.owner = owner;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Catalog#getCatalogItems()
|
||||
*/
|
||||
public Builder catalogItems(CatalogItems catalogItems) {
|
||||
this.catalogItems = catalogItems;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Catalog#isPublished()
|
||||
*/
|
||||
public Builder isPublished(Boolean isPublished) {
|
||||
this.isPublished = isPublished;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Catalog#isPublished()
|
||||
*/
|
||||
public Builder published() {
|
||||
this.isPublished = Boolean.TRUE;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Catalog build() {
|
||||
Catalog catalog = new Catalog(href, name);
|
||||
catalog.setOwner(owner);
|
||||
catalog.setCatalogItems(catalogItems);
|
||||
catalog.setIsPublished(isPublished);
|
||||
catalog.setDescription(description);
|
||||
catalog.setId(id);
|
||||
catalog.setType(type);
|
||||
catalog.setLinks(links);
|
||||
catalog.setTasksInProgress(tasksInProgress);
|
||||
return catalog;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getName()
|
||||
*/
|
||||
@Override
|
||||
public Builder name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getDescription()
|
||||
*/
|
||||
@Override
|
||||
public Builder description(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getId()
|
||||
*/
|
||||
@Override
|
||||
public Builder id(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
*/
|
||||
@Override
|
||||
public Builder tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
this.tasksInProgress = tasksInProgress;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getHref()
|
||||
*/
|
||||
@Override
|
||||
public Builder href(URI href) {
|
||||
this.href = href;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getType()
|
||||
*/
|
||||
@Override
|
||||
public Builder type(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder links(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder link(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder fromEntityType(EntityType<Catalog> in) {
|
||||
return Builder.class.cast(super.fromEntityType(in));
|
||||
}
|
||||
|
||||
public Builder fromCatalog(Catalog in) {
|
||||
return fromEntityType(in).owner(in.getOwner()).catalogItems(in.getCatalogItems()).isPublished(in.isPublished());
|
||||
}
|
||||
}
|
||||
|
||||
private Catalog() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
private Catalog(URI href, String name) {
|
||||
super(href, name);
|
||||
}
|
||||
|
||||
@XmlElement(name = "Owner")
|
||||
private Entity owner;
|
||||
@XmlElement(name = "CatalogItems")
|
||||
private CatalogItems catalogItems;
|
||||
@XmlElement(name = "IsPublished")
|
||||
private Boolean isPublished;
|
||||
|
||||
/**
|
||||
* Gets the value of the owner property.
|
||||
*/
|
||||
public Entity getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public void setOwner(Entity value) {
|
||||
this.owner = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the catalogItems property.
|
||||
*/
|
||||
public CatalogItems getCatalogItems() {
|
||||
return catalogItems;
|
||||
}
|
||||
|
||||
public void setCatalogItems(CatalogItems value) {
|
||||
this.catalogItems = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the isPublished property.
|
||||
*/
|
||||
public Boolean isPublished() {
|
||||
return isPublished;
|
||||
}
|
||||
|
||||
public void setIsPublished(Boolean value) {
|
||||
this.isPublished = value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,220 @@
|
|||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
*
|
||||
* Contains a reference to a VappTemplate or Media object and related metadata.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="CatalogItemType" />
|
||||
* </pre>
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Catalog")
|
||||
public class CatalogItem extends EntityType<CatalogItem> {
|
||||
|
||||
public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG_ITEM;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromCatalogItem(this);
|
||||
}
|
||||
|
||||
public static class Builder extends EntityType.Builder<CatalogItem> {
|
||||
|
||||
private Reference entity;
|
||||
private List<Property> properties = Lists.newArrayList();
|
||||
|
||||
/**
|
||||
* @see CatalogItem#getEntity()
|
||||
*/
|
||||
public Builder entity(Reference entity) {
|
||||
this.entity = entity;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see CatalogItem#getProperties()
|
||||
*/
|
||||
public Builder properties(List<Property> properties) {
|
||||
this.properties = Lists.newArrayList(checkNotNull(properties, "properties"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see CatalogItem#getProperties()
|
||||
*/
|
||||
public Builder property(Property property) {
|
||||
this.properties.add(checkNotNull(property, "property"));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CatalogItem build() {
|
||||
CatalogItem catalog = new CatalogItem(href, name, entity);
|
||||
catalog.setProperties(properties);
|
||||
catalog.setDescription(description);
|
||||
catalog.setId(id);
|
||||
catalog.setType(type);
|
||||
catalog.setLinks(links);
|
||||
catalog.setTasksInProgress(tasksInProgress);
|
||||
return catalog;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getName()
|
||||
*/
|
||||
@Override
|
||||
public Builder name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getDescription()
|
||||
*/
|
||||
@Override
|
||||
public Builder description(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getId()
|
||||
*/
|
||||
@Override
|
||||
public Builder id(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
*/
|
||||
@Override
|
||||
public Builder tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
this.tasksInProgress = tasksInProgress;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getHref()
|
||||
*/
|
||||
@Override
|
||||
public Builder href(URI href) {
|
||||
this.href = href;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getType()
|
||||
*/
|
||||
@Override
|
||||
public Builder type(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder links(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder link(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder fromEntityType(EntityType<CatalogItem> in) {
|
||||
return Builder.class.cast(super.fromEntityType(in));
|
||||
}
|
||||
|
||||
public Builder fromCatalogItem(CatalogItem in) {
|
||||
return fromEntityType(in).entity(in.getEntity()).properties(in.getProperties());
|
||||
}
|
||||
}
|
||||
|
||||
private CatalogItem() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
private CatalogItem(URI href, String name, Reference entity) {
|
||||
super(href, name);
|
||||
this.entity = entity;
|
||||
this.setProperties(properties);
|
||||
}
|
||||
|
||||
@XmlElement(name = "Entity", required = true)
|
||||
private Reference entity;
|
||||
@XmlElement(name = "Property")
|
||||
private List<Property> properties = Lists.newArrayList();
|
||||
|
||||
/**
|
||||
* Gets the value of the entity property.
|
||||
*/
|
||||
public Reference getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the properties property.
|
||||
*/
|
||||
public List<Property> getProperties() {
|
||||
return this.properties;
|
||||
}
|
||||
|
||||
public void setProperties(List<Property> properties) {
|
||||
this.properties = Lists.newArrayList(checkNotNull(properties, "properties"));
|
||||
}
|
||||
|
||||
public void addProperty(Property property) {
|
||||
this.properties.add(checkNotNull(property, "property"));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
/**
|
||||
* Represents a list of catalog item references.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="CatalogItemsType" />
|
||||
* </pre>
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "CatalogItems")
|
||||
public class CatalogItems {
|
||||
|
||||
public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG_ITEMS;
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private List<Reference> catalogItems = Lists.newArrayList();
|
||||
|
||||
/**
|
||||
* @see CatalogItems#getCatalogItems()
|
||||
*/
|
||||
public Builder items(List<Reference> catalogItems) {
|
||||
this.catalogItems = Lists.newArrayList(checkNotNull(catalogItems, "catalogItems"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see CatalogItems#getCatalogItems()
|
||||
*/
|
||||
public Builder item(Reference catalogItem) {
|
||||
this.catalogItems.add(checkNotNull(catalogItem, "catalogItem"));
|
||||
return this;
|
||||
}
|
||||
|
||||
public CatalogItems build() {
|
||||
return new CatalogItems(catalogItems);
|
||||
}
|
||||
|
||||
public Builder fromCatalogItems(CatalogItems in) {
|
||||
return items(in.getCatalogItems());
|
||||
}
|
||||
}
|
||||
|
||||
private CatalogItems() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
private CatalogItems(Collection<Reference> tasks) {
|
||||
this.catalogItems = Lists.newArrayList(checkNotNull(catalogItems, "catalogItems"));
|
||||
}
|
||||
|
||||
@XmlElement(name = "CatalogItem")
|
||||
private List<Reference> catalogItems = Lists.newArrayList();
|
||||
|
||||
/**
|
||||
* Gets the value of the catalogItems property.
|
||||
*/
|
||||
public List<Reference> getCatalogItems() {
|
||||
return this.catalogItems;
|
||||
}
|
||||
|
||||
public void setCatalogItems(List<Reference> catalogItems) {
|
||||
this.catalogItems = Lists.newArrayList(checkNotNull(catalogItems, "catalogItems"));
|
||||
}
|
||||
|
||||
public void addCatalogItem(Reference catalogItem) {
|
||||
this.catalogItems.add(checkNotNull(catalogItem, "catalogItem"));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
/**
|
||||
* Container for ReferenceType elements that reference catalogs.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="CatalogsListType" />
|
||||
* </pre>
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "CatalogsList")
|
||||
public class CatalogsList {
|
||||
|
||||
public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG_ITEMS;
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private List<Reference> catalogReferences = Lists.newArrayList();
|
||||
|
||||
/**
|
||||
* @see CatalogsList#getCatalogItems()
|
||||
*/
|
||||
public Builder catalogs(List<Reference> catalogReferences) {
|
||||
this.catalogReferences = Lists.newArrayList(checkNotNull(catalogReferences, "catalogReferences"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see CatalogsList#getCatalogItems()
|
||||
*/
|
||||
public Builder catalog(Reference catalog) {
|
||||
this.catalogReferences.add(checkNotNull(catalog, "catalog"));
|
||||
return this;
|
||||
}
|
||||
|
||||
public CatalogsList build() {
|
||||
return new CatalogsList(catalogReferences);
|
||||
}
|
||||
|
||||
public Builder fromCatalogsList(CatalogsList in) {
|
||||
return catalogs(in.getCatalogsList());
|
||||
}
|
||||
}
|
||||
|
||||
private CatalogsList() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
private CatalogsList(Collection<Reference> tasks) {
|
||||
this.catalogReferences = Lists.newArrayList(checkNotNull(catalogReferences, "catalogReferences"));
|
||||
}
|
||||
|
||||
@XmlElement(name = "CatalogReference")
|
||||
private List<Reference> catalogReferences = Lists.newArrayList();
|
||||
|
||||
/**
|
||||
* Gets the value of the catalogReferences property.
|
||||
*/
|
||||
public List<Reference> getCatalogsList() {
|
||||
return this.catalogReferences;
|
||||
}
|
||||
|
||||
public void setCatalogsList(List<Reference> catalogReferences) {
|
||||
this.catalogReferences = Lists.newArrayList(checkNotNull(catalogReferences, "catalogReferences"));
|
||||
}
|
||||
|
||||
public void addCatalog(Reference catalog) {
|
||||
this.catalogReferences.add(checkNotNull(catalog, "catalog"));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlValue;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
|
||||
/**
|
||||
* Contains key/value pair as property.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="PropertyType" />
|
||||
* </pre>
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Property")
|
||||
public class Property {
|
||||
|
||||
public static final String MEDIA_TYPE = VCloudDirectorMediaType.PROPERTY;
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private String value;
|
||||
private String key;
|
||||
|
||||
/**
|
||||
* @see Property#getKey()
|
||||
*/
|
||||
public Builder key(String key) {
|
||||
this.key = key;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Property#getValue()
|
||||
*/
|
||||
public Builder value(String value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Property#getKey()
|
||||
* @see Property#getValue()
|
||||
*/
|
||||
public Builder property(String key, String value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Property build() {
|
||||
Property property = new Property(key);
|
||||
property.setValue(value);
|
||||
return property;
|
||||
}
|
||||
|
||||
public Builder fromProperty(Property in) {
|
||||
return property(in.getKey(), in.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
private Property() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
private Property(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@XmlValue
|
||||
private String value;
|
||||
@XmlAttribute(required = true)
|
||||
private String key;
|
||||
|
||||
/**
|
||||
* Gets the value of the value property.
|
||||
*/
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the key property.
|
||||
*/
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue