Class EntityModel
- java.lang.Object
-
- com.priint.pubserver.entity.EntityModel
-
- All Implemented Interfaces:
java.io.Serializable
public class EntityModel extends java.lang.Object implements java.io.SerializableClass representing an entity model.The model contains a list of entities building a hierarchy of buckets and optionally a net of associated buckets (via cords) together with content entities containing final data, like texts, images, prices etc.
Connectors can be attached to the model and the entities to connect to content systems.
- Since:
- 4.0.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description EntityModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConnectorOfEntityModel(ConnectorOfEntityModel conmodel)Add a connector to the entity model.voidaddEntity(Entity entity)Add an entity to the list of entities.voidaddTestCase(TestCase testCase)Add a case to the list of test cases.ClientgetClient()Get the client associated with this entity model.java.util.List<ConnectorOfEntityModel>getConnectorOfEntityModels()Gets connector of entity models.java.lang.StringgetDescription()Get the description of the model.java.util.Map<java.lang.String,Entity>getEntities()Returns the entities of this model.EntitygetEntity(java.lang.String entityIdentifier)Get a entity by identifier and sub-class of entity.<T extends Entity>
TgetEntity(java.lang.String entityIdentifier, java.lang.Class<T> entityClass)Get a entity by identifier and sub-class of entity.java.lang.StringgetIdentifier()Get the identifier of the model.java.lang.StringgetLabel()Get the label of the entity model.java.lang.StringgetPluginConfigName()Get the name of this entity model to use in plug-in configuration.java.lang.StringgetPluginConfigPath()Get the path of the entity's model to use in plug-in configurations.java.util.List<TestCase>getTestCases()Gets test cases.booleanisPublicModel()Get if entity model is visible to other modules than entity manager.booleanisTestMode()Is test mode boolean.voidsetClient(Client client)Set the client associated with this entity model.voidsetConnectorOfEntityModels(java.util.List<ConnectorOfEntityModel> connectorOfEntityModels)Sets connector of entity models.voidsetDescription(java.lang.String description)Set the description of the model.voidsetEntities(java.util.Map<java.lang.String,Entity> entities)Set the entities of this model.voidsetIdentifier(java.lang.String identifier)Set the identifier of the model.voidsetLabel(java.lang.String label)Set the label of the entity model.voidsetPublicModel(boolean publicModel)Set if entity model is visible to other modules than entity manager.voidsetTestCases(java.util.List<TestCase> testCases)Sets test cases.voidsetTestMode(boolean testMode)Sets test mode.PluginConfigtoPluginConfig()Create a plug-in configuration for this entity model with all dependencies.java.lang.StringtoString()
-
-
-
Method Detail
-
getIdentifier
public java.lang.String getIdentifier()
Get the identifier of the model.Must be unique within the client.
Defaults to an empty string.
- Returns:
- identifier string
-
setIdentifier
public void setIdentifier(java.lang.String identifier)
Set the identifier of the model.Must be unique within the client.
Throws NullArgumentException if input is
null.- Parameters:
identifier-
-
getTestCases
public java.util.List<TestCase> getTestCases()
Gets test cases.- Returns:
- list of
TestCaseDefaults to an empty list.
-
setTestCases
public void setTestCases(java.util.List<TestCase> testCases)
Sets test cases.Throws NullArgumentException if input is
null.- Parameters:
testCases- the test cases
-
addTestCase
public void addTestCase(TestCase testCase)
Add a case to the list of test cases.- Parameters:
testCase-
-
getLabel
public java.lang.String getLabel()
Get the label of the entity model.Defaults to an empty string.
- Returns:
- label of this model
-
setLabel
public void setLabel(java.lang.String label)
Set the label of the entity model.Throws NullArgumentException if input is
null.- Parameters:
label-
-
getClient
public Client getClient()
Get the client associated with this entity model.Defaults to an empty client.
- Returns:
Client
-
setClient
public void setClient(Client client)
Set the client associated with this entity model.Throws NullArgumentException if input is
null.- Parameters:
client-
-
getConnectorOfEntityModels
public java.util.List<ConnectorOfEntityModel> getConnectorOfEntityModels()
Gets connector of entity models.- Returns:
- a list of
ConnectorOfEntityModelDefaults to an empty list.
-
setConnectorOfEntityModels
public void setConnectorOfEntityModels(java.util.List<ConnectorOfEntityModel> connectorOfEntityModels)
Sets connector of entity models.Throws NullArgumentException if input is
null.- Parameters:
connectorOfEntityModels- the connectorOfEntityModels to set
-
addConnectorOfEntityModel
public void addConnectorOfEntityModel(ConnectorOfEntityModel conmodel)
Add a connector to the entity model.- Parameters:
conmodel-
-
isTestMode
public boolean isTestMode()
Is test mode boolean.- Returns:
- true if it is a test
Defaults to
false.
-
setTestMode
public void setTestMode(boolean testMode)
Sets test mode.- Parameters:
testMode-
-
getEntities
public java.util.Map<java.lang.String,Entity> getEntities()
Returns the entities of this model. The keys are NOT the identifiers or labels of the entities, but set internally by this class.Defaults to empty map.
- Returns:
- the entities
-
setEntities
public void setEntities(java.util.Map<java.lang.String,Entity> entities)
Set the entities of this model.Throws NullArgumentException if input is
null.- Parameters:
entities- the map of entities to set
-
addEntity
public void addEntity(Entity entity)
Add an entity to the list of entities.Throws NullArgumentException if input is
null.- Parameters:
entity-
-
getEntity
public <T extends Entity> T getEntity(java.lang.String entityIdentifier, java.lang.Class<T> entityClass)
Get a entity by identifier and sub-class of entity.- Type Parameters:
T- the type parameter- Parameters:
entityIdentifier- the entity identifierentityClass- type of entity- Returns:
- Entity from model or
nullif no entity with that identifier belongs to the model
-
getEntity
public Entity getEntity(java.lang.String entityIdentifier)
Get a entity by identifier and sub-class of entity.- Parameters:
entityIdentifier- the entity identifier- Returns:
- Entity from model or
nullif no entity with that identifier belongs to the model
-
isPublicModel
public boolean isPublicModel()
Get if entity model is visible to other modules than entity manager.Defaults to
false.- Returns:
- true if entity model is visible to other modules than entity manager.
-
setPublicModel
public void setPublicModel(boolean publicModel)
Set if entity model is visible to other modules than entity manager.- Parameters:
publicModel- the public model
-
getDescription
public java.lang.String getDescription()
Get the description of the model.Defaults to an empty string.
- Returns:
- the description
-
setDescription
public void setDescription(java.lang.String description)
Set the description of the model.Throws NullArgumentException if input is
null.- Parameters:
description- the description to set
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getPluginConfigName
public java.lang.String getPluginConfigName()
Get the name of this entity model to use in plug-in configuration.- Returns:
- string containing plug-in configuration name
-
getPluginConfigPath
public java.lang.String getPluginConfigPath()
Get the path of the entity's model to use in plug-in configurations.- Returns:
- string containing repository path
-
toPluginConfig
public PluginConfig toPluginConfig()
Create a plug-in configuration for this entity model with all dependencies.- Returns:
- plug -in configuration
-
-