public static ResourceInventory valueOf(ResourceVO vo) { ResourceInventory inv = new ResourceInventory(); inv.setResourceName(vo.getResourceName()); inv.setResourceType(vo.getResourceType()); inv.setUuid(vo.getUuid()); return inv; }
public boolean hasNameField() { return getNameField() != null; }
@Entity @Table @EO(EOClazz = ZoneEO.class) @BaseResource @EntityGraph( friends = { @EntityGraph.Neighbour(type = BackupStorageZoneRefVO.class, myField = "uuid", targetField = "zoneUuid") } ) public class ZoneVO extends ZoneAO { }
/** * Created by frank on 7/28/2015. */ @Entity @Table @SoftDeletionCascades({ @SoftDeletionCascade(parent = PrimaryStorageVO.class, joinColumn = "primaryStorageUuid") }) public class CephPrimaryStorageMonVO extends CephMonAO { @Column @ForeignKey(parentEntityClass = PrimaryStorageEO.class, parentKey = "uuid", onDeleteAction = ReferenceOption.CASCADE) private String primaryStorageUuid; public String getPrimaryStorageUuid() { return primaryStorageUuid; } public void setPrimaryStorageUuid(String primaryStorageUuid) { this.primaryStorageUuid = primaryStorageUuid; } }
@Entity @Table @SoftDeletionCascades({ @SoftDeletionCascade(parent = VirtualRouterVmVO.class, joinColumn = "virtualRouterVmUuid"), @SoftDeletionCascade(parent = VipVO.class, joinColumn = "uuid") }) @EntityGraph( friends = { @EntityGraph.Neighbour(type = VmInstanceVO.class, myField = "virtualRouterVmUuid", targetField = "uuid"), @Id @Column @ForeignKey(parentEntityClass = VipVO.class, onDeleteAction = ReferenceOption.RESTRICT) private String uuid; @ForeignKey(parentEntityClass = VmInstanceEO.class, onDeleteAction = ReferenceOption.CASCADE) private String virtualRouterVmUuid;
@Entity @Table @EO(EOClazz = ImageEO.class) @BaseResource @EntityGraph( parents = { @EntityGraph.Neighbour(type = ImageBackupStorageRefVO.class, myField = "uuid", targetField = "imageUuid") @OneToMany(fetch = FetchType.EAGER) @JoinColumn(name = "imageUuid", insertable = false, updatable = false) @NoView private Set<ImageBackupStorageRefVO> backupStorageRefs = new HashSet<ImageBackupStorageRefVO>();
@Entity @Table @EO(EOClazz = DiskOfferingEO.class) @BaseResource public class DiskOfferingVO extends DiskOfferingAO implements OwnedByAccount { @Transient private String accountUuid; @Override public String getAccountUuid() { return accountUuid; } @Override public void setAccountUuid(String accountUuid) { this.accountUuid = accountUuid; } }
public static APIGetResourceNamesReply __example__() { APIGetResourceNamesReply reply = new APIGetResourceNamesReply(); ResourceInventory inv = new ResourceInventory(); inv.setUuid(uuid()); inv.setResourceName("zone"); inv.setResourceType(ZoneVO.class.getSimpleName()); ResourceInventory inv1 = new ResourceInventory(); inv1.setUuid(uuid()); inv1.setResourceName("vm"); inv1.setResourceType(VmInstanceVO.class.getSimpleName()); reply.setInventories(asList(inv, inv1)); return reply; } }
private void updateResourceVONameOnEntityUpdate() { dbf.installEntityLifeCycleCallback(null, EntityEvent.PRE_UPDATE, (evt, o) -> { if (o instanceof ResourceVO) { ResourceVO rvo = (ResourceVO) o; if (rvo.hasNameField()) { String name = rvo.getValueOfNameField(); if (name != null) { rvo.setResourceName(name); } } } }); }
@PrePersist private void prePersist() { resourceType = ResourceTypeMetadata.getBaseResourceTypeFromConcreteType(getClass()).getSimpleName(); concreteResourceType = getClass().getName(); resourceName = getValueOfNameField(); }
public static APIGetResourceNamesMsg __example__() { APIGetResourceNamesMsg msg = new APIGetResourceNamesMsg(); msg.setUuids(asList(uuid(), uuid())); return msg; } }
public static List<ResourceInventory> valueOf(Collection<ResourceVO> vos) { List<ResourceInventory> invs = new ArrayList<>(); for (ResourceVO vo : vos) { invs.add(valueOf(vo)); } return invs; }
static String getResourceUuid(Object entity) { if (entity instanceof ResourceVO) { return ((ResourceVO) entity).getUuid(); } return FieldUtils.getFieldValue("uuid", entity); } }
@Override public void permissions() { permissionBuilder() .normalAPIs(APIGetResourceNamesMsg.class) .build(); }
@Override public void contributeToRoles() { roleContributorBuilder() .roleName("other") .actions(APIGetResourceNamesMsg.class) .build(); }
/** * Created by frank on 7/28/2015. */ @Entity @Table @Inheritance(strategy= InheritanceType.JOINED) @SoftDeletionCascades({ @SoftDeletionCascade(parent = PrimaryStorageVO.class, joinColumn = "primaryStorageUuid") }) public class FusionstorPrimaryStorageMonVO extends FusionstorMonAO { @Column @ForeignKey(parentEntityClass = PrimaryStorageEO.class, parentKey = "uuid", onDeleteAction = ReferenceOption.CASCADE) private String primaryStorageUuid; public String getPrimaryStorageUuid() { return primaryStorageUuid; } public void setPrimaryStorageUuid(String primaryStorageUuid) { this.primaryStorageUuid = primaryStorageUuid; } }
/** */ @Entity @Table @EO(EOClazz = VolumeSnapshotTreeEO.class) @BaseResource @EntityGraph( parents = { @EntityGraph.Neighbour(type = VolumeVO.class, myField = "volumeUuid", targetField = "uuid") } ) public class VolumeSnapshotTreeVO extends VolumeSnapshotTreeAO { }
/** * Created by frank on 7/27/2015. */ @Entity @Table @Inheritance(strategy= InheritanceType.JOINED) @SoftDeletionCascades({ @SoftDeletionCascade(parent = BackupStorageVO.class, joinColumn = "backupStorageUuid") }) public class CephBackupStorageMonVO extends CephMonAO { @Column @ForeignKey(parentEntityClass = BackupStorageEO.class, parentKey = "uuid", onDeleteAction = ReferenceOption.CASCADE) private String backupStorageUuid; public String getBackupStorageUuid() { return backupStorageUuid; } public void setBackupStorageUuid(String backupStorageUuid) { this.backupStorageUuid = backupStorageUuid; } }
@Entity @Table @EO(EOClazz = ClusterEO.class) @BaseResource @EntityGraph( parents = { @EntityGraph.Neighbour(type = ZoneVO.class, myField = "zoneUuid", targetField = "uuid") }, friends = { @EntityGraph.Neighbour(type = PrimaryStorageClusterRefVO.class, myField = "uuid", targetField = "clusterUuid"), @EntityGraph.Neighbour(type = L2NetworkClusterRefVO.class, myField = "uuid", targetField = "clusterUuid") } ) public class ClusterVO extends ClusterAO { }
/** * Created by frank on 7/27/2015. */ @Entity @Table @Inheritance(strategy= InheritanceType.JOINED) @SoftDeletionCascades({ @SoftDeletionCascade(parent = BackupStorageVO.class, joinColumn = "backupStorageUuid") }) public class FusionstorBackupStorageMonVO extends FusionstorMonAO { @Column @ForeignKey(parentEntityClass = BackupStorageEO.class, parentKey = "uuid", onDeleteAction = ReferenceOption.CASCADE) private String backupStorageUuid; public String getBackupStorageUuid() { return backupStorageUuid; } public void setBackupStorageUuid(String backupStorageUuid) { this.backupStorageUuid = backupStorageUuid; } }