org.jooq.Configuration Java Examples

The following examples show how to use org.jooq.Configuration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AclDAO.java    From keywhiz with Apache License 2.0 6 votes vote down vote up
protected void enrollClient(Configuration configuration, long clientId, long groupId) {
  long now = OffsetDateTime.now().toEpochSecond();

  boolean enrolled = 0 < DSL.using(configuration)
      .fetchCount(MEMBERSHIPS,
          MEMBERSHIPS.GROUPID.eq(groupId).and(
          MEMBERSHIPS.CLIENTID.eq(clientId)));
  if (enrolled) {
    return;
  }

  String verificationHmac = rowHmacGenerator.computeRowHmac(
      MEMBERSHIPS.getName(), List.of(clientId, groupId));

  DSL.using(configuration)
      .insertInto(MEMBERSHIPS)
      .set(MEMBERSHIPS.GROUPID, groupId)
      .set(MEMBERSHIPS.CLIENTID, clientId)
      .set(MEMBERSHIPS.CREATEDAT, now)
      .set(MEMBERSHIPS.UPDATEDAT, now)
      .set(MEMBERSHIPS.ROW_HMAC, verificationHmac)
      .execute();
}
 
Example #2
Source File: Routines.java    From oneops with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #3
Source File: Routines.java    From oneops with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #4
Source File: Routines.java    From oneops with Apache License 2.0 6 votes vote down vote up
/**
 * Call <code>kloopzcm.md_add_class_attribute</code>
 */
public static Integer mdAddClassAttribute1(Configuration configuration, Integer pClassId, String pAttributeName, String pDataType, Boolean pIsMandatory, Boolean pIsInheritable, Boolean pIsEncrypted, Boolean pForceOnDependent, String pDefaultValue, String pValueFormat, String pDescr) {
    MdAddClassAttribute1 p = new MdAddClassAttribute1();
    p.setPClassId(pClassId);
    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);
    return p.getOutAttributeId();
}
 
Example #5
Source File: Routines.java    From oneops with Apache License 2.0 5 votes vote down vote up
/**
 * Call <code>kloopzcm.dj_reset_failed_records</code>
 */
public static void djResetFailedRecords(Configuration configuration, Long pDeploymentId) {
    DjResetFailedRecords p = new DjResetFailedRecords();
    p.setPDeploymentId(pDeploymentId);

    p.execute(configuration);
}
 
Example #6
Source File: Routines.java    From oneops with Apache License 2.0 5 votes vote down vote up
/**
 * Call <code>kloopzcm.dj_update_release</code>
 */
public static void djUpdateRelease(Configuration configuration, Long pReleaseId, Long pParentReleaseId, String pReleaseName, Integer pReleaseStateId, String pCommitedBy, Integer pRevision, String pDesc) {
    DjUpdateRelease p = new DjUpdateRelease();
    p.setPReleaseId(pReleaseId);
    p.setPParentReleaseId(pParentReleaseId);
    p.setPReleaseName(pReleaseName);
    p.setPReleaseStateId(pReleaseStateId);
    p.setPCommitedBy(pCommitedBy);
    p.setPRevision(pRevision);
    p.setPDesc(pDesc);

    p.execute(configuration);
}
 
Example #7
Source File: SomethingcompositeDao.java    From vertx-jooq with MIT License 5 votes vote down vote up
@javax.inject.Inject

    /**
     * @param configuration Used for rendering, so only SQLDialect must be set and must be one of the MYSQL types or POSTGRES.
     * @param vertx the vertx instance
     * @param delegate A configured AsyncSQLClient that is used for query execution
     */
    public SomethingcompositeDao(Configuration configuration, io.vertx.core.Vertx vertx, io.vertx.ext.asyncsql.AsyncSQLClient delegate) {
        super(Somethingcomposite.SOMETHINGCOMPOSITE, generated.cf.async.guice.tables.pojos.Somethingcomposite.class, new AsyncCompletableFutureQueryExecutor<SomethingcompositeRecord,generated.cf.async.guice.tables.pojos.Somethingcomposite,Record2<Integer, Integer>>(configuration,vertx,delegate,generated.cf.async.guice.tables.pojos.Somethingcomposite::new, Somethingcomposite.SOMETHINGCOMPOSITE));
    }
 
Example #8
Source File: Routines.java    From oneops with Apache License 2.0 5 votes vote down vote up
/**
 * Call <code>kloopzcm.dj_update_rfc_ci</code>
 */
public static void djUpdateRfcCi2(Configuration configuration, Long pRfcId, String pCiName, Integer pExecOrder, String pComments, String pUpdatedBy, Long pReleaseId) {
    DjUpdateRfcCi2 p = new DjUpdateRfcCi2();
    p.setPRfcId(pRfcId);
    p.setPCiName(pCiName);
    p.setPExecOrder(pExecOrder);
    p.setPComments(pComments);
    p.setPUpdatedBy(pUpdatedBy);
    p.setPReleaseId(pReleaseId);

    p.execute(configuration);
}
 
Example #9
Source File: Routines.java    From oneops with Apache License 2.0 5 votes vote down vote up
/**
 * Call <code>kloopzcm.dj_update_rfc_relation</code>
 */
public static void djUpdateRfcRelation1(Configuration configuration, Long pRfcId, Integer pExecOrder, String pComments, String pUpdatedBy) {
    DjUpdateRfcRelation1 p = new DjUpdateRfcRelation1();
    p.setPRfcId(pRfcId);
    p.setPExecOrder(pExecOrder);
    p.setPComments(pComments);
    p.setPUpdatedBy(pUpdatedBy);

    p.execute(configuration);
}
 
Example #10
Source File: Routines.java    From java-persistence-frameworks-comparison with MIT License 5 votes vote down vote up
/**
 * Call <code>public.register_employee</code>
 */
public static RegisterEmployee registerEmployee(Configuration configuration, String _Name, String _Surname, String _Email, BigDecimal _Salary, String _DepartmentName, String _CompanyName) {
    RegisterEmployee p = new RegisterEmployee();
    p.set_Name(_Name);
    p.set_Surname(_Surname);
    p.set_Email(_Email);
    p.set_Salary(_Salary);
    p.set_DepartmentName(_DepartmentName);
    p.set_CompanyName(_CompanyName);

    p.execute(configuration);
    return p;
}
 
Example #11
Source File: Routines.java    From oneops with Apache License 2.0 5 votes vote down vote up
/**
 * Call <code>kloopzcm.dj_upsert_rfc_ci_attr</code>
 */
public static Long djUpsertRfcCiAttr(Configuration configuration, Long pRfcId, Integer pAttributeId, String pNewAttrValue, String pOwner, String pComments) {
    DjUpsertRfcCiAttr p = new DjUpsertRfcCiAttr();
    p.setPRfcId(pRfcId);
    p.setPAttributeId(pAttributeId);
    p.setPNewAttrValue(pNewAttrValue);
    p.setPOwner(pOwner);
    p.setPComments(pComments);

    p.execute(configuration);
    return p.getPRfcAttrId();
}
 
Example #12
Source File: SomethingcompositeDao.java    From vertx-jooq with MIT License 5 votes vote down vote up
@javax.inject.Inject

    /**
     * @param configuration The Configuration used for rendering and query execution.
     * @param vertx the vertx instance
     */
    public SomethingcompositeDao(Configuration configuration, io.vertx.core.Vertx vertx) {
        super(Somethingcomposite.SOMETHINGCOMPOSITE, generated.classic.jdbc.guice.vertx.tables.pojos.Somethingcomposite.class, new JDBCClassicQueryExecutor<SomethingcompositeRecord,generated.classic.jdbc.guice.vertx.tables.pojos.Somethingcomposite,Record2<Integer, Integer>>(configuration,generated.classic.jdbc.guice.vertx.tables.pojos.Somethingcomposite.class,vertx));
    }
 
Example #13
Source File: JooqConfig.java    From StubbornJava with MIT License 5 votes vote down vote up
public static Configuration defaultConfigFromDataSource(DataSource ds) {
    DataSourceConnectionProvider dcp = new DataSourceConnectionProvider(ds);
    Configuration jooqConfig = new DefaultConfiguration();
    jooqConfig.set(SQLDialect.MYSQL);
    jooqConfig.set(dcp);
    //jooqConfig.set(new ThreadLocalTransactionProvider(dcp));
    jooqConfig.settings()
              .withExecuteWithOptimisticLockingExcludeUnversioned(true);
    return jooqConfig;
}
 
Example #14
Source File: Routines.java    From oneops with Apache License 2.0 5 votes vote down vote up
/**
 * Call <code>kloopzcm.dj_upsert_rfc_rel_attr</code>
 */
public static Long djUpsertRfcRelAttr(Configuration configuration, Long pRfcId, Integer pAttributeId, String pNewAttrValue, String pOwner, String pComments) {
    DjUpsertRfcRelAttr p = new DjUpsertRfcRelAttr();
    p.setPRfcId(pRfcId);
    p.setPAttributeId(pAttributeId);
    p.setPNewAttrValue(pNewAttrValue);
    p.setPOwner(pOwner);
    p.setPComments(pComments);

    p.execute(configuration);
    return p.getPRfcAttrId();
}
 
Example #15
Source File: AsText.java    From java-crud-api with MIT License 5 votes vote down vote up
private QueryPart delegate(Configuration configuration) {
	switch (configuration.dialect().family().toString()) {
	case "MYSQL":
	case "POSTGRES":
		return DSL.field("ST_AsText({0})", String.class, field);
	case "SQLSERVER":
		return DSL.field("{0}.STAsText(0)", String.class, field);
	default:
		throw new UnsupportedOperationException("Dialect not supported");
	}
}
 
Example #16
Source File: IsSimple.java    From java-crud-api with MIT License 5 votes vote down vote up
private QueryPart delegate(Configuration configuration) {
	switch (configuration.dialect().family().toString()) {
	case "MYSQL":
	case "POSTGRES":
		return DSL.field("ST_IsSimple({0})", Boolean.class, field);
	case "SQLSERVER":
		return DSL.field("{0}.STIsSimple()", Boolean.class, field);
	default:
		throw new UnsupportedOperationException("Dialect not supported");
	}
}
 
Example #17
Source File: Routines.java    From oneops with Apache License 2.0 5 votes vote down vote up
/**
 * Call <code>kloopzcm.md_add_relation_attribute</code>
 */
public static Integer mdAddRelationAttribute(Configuration configuration, Integer pRelId, String pAttributeName, String pDataType, Boolean pIsMandatory, String pDefaultValue, String pValueFormat, String pDescr) {
    MdAddRelationAttribute p = new MdAddRelationAttribute();
    p.setPRelId(pRelId);
    p.setPAttributeName(pAttributeName);
    p.setPDataType(pDataType);
    p.setPIsMandatory(pIsMandatory);
    p.setPDefaultValue(pDefaultValue);
    p.setPValueFormat(pValueFormat);
    p.setPDescr(pDescr);

    p.execute(configuration);
    return p.getOutAttributeId();
}
 
Example #18
Source File: Routines.java    From oneops with Apache License 2.0 5 votes vote down vote up
/**
 * Call <code>kloopzcm.dj_deploy_release</code>
 */
public static Long djDeployRelease5(Configuration configuration, Long pReleaseId, String pState, String pCreatedBy, String pDescription, String pComments, String pOps, Long pFlags, String pAutoPauseExecOrders) {
    DjDeployRelease5 p = new DjDeployRelease5();
    p.setPReleaseId(pReleaseId);
    p.setPState(pState);
    p.setPCreatedBy(pCreatedBy);
    p.setPDescription(pDescription);
    p.setPComments(pComments);
    p.setPOps(pOps);
    p.setPFlags(pFlags);
    p.setPAutoPauseExecOrders(pAutoPauseExecOrders);

    p.execute(configuration);
    return p.getOutDeploymentId();
}
 
Example #19
Source File: Routines.java    From oneops with Apache License 2.0 5 votes vote down vote up
/**
 * Call <code>kloopzcm.dj_deploy_release</code>
 */
public static Long djDeployRelease1(Configuration configuration, Long pReleaseId, String pCreatedBy, String pComments) {
    DjDeployRelease1 p = new DjDeployRelease1();
    p.setPReleaseId(pReleaseId);
    p.setPCreatedBy(pCreatedBy);
    p.setPComments(pComments);

    p.execute(configuration);
    return p.getOutDeploymentId();
}
 
Example #20
Source File: Routines.java    From oneops with Apache License 2.0 5 votes vote down vote up
/**
 * Call <code>kloopzcm.dj_delete_release</code>
 */
public static void djDeleteRelease(Configuration configuration, Long pReleaseId) {
    DjDeleteRelease p = new DjDeleteRelease();
    p.setPReleaseId(pReleaseId);

    p.execute(configuration);
}
 
Example #21
Source File: Routines.java    From oneops with Apache License 2.0 5 votes vote down vote up
/**
 * Call <code>kloopzcm.md_add_class_action</code>
 */
public static Integer mdAddClassAction1(Configuration configuration, Integer pClassId, String pActionName, Boolean pIsInheritable, String pDescr) {
    MdAddClassAction1 p = new MdAddClassAction1();
    p.setPClassId(pClassId);
    p.setPActionName(pActionName);
    p.setPIsInheritable(pIsInheritable);
    p.setPDescr(pDescr);

    p.execute(configuration);
    return p.getOutActionId();
}
 
Example #22
Source File: Routines.java    From oneops with Apache License 2.0 5 votes vote down vote up
/**
 * Call <code>kloopzcm.dj_create_release</code>
 */
public static void djCreateRelease1(Configuration configuration, Long pReleaseId, Long pNsId, Long pParentReleaseId, String pReleaseName, String pCreatedBy, Long pReleaseStateId, String pDescription, String pRevision) {
    DjCreateRelease1 p = new DjCreateRelease1();
    p.setPReleaseId(pReleaseId);
    p.setPNsId(pNsId);
    p.setPParentReleaseId(pParentReleaseId);
    p.setPReleaseName(pReleaseName);
    p.setPCreatedBy(pCreatedBy);
    p.setPReleaseStateId(pReleaseStateId);
    p.setPDescription(pDescription);
    p.setPRevision(pRevision);

    p.execute(configuration);
}
 
Example #23
Source File: AclDAO.java    From keywhiz with Apache License 2.0 5 votes vote down vote up
/**
 * @param configuration database information
 * @param client client to access secrets
 * @param secretName name of SecretSeries
 * @return Optional.absent() when secret unauthorized or not found.
 * The query doesn't distinguish between these cases. If result absent, a followup call on clients
 * table should be used to determine the exception.
 */
protected Optional<SecretSeries> getSecretSeriesFor(Configuration configuration, Client client, String secretName) {
  // TODO: We need to set limit(1) because we are using joins. We should probably change the join type.
  SecretsRecord r = DSL.using(configuration)
      .select(SECRETS.fields())
      .from(SECRETS)
      .join(ACCESSGRANTS).on(SECRETS.ID.eq(ACCESSGRANTS.SECRETID))
      .join(MEMBERSHIPS).on(ACCESSGRANTS.GROUPID.eq(MEMBERSHIPS.GROUPID))
      .join(CLIENTS).on(CLIENTS.ID.eq(MEMBERSHIPS.CLIENTID))
      .where(SECRETS.NAME.eq(secretName).and(CLIENTS.NAME.eq(client.getName())).and(SECRETS.CURRENT.isNotNull()))
      .limit(1)
      .fetchOneInto(SECRETS);
  return Optional.ofNullable(r).map(secretSeriesMapper::map);
}
 
Example #24
Source File: Routines.java    From oneops with Apache License 2.0 5 votes vote down vote up
/**
 * Call <code>kloopzcm.dj_complete_deployment</code>
 */
public static void djCompleteDeployment(Configuration configuration, Long pDeploymentId) {
    DjCompleteDeployment p = new DjCompleteDeployment();
    p.setPDeploymentId(pDeploymentId);

    p.execute(configuration);
}
 
Example #25
Source File: Contains.java    From java-crud-api with MIT License 5 votes vote down vote up
private QueryPart delegate(Configuration configuration) {
	switch (configuration.dialect().family().toString()) {
	case "MYSQL":
	case "POSTGRES":
		return DSL.field("ST_Contains({0}, {1})", Boolean.class, field1, field2);
	case "SQLSERVER":
		return DSL.field("{0}.STContains({1})", Boolean.class, field1, field2);
	default:
		throw new UnsupportedOperationException("Dialect not supported");
	}
}
 
Example #26
Source File: SomethingwithoutjsonDao.java    From vertx-jooq with MIT License 5 votes vote down vote up
@javax.inject.Inject

    /**
     * @param configuration Used for rendering, so only SQLDialect must be set and must be one of the MYSQL types or POSTGRES.
     * @param delegate A configured AsyncSQLClient that is used for query execution
     */
    public SomethingwithoutjsonDao(Configuration configuration,io.vertx.reactivex.ext.asyncsql.AsyncSQLClient delegate) {
        super(Somethingwithoutjson.SOMETHINGWITHOUTJSON, generated.rx.async.guice.tables.pojos.Somethingwithoutjson.class, new AsyncRXQueryExecutor<SomethingwithoutjsonRecord,generated.rx.async.guice.tables.pojos.Somethingwithoutjson,Integer>(configuration,delegate,generated.rx.async.guice.tables.pojos.Somethingwithoutjson::new, Somethingwithoutjson.SOMETHINGWITHOUTJSON));
    }
 
Example #27
Source File: Routines.java    From oneops with Apache License 2.0 5 votes vote down vote up
/**
 * Call <code>kloopzcm.ns_delete_namespace</code>
 */
public static void nsDeleteNamespace(Configuration configuration, String pNsPath) {
    NsDeleteNamespace p = new NsDeleteNamespace();
    p.setPNsPath(pNsPath);

    p.execute(configuration);
}
 
Example #28
Source File: Routines.java    From oneops with Apache License 2.0 5 votes vote down vote up
/**
 * Call <code>kloopzcm.dj_brush_exec_order</code>
 */
public static void djBrushExecOrder(Configuration configuration, Long pReleaseId) {
    DjBrushExecOrder p = new DjBrushExecOrder();
    p.setPReleaseId(pReleaseId);

    p.execute(configuration);
}
 
Example #29
Source File: SomethingcompositeDao.java    From vertx-jooq with MIT License 5 votes vote down vote up
@javax.inject.Inject

    /**
     * @param configuration The Configuration used for rendering and query execution.
     * @param vertx the vertx instance
     */
    public SomethingcompositeDao(Configuration configuration, io.vertx.reactivex.core.Vertx vertx) {
        super(Somethingcomposite.SOMETHINGCOMPOSITE, generated.rx.jdbc.guice.vertx.tables.pojos.Somethingcomposite.class, new JDBCRXQueryExecutor<SomethingcompositeRecord,generated.rx.jdbc.guice.vertx.tables.pojos.Somethingcomposite,Record2<Integer, Integer>>(configuration,generated.rx.jdbc.guice.vertx.tables.pojos.Somethingcomposite.class,vertx));
    }
 
Example #30
Source File: AclDAO.java    From keywhiz with Apache License 2.0 5 votes vote down vote up
protected ImmutableSet<SecretSeries> getSecretSeriesFor(Configuration configuration, Group group) {
  List<SecretSeries> r = DSL.using(configuration)
      .select(SECRETS.fields())
      .from(SECRETS)
      .join(ACCESSGRANTS).on(SECRETS.ID.eq(ACCESSGRANTS.SECRETID))
      .join(GROUPS).on(GROUPS.ID.eq(ACCESSGRANTS.GROUPID))
      .where(GROUPS.NAME.eq(group.getName()).and(SECRETS.CURRENT.isNotNull()))
      .fetchInto(SECRETS)
      .map(secretSeriesMapper);
  return ImmutableSet.copyOf(r);
}