private News insertNews(final Connection con, final Configuration jooqConfig) { final Module module = new Module(9999, "key", "", ""); final Provider provider = new Provider(9999, "Test-Provider", "", "", null); final Category category = new Category(9999, "testKey", "", module.getId()); new InternalModuleDao(jooqConfig).insert(module); new InternalProviderDao(jooqConfig).insert(provider); new InternalCategoryDao(jooqConfig).insert(category); final News news = new News(99999, provider.getId(), category.getId(), "Test-News", Locale.GERMAN, "Lorem ipsum dolor ...", new Timestamp(System.currentTimeMillis()), "http://incomb.com", "/img/logo.svg", 232, 32, 287389); new NewsDao(con).saveNews(news); return news; }
@Test public void testGet() { final Configuration jooqConfig = new DefaultConfiguration().set(con).set(SQLDialect.MYSQL); final News news = insertNews(con, jooqConfig); final News fetchedNews = new NewsDao(con).getNews(news.getId()); assertNotNull(fetchedNews); assertEquals(news.getTitle(), fetchedNews.getTitle()); assertEquals(news.getText(), fetchedNews.getText()); assertEquals(news.getProviderId(), fetchedNews.getProviderId()); assertEquals(news.getCategoryId(), fetchedNews.getCategoryId()); assertEquals(news.getLocale(), fetchedNews.getLocale()); assertEquals(news.getLink(), fetchedNews.getLink()); assertEquals(news.getImageUrl(), fetchedNews.getImageUrl()); assertEquals(news.getImageWidth(), fetchedNews.getImageWidth()); assertEquals(news.getImageHeight(), fetchedNews.getImageHeight()); assertEquals(news.getNewsGroupId(), fetchedNews.getNewsGroupId()); }
@Provides @Singleton static DSLContext dbContext( DataSource dataSource, @ForDatabase ListeningExecutorService dbExecutor) { Configuration configuration = new DefaultConfiguration() .set(dbExecutor) .set(SQLDialect.MYSQL) .set(new Settings().withRenderSchema(false)) .set(new DataSourceConnectionProvider(dataSource)) .set(DatabaseUtil.sfmRecordMapperProvider()); DSLContext ctx = DSL.using(configuration); // Eagerly trigger JOOQ classinit for better startup performance. ctx.select().from("curio_server_framework_init").getSQL(); return ctx; }
/** * Call <code>kloopzcm.md_update_class_attribute</code> */ public static void mdUpdateClassAttribute2(Configuration configuration, Integer pAttributeId, String pAttributeName, String pDataType, Boolean pIsMandatory, Boolean pIsInheritable, Boolean pIsEncrypted, Boolean pIsImmutable, Boolean pForceOnDependent, String pDefaultValue, String pValueFormat, String pDescr) { MdUpdateClassAttribute2 p = new MdUpdateClassAttribute2(); p.setPAttributeId(pAttributeId); p.setPAttributeName(pAttributeName); p.setPDataType(pDataType); p.setPIsMandatory(pIsMandatory); p.setPIsInheritable(pIsInheritable); p.setPIsEncrypted(pIsEncrypted); p.setPIsImmutable(pIsImmutable); p.setPForceOnDependent(pForceOnDependent); p.setPDefaultValue(pDefaultValue); p.setPValueFormat(pValueFormat); p.setPDescr(pDescr); p.execute(configuration); }
/** * Call <code>kloopzcm.md_update_class_attribute</code> */ public static void mdUpdateClassAttribute1(Configuration configuration, Integer pAttributeId, String pAttributeName, String pDataType, Boolean pIsMandatory, Boolean pIsInheritable, Boolean pIsEncrypted, Boolean pForceOnDependent, String pDefaultValue, String pValueFormat, String pDescr) { MdUpdateClassAttribute1 p = new MdUpdateClassAttribute1(); p.setPAttributeId(pAttributeId); p.setPAttributeName(pAttributeName); p.setPDataType(pDataType); p.setPIsMandatory(pIsMandatory); p.setPIsInheritable(pIsInheritable); p.setPIsEncrypted(pIsEncrypted); p.setPForceOnDependent(pForceOnDependent); p.setPDefaultValue(pDefaultValue); p.setPValueFormat(pValueFormat); p.setPDescr(pDescr); p.execute(configuration); }
@Override public void saveTaxCodes(final Iterable<EasyTaxTaxCode> taxCodes) throws SQLException { final DateTime now = new DateTime(); execute(dataSource.getConnection(), new WithConnectionCallback<Void>() { @Override public Void withConnection(final Connection conn) throws SQLException { DSL.using(conn, dialect, settings).transaction(new TransactionalRunnable() { @Override public void run(final Configuration configuration) throws Exception { final DSLContext dslContext = DSL.using(configuration); for (EasyTaxTaxCode taxCode : taxCodes) { DateTime date = taxCode.getCreatedDate() != null ? taxCode.getCreatedDate() : now; saveTaxCodeInternal(taxCode, date, dslContext); } } }); return null; } }); }
/** * Call <code>kloopzcm.dj_create_rfc_ci</code> */ public static void djCreateRfcCi(Configuration configuration, Long pRfcId, Long pReleaseId, Long pCiId, Long pNsId, Integer pClassId, String pCiName, String pCiGoid, Integer pActionId, Integer pExecOrder, Long pLastRfcId, String pComments, String pCreatedBy) { DjCreateRfcCi p = new DjCreateRfcCi(); p.setPRfcId(pRfcId); p.setPReleaseId(pReleaseId); p.setPCiId(pCiId); p.setPNsId(pNsId); p.setPClassId(pClassId); p.setPCiName(pCiName); p.setPCiGoid(pCiGoid); p.setPActionId(pActionId); p.setPExecOrder(pExecOrder); p.setPLastRfcId(pLastRfcId); p.setPComments(pComments); p.setPCreatedBy(pCreatedBy); p.execute(configuration); }
/** * Call <code>kloopzcm.dj_create_rfc_relation</code> */ public static void djCreateRfcRelation(Configuration configuration, Long pRfcId, Long pReleaseId, Long pNsId, Long pCiRelationId, Long pFromRfcId, Long pFromCiId, Integer pRelationId, String pRelationGoid, Long pToRfcId, Long pToCiId, Integer pActionId, Integer pExecOrder, Long pLastRfcId, String pComments, String pCreatedBy) { DjCreateRfcRelation p = new DjCreateRfcRelation(); p.setPRfcId(pRfcId); p.setPReleaseId(pReleaseId); p.setPNsId(pNsId); p.setPCiRelationId(pCiRelationId); p.setPFromRfcId(pFromRfcId); p.setPFromCiId(pFromCiId); p.setPRelationId(pRelationId); p.setPRelationGoid(pRelationGoid); p.setPToRfcId(pToRfcId); p.setPToCiId(pToCiId); p.setPActionId(pActionId); p.setPExecOrder(pExecOrder); p.setPLastRfcId(pLastRfcId); p.setPComments(pComments); p.setPCreatedBy(pCreatedBy); p.execute(configuration); }
/** * Call <code>kloopzcm.md_add_class_attribute</code> */ public static Integer mdAddClassAttribute2(Configuration configuration, Integer pClassId, String pAttributeName, String pDataType, Boolean pIsMandatory, Boolean pIsInheritable, Boolean pIsEncrypted, Boolean pIsImmutable, Boolean pForceOnDependent, String pDefaultValue, String pValueFormat, String pDescr) { MdAddClassAttribute2 p = new MdAddClassAttribute2(); p.setPClassId(pClassId); p.setPAttributeName(pAttributeName); p.setPDataType(pDataType); p.setPIsMandatory(pIsMandatory); p.setPIsInheritable(pIsInheritable); p.setPIsEncrypted(pIsEncrypted); p.setPIsImmutable(pIsImmutable); p.setPForceOnDependent(pForceOnDependent); p.setPDefaultValue(pDefaultValue); p.setPValueFormat(pValueFormat); p.setPDescr(pDescr); p.execute(configuration); return p.getOutAttributeId(); }
/** * Call <code>kloopzcm.md_create_class</code> */ public static void mdCreateClass2(Configuration configuration, Integer pClassId, String pClassName, String pShortClassName, Integer pSuperClassId, String pImpl, Boolean pIsNamespace, Integer pFlags, String pAccessLevel, String pDescr, String pFormat) { MdCreateClass2 p = new MdCreateClass2(); p.setPClassId(pClassId); p.setPClassName(pClassName); p.setPShortClassName(pShortClassName); p.setPSuperClassId(pSuperClassId); p.setPImpl(pImpl); p.setPIsNamespace(pIsNamespace); p.setPFlags(pFlags); p.setPAccessLevel(pAccessLevel); p.setPDescr(pDescr); p.setPFormat(pFormat); p.execute(configuration); }
public boolean retry(Configuration configuration, long taskId, String message) { try { return juiceDao.rerty(configuration, taskId, message); } catch (Exception e) { String error = "retry task error, taskId : " + taskId + ", message : " + message + ", due to : " + e.getMessage(); log.error(error); throw new DataBaseException(DB_OPERATION_ERROR.getCode(), e.getMessage()); } }
public boolean submit(Configuration configuration, long taskId, String callbackUrl, String taskName, String taskInfo, Integer retry) { try { return juiceDao.submit(DSL.using(configuration), taskId, callbackUrl, taskName, taskInfo, retry); } catch (Exception e) { String error = "submit task error, taskId : " + taskId + ", taskName : " + taskName + ", callbackUrl : " + callbackUrl + ", due to : " + e.getMessage(); log.error(error); throw new DataBaseException(DB_OPERATION_ERROR.getCode(), e.getMessage()); } }
/** * Call <code>kloopzcm.md_delete_relation_attribute</code> */ public static void mdDeleteRelationAttribute(Configuration configuration, Integer pAttrId, Boolean pDeleteAll) { MdDeleteRelationAttribute p = new MdDeleteRelationAttribute(); p.setPAttrId(pAttrId); p.setPDeleteAll(pDeleteAll); p.execute(configuration); }
@Override protected SQLClient createDbClient(JsonObject config) { JsonObject myConfig = new JsonObject(); if(config.containsKey("db_host")) myConfig.put("host", config.getString("db_host")); if(config.containsKey("db_port")) myConfig.put("port", config.getInteger("db_port")); if(config.containsKey("db_user")) myConfig.put("username", config.getString("db_user")); if(config.containsKey("db_pass")) myConfig.put("password", config.getString("db_pass")); if(config.containsKey("db_name")) myConfig.put("database", config.getString("db_name")); myConfig.put("max_pool_size", config.getInteger("db_max_pool_size", 30)); Vertx vertx = AppGlobals.get().getVertx(); AsyncSQLClient dbClient = PostgreSQLClient.createNonShared(vertx, myConfig); AsyncJooqSQLClient client = AsyncJooqSQLClient.create(vertx, dbClient); Configuration configuration = new DefaultConfiguration(); configuration.set(SQLDialect.POSTGRES); PagesDao dao = new PagesDao(configuration); dao.setClient(client); AppGlobals.get().setGlobal("dao", dao); return dbClient; }
/** * Call <code>public.random_joke</code> */ public static RandomJoke randomJoke(Configuration configuration) { RandomJoke p = new RandomJoke(); p.execute(configuration); return p; }
/** * Call <code>kloopzcm.md_update_relation_attribute</code> */ public static void mdUpdateRelationAttribute(Configuration configuration, Integer pAttributeId, Integer pRelId, String pAttributeName, String pDataType, Boolean pIsMandatory, String pDefaultValue, String pValueFormat, String pDescr) { MdUpdateRelationAttribute p = new MdUpdateRelationAttribute(); p.setPAttributeId(pAttributeId); p.setPRelId(pRelId); p.setPAttributeName(pAttributeName); p.setPDataType(pDataType); p.setPIsMandatory(pIsMandatory); p.setPDefaultValue(pDefaultValue); p.setPValueFormat(pValueFormat); p.setPDescr(pDescr); p.execute(configuration); }
/** * Controller no parameter constructor * It's setting needed daos with configuration */ FileController() { try { String DB_URL = "jdbc:sqlite:test.db"; connection = DriverManager.getConnection(DB_URL); } catch (SQLException e) { e.printStackTrace(); } Configuration configuration = new DefaultConfiguration().set(connection).set(SQLDialect.SQLITE); fileMetadataDao = new FileMetadataDao(configuration); folderMetadataDao = new FolderMetadataDao(configuration); fileContentsDao = new FileContentsDao(configuration); }
@BeforeClass public static void beforeClass() throws SQLException { TestTool.setupDB(); Configuration configuration = new DefaultConfiguration(); configuration.set(SQLDialect.MYSQL); JsonObject config = new JsonObject().put("host", "127.0.0.1").put("username", "vertx").putNull("password").put("database","vertx"); dao = new SomethingDao(configuration); Vertx vertx = Vertx.vertx(); dao.setClient(AsyncJooqSQLClient.create(vertx,MySQLClient.createNonShared(vertx, config))); compositeDao = new SomethingcompositeDao(configuration); compositeDao.setClient(AsyncJooqSQLClient.create(vertx,MySQLClient.createNonShared(vertx, config))); }
/** * Call <code>kloopzcm.cm_create_alt_namespace</code> */ public static void cmCreateAltNamespace(Configuration configuration, Long pNsId, String pTag, Long pCiId) { CmCreateAltNamespace p = new CmCreateAltNamespace(); p.setPNsId(pNsId); p.setPTag(pTag); p.setPCiId(pCiId); p.execute(configuration); }
/** * Call <code>kloopzcm.cm_create_ci</code> */ public static void cmCreateCi1(Configuration configuration, Long pCiId, Long pNsId, Integer pClassId, String pGoid, String pCiName, String pComments, Integer pStateId, String pCreatedBy) { CmCreateCi1 p = new CmCreateCi1(); p.setPCiId(pCiId); p.setPNsId(pNsId); p.setPClassId(pClassId); p.setPGoid(pGoid); p.setPCiName(pCiName); p.setPComments(pComments); p.setPStateId(pStateId); p.setPCreatedBy(pCreatedBy); p.execute(configuration); }
/** * Call <code>kloopzcm.cm_create_ci</code> */ public static void cmCreateCi2(Configuration configuration, Long pCiId, Long pNsId, Integer pClassId, String pGoid, String pCiName, String pComments, Integer pStateId, Long pLastRfcId, String pCreatedBy) { CmCreateCi2 p = new CmCreateCi2(); p.setPCiId(pCiId); p.setPNsId(pNsId); p.setPClassId(pClassId); p.setPGoid(pGoid); p.setPCiName(pCiName); p.setPComments(pComments); p.setPStateId(pStateId); p.setPLastRfcId(pLastRfcId); p.setPCreatedBy(pCreatedBy); p.execute(configuration); }
/** * Call <code>kloopzcm.cm_create_ops_action</code> */ public static void cmCreateOpsAction(Configuration configuration, String pActionName, Long pOpsProcId, Long pCiId, String pStateName, Integer pExecOrder, Boolean pCritical, String pExtraInfo, String pArglist, String pPayload) { CmCreateOpsAction p = new CmCreateOpsAction(); p.setPActionName(pActionName); p.setPOpsProcId(pOpsProcId); p.setPCiId(pCiId); p.setPStateName(pStateName); p.setPExecOrder(pExecOrder); p.setPCritical(pCritical); p.setPExtraInfo(pExtraInfo); p.setPArglist(pArglist); p.setPPayload(pPayload); p.execute(configuration); }
/** * Call <code>kloopzcm.md_delete_relation</code> */ public static void mdDeleteRelation(Configuration configuration, Integer pRelId, Boolean pDeleteAll) { MdDeleteRelation p = new MdDeleteRelation(); p.setPRelId(pRelId); p.setPDeleteAll(pDeleteAll); p.execute(configuration); }
/** * Call <code>kloopzcm.cm_create_relation</code> */ public static void cmCreateRelation1(Configuration configuration, Long pCiRelationId, Long pNsId, Long pFromCiId, Integer pRelationId, Long pToCiId, String pRelGoid, String pComments, Integer pStateId) { CmCreateRelation1 p = new CmCreateRelation1(); p.setPCiRelationId(pCiRelationId); p.setPNsId(pNsId); p.setPFromCiId(pFromCiId); p.setPRelationId(pRelationId); p.setPToCiId(pToCiId); p.setPRelGoid(pRelGoid); p.setPComments(pComments); p.setPStateId(pStateId); p.execute(configuration); }
@BeforeClass public static void beforeClass() throws SQLException { TestTool.setupDB(); Configuration configuration = new DefaultConfiguration(); configuration.set(SQLDialect.MYSQL); JsonObject config = new JsonObject().put("host", "127.0.0.1").put("username", "vertx").putNull("password").put("database","vertx"); dao = new SomethingDao(configuration); Vertx vertx = Vertx.vertx(); dao.setClient(AsyncJooqSQLClient.create(vertx, MySQLClient.createNonShared(vertx, config))); compositeDao = new SomethingcompositeDao(configuration); compositeDao.setClient(AsyncJooqSQLClient.create(vertx,MySQLClient.createNonShared(vertx, config))); }
/** * Call <code>kloopzcm.cm_delete_alt_namespace</code> */ public static Long cmDeleteAltNamespace(Configuration configuration, Long pNsId, Long pCiId) { CmDeleteAltNamespace f = new CmDeleteAltNamespace(); f.setPNsId(pNsId); f.setPCiId(pCiId); f.execute(configuration); return f.getReturnValue(); }
/** * Call <code>kloopzcm.cm_delete_ci</code> */ public static void cmDeleteCi1(Configuration configuration, Long pCiId, Boolean pDelete4real) { CmDeleteCi1 p = new CmDeleteCi1(); p.setPCiId(pCiId); p.setPDelete4real(pDelete4real); p.execute(configuration); }
/** * Call <code>kloopzcm.cm_delete_ci</code> */ public static void cmDeleteCi3(Configuration configuration, Long pCiId, Long pLastRfcId, Boolean pDelete4real, String pDeletedBy) { CmDeleteCi3 p = new CmDeleteCi3(); p.setPCiId(pCiId); p.setPLastRfcId(pLastRfcId); p.setPDelete4real(pDelete4real); p.setPDeletedBy(pDeletedBy); p.execute(configuration); }
/** * Call <code>kloopzcm.cm_delete_relation</code> */ public static void cmDeleteRelation(Configuration configuration, Long pCiRelationId, Boolean pDelete4real) { CmDeleteRelation p = new CmDeleteRelation(); p.setPCiRelationId(pCiRelationId); p.setPDelete4real(pDelete4real); p.execute(configuration); }
/** * Call <code>kloopzcm.cm_is_opened_release_for_ci</code> */ public static Boolean cmIsOpenedReleaseForCi(Configuration configuration, Long pCiId) { CmIsOpenedReleaseForCi f = new CmIsOpenedReleaseForCi(); f.setPCiId(pCiId); f.execute(configuration); return f.getReturnValue(); }
/** * Call <code>kloopzcm.cm_is_ops_procedure_active_for_ci</code> */ public static Boolean cmIsOpsProcedureActiveForCi(Configuration configuration, Long pCiId) { CmIsOpsProcedureActiveForCi f = new CmIsOpsProcedureActiveForCi(); f.setPCiId(pCiId); f.execute(configuration); return f.getReturnValue(); }
/** * Call <code>kloopzcm.cm_update_ci</code> */ public static void cmUpdateCi1(Configuration configuration, Long pCiId, String pCiName, String pComments, Integer pStateId, String pUpdatedBy) { CmUpdateCi1 p = new CmUpdateCi1(); p.setPCiId(pCiId); p.setPCiName(pCiName); p.setPComments(pComments); p.setPStateId(pStateId); p.setPUpdatedBy(pUpdatedBy); p.execute(configuration); }
/** * Call <code>kloopzcm.cm_update_ci</code> */ public static void cmUpdateCi2(Configuration configuration, Long pCiId, String pCiName, String pComments, Integer pStateId, Long pLastRfcId, String pUpdatedBy) { CmUpdateCi2 p = new CmUpdateCi2(); p.setPCiId(pCiId); p.setPCiName(pCiName); p.setPComments(pComments); p.setPStateId(pStateId); p.setPLastRfcId(pLastRfcId); p.setPUpdatedBy(pUpdatedBy); p.execute(configuration); }
/** * Call <code>kloopzcm.cm_update_ci_attribute</code> */ public static void cmUpdateCiAttribute(Configuration configuration, Long pCiAttrId, String pDfValue, String pDjValue, String pOwner, String pComments) { CmUpdateCiAttribute p = new CmUpdateCiAttribute(); p.setPCiAttrId(pCiAttrId); p.setPDfValue(pDfValue); p.setPDjValue(pDjValue); p.setPOwner(pOwner); p.setPComments(pComments); p.execute(configuration); }
/** * Call <code>kloopzcm.cm_update_ops_action_state</code> */ public static void cmUpdateOpsActionState(Configuration configuration, Long pActionId, String pState) { CmUpdateOpsActionState p = new CmUpdateOpsActionState(); p.setPActionId(pActionId); p.setPState(pState); p.execute(configuration); }
/** * Call <code>kloopzcm.md_delete_class_attribute</code> */ public static void mdDeleteClassAttribute(Configuration configuration, Integer pAttributeId, Boolean pDeleteAll) { MdDeleteClassAttribute p = new MdDeleteClassAttribute(); p.setPAttributeId(pAttributeId); p.setPDeleteAll(pDeleteAll); p.execute(configuration); }
/** * Call <code>kloopzcm.cm_update_rel_attribute</code> */ public static void cmUpdateRelAttribute(Configuration configuration, Long pCiRelAttrId, String pDfValue, String pDjValue, String pOwner, String pComments) { CmUpdateRelAttribute p = new CmUpdateRelAttribute(); p.setPCiRelAttrId(pCiRelAttrId); p.setPDfValue(pDfValue); p.setPDjValue(pDjValue); p.setPOwner(pOwner); p.setPComments(pComments); p.execute(configuration); }
/** * Call <code>kloopzcm.md_update_class_action</code> */ public static void mdUpdateClassAction1(Configuration configuration, Integer pActionId, String pActionName, Boolean pIsInheritable, String pDescr) { MdUpdateClassAction1 p = new MdUpdateClassAction1(); p.setPActionId(pActionId); p.setPActionName(pActionName); p.setPIsInheritable(pIsInheritable); p.setPDescr(pDescr); p.execute(configuration); }
/** * Call <code>kloopzcm.cms_acquire_lock</code> */ public static Boolean cmsAcquireLock(Configuration configuration, String pLockName, String pLockedBy, Integer pStaleTimeout) { CmsAcquireLock f = new CmsAcquireLock(); f.setPLockName(pLockName); f.setPLockedBy(pLockedBy); f.setPStaleTimeout(pStaleTimeout); f.execute(configuration); return f.getReturnValue(); }
/** * Call <code>kloopzcm.cms_set_var</code> */ public static void cmsSetVar1(Configuration configuration, String pVarName, String pVarValue, String pUpdatedBy) { CmsSetVar1 p = new CmsSetVar1(); p.setPVarName(pVarName); p.setPVarValue(pVarValue); p.setPUpdatedBy(pUpdatedBy); p.execute(configuration); }