From 6c4dea7bb87f5b3714c3eb21dea1d4936f5d685a Mon Sep 17 00:00:00 2001 From: Abhinandan Prateek Date: Tue, 7 Jul 2015 09:14:41 +0530 Subject: [PATCH] CLOUDSTACK-8592: creating respective VO objects --- .../cloudstack/quota/QuotaBalanceVO.java | 133 ++++++++++++++++++ .../cloudstack/quota/QuotaCreditsVO.java | 2 +- .../quota/QuotaEmailTemplatesVO.java | 114 +++++++++++++++ .../apache/cloudstack/quota/QuotaUsageVO.java | 121 ++++++++++++++++ setup/db/db/schema-451to452.sql | 2 - 5 files changed, 369 insertions(+), 3 deletions(-) create mode 100644 plugins/database/quota/src/org/apache/cloudstack/quota/QuotaBalanceVO.java create mode 100644 plugins/database/quota/src/org/apache/cloudstack/quota/QuotaEmailTemplatesVO.java create mode 100644 plugins/database/quota/src/org/apache/cloudstack/quota/QuotaUsageVO.java diff --git a/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaBalanceVO.java b/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaBalanceVO.java new file mode 100644 index 00000000000..93d2eca560f --- /dev/null +++ b/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaBalanceVO.java @@ -0,0 +1,133 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF 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.apache.cloudstack.quota; + +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.cloudstack.api.InternalIdentity; + +@Entity +@Table(name = "quota_balance") +public class QuotaBalanceVO implements InternalIdentity { + + public QuotaBalanceVO(Long accountId, Long domainId, + BigDecimal creditBalance, Date updatedOn, Long previousUpdateId, + Date previousUpdateOn) { + super(); + this.accountId = accountId; + this.domainId = domainId; + this.creditBalance = creditBalance; + this.updatedOn = updatedOn; + this.previousUpdateId = previousUpdateId; + this.previousUpdateOn = previousUpdateOn; + } + + private static final long serialVersionUID = -7112846845287653210L; + + @Id + @Column(name = "id") + private Long id; + + @Column(name = "account_id") + private Long accountId = null; + + @Column(name = "domain_id") + private Long domainId = null; + + @Column(name = "credit_balance") + private BigDecimal creditBalance; + + @Column(name = "updated_on") + @Temporal(value = TemporalType.TIMESTAMP) + private Date updatedOn = null; + + @Column(name = "previous_update_id") + private Long previousUpdateId; + + @Column(name = "previous_update_on") + @Temporal(value = TemporalType.TIMESTAMP) + private Date previousUpdateOn = null; + + public QuotaBalanceVO() { + } + + @Override + public long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getAccountId() { + return accountId; + } + + public void setAccountId(Long accountId) { + this.accountId = accountId; + } + + public Long getDomainId() { + return domainId; + } + + public void setDomainId(Long domainId) { + this.domainId = domainId; + } + + public BigDecimal getCreditBalance() { + return creditBalance; + } + + public void setCreditBalance(BigDecimal creditBalance) { + this.creditBalance = creditBalance; + } + + public Date getUpdatedOn() { + return updatedOn; + } + + public void setUpdatedOn(Date updatedOn) { + this.updatedOn = updatedOn; + } + + public Long getPreviousUpdateId() { + return previousUpdateId; + } + + public void setPreviousUpdateId(Long previousUpdateId) { + this.previousUpdateId = previousUpdateId; + } + + public Date getPreviousUpdateOn() { + return previousUpdateOn; + } + + public void setPreviousUpdateOn(Date previousUpdateOn) { + this.previousUpdateOn = previousUpdateOn; + } + +} diff --git a/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaCreditsVO.java b/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaCreditsVO.java index 53cba588070..423b840ea26 100644 --- a/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaCreditsVO.java +++ b/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaCreditsVO.java @@ -32,7 +32,7 @@ import org.apache.cloudstack.api.InternalIdentity; @Table(name = "quota_credits") public class QuotaCreditsVO implements InternalIdentity { - private static final long serialVersionUID = -7117933845287653210L; + private static final long serialVersionUID = -3576833845287653210L; @Id @Column(name = "id") diff --git a/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaEmailTemplatesVO.java b/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaEmailTemplatesVO.java new file mode 100644 index 00000000000..08a638c8f3c --- /dev/null +++ b/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaEmailTemplatesVO.java @@ -0,0 +1,114 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF 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.apache.cloudstack.quota; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.cloudstack.api.InternalIdentity; + +@Entity +@Table(name = "quota_email_templates") +public class QuotaEmailTemplatesVO implements InternalIdentity { + + public QuotaEmailTemplatesVO(String templateName, String templateText, + String locale, Integer version) { + super(); + this.templateName = templateName; + this.templateText = templateText; + this.locale = locale; + this.version = version; + } + + private static final long serialVersionUID = -7117933842834553210L; + + @Id + @Column(name = "id") + private Long id; + + @Column(name = "template_name") + private String templateName; + + @Column(name = "template_text") + private String templateText; + + @Column(name = "last_updated") + @Temporal(value = TemporalType.TIMESTAMP) + private Date lastUpdated = null; + + @Column(name = "locale") + private String locale; + + @Column(name = "version") + private Integer version; + + public QuotaEmailTemplatesVO() { + } + + @Override + public long getId() { + // TODO Auto-generated method stub + return id; + } + + public String getTemplateName() { + return templateName; + } + + public void setTemplateName(String templateName) { + this.templateName = templateName; + } + + public String getTemplateText() { + return templateText; + } + + public void setTemplateText(String templateText) { + this.templateText = templateText; + } + + public Date getLastUpdated() { + return lastUpdated; + } + + public void setLastUpdated(Date lastUpdated) { + this.lastUpdated = lastUpdated; + } + + public String getLocale() { + return locale; + } + + public void setLocale(String locale) { + this.locale = locale; + } + + public Integer getVersion() { + return version; + } + + public void setVersion(Integer version) { + this.version = version; + } + +} diff --git a/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaUsageVO.java b/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaUsageVO.java new file mode 100644 index 00000000000..5ffe01ccfed --- /dev/null +++ b/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaUsageVO.java @@ -0,0 +1,121 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF 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.apache.cloudstack.quota; + +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.cloudstack.api.InternalIdentity; + +@Entity +@Table(name = "quota_usage") +public class QuotaUsageVO implements InternalIdentity { + + private static final long serialVersionUID = -7117933845287204781L; + + @Id + @Column(name = "id") + private Long id; + + @Column(name = "usage_item_id") + private Long usageItemId; + + @Column(name = "usage_type") + private String usageType; + + @Column(name = "quota_used") + private BigDecimal quotaUsed; + + @Column(name = "start_date") + @Temporal(value = TemporalType.TIMESTAMP) + private Date startDate = null; + + @Column(name = "end_date") + @Temporal(value = TemporalType.TIMESTAMP) + private Date endDate = null; + + public QuotaUsageVO() { + } + + public QuotaUsageVO(Long usageItemId, String usageType, + BigDecimal quotaUsed, Date startDate, Date endDate) { + super(); + this.usageItemId = usageItemId; + this.usageType = usageType; + this.quotaUsed = quotaUsed; + this.startDate = startDate; + this.endDate = endDate; + } + + @Override + public long getId() { + // TODO Auto-generated method stub + return id; + } + + public Long getUsageItemId() { + return usageItemId; + } + + public void setUsageItemId(Long usageItemId) { + this.usageItemId = usageItemId; + } + + public String getUsageType() { + return usageType; + } + + public void setUsageType(String usageType) { + this.usageType = usageType; + } + + public BigDecimal getQuotaUsed() { + return quotaUsed; + } + + public void setQuotaUsed(BigDecimal quotaUsed) { + this.quotaUsed = quotaUsed; + } + + public Date getStartDate() { + return startDate; + } + + public void setStartDate(Date startDate) { + this.startDate = startDate; + } + + public Date getEndDate() { + return endDate; + } + + public void setEndDate(Date endDate) { + this.endDate = endDate; + } + + public void setId(Long id) { + this.id = id; + } + +} diff --git a/setup/db/db/schema-451to452.sql b/setup/db/db/schema-451to452.sql index 17d957957a0..97c8934bbe1 100644 --- a/setup/db/db/schema-451to452.sql +++ b/setup/db/db/schema-451to452.sql @@ -114,10 +114,8 @@ CREATE TABLE `cloud_usage.quota_email_templates` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `template_name` varchar(64) DEFAULT NULL, `template_text` longtext, - `category` int(10) unsigned NOT NULL DEFAULT '0', `last_updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `locale` varchar(25) DEFAULT 'en_US', - `template_name_locale` varchar(74) DEFAULT NULL, `version` int(11) DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;