Package com.axelor.meta.db.repo
Class MetaJsonRecordRepository
- java.lang.Object
-
- com.axelor.db.JpaRepository<MetaJsonRecord>
-
- com.axelor.meta.db.repo.MetaJsonRecordRepository
-
- All Implemented Interfaces:
Repository<MetaJsonRecord>
public class MetaJsonRecordRepository extends JpaRepository<MetaJsonRecord>
Repository implementation to handle custom model records.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMetaJsonRecordRepository.MetaJsonRecordQuery
-
Field Summary
-
Fields inherited from class com.axelor.db.JpaRepository
modelClass
-
-
Constructor Summary
Constructors Constructor Description MetaJsonRecordRepository()Create new instance of theMetaJsonRecordRepository.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MetaJsonRecordRepository.MetaJsonRecordQueryall(String jsonModel)Create aQueryfor the given json model.Contextcreate(MetaJsonRecord record)Contextcreate(String jsonModel)Create aContextfor the given json model to seamlessly work with json fields.MetaJsonRecordcreate(String jsonModel, Map<String,Object> values)Create a newMetaJsonRecordfor the given json model with given values.MetaJsonRecordsave(MetaJsonRecord entity)Save the given entity.MetaJsonRecordsave(Context context)Save the json record backed by the given context.
-
-
-
Constructor Detail
-
MetaJsonRecordRepository
public MetaJsonRecordRepository()
Create new instance of theMetaJsonRecordRepository.
-
-
Method Detail
-
create
public Context create(String jsonModel)
Create aContextfor the given json model to seamlessly work with json fields.For example:
Context person = repo.create("Person"); person.put("name", "Some NAME"); person.put("email", "some.name@gmail.com"); MetaJsonRecord saved = repo.save(person);- Parameters:
jsonModel- the name of the json model- Returns:
- a
Context
-
create
public Context create(MetaJsonRecord record)
-
create
public MetaJsonRecord create(String jsonModel, Map<String,Object> values)
Create a newMetaJsonRecordfor the given json model with given values.- Parameters:
jsonModel- the name of the json modelvalues- the values to set- Returns:
- a new unsaved instance of
MetaJsonRecord
-
save
public MetaJsonRecord save(Context context)
Save the json record backed by the given context.- Parameters:
context- the json record context- Returns:
- saved instance
MetaJsonRecord
-
save
public MetaJsonRecord save(MetaJsonRecord entity)
Description copied from interface:RepositorySave the given entity.Depending on the implementation, it may return same entity or a copy of it. For example JPA implementation may return a copy if the given entity can't be managed.
- Specified by:
savein interfaceRepository<MetaJsonRecord>- Overrides:
savein classJpaRepository<MetaJsonRecord>- Parameters:
entity- the entity object to save- Returns:
- an instance of the entity with saved state
-
all
public MetaJsonRecordRepository.MetaJsonRecordQuery all(String jsonModel)
Create aQueryfor the given json model.- Parameters:
jsonModel- name of the json model- Returns:
- an instance of
MetaJsonRecordRepository.MetaJsonRecordQuery
-
-