All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
org.openstack4j.openstack.identity.v3.domain.KeystoneProject Maven / Gradle / Ivy
package org.openstack4j.openstack.identity.v3.domain;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.*;
import org.openstack4j.model.identity.v3.Domain;
import org.openstack4j.model.identity.v3.Project;
import org.openstack4j.model.identity.v3.builder.ProjectBuilder;
import org.openstack4j.openstack.common.ListResult;
import com.google.common.base.Objects;
/**
* Project model class for identity/v3
*
* @see API reference
*/
@JsonRootName("project")
/** If we don't explicitly set extra as an ignore property, it will methods with @JsonAnyGetter/Setter will not work **/
@JsonIgnoreProperties(value = "extra" , ignoreUnknown = true)
public class KeystoneProject implements Project {
private static final long serialVersionUID = 1L;
@JsonProperty
private String id;
@JsonProperty
private String name;
@JsonProperty
private KeystoneDomain domain;
@JsonProperty("domain_id")
private String domainId;
private String description;
@JsonIgnore
private Map links;
@JsonProperty("parent_id")
private String parentId;
private String subtree;
private String parents;
private Boolean enabled = true;
private Map extra = new HashMap();
/**
* @return the Project builder
*/
public static ProjectBuilder builder() {
return new ProjectConcreteBuilder();
}
@Override
public ProjectBuilder toBuilder() {
return new ProjectConcreteBuilder(this);
}
/**
* {@inheritDoc}
*/
@Override
public String getId() {
return id;
}
/**
* {@inheritDoc}
*/
@Override
public Domain getDomain() {
return domain;
}
/**
* {@inheritDoc}
*/
@Override
public String getDomainId() {
if (domainId == null && domain != null && domain.getId() != null)
domainId = domain.getId();
return domainId;
}
/**
* {@inheritDoc}
*/
@Override
public String getDescription() {
return description;
}
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return name;
}
/**
* {@inheritDoc}
*/
@JsonIgnore
@Override
public Map getLinks() {
return links;
}
/**
* {@inheritDoc}
*/
@JsonProperty("links")
public void setLinks(Map links) {
this.links = links;
}
/**
* {@inheritDoc}
*/
@Override
public String getParentId() {
return parentId;
}
/**
* {@inheritDoc}
*/
@Override
public String getSubtree() {
return subtree;
}
/**
* {@inheritDoc}
*/
@Override
public String getParents() {
return parents;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isEnabled() {
return (enabled != null && enabled);
}
/**
* {@inheritDoc}
*/
public String getExtra(String key) {
return extra.get(key);
}
@JsonAnyGetter
public Map getExtra() {
return extra;
}
@JsonAnySetter
public void setExtra(String key, String value) {
// is_domain is not necessary
// if we don't ignore this, this will be set into extra field.
if (Objects.equal(key, "is_domain")) {
return;
}
extra.put(key, value);
}
/**
* set project enabled
*
* @param enabled
* the new enabled status
*/
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
String domainId = null;
if (domain != null) {
domainId = domain.getId();
}
return Objects.toStringHelper(this)
.add("id", id)
.add("domainId", domainId)
.add("description", description)
.add("name", name)
.add("links", links)
.add("parentId", parentId)
.add("subtree", subtree)
.add("parents", parents)
.add("enabled", enabled)
.omitNullValues()
.toString();
}
/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
return Objects.hashCode(id, domain.getId(), description, name, links, parentId, subtree, parents);
}
/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null || getClass() != obj.getClass())
return false;
KeystoneProject that = KeystoneProject.class.cast(obj);
return Objects.equal(this.id, that.id)
&& Objects.equal(this.domain, that.domain)
&& Objects.equal(this.description, that.description)
&& Objects.equal(this.name, that.name)
&& Objects.equal(this.links, that.links)
&& Objects.equal(this.parentId, that.parentId)
&& Objects.equal(this.subtree, that.subtree)
&& Objects.equal(this.parents, that.parents)
&& Objects.equal(this.enabled, that.enabled);
}
public static class ProjectConcreteBuilder implements ProjectBuilder {
KeystoneProject model;
ProjectConcreteBuilder() {
this(new KeystoneProject());
}
ProjectConcreteBuilder(KeystoneProject model) {
this.model = model;
}
/**
* @see KeystoneProject#getId()
*/
@Override
public ProjectBuilder id(String id) {
model.id = id;
return this;
}
/**
* @see KeystoneProject#getDomainId()
*/
@Override
public ProjectBuilder domain(Domain domain) {
if (domain != null && domain.getId() != null)
model.domainId = domain.getId();
return this;
}
/**
* @see KeystoneProject#getDescription()
*/
@Override
public ProjectBuilder description(String description) {
model.description = description;
return this;
}
/**
* @see KeystoneProject#getName()
*/
@Override
public ProjectBuilder name(String name) {
model.name = name;
return this;
}
/**
* @see KeystoneProject#getLinks()
*/
@Override
public ProjectBuilder links(Map links) {
model.links = links;
return this;
}
/**
* @see KeystoneProject#getParentId()
*/
@Override
public ProjectBuilder parentId(String parentId) {
model.parentId = parentId;
return this;
}
/**
* @see KeystoneProject#getSubtree()
*/
@Override
public ProjectBuilder subtree(String subtree) {
model.subtree = subtree;
return this;
}
/**
* @see KeystoneProject#getParents()
*/
@Override
public ProjectBuilder parents(String parents) {
model.parents = parents;
return this;
}
/**
* @see KeystoneProject#setExtra(String, String)
*/
@Override
public ProjectBuilder setExtra(String key, String value) {
model.extra.put(key, value);
return this;
}
/**
* @see KeystoneProject#isEnabled()
*/
@Override
public ProjectBuilder enabled(boolean enabled) {
model.enabled = enabled;
return this;
}
/**
* {@inheritDoc}
*/
@Override
public Project build() {
return model;
}
/**
* {@inheritDoc}
*/
@Override
public ProjectBuilder from(Project in) {
if (in != null)
this.model = (KeystoneProject) in;
return this;
}
@Override
public ProjectBuilder domainId(String domainId) {
model.domainId = domainId;
return this;
}
}
public static class Projects extends ListResult {
private static final long serialVersionUID = 1L;
@JsonProperty("projects")
protected List list;
@Override
public List value() {
return list;
}
}
}