Search in sources :

Example 1 with DatasourceDb

use of com.qlangtech.tis.workflow.pojo.DatasourceDb in project tis by qlangtech.

the class DatasourceDbDAOImpl method deleteByPrimaryKey.

public int deleteByPrimaryKey(Integer id) {
    DatasourceDb key = new DatasourceDb();
    key.setId(id);
    return this.deleteRecords("datasource_db.ibatorgenerated_deleteByPrimaryKey", key);
}
Also used : DatasourceDb(com.qlangtech.tis.workflow.pojo.DatasourceDb)

Example 2 with DatasourceDb

use of com.qlangtech.tis.workflow.pojo.DatasourceDb in project tis by qlangtech.

the class DatasourceDbDAOImpl method selectByPrimaryKey.

public DatasourceDb selectByPrimaryKey(Integer id) {
    DatasourceDb key = new DatasourceDb();
    key.setId(id);
    DatasourceDb record = (DatasourceDb) this.load("datasource_db.ibatorgenerated_selectByPrimaryKey", key);
    return record;
}
Also used : DatasourceDb(com.qlangtech.tis.workflow.pojo.DatasourceDb)

Example 3 with DatasourceDb

use of com.qlangtech.tis.workflow.pojo.DatasourceDb in project tis by qlangtech.

the class PluginAction method createDatabase.

public static DatasourceDb createDatabase(BasicModule module, Descriptor.ParseDescribable<DataSourceFactory> dbDesc, String dbName, Context context, boolean shallUpdateDB, OfflineManager offlineManager) {
    DatasourceDb datasourceDb = null;
    if (shallUpdateDB) {
        datasourceDb = new DatasourceDb();
        datasourceDb.setName(dbName);
        datasourceDb.setSyncOnline(new Byte("0"));
        datasourceDb.setCreateTime(new Date());
        datasourceDb.setOpTime(new Date());
        datasourceDb.setExtendClass(StringUtils.lowerCase(dbDesc.instance.getDescriptor().getDisplayName()));
        DatasourceDbCriteria criteria = new DatasourceDbCriteria();
        criteria.createCriteria().andNameEqualTo(dbName);
        int exist = module.getWorkflowDAOFacade().getDatasourceDbDAO().countByExample(criteria);
        if (exist > 0) {
            module.addErrorMessage(context, "已经有了同名(" + dbName + ")的数据库");
            return null;
        }
        /**
         * 校验数据库连接是否正常
         */
        int dbId = module.getWorkflowDAOFacade().getDatasourceDbDAO().insertSelective(datasourceDb);
        datasourceDb.setId(dbId);
    // module.setBizResult(context, datasourceDb);
    } else {
        // 更新状态
        DatasourceDbCriteria dbCriteria = new DatasourceDbCriteria();
        dbCriteria.createCriteria().andNameEqualTo(dbName);
        for (DatasourceDb db : module.getWorkflowDAOFacade().getDatasourceDbDAO().selectByExample(dbCriteria)) {
            datasourceDb = db;
            break;
        }
        Objects.requireNonNull(datasourceDb, "dbName:" + dbName + " relevant datasourceDb can not be null");
    }
    module.setBizResult(context, offlineManager.getDbConfig(module, datasourceDb));
    return datasourceDb;
}
Also used : DatasourceDb(com.qlangtech.tis.workflow.pojo.DatasourceDb) DatasourceDbCriteria(com.qlangtech.tis.workflow.pojo.DatasourceDbCriteria)

Example 4 with DatasourceDb

use of com.qlangtech.tis.workflow.pojo.DatasourceDb in project tis by qlangtech.

the class DatasourceDbDAOImpl method loadFromWriteDB.

public DatasourceDb loadFromWriteDB(Integer id) {
    DatasourceDb key = new DatasourceDb();
    key.setId(id);
    DatasourceDb record = (DatasourceDb) this.loadFromWriterDB("datasource_db.ibatorgenerated_selectByPrimaryKey", key);
    return record;
}
Also used : DatasourceDb(com.qlangtech.tis.workflow.pojo.DatasourceDb)

Aggregations

DatasourceDb (com.qlangtech.tis.workflow.pojo.DatasourceDb)4 DatasourceDbCriteria (com.qlangtech.tis.workflow.pojo.DatasourceDbCriteria)1