package org.zstack.header.volume;

import org.zstack.header.configuration.DiskOfferingVO;
import org.zstack.header.identity.OwnedByAccount;
import org.zstack.header.image.ImageVO;
import org.zstack.header.storage.primary.PrimaryStorageVO;
import org.zstack.header.vm.VmInstanceVO;
import org.zstack.header.vo.BaseResource;
import org.zstack.header.vo.EO;
import org.zstack.header.vo.EntityGraph;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table
@EO(EOClazz = VolumeEO.class)
@BaseResource
@EntityGraph(
        parents = {
                @EntityGraph.Neighbour(type = VmInstanceVO.class, myField = "vmInstanceUuid", targetField = "uuid"),
                @EntityGraph.Neighbour(type = PrimaryStorageVO.class, myField = "primaryStorageUuid", targetField = "uuid"),
                @EntityGraph.Neighbour(type = ImageVO.class, myField = "rootImageUuid", targetField = "uuid"),
                @EntityGraph.Neighbour(type = DiskOfferingVO.class, myField = "diskOfferingUuid", targetField = "uuid"),
        }
)
public class VolumeVO extends VolumeAO implements OwnedByAccount {
    @Transient
    private String accountUuid;

    @Override
    public String getAccountUuid() {
        return accountUuid;
    }

    @Override
    public void setAccountUuid(String accountUuid) {
        this.accountUuid = accountUuid;
    }

}

@@ -631,25 +631,29 @@
 (type = 
-VmInstanc
+PrimaryStorag
 eVO.clas
@@ -670,17 +670,21 @@
  = %22
-vmInstanc
+primaryStorag
 eUui
@@ -702,32 +702,64 @@
 ield = %22uuid%22),%0A
+        %7D,%0A%0A        friends = %7B%0A
                 
@@ -784,37 +784,33 @@
 bour(type = 
-PrimaryStorag
+VmInstanc
 eVO.class, m
@@ -815,37 +815,33 @@
  myField = %22
-primaryStorag
+vmInstanc
 eUuid%22, targ

fix ut