Package com.morpheusdata.model
Class MorpheusModel
- java.lang.Object
-
- com.morpheusdata.model.MorpheusModel
-
- Direct Known Subclasses:
Account
,AccountCredential
,AccountCredentialType
,AccountDiscovery
,AccountDiscoveryType
,AccountIntegration
,AccountIntegrationType
,AccountInventoryIdentityProjection
,AccountInvoice
,App
,Backup
,BackupIdentityProjection
,BackupIntegration
,BackupJob
,BackupJobIdentityProjection
,BackupProvider
,BackupProviderType
,BackupRepository
,BackupRestore
,BackupRestoreIdentityProjection
,BackupResult
,BackupResultIdentityProjection
,BackupType
,BackupTypeIdentityProjection
,CatalogItemType
,CloudIdentityProjection
,ComputeCapacityInfo
,ComputePort
,ComputeServerGroup
,ComputeServerGroupType
,ComputeServerIdentityProjection
,ComputeServerInterface
,ComputeServerInterfaceType
,ComputeServerType
,ComputeSite
,ComputeTypeLayout
,ComputeTypeSet
,ComputeZoneFolderIdentityProjection
,ComputeZonePoolIdentityProjection
,Container
,ContainerType
,Dashboard
,DashboardItem
,DashboardItemType
,DatastoreIdentityProjection
,ExecuteScheduleType
,InstanceIdentityProjection
,InstanceTypeLayout
,KeyPair
,MetadataTagIdentityProjection
,MetadataTagTypeIdentityProjection
,NetAddress
,NetworkDomainIdentityProjection
,NetworkDomainRecordIdentityProjection
,NetworkIdentityProjection
,NetworkPoolIdentityProjection
,NetworkPoolIpIdentityProjection
,NetworkPoolRange
,NetworkPoolServer
,NetworkPoolServerType
,NetworkPoolType
,NetworkProxy
,NetworkSecurityServerType
,NetworkServer
,NetworkServerType
,NetworkSubnetIdentityProjection
,NetworkSubnetType
,NetworkType
,OperationNotificationIdentityProjection
,OptionType
,OsType
,Permission
,Policy
,PolicyType
,ProvisionType
,ReferenceDataSyncProjection
,Replication
,ReplicationGroup
,ReplicationGroupIdentityProjection
,ReplicationIdentityProjection
,ReplicationSite
,ReplicationSiteIdentityProjection
,ReplicationType
,ReplicationTypeIdentityProjection
,ReportResult
,ReportResultRow
,ReportType
,Request
,SecurityGroupIdentityProjection
,SecurityGroupLocationIdentityProjection
,SecurityGroupRuleApplication
,SecurityGroupRuleDestination
,SecurityGroupRuleIdentityProjection
,SecurityGroupRuleLocation
,SecurityGroupRuleProfile
,SecurityGroupRuleScope
,SecurityGroupRuleSource
,ServicePlanIdentityProjection
,SnapshotIdentityProjection
,StorageControllerIdentityProjection
,StorageControllerType
,StorageVolumeIdentityProjection
,StorageVolumeType
,Tab
,Task
,TaskOption
,TaskType
,User
,UserGroup
,VirtualImageIdentityProjection
,VirtualImageLocationIdentityProjection
,WikiPageIdentityProjection
,WorkloadIdentityProjection
public class MorpheusModel extends java.lang.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.
-
-
Constructor Summary
Constructors Constructor Description MorpheusModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getConfig()
java.util.Map
getConfigMap()
java.lang.Object
getConfigProperty(java.lang.String prop)
java.util.Set<java.lang.String>
getDirtyProperties()
Gets a list of all dirty properties / fields (things that have changes) on the corresponding model based on the used setters.java.util.LinkedHashMap<java.lang.String,java.lang.Object>
getDirtyPropertyValues()
Gets a Map containing all dirty properties as well as their newly assigned values.java.lang.Long
getId()
Gets the uniquely generated ID from the database record stored via the Morpheus appliance.java.util.HashMap<java.lang.String,java.lang.Object>
getProperties()
java.lang.Boolean
isDirty(java.lang.String propertyName)
Checks if a property has been modifiedvoid
markClean()
Marks the corresponding Model clean from all changes.protected void
markDirty(java.lang.String propertyName, java.lang.Object value)
All setters that are presented to the morpheus API should call markDirty with a string representation of the fieldname.protected void
markDirty(java.lang.String propertyName, java.lang.Object value, java.lang.Object persistedValue)
All setters that are presented to the morpheus API should call markDirty with a string representation of the fieldname.void
setConfig(java.lang.String config)
void
setConfigMap(java.util.Map<java.lang.String,java.lang.Object> map)
void
setConfigProperty(java.lang.String prop, java.lang.Object object)
void
setId(java.lang.Long id)
Used for setting the unique ID of the Pool Type.
-
-
-
Method Detail
-
getId
public java.lang.Long getId()
Gets the uniquely generated ID from the database record stored via the Morpheus appliance.- Returns:
- id
-
setId
public void setId(java.lang.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(java.lang.String propertyName, java.lang.Object value)
All setters that are presented to the morpheus API should call markDirty with a string representation of the fieldname. This enables theMorpheusContext
to reconcile differences and perform differential updates.- Parameters:
propertyName
- Name of the property that has been changedvalue
- The newly assigned value the property has been given.
-
markDirty
protected void markDirty(java.lang.String propertyName, java.lang.Object value, java.lang.Object persistedValue)
All setters that are presented to the morpheus API should call markDirty with a string representation of the fieldname. This enables theMorpheusContext
to reconcile differences and perform differential updates.- Parameters:
propertyName
- Name of the property that has been changedvalue
- 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 java.lang.Boolean isDirty(java.lang.String propertyName)
Checks if a property has been modified- Parameters:
propertyName
- Name of the property to check- Returns:
- true or false
-
getDirtyProperties
public java.util.Set<java.lang.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 java.util.LinkedHashMap<java.lang.String,java.lang.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 java.util.HashMap<java.lang.String,java.lang.Object> getProperties()
- Returns:
- A Map of all properties, similar to Groovy's getProperties()
-
getConfig
public java.lang.String getConfig()
-
setConfig
public void setConfig(java.lang.String config)
-
getConfigMap
public java.util.Map getConfigMap()
-
setConfigMap
public void setConfigMap(java.util.Map<java.lang.String,java.lang.Object> map)
-
getConfigProperty
public java.lang.Object getConfigProperty(java.lang.String prop)
-
setConfigProperty
public void setConfigProperty(java.lang.String prop, java.lang.Object object)
-
-