Interface Model
- All Known Implementing Classes:
Achievement
,AchievementConfig
,AchievementConfigUser
,AchievementEvent
,AckAwaitConfig
,AckAwaitConfigs
,AckRequest
,AckResponse
,Alert
,AlertDigestDeliverySchedule
,AnonymizerOverride
,AsyncAction
,Attachment
,Attribute
,BaseTemplate
,BlockRelationship
,Buffer
,BufferLane
,ChainEngineCondition
,ChainEngineConditionLine
,ChainEngineConfig
,ChainEngineConfigLine
,ChainEngineRun
,ClobProperty
,Collaboration
,CollaborationLine
,ContactInformation
,CrossReference
,CrossReferenceValue
,CurrencyConversionFactor
,CurrencyConverter
,CustomEmailTemplate
,DocTypePerm
,DocumentType
,DynaFieldComp
,DynaFieldDef
,DynKPIFamilyDef
,EdiConfig
,EdiForward
,EdiInboundRoute
,EdiMessageQueue
,EdiMessageTransform
,EdiMonitorPartnerOverride
,EdiMonitorSettings
,EdiMQTransRef
,EdiOutboundRoute
,EINTypeAvailability
,Enterprise
,EnterpriseEINs
,EnterpriseObject
,EntityGroupRoleAssoc
,EntQueueSubsPerm
,EntRoleType
,EntRoleTypeBase
,EntRoleTypeExclusion
,EntRoleTypeInclusion
,EnumConversionDef
,EnumConversionFactor
,EnumDependency
,EnumFieldDependency
,EnumPreferences
,EquipmentType
,ExecutiveDashboard
,ExternalReference
,FeatureSubscription
,GeoLanePattern
,GeoLanePermission
,GeoPattern
,GeoPatternList
,GeoPermission
,HeatMapDef
,HierEnumConversionDef
,HierEnumConversionFactor
,Image
,IntegMapping
,IntegrationConnection
,IntegrationSubscription
,IntegrationSubscriptionQueue
,InteractiveSimulation
,InteractiveSimulationStep
,InterfaceListener
,Invoice
,InvoiceHold
,InvoiceLine
,InvoiceLineDetail
,IssueProblemRole
,IssueSubscription
,IssueSubscriptionFilter
,Item
,ItemSubstitution
,ItemTaxCode
,IxmEngineConfig
,IxmEngineNodeConfig
,IxmTaskGeneratorSchedule
,JoinedIssueSubscription
,KPI
,KPIDef
,KPIHistory
,Message
,MessageDestination
,MessageDetail
,MessageQueue
,MessageRoute
,MessageSource
,MessageSourcePoll
,MessageTransform
,MLModel
,MLPlugPoint
,com.onenetwork.platform.common.Model
,ModelValidationConfig
,Movement
,MovementStop
,MovementStopLine
,MsgProcessingContext
,MsgQueueDependency
,NeoAnalyticReport
,NeoCustomWidget
,NeoDashboard
,NeoDashboardSubscr
,NeoKPIConfig
,NeoKPIDefConfig
,NeoKPIValue
,NeoNotification
,Neophyte
,NeoPrescription
,NodeExecHistory
,OAuthIBClientApp
,OAuthIBToken
,OAuthIBTokenReq
,OAuthOBClientApp
,OAuthOBToken
,OAuthOBTokenReq
,OBFixlenFieldFormat
,OBFixlenInterfaceFmt
,OBFixlenRecordFormat
,OBFLRecordGroup
,OBFLRecordGroupEntry
,OnboardingProgram
,Order
,OrderForecast
,OrderLineItem
,OrderSchedule
,Organization
,OrgCode
,OrgEnumDependency
,OrgEnumPreferences
,OrgHierarchy
,OrgHierarchyEntry
,OrgListPerm
,Page
,PageAction
,PageFlow
,PageRelatedModel
,PageRoutingGuide
,Partner
,PartnerEDIConfig
,PartnerInvitation
,PartnerSite
,PartnerTypeConfig
,Payment
,Person
,PersonIdentityMapping
,PersonSpace
,PersonSpacePermission
,Pipeline
,PipelineExecHistory
,PlatformInstance
,PolicyValue
,ProductGroup
,ProductGroupLevel
,PublicProfile
,RelatedModelAction
,ReportSummaryRow
,Role
,SharedDashPref
,Shipment
,ShipmentLine
,Singleton
,SingletonLine
,Site
,SiteGroup
,SiteGroupLevel
,SiteLane
,SiteRsrc
,SiteRsrcReservation
,SlcFileCache
,Task
,TaskReqmt
,Template
,TemplatePermission
,ToDo
,User
,UserABAC
,UserABACValue
,UserAssociation
,UserDefinedConstant
,UserGroup
,UserGroupMember
,UserRequest
,UserTermsAndConditions
,ValidationRule
,ValidationRuleIf
,ValidationRuleTest
,ValidationRuleThen
,ValueBand
,ValueBands
,ValueChain
,WBGeo
,WBProblem
,WBProblemAddtlModelRef
,WBProblemDimension
,WBProblemIssue
,WBProblemLine
,WBProblemLineMember
,WBProblemNote
,WBProblemRole
,WBProblemRoleType
,WBProblemSharedOrg
,WBProblemType
public interface Model
Common interface implemented by all Model objects.
-
Method Summary
Modifier and Type Method Description void
addWarning(java.lang.String msgKey, java.lang.Object... args)
Adds a Warning to the current model by instantiating a new StatusMessage with the given message, which can optionally be parameterized usingMessageFormat
and given argumentsjava.util.List<Difference>
diff(Model m1, ModelDiffConfig cfg)
Returns the differences found for field values in current Model and parameter Model object.boolean
equals(java.lang.Object o)
A Model object is considered "equal" to another Model object if it is a Model of the same type and its Natural Key fields are identical.java.lang.Object
getAttribute(java.lang.String attributeName)
Given aAttribute
name, return the value of that Attribute.StatusMessage
getError()
Returns the current Error set on this modeljava.util.Calendar
getLastModifiedDate()
java.lang.String
getLastModifiedUser()
java.lang.Object
getMDF(java.lang.String modulePrefix, java.lang.String fieldName)
Given a module prefix and module-defined field name, return the value of that MDF.<T extends MDFs>
TgetMDFs(java.lang.Class<T> moduleFieldsClass)
<T extends Rider>
TgetRider(java.lang.Class<T> cls)
<T extends Rider>
TgetRider(java.lang.Class<T> cls, PlatformUserContext pltUsrContext)
Deprecated.prefergetRider(Class)
java.lang.Long
getSysId()
Returns the surrogate key value for this Model.java.lang.Object
getTransientField(java.lang.String key)
Given the name of the transient field, this returns its corresponding value.java.util.Map<java.lang.String,java.lang.Object>
getTransientFields()
Returns a map of all transient fields and their values held in an instance.java.lang.String
getUdf(java.lang.String name)
Given a field name, returns the value of the User-Defined Field.java.util.List<java.lang.String>
getUdfNames()
Returns a list of all User-Defined Field names which currently have valuesjava.util.List<StatusMessage>
getWarnings()
Contains a collection of "warning" messages which can be used to communicate informational, non-error conditions back to a client after a read operation.void
setAttribute(java.lang.String attributeName, java.lang.Object value)
Given aAttribute
name and field value, sets that Attribute value on the modelvoid
setError(StatusMessage value)
Sets the current Error for this modelvoid
setError(java.lang.String msgKey, java.lang.Object... args)
Sets the current Error for this model by instantiating a new StatusMessage with the given message, which can optionally be parameterized usingMessageFormat
and given argumentsvoid
setLastModifiedDate(java.util.Calendar val)
void
setLastModifiedUser(java.lang.String val)
void
setMDF(java.lang.String modulePrefix, java.lang.String fieldName, java.lang.Object value)
Given a module prefix, module-defined field name and field value, sets that MDF value on the modelvoid
setSysId(java.lang.Long sysId)
Used by the Platform to populate the sysId of a Model from the database.void
setTransientField(java.lang.String key, java.lang.Object val)
Sets the value of the transient field given its name.void
setUdf(java.lang.String name, java.lang.String value)
Sets a User-Defined Field valueorg.json.JSONObject
toJSONObject()
Returns a JSON representation of this Model.org.json.JSONObject
toJSONObject(PlatformUserProfile profile)
Returns a JSON representation of this Model.org.json.JSONObject
toJSONObjectExternal(PlatformUserProfile profile)
Returns a serialized JSON representation of this Model with following conditions.org.json.JSONObject
toJSONObjectFullySerialized(PlatformUserProfile profile)
Returns a fully serialized JSON representation of this Model.java.lang.String
toXML()
Returns an XML representation of this Model.
-
Method Details
-
getSysId
java.lang.Long getSysId()Returns the surrogate key value for this Model.- Returns:
- surrogate key value for this Model
-
setSysId
void setSysId(java.lang.Long sysId)Used by the Platform to populate the sysId of a Model from the database. Not intended for user by clients. Please note that setting or changing this value will not have any effect on the surrogate key value in the database, either immediately or when the Model is written using an SPT action. However, if the surrogate value is provided it will be used to fetch the model's natural keys when executing a model write.- Parameters:
sysId
- surrogate key value
-
getMDFs
- Type Parameters:
T
- ModuleFields class to retrieve instance of- Parameters:
moduleFieldsClass
- ModuleFields class to retrieve instance of- Returns:
- ModuleFields instance of given class from underlying jaxb
-
getError
StatusMessage getError()Returns the current Error set on this model -
setError
Sets the current Error for this model- Parameters:
value
- error to set on this model
-
getWarnings
java.util.List<StatusMessage> getWarnings()Contains a collection of "warning" messages which can be used to communicate informational, non-error conditions back to a client after a read operation. -
setError
void setError(java.lang.String msgKey, java.lang.Object... args)Sets the current Error for this model by instantiating a new StatusMessage with the given message, which can optionally be parameterized usingMessageFormat
and given arguments- Parameters:
msgKey
- the key to the localized string. msgKey will be used as error message if no localized string is defined.args
- parameters to error message if it is a pattern
-
addWarning
void addWarning(java.lang.String msgKey, java.lang.Object... args)Adds a Warning to the current model by instantiating a new StatusMessage with the given message, which can optionally be parameterized usingMessageFormat
and given arguments- Parameters:
msgKey
- the key to the localized string. msgKey will be used as error message if no localized string is defined.args
- parameters to error message if it is a pattern
-
getUdfNames
java.util.List<java.lang.String> getUdfNames()Returns a list of all User-Defined Field names which currently have values -
setUdf
void setUdf(java.lang.String name, java.lang.String value)Sets a User-Defined Field value- Parameters:
name
- field namevalue
- field value
-
getUdf
java.lang.String getUdf(java.lang.String name)Given a field name, returns the value of the User-Defined Field. may be null- Parameters:
name
- field name- Returns:
- field value
-
setMDF
void setMDF(java.lang.String modulePrefix, java.lang.String fieldName, java.lang.Object value)Given a module prefix, module-defined field name and field value, sets that MDF value on the model If the module is not available or the field name is not valid, this method throws a runtime exception. Usage:
To set the MDF, here is an example:model.setMDF("PTA", "TestMDFForInteg", testCaseName);
The first parameter is the module prefix, second one is the field name and the third parameter is the field value. Here are the examples to set different field typesDouble: model.setMDF("PTA", "TestDouble", 100.0); Boolean: model.setMDF("PTA", "TestBoolean", true); Address: Address address = Services.get(AddressService.class).createAddress(CountryCodes.US); address.set(AddressComponentType.STREET_1, testCaseName); address.set(AddressComponentType.CITY, testCaseName); address.set(AddressComponentType.STATE, "TX"); model.setMDF("PTA", "TestAddress", address); String Enumeration: model.setMDF("PTA", "TestStringEnum", "Test1"); Integer: model.setMDF("PTA", "TestInteger", 10); Float: model.setMDF("PTA", "TestFloat", 10.0); Model Link: Set the MDFs for individual components: model.setMDF("PTA", "TestMLName", "SampleEnterprise"); Composite: Set the individuals fields of composite: model.setMDF("PTA", "TestCompositeAmount", 100.00); model.setMDF("PTA", "TestCompositeCurrency", CurrencyCode.USD.getValue());
- Parameters:
modulePrefix
- module prefixfieldName
- module-defined field namevalue
- new field value
-
getMDF
java.lang.Object getMDF(java.lang.String modulePrefix, java.lang.String fieldName)Given a module prefix and module-defined field name, return the value of that MDF. Usage:Object obj = model.getMDF("PTA", "TestFloat");
(where PTA is the module prefix and TestFloat is the field name) This method throws a runtime exception if the module with the given prefix is not available during runtime or the field name is not valid.- Parameters:
modulePrefix
- module prefixfieldName
- module-defined field name- Returns:
- the field value, or null if the field isn't found or has no value
-
getTransientFields
java.util.Map<java.lang.String,java.lang.Object> getTransientFields()Returns a map of all transient fields and their values held in an instance. Transient fields are part of an action, meaning they only live as long as the lifetime of the action they are used with. -
getTransientField
java.lang.Object getTransientField(java.lang.String key)Given the name of the transient field, this returns its corresponding value.- Parameters:
key
- the name of the transient field- Returns:
- the value of the field, or null if not found
-
setTransientField
void setTransientField(java.lang.String key, java.lang.Object val)Sets the value of the transient field given its name. If an entry with that name already exists, it will be overwritten with the new value.- Parameters:
key
- the name of the fieldval
- the value of the field
-
toXML
java.lang.String toXML()Returns an XML representation of this Model. See the XML Schema of your Model implementation for details. The XML will include any child levels. To convert XML to a Model, seeXMLService
. -
toJSONObject
org.json.JSONObject toJSONObject()Returns a JSON representation of this Model. Will use system default for Date and other localized formats. Consider a model TestModel with ModelLinks for: Organization, TestModelLink and TransientField : "TestTransientField", using this method will result in following JSON conversion. Sample JSON received after conversion for TestModel:{ "TestModelKey": "ModelKeyTest", "SysId": 9, "Organization": { "displayValue": "SouthRegion", "value": 10000 }, "ValueChainId": 100, "TestModelLink": { "displayValue": "ModelLinkTest", "value": 10001 }, "ModelLevelType": "PTA.TestModel", "TestTransientField": "TestVal" }
To convert JSON to a Model, seeJSONService
. -
toJSONObject
Returns a JSON representation of this Model. Will consult the given user profile for Date and other localized formats.- Parameters:
profile
- user profile, from which localized date format and other information is taken
-
toJSONObjectFullySerialized
Returns a fully serialized JSON representation of this Model. Will consult the given user profile for Date and other localized formats. Consider a model TestModel with ModelLinks for: Organization, TestModelLink and TransientField : "TestTransientField", using this method will result in following JSON conversion. Sample JSON received after conversion for TestModel:{ "TestModelKey": "ModelKeyTest", "SysId": 9, "Organization": { "EnterpriseName": "ProgressiveRetailer", "value": 10000, "Name": "SouthRegion" }, "ValueChainId": 100, "TestModelLink": { "TestModelKey": "ModelLinkTest", "value": 10001 }, "ModelLevelType": "PTA.TestModel", "TestTransientField": "TestVal" }
- Parameters:
profile
- user profile, from which localized date format and other information is taken
-
toJSONObjectExternal
Returns a serialized JSON representation of this Model with following conditions. following conditions: serialize all NK components(populateAllNKComponents=true) serializeOnlyNKs = false, showsMDFSeparately, skipSysId and does not serialize transient fields on models. Will consult the given user profile for Date and other localized formats. Consider a model TestModel with ModelLinks for: Organization, TestModelLink and TransientField : "TestTransientField", using this method will result in following JSON conversion. Sample JSON received after conversion for TestModel:{ "TestModelKey": "ModelKeyTest", "Organization": { "EnterpriseName": "ProgressiveRetailer", "Name": "SouthRegion" }, "ValueChainId": 100, "TestModelLink": { "TestModelKey": "ModelLinkTest" }, "ModelLevelType": "PTA.TestModel" }
- Parameters:
profile
- user profile, from which localized date format and other information is taken
-
equals
boolean equals(java.lang.Object o)A Model object is considered "equal" to another Model object if it is a Model of the same type and its Natural Key fields are identical.- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- object to compare- Returns:
- true if the object is the same type of Model with identical Natural Key fields
-
diff
Returns the differences found for field values in current Model and parameter Model object.
Following list describes the type of value objects returned, if difference for specific field type is found,- Address Field Type: Model value class is
Address
- Composite Field Type (like DateRange, Monetary): Model value class is
List
. This list can contain heterogeneous primitive data types like Integer, String. - Duration Field Type: Model value class is
String
. e.g."11D 11H 11M "
- ModelLink Field Type: Model value class is
ModelLinkKey
. NOTE: Only natural key component values of ModelLink are compared. - String Enumeration Field Type: Model value class is
String
. e.g. for Currency, value can beINR
- Primitive Field Type (like Integer, Float): Model value class is corresponding wrapper class from
java.lang
package
- Parameters:
m1
- Model object to find differencescfg
- rules to be used for diff- Returns:
- list of differences found
- Throws:
java.lang.RuntimeException
- if class of the passed Model object is not equal to current Model class- See Also:
ModelDiffConfig
,Difference
- Address Field Type: Model value class is
-
setAttribute
void setAttribute(java.lang.String attributeName, java.lang.Object value)Given aAttribute
name and field value, sets that Attribute value on the model This method throws a runtime exception if provided attribute value is not valid Usage:
To set the Attribute, here is an example:model.setAttribute("EPT.SampleEnterprise.TestString", "TestString");
The first parameter is attribute field name and the second parameter is the field value. Here are the examples to set different field typesDouble: model.setAttribute("EPT.SampleEnterprise.TestDouble", 100.0); Boolean: model.setAttribute("EPT.SampleEnterprise.TestBoolean", true); Address: Address address = Services.get(AddressService.class).createAddress(CountryCodes.US); address.set(AddressComponentType.STREET_1, testCaseName); address.set(AddressComponentType.CITY, testCaseName); address.set(AddressComponentType.STATE, "TX"); model.setAttribute("EPT.SampleEnterprise.TestAddress", address); String Enumeration: model.setAttribute("EPT.SampleEnterprise.TestStringEnum", "Test1"); Integer: model.setAttribute("EPT.SampleEnterprise.TestInteger", 10); Float: model.setAttribute("EPT.SampleEnterprise.TestFloat", 10.0); Duration: DurationValue value = new DurationValue(); value.setValue("P1DT1H1M"); model.setAttribute("EPT.SampleEnterprise.TestDuration", value); Model Link: ModelLinkAttributeValue modelLinkAttributeValue = new ModelLinkAttributeValue(); Set all the NK fields of ModelLink: modelLinkAttributeValue.set("EPT.SampleEnterprise.TestModelLinkName", "SampleEnterprise"); //set the modellink field model.setAttribute("EPT.SampleEnterprise.TestModelLink", modelLinkAttributeValue); Composite: Set the individuals fields of composite: model.setAttribute("EPT.SampleEnterprise.TestCompositeAmount", 100.00); model.setAttribute("EPT.SampleEnterprise.TestCompositeCurrency", CurrencyCode.USD.getValue());
To nullify the attribute value, useNullConstants
Double: model.setAttribute("EPT.SampleEnterprise.TestDouble",
NullConstants.NULL_DOUBLE_VALUE
); Address: model.setAttribute("EPT.SampleEnterprise.TestAddress",NullConstants.NULL_ADDRESS_VALUE
); String Enumeration: model.setAttribute("EPT.SampleEnterprise.TestStringEnum",NullConstants.NULL_STRING_VALUE
); Integer: model.setAttribute("EPT.SampleEnterprise.TestInteger",NullConstants.NULL_INT_VALUE
); Float: model.setAttribute("EPT.SampleEnterprise.TestFloat",NullConstants.NULL_FLOAT_VALUE
); Duration: DurationValue value = new DurationValue(); value.setValue(NullConstants.NULL_STRING_VALUE
); model.setAttribute("EPT.SampleEnterprise.TestDuration", value); Model Link: ModelLinkAttributeValue modelLinkAttributeValue = new ModelLinkAttributeValue(); Set the SysId to NULL Value: ModelLinkAttributeValue.setSysId(NullConstants.NULL_LONG_VALUE
); model.setAttribute("EPT.SampleEnterprise.TestModelLink", modelLinkAttributeValue); Composite: Nullify the individuals fields of composite: model.setAttribute("EPT.SampleEnterprise.TestCompositeAmount",NullConstants.NULL_DOUBLE_VALUE
); model.setAttribute("EPT.SampleEnterprise.TestCompositeCurrency",NullConstants.NULL_STRING_VALUE
);- Parameters:
attributeName
- EPT defined attribute namevalue
- new attribute value
-
getAttribute
java.lang.Object getAttribute(java.lang.String attributeName)Given aAttribute
name, return the value of that Attribute. Usage:Object obj = model.getAttribute("EPT.ProgressiveRetailer.TestString");
(EPT.ProgressiveRetailer.TestString is the attribute name) This method returns null if value is not exist for an attribute.- Parameters:
attributeName
- EPT defined attribute name- Returns:
- attribute value
-
getRider
Deprecated.prefergetRider(Class)
- Parameters:
cls
- Implementing class ofRider
pltUsrContext
- User Context- Returns:
- Rider object associated with
cls
-
getRider
- Parameters:
cls
- Implementing class ofRider
- Returns:
- Rider object associated with
cls
-
getLastModifiedDate
java.util.Calendar getLastModifiedDate()- Returns:
- Last date/time when the model was modified
-
getLastModifiedUser
java.lang.String getLastModifiedUser()- Returns:
- username of the last user to modify the model
-
setLastModifiedDate
void setLastModifiedDate(java.util.Calendar val)- Parameters:
val
- last date/time when the model was modified
-
setLastModifiedUser
void setLastModifiedUser(java.lang.String val)- Parameters:
val
- username of the last user to modify the model
-