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 class
MetaJsonRecordRepository.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.MetaJsonRecordQuery
all(String jsonModel)
Create aQuery
for the given json model.Context
create(MetaJsonRecord record)
Context
create(String jsonModel)
Create aContext
for the given json model to seamlessly work with json fields.MetaJsonRecord
create(String jsonModel, Map<String,Object> values)
Create a newMetaJsonRecord
for the given json model with given values.MetaJsonRecord
save(MetaJsonRecord entity)
Save the given entity.MetaJsonRecord
save(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 aContext
for 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 newMetaJsonRecord
for 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:Repository
Save 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:
save
in interfaceRepository<MetaJsonRecord>
- Overrides:
save
in 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 aQuery
for the given json model.- Parameters:
jsonModel
- name of the json model- Returns:
- an instance of
MetaJsonRecordRepository.MetaJsonRecordQuery
-
-