Class Resource

java.lang.Object
org.ivoa.dm.proposal.management.Resource
All Implemented Interfaces:
org.ivoa.vodml.jpa.JPAManipulations, org.ivoa.vodml.jpa.JPAManipulationsForObjectType<Long>

@Entity @VoDml(id="proposalManagement:Resource", role=objectType) public class Resource extends Object implements org.ivoa.vodml.jpa.JPAManipulationsForObjectType<Long>
A resource that will be consumed by allocating an observation from a proposal. objectType: Resource
  • Field Details

    • _id

      protected Long _id
      inserted database key
    • amount

      @VoDml(id="proposalManagement:Resource.amount", role=attribute, type="ivoa:real", typeRole=primitiveType) protected Double amount
      The amount of the resource. : Attribute amount : multiplicity 1
    • type

      @VoDml(id="proposalManagement:Resource.type", role=reference, type="proposalManagement:ResourceType", typeRole=objectType) protected ResourceType type
      ReferenceObject type : the type of the resource. ( Multiplicity : 1 )
  • Constructor Details

    • Resource

      public Resource()
      Creates a new Resource
    • Resource

      public Resource(ResourceType type, Double amount)
      full parameter constructor.
      Parameters:
      type - the type of the resource.
      amount - The amount of the resource.
    • Resource

      public Resource(Resource other)
      Copy Constructor. Note that references will remain as is rather than be copied.
      Parameters:
      other - the object to be copied.
  • Method Details

    • getId

      public Long getId()
      Specified by:
      getId in interface org.ivoa.vodml.jpa.JPAManipulationsForObjectType<Long>
      Returns:
      the id
    • updateUsing

      public void updateUsing(Resource other)
      Update this object with the content of the given object. Note that references will remain as is rather than be copied.
      Parameters:
      other - the object to be copied.
    • getType

      public ResourceType getType()
      Returns type Reference
      Returns:
      type Reference
    • setType

      public void setType(ResourceType pType)
      Defines type Reference
      Parameters:
      pType - reference to set
    • getAmount

      public Double getAmount()
      Returns amount Attribute.
      Returns:
      amount Attribute
    • setAmount

      public void setAmount(Double pAmount)
      Set amount Attribute.
      Parameters:
      pAmount - value to set
    • withAmount

      public Resource withAmount(Double pAmount)
      fluent setter for amount Attribute.
      Parameters:
      pAmount - value to set
      Returns:
      Resource
    • createResource

      public static Resource createResource(Consumer<Resource.ResourceBuilder> f)
      create a Resource in functional builder style.
      Parameters:
      f - the functional builder.
      Returns:
      an object initialized from the builder.
    • forceLoad

      public void forceLoad()
      Specified by:
      forceLoad in interface org.ivoa.vodml.jpa.JPAManipulations
    • persistRefs

      @Deprecated public void persistRefs(jakarta.persistence.EntityManager _em)
      Deprecated.
      generally better to use the model level reference persistence as only this can deal with "contained" references properly.
      Specified by:
      persistRefs in interface org.ivoa.vodml.jpa.JPAManipulations