Fix several bugs of new refactored list apis.

This commit is contained in:
Min Chen 2012-12-11 17:14:14 -08:00 committed by Rohit Yadav
parent 9c93fee0dc
commit 3661f7f992
11 changed files with 144 additions and 20 deletions

View File

@ -20,22 +20,16 @@ import javax.persistence.Column;
public abstract class BaseViewVO {
@Column(name="id", updatable=false, nullable = false)
protected long id;
public abstract long getId();
public long getId() {
return id;
}
public abstract void setId(long id);
public void setId(long id) {
this.id = id;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + (int) (getId() ^ (getId() >>> 32));
return result;
}
@ -48,7 +42,7 @@ public abstract class BaseViewVO {
if (getClass() != obj.getClass())
return false;
BaseViewVO other = (BaseViewVO) obj;
if (id != other.id)
if (getId() != other.getId())
return false;
return true;
}

View File

@ -35,9 +35,11 @@ import com.cloud.vm.VirtualMachine.State;
@Table(name="domain_router_view")
public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEntity {
@Column(name="id", updatable=false, nullable = false)
private long id;
@Column(name="name", updatable=false, nullable=false, length=255)
private String name = null;
private String name = null;
@Column(name="account_id")
@ -225,7 +227,22 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti
public String getUuid() {
@Override
public long getId() {
return id;
}
@Override
public void setId(long id) {
this.id = id;
}
public String getUuid() {
return uuid;
}
@ -250,6 +267,7 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti
@Override
public long getAccountId() {
return accountId;
}
@ -260,6 +278,7 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti
}
@Override
public String getAccountUuid() {
return accountUuid;
}
@ -274,6 +293,7 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti
@Override
public String getAccountName() {
return accountName;
}
@ -284,6 +304,7 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti
}
@Override
public short getAccountType() {
return accountType;
}
@ -294,6 +315,7 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti
}
@Override
public long getDomainId() {
return domainId;
}
@ -318,6 +340,7 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti
@Override
public String getDomainName() {
return domainName;
}
@ -327,6 +350,7 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti
this.domainName = domainName;
}
@Override
public String getDomainPath() {
return domainPath;
}
@ -656,6 +680,7 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti
@Override
public String getProjectUuid() {
return projectUuid;
}
@ -670,6 +695,7 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti
@Override
public String getProjectName() {
return projectName;
}

View File

@ -31,6 +31,9 @@ import com.cloud.event.Event.State;
@Table(name="event_view")
public class EventJoinVO extends BaseViewVO implements ControlledViewEntity {
@Column(name="id", updatable=false, nullable = false)
private long id;
@Column(name="uuid")
private String uuid;
@ -104,6 +107,17 @@ public class EventJoinVO extends BaseViewVO implements ControlledViewEntity {
public EventJoinVO() {
}
@Override
public long getId() {
return id;
}
@Override
public void setId(long id) {
this.id = id;
}
public String getUuid() {
return uuid;
}

View File

@ -28,6 +28,9 @@ import com.cloud.utils.db.GenericDao;
@Table(name="instance_group_view")
public class InstanceGroupJoinVO extends BaseViewVO implements ControlledViewEntity {
@Column(name="id", updatable=false, nullable = false)
private long id;
@Column(name="uuid")
private String uuid;
@ -80,6 +83,18 @@ public class InstanceGroupJoinVO extends BaseViewVO implements ControlledViewEnt
public InstanceGroupJoinVO() {
}
@Override
public long getId() {
return id;
}
@Override
public void setId(long id) {
this.id = id;
}
public String getUuid() {
return uuid;
}

View File

@ -16,8 +16,6 @@
// under the License.
package org.apache.cloudstack.api.view.vo;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
@ -25,14 +23,14 @@ import javax.persistence.Enumerated;
import javax.persistence.Table;
import com.cloud.projects.ProjectAccount.Role;
import com.cloud.server.ResourceTag.TaggedResourceType;
import com.cloud.utils.db.GenericDao;
import com.cloud.vm.VirtualMachine.State;
@Entity
@Table(name="project_account_view")
public class ProjectAccountJoinVO extends BaseViewVO {
@Column(name="id", updatable=false, nullable = false)
private long id;
@Column(name="account_id")
private long accountId;
@ -74,8 +72,18 @@ public class ProjectAccountJoinVO extends BaseViewVO {
public ProjectAccountJoinVO() {
}
@Override
public long getId() {
return id;
}
@Override
public void setId(long id) {
this.id = id;
}
public long getDomainId() {
return domainId;
}

View File

@ -32,6 +32,9 @@ import com.cloud.vm.VirtualMachine.State;
@Table(name="project_view")
public class ProjectJoinVO extends BaseViewVO {
@Column(name="id", updatable=false, nullable = false)
private long id;
@Column(name="uuid")
private String uuid;
@ -104,6 +107,18 @@ public class ProjectJoinVO extends BaseViewVO {
public ProjectJoinVO() {
}
@Override
public long getId() {
return id;
}
@Override
public void setId(long id) {
this.id = id;
}
public String getUuid() {
return uuid;
}

View File

@ -28,6 +28,8 @@ import com.cloud.server.ResourceTag.TaggedResourceType;
@Table(name="resource_tag_view")
public class ResourceTagJoinVO extends BaseViewVO implements ControlledViewEntity {
@Column(name="id", updatable=false, nullable = false)
private long id;
@Column(name="uuid")
private String uuid;
@ -100,10 +102,12 @@ public class ResourceTagJoinVO extends BaseViewVO implements ControlledViewEntit
this.uuid = uuid;
}
@Override
public long getId() {
return id;
}
@Override
public void setId(long id) {
this.id = id;
}

View File

@ -29,6 +29,9 @@ import com.cloud.server.ResourceTag.TaggedResourceType;
@Table(name="security_group_view")
public class SecurityGroupJoinVO extends BaseViewVO implements ControlledViewEntity {
@Column(name="id", updatable=false, nullable = false)
private long id;
@Column(name="name")
private String name;
@ -138,6 +141,16 @@ public class SecurityGroupJoinVO extends BaseViewVO implements ControlledViewEnt
public SecurityGroupJoinVO() {
}
@Override
public long getId() {
return id;
}
@Override
public void setId(long id) {
this.id = id;
}
public String getUuid() {
return uuid;
}

View File

@ -20,18 +20,18 @@ import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;
import com.cloud.utils.db.Encrypt;
import com.cloud.utils.db.GenericDao;
import com.cloud.event.Event.State;
@Entity
@Table(name="user_view")
public class UserAccountJoinVO extends BaseViewVO {
@Column(name="id", updatable=false, nullable = false)
private long id;
@Column(name="uuid")
private String uuid;
@ -107,6 +107,16 @@ public class UserAccountJoinVO extends BaseViewVO {
public UserAccountJoinVO() {
}
@Override
public long getId() {
return id;
}
@Override
public void setId(long id) {
this.id = id;
}
public String getUuid() {
return uuid;
}

View File

@ -42,6 +42,8 @@ import com.cloud.vm.VirtualMachine.State;
@Table(name="user_vm_view")
public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
@Column(name="id", updatable=false, nullable = false)
private long id;
@Column(name="name", updatable=false, nullable=false, length=255)
private String name = null;
@ -364,6 +366,15 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
}
@Override
public long getId() {
return id;
}
@Override
public void setId(long id) {
this.id = id;
}
public String getUuid() {
@ -407,6 +418,7 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
}
@Override
public long getAccountId() {
return accountId;
}
@ -417,6 +429,7 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
}
@Override
public String getAccountUuid() {
return accountUuid;
}
@ -431,6 +444,7 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
@Override
public String getAccountName() {
return accountName;
}
@ -441,6 +455,7 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
}
@Override
public short getAccountType() {
return accountType;
}
@ -451,6 +466,7 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
}
@Override
public long getDomainId() {
return domainId;
}
@ -461,6 +477,7 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
}
@Override
public String getDomainUuid() {
return domainUuid;
}
@ -475,6 +492,7 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
@Override
public String getDomainName() {
return domainName;
}
@ -485,6 +503,7 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
}
@Override
public String getDomainPath() {
return domainPath;
}
@ -1252,6 +1271,7 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
@Override
public String getProjectUuid() {
return projectUuid;
}
@ -1266,6 +1286,7 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
@Override
public String getProjectName() {
return projectName;
}

View File

@ -340,8 +340,12 @@ public class ApiDBUtils {
_asVmGroupPolicyMapDao = locator.getDao(AutoScaleVmGroupPolicyMapDao.class);
_counterDao = locator.getDao(CounterDao.class);
_tagJoinDao = locator.getDao(ResourceTagJoinDao.class);
_vmGroupJoinDao = locator.getDao(InstanceGroupJoinDao.class);
_eventJoinDao = locator.getDao(EventJoinDao.class);
_userAccountJoinDao = locator.getDao(UserAccountJoinDao.class);
_projectJoinDao = locator.getDao(ProjectJoinDao.class);
_projectAccountJoinDao = locator.getDao(ProjectAccountJoinDao.class);
// Note: stats collector should already have been initialized by this time, otherwise a null instance is returned
_statsCollector = StatsCollector.getInstance();