Class MorpheusModel

java.lang.Object
com.morpheusdata.model.MorpheusModel
Direct Known Subclasses:
Account, AccountCertificateIdentityProjection, AccountCertificateType, AccountCredentialIdentityProjection, AccountCredentialType, AccountDiscovery, AccountDiscoveryType, AccountIntegration, AccountIntegrationObjectRef, AccountIntegrationType, AccountInvoice, AccountInvoiceItem, AccountNamespace, AccountPrice, AccountPriceSet, AccountPriceSetPrice, AccountResourceIdentityProjection, AccountResourceType, AppIdentityProjection, AppInstance, AppTemplate, AppTemplateType, AppTier, Attachment, Backup, BackupIntegration, BackupJob, BackupProvider, BackupProviderType, BackupRepository, BackupRestore, BackupResult, BackupType, CatalogItemType, CloudRegionIdentity, CodeRepository, ComputeCapacityInfo, ComputePort, ComputeServerAccess, ComputeServerGroup, ComputeServerGroupType, ComputeServerInterface, ComputeServerInterfaceType, ComputeServerType, ComputeSite, ComputeTypeLayout, ComputeTypeSet, Container, ContainerType, Dashboard, DashboardItem, DashboardItemType, EnvironmentVariableType, ExecuteScheduleType, FileContent, InstanceAction, InstanceScaleType, InstanceType, InstanceTypeLayout, JobTarget, JobTemplate, JobType, KeyPairIdentityProjection, MorpheusIdentityModel, NetAddress, NetworkLoadBalancerIdentityProjection, NetworkLoadBalancerMember, NetworkLoadBalancerType, NetworkPoolRange, NetworkPoolServer, NetworkPoolServerType, NetworkPoolType, NetworkProxy, NetworkRouteIdentityProjection, NetworkRouterIdentityProjection, NetworkRouterInterface, NetworkRouterType, NetworkRouteTableIdentityProjection, NetworkSecurityServer, NetworkSecurityServerType, NetworkServer, NetworkServerType, NetworkSubnetType, NetworkType, OperationData, OptionType, OsType, Permission, Policy, PolicyType, PricePlanPriceSet, PricePlanType, Process, ProvisionType, Replication, ReplicationGroup, ReplicationSite, ReplicationType, ReportResult, ReportResultRow, ReportType, Request, ResourceSpec, ResourceSpecTemplateType, ScaleAction, SecurityGroupRuleApplication, SecurityGroupRuleDestination, SecurityGroupRuleLocation, SecurityGroupRuleProfile, SecurityGroupRuleScope, SecurityGroupRuleSource, ServicePlanPriceSet, StorageBucketPermission, StorageControllerType, StorageGroup, StorageServerType, StorageVolumeType, Tab, Task, TaskOption, TaskSet, TaskSetTask, TaskType, Tier, TierType, UserGroup, WorkloadAction, WorkloadScript, WorkloadState, WorkloadTemplate, WorkloadType, WorkloadTypeConfig, WorkloadTypeLog, WorkloadTypeMount, WorkloadTypePort, WorkloadTypeSet

public class MorpheusModel extends Object
Base class for all Morpheus Model classes. This provides dirty checking capabilities for most base object representations and common id property representations. All setter methods in a Morpheus class should call the markDirty method. So that the underlying Context classes can perform differential updates of these models.
  • Field Details

    • id

      protected Long id
      Database reference Id of the Object. Typically not directly set.
    • config

      protected String config
  • Constructor Details

    • MorpheusModel

      public MorpheusModel()
  • Method Details

    • getId

      public Long getId()
      Gets the uniquely generated ID from the database record stored via the Morpheus appliance.
      Returns:
      id
    • setId

      public void setId(Long id)
      Used for setting the unique ID of the Pool Type. This should not be directly used.
      Parameters:
      id - unique identifer
    • markDirty

      protected void markDirty(String propertyName, Object value)
      All setters that are presented to the morpheus API should call markDirty with a string representation of the fieldname. This enables the MorpheusContext to reconcile differences and perform differential updates.
      Parameters:
      propertyName - Name of the property that has been changed
      value - The newly assigned value the property has been given.
    • markDirty

      protected void markDirty(String propertyName, Object value, Object persistedValue)
      All setters that are presented to the morpheus API should call markDirty with a string representation of the fieldname. This enables the MorpheusContext to reconcile differences and perform differential updates.
      Parameters:
      propertyName - Name of the property that has been changed
      value - The newly assigned value the property has been given.
      persistedValue - The old value of the property.
    • markClean

      public void markClean()
      Marks the corresponding Model clean from all changes. This resets all stored differential value changes.
    • isDirty

      public Boolean isDirty(String propertyName)
      Checks if a property has been modified
      Parameters:
      propertyName - Name of the property to check
      Returns:
      true or false
    • getDirtyProperties

      public Set<String> getDirtyProperties()
      Gets a list of all dirty properties / fields (things that have changes) on the corresponding model based on the used setters.
      Returns:
      A List of dirty fields by name
    • getDirtyPropertyValues

      public LinkedHashMap<String,Object> getDirtyPropertyValues()
      Gets a Map containing all dirty properties as well as their newly assigned values.
      Returns:
      A Map containing all model changes on properties from the original object.
    • getProperties

      public HashMap<String,Object> getProperties()
      Returns:
      A Map of all properties, similar to Groovy's getProperties()
    • getConfig

      public String getConfig()
    • setConfig

      public void setConfig(String config)
    • getConfigMap

      public Map getConfigMap()
    • setConfigMap

      public void setConfigMap(Map<String,Object> map)
    • getConfigProperty

      public Object getConfigProperty(String prop)
    • setConfigProperty

      public void setConfigProperty(String prop, Object object)