@java.lang.SuppressWarnings("unused") public interface EntityFacade
The main interface for general database operations in Moqui.
Type Params | Return Type | Name and description |
---|---|---|
|
public EntityValue |
fastFindOne(java.lang.String entityName, java.lang.Boolean useCache, boolean disableAuthz, java.lang.Object values) |
|
public EntityFind |
find(java.lang.String entityName) Create an EntityFind object that can be used to specify additional options, and then to execute one or more finds (queries). |
|
public EntityFind |
find(MNode entityFindNode) |
|
public java.util.Calendar |
getCalendarForTzLc() |
|
public EntityConditionFactory |
getConditionFactory() Get a EntityConditionFactory object that can be used to create and assemble conditions used for finds. |
|
public java.sql.Connection |
getConnection(java.lang.String groupName) Use this to get a Connection if you want to do JDBC operations directly. |
|
public java.sql.Connection |
getConnection(java.lang.String groupName, boolean useClone) |
|
public java.util.ArrayList<java.util.Map> |
getDataDocuments(java.lang.String dataDocumentId, EntityCondition condition, java.sql.Timestamp fromUpdateStamp, java.sql.Timestamp thruUpdatedStamp) Find and assemble data documents represented by a Map that can be easily turned into a JSON document. |
|
public java.util.ArrayList<java.util.Map> |
getDataFeedDocuments(java.lang.String dataFeedId, java.sql.Timestamp fromUpdateStamp, java.sql.Timestamp thruUpdatedStamp) Find and assemble data documents represented by a Map that can be easily turned into a JSON document. |
|
public EntityDatasourceFactory |
getDatasourceFactory(java.lang.String groupName) Get a EntityDatasourceFactory implementation for a group. |
|
public java.lang.String |
getEntityGroupName(java.lang.String entityName) Gets the group name for specified entityName |
|
public EntityDataLoader |
makeDataLoader() Make an object used to load XML or CSV entity data into the database or into an EntityList. |
|
public EntityDataWriter |
makeDataWriter() Used to write XML entity data from the database to a writer. |
|
public Loader |
makeEtlLoader() |
|
public EntityValue |
makeValue(java.lang.String entityName) Creates a Entity in the form of a EntityValue without persisting it |
|
public EntityValue |
makeValue(org.w3c.dom.Element element) Make an EntityValue and populate it with the data (attributes and sub-elements) from the given XML element. |
|
public java.lang.Object |
rest(java.lang.String operation, java.util.List<java.lang.String> entityPath, java.util.Map parameters, boolean masterNameInPath) Meant for processing entity REST requests, but useful more generally as a simple way to perform entity operations. |
|
public java.lang.String |
sequencedIdPrimary(java.lang.String seqName, java.lang.Long staggerMax, java.lang.Long bankSize) Get the next guaranteed unique seq id from the sequence with the given sequence name; if the named sequence doesn't exist, it will be created. |
|
public EntityListIterator |
sqlFind(java.lang.String sql, java.util.List<java.lang.Object> sqlParameterList, java.lang.String entityName, java.util.List<java.lang.String> fieldList) Do a database query with the given SQL and return the results as an EntityList for the given entity and with selected columns mapped to the listed fields. |
Create an EntityFind object that can be used to specify additional options, and then to execute one or more finds (queries).
entityName
- The Name of the Entity as defined in the entity XML file, can be null.Get a EntityConditionFactory object that can be used to create and assemble conditions used for finds.
Use this to get a Connection if you want to do JDBC operations directly. This Connection will be enlisted in the active Transaction.
groupName
- The name of entity group to get a connection for.
Corresponds to the entity.@group attribute and the moqui-conf datasource.@group-name attribute.Find and assemble data documents represented by a Map that can be easily turned into a JSON document. This is used for searching by the Data Search feature and for data feeds to other systems with the Data Feed feature.
dataDocumentId
- Used to look up the DataDocument and related records (DataDocument* entities).condition
- An optional condition to AND with from/thru updated timestamps and any DataDocumentCondition
records associated with the DataDocument.fromUpdateStamp
- The lastUpdatedStamp on at least one entity selected must be after (>=) this Timestamp.thruUpdatedStamp
- The lastUpdatedStamp on at least one entity selected must be before (<) this Timestamp.Find and assemble data documents represented by a Map that can be easily turned into a JSON document. This is similar to the getDataDocuments() method except that the dataDocumentId(s) are looked up using the dataFeedId.
dataFeedId
- Used to look up the DataFeed records to find the associated DataDocument records.fromUpdateStamp
- The lastUpdatedStamp on at least one entity selected must be after (>=) this Timestamp.thruUpdatedStamp
- The lastUpdatedStamp on at least one entity selected must be before (<) this Timestamp.Get a EntityDatasourceFactory implementation for a group. This is most useful for non-SQL databases to get access to underlying details.
Gets the group name for specified entityName
entityName
- The name of the entity to get the group name Make an object used to load XML or CSV entity data into the database or into an EntityList. The files come from
a specific location, text already read from somewhere, or by searching all component data directories
and the entity-facade.load-data elements for entity data files that match a type in the Set of types
specified.
An XML document should have a root element like <entity-facade-xml type="seed">
. The
type attribute will be used to determine if the file should be loaded by whether or not it matches the values
specified for data types on the loader.
Used to write XML entity data from the database to a writer.
The document will have a root element like <entity-facade-xml>
.
Creates a Entity in the form of a EntityValue without persisting it
entityName
- The name of the entity to make a value object for.Make an EntityValue and populate it with the data (attributes and sub-elements) from the given XML element.
element
- A XML DOM element representing a single value/record for an entity.Meant for processing entity REST requests, but useful more generally as a simple way to perform entity operations.
operation
- Can be get/find, post/create, put/store, patch/update, or delete/delete.entityPath
- First element should be an entity name or short-alias, followed by (optionally depending on
operation) the PK fields for the entity in the order they appear in the entity definition
followed optionally by (one or more) relationship name or short-alias and then PK values for
the related entity, not including any PK fields defined in the relationship.parameters
- A Map of extra parameters, used depending on the operation. For find operations these can be
any parameters handled by the EntityFind.searchFormInputs() method. For create, update, store,
and delete operations these parameters are for non-PK fields and as an alternative to the
entity path for PK field values. For find operations also supports a "dependents" parameter
that if true will get dependent values of the record referenced in the entity path.masterNameInPath
- If true the second entityPath entry must be the name of a master entity definitionGet the next guaranteed unique seq id from the sequence with the given sequence name; if the named sequence doesn't exist, it will be created.
seqName
- The name of the sequence to get the next seq id fromstaggerMax
- The maximum amount to stagger the sequenced ID, if 1 the sequence will be incremented by 1,
otherwise the current sequence ID will be incremented by a value between 1 and staggerMaxbankSize
- The size of the "bank" of values to get from the database (defaults to 1)Do a database query with the given SQL and return the results as an EntityList for the given entity and with selected columns mapped to the listed fields.
sql
- The actual SQL to run.sqlParameterList
- Parameter values that correspond with any question marks (?) in the SQL.entityName
- Name of the entity to map the results to.fieldList
- List of entity field names in order that they match columns selected in the query.