content: /*
   * 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.storage.datastore.db;
  
  import org.apache.cloudstack.storage.object.ObjectStore;
  import com.cloud.utils.db.GenericDao;
  import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
  
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.Id;
  import javax.persistence.Table;
  import javax.persistence.TableGenerator;
  import javax.persistence.Transient;
  import java.util.Date;
  import java.util.Map;
  
  @Entity
  @Table(name = "object_store")
  public class ObjectStoreVO implements ObjectStore {
      @Id
      @TableGenerator(name = "object_store_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "object_store_seq", allocationSize = 1)
      @Column(name = "id", nullable = false)
      private long id;
  
      @Column(name = "name", nullable = false)
      private String name;
  
      @Column(name = "uuid", nullable = false)
      private String uuid;
  
      @Column(name = "url", nullable = false, length = 2048)
      private String url;
  
      @Column(name = "object_provider_name", nullable = false)
      private String providerName;
  
      @Column(name = GenericDao.CREATED_COLUMN)
      private Date created;
  
      @Column(name = GenericDao.REMOVED_COLUMN)
      private Date removed;
  
      @Column(name = "total_size")
      private Long totalSize;
  
      @Column(name = "used_size")
      private Long usedSize;
  
      @Column(name = "allocated_size")
      private Long allocatedSize;
  
      @Transient
      Map<String, String> details;
  
      @Override
      public long getId() {
          return this.id;
      }
  
      @Override
      public String getName() {
          return this.name;
      }
  
      @Override
      public String getProviderName() {
          return this.providerName;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public void setProviderName(String provider) {
          this.providerName = provider;
      }
  
      public void setUuid(String uuid) {
          this.uuid = uuid;
      }
  
      @Override
      public String getUuid() {
          return this.uuid;
      }
  
      public String getUrl() {
          return url;
      }
  
      public void setUrl(String url) {
          this.url = url;
      }
  
      public Date getCreated() {
          return created;
      }
  
      public void setCreated(Date created) {
          this.created = created;
      }
  
      public Date getRemoved() {
          return removed;
      }
  
      public void setRemoved(Date removed) {
          this.removed = removed;
      }
  
      public Long getTotalSize() {
          return totalSize;
      }
  
      public void setTotalSize(Long totalSize) {
          this.totalSize = totalSize;
      }
  
      public Long getUsedSize() {
          return usedSize;
      }
  
      public void setUsedSize(Long usedSize) {
          this.usedSize = usedSize;
      }
  
      public void setDetails(Map<String, String> details) {
          this.details = details;
      }
  
      public Long getAllocatedSize() {
          return allocatedSize;
      }
  
      public void setAllocatedSize(Long allocatedSize) {
          this.allocatedSize = allocatedSize;
      }
  
      @Override
      public String toString() {
          return String.format("ObjectStore %s",
                  ReflectionToStringBuilderUtils.reflectOnlySelectedFields(
                          this, "id", "uuid", "name", "providerName"));
      }
  }
  