Search in sources :

Example 1 with EntityRecordCreator

use of com.rebuild.core.metadata.EntityRecordCreator in project rebuild by getrebuild.

the class MetaschemaImporter method performTrigger.

private void performTrigger(String entity, JSONObject config) {
    Entity configEntity = MetadataHelper.getEntity(EntityHelper.RobotTriggerConfig);
    config.put("metadata", JSONUtils.toJSONObject("entity", configEntity.getName()));
    config.put("belongEntity", entity);
    String actionType = config.getString("actionType");
    boolean available = false;
    for (ActionType type : ActionFactory.getAvailableActions()) {
        if (type.name().equalsIgnoreCase(actionType)) {
            available = true;
            break;
        }
    }
    if (!available) {
        log.warn("Trigger `{}` unavailable", actionType);
        return;
    }
    Record record = new EntityRecordCreator(configEntity, config, getUser()).create();
    Application.getBean(RobotTriggerConfigService.class).create(record);
}
Also used : Entity(cn.devezhao.persist4j.Entity) ActionType(com.rebuild.core.service.trigger.ActionType) Record(cn.devezhao.persist4j.Record) EntityRecordCreator(com.rebuild.core.metadata.EntityRecordCreator) RobotTriggerConfigService(com.rebuild.core.service.trigger.RobotTriggerConfigService)

Example 2 with EntityRecordCreator

use of com.rebuild.core.metadata.EntityRecordCreator in project rebuild by getrebuild.

the class MetaschemaImporter method performFilter.

private void performFilter(String entity, JSONObject config) {
    Entity configEntity = MetadataHelper.getEntity(EntityHelper.FilterConfig);
    config.put("metadata", JSONUtils.toJSONObject("entity", configEntity.getName()));
    config.put("belongEntity", entity);
    config.put("shareTo", ShareToManager.SHARE_ALL);
    Record record = new EntityRecordCreator(configEntity, config, getUser()).create();
    Application.getBean(AdvFilterService.class).create(record);
}
Also used : Entity(cn.devezhao.persist4j.Entity) Record(cn.devezhao.persist4j.Record) EntityRecordCreator(com.rebuild.core.metadata.EntityRecordCreator)

Example 3 with EntityRecordCreator

use of com.rebuild.core.metadata.EntityRecordCreator in project rebuild by getrebuild.

the class MetaschemaImporter method performFillin.

private void performFillin(String entity, JSONObject config) {
    Entity configEntity = MetadataHelper.getEntity(EntityHelper.AutoFillinConfig);
    config.put("metadata", JSONUtils.toJSONObject("entity", configEntity.getName()));
    config.put("belongEntity", entity);
    Record record = new EntityRecordCreator(configEntity, config, getUser()).create();
    Application.getBean(AutoFillinConfigService.class).create(record);
}
Also used : Entity(cn.devezhao.persist4j.Entity) Record(cn.devezhao.persist4j.Record) EntityRecordCreator(com.rebuild.core.metadata.EntityRecordCreator)

Example 4 with EntityRecordCreator

use of com.rebuild.core.metadata.EntityRecordCreator in project rebuild by getrebuild.

the class MetaschemaImporter method performApproval.

private void performApproval(String entity, JSONObject config) {
    Entity configEntity = MetadataHelper.getEntity(EntityHelper.RobotApprovalConfig);
    config.put("metadata", JSONUtils.toJSONObject("entity", configEntity.getName()));
    config.put("belongEntity", entity);
    Record record = new EntityRecordCreator(configEntity, config, getUser()).create();
    Application.getBean(RobotApprovalConfigService.class).create(record);
}
Also used : Entity(cn.devezhao.persist4j.Entity) RobotApprovalConfigService(com.rebuild.core.service.approval.RobotApprovalConfigService) Record(cn.devezhao.persist4j.Record) EntityRecordCreator(com.rebuild.core.metadata.EntityRecordCreator)

Example 5 with EntityRecordCreator

use of com.rebuild.core.metadata.EntityRecordCreator in project rebuild by getrebuild.

the class MetaschemaImporter method performTransform.

private void performTransform(String entity, JSONObject config) {
    Entity configEntity = MetadataHelper.getEntity(EntityHelper.TransformConfig);
    config.put("metadata", JSONUtils.toJSONObject("entity", configEntity.getName()));
    config.put("belongEntity", entity);
    Record record = new EntityRecordCreator(configEntity, config, getUser()).create();
    Application.getBean(TransformConfigService.class).create(record);
}
Also used : Entity(cn.devezhao.persist4j.Entity) Record(cn.devezhao.persist4j.Record) EntityRecordCreator(com.rebuild.core.metadata.EntityRecordCreator)

Aggregations

Record (cn.devezhao.persist4j.Record)6 EntityRecordCreator (com.rebuild.core.metadata.EntityRecordCreator)6 Entity (cn.devezhao.persist4j.Entity)5 ID (cn.devezhao.persist4j.engine.ID)1 RobotApprovalConfigService (com.rebuild.core.service.approval.RobotApprovalConfigService)1 ActionType (com.rebuild.core.service.trigger.ActionType)1 RobotTriggerConfigService (com.rebuild.core.service.trigger.RobotTriggerConfigService)1