fix domain object inheritance

This commit is contained in:
danikov 2012-02-23 13:46:24 +00:00
parent fa7f81c4e7
commit db528408e3
3 changed files with 34 additions and 7 deletions

View File

@ -92,10 +92,17 @@ public class Media extends ResourceEntityType<Media> {
@Override
public Media build() {
Media media = new Media();
Media media = new Media(href, name);
media.setOwner(owner);
media.setImageType(imageType);
media.setSize(size);
media.setFiles(files);
media.setStatus(status);
media.setDescription(description);
media.setTasksInProgress(tasksInProgress);
media.setId(id);
media.setType(type);
media.setLinks(links);
return media;
}
@ -200,7 +207,11 @@ public class Media extends ResourceEntityType<Media> {
}
public Media() {
super();
// for JAXB
}
protected Media(URI href, String name) {
super(href, name);
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Owner")

View File

@ -89,8 +89,10 @@ public class Owner
public Owner build() {
Owner owner = new Owner();
Owner owner = new Owner(href);
owner.setUser(user);
owner.setType(type);
owner.setLinks(links);
return owner;
}
@ -146,6 +148,10 @@ public class Owner
// For JAXB and builder use
}
private Owner(URI href) {
super(href);
}
@XmlElement(name = "User", required = true)

View File

@ -54,8 +54,8 @@ public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityT
public static class Builder<T extends ResourceEntityType<T>> extends EntityType.Builder<T> {
private FilesList files;
private Integer status;
protected FilesList files;
protected Integer status;
/**
* @see ResourceEntityType#getFiles()
@ -75,9 +75,14 @@ public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityT
@Override
public ResourceEntityType<T> build() {
ResourceEntityType<T> resourceEntity = new ResourceEntityType<T>();
ResourceEntityType<T> resourceEntity = new ResourceEntityType<T>(href, name);
resourceEntity.setFiles(files);
resourceEntity.setStatus(status);
resourceEntity.setDescription(description);
resourceEntity.setTasksInProgress(tasksInProgress);
resourceEntity.setId(id);
resourceEntity.setType(type);
resourceEntity.setLinks(links);
return resourceEntity;
}
@ -135,6 +140,7 @@ public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityT
return this;
}
@SuppressWarnings("unchecked")
@Override
public Builder<T> fromResourceType(ResourceType<T> in) {
return Builder.class.cast(super.fromResourceType(in));
@ -145,10 +151,14 @@ public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityT
}
}
public ResourceEntityType() {
protected ResourceEntityType() {
// for JAXB
}
protected ResourceEntityType(URI href, String name) {
super(href, name);
}
@XmlElement(name = "Files")
protected FilesList files;
@XmlAttribute