本文整理汇总了Java中org.jooq.UpdateSetMoreStep类的典型用法代码示例。如果您正苦于以下问题:Java UpdateSetMoreStep类的具体用法?Java UpdateSetMoreStep怎么用?Java UpdateSetMoreStep使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UpdateSetMoreStep类属于org.jooq包,在下文中一共展示了UpdateSetMoreStep类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateResponse
import org.jooq.UpdateSetMoreStep; //导入依赖的package包/类
/**
* Update the PSP reference and additional data of the latest response row for a payment transaction
*
* @param kbPaymentTransactionId Kill Bill payment transaction id
* @param paymentServiceProviderResult New PSP result (null if unchanged)
* @param additionalPluginProperties Latest properties
* @param kbTenantId Kill Bill tenant id
* @return the latest version of the response row, null if one couldn't be found
* @throws SQLException For any unexpected SQL error
*/
public AdyenResponsesRecord updateResponse(final UUID kbPaymentTransactionId, @Nullable final PaymentServiceProviderResult paymentServiceProviderResult, final Iterable<PluginProperty> additionalPluginProperties, final UUID kbTenantId) throws SQLException {
final Map<String, Object> additionalProperties = PluginProperties.toMap(additionalPluginProperties);
return execute(dataSource.getConnection(),
new WithConnectionCallback<AdyenResponsesRecord>() {
@Override
public AdyenResponsesRecord withConnection(final Connection conn) throws SQLException {
final AdyenResponsesRecord response = DSL.using(conn, dialect, settings)
.selectFrom(ADYEN_RESPONSES)
.where(ADYEN_RESPONSES.KB_PAYMENT_TRANSACTION_ID.equal(kbPaymentTransactionId.toString()))
.and(ADYEN_RESPONSES.KB_TENANT_ID.equal(kbTenantId.toString()))
.orderBy(ADYEN_RESPONSES.RECORD_ID.desc())
.limit(1)
.fetchOne();
if (response == null) {
return null;
}
final Map originalData = new HashMap(fromAdditionalData(response.getAdditionalData()));
originalData.putAll(additionalProperties);
final String pspReference = getProperty(PROPERTY_PSP_REFERENCE, additionalProperties);
if (pspReference != null) {
// If there is a PSP reference, the call went eventually to Adyen. Remove exceptions
originalData.remove(ADYEN_CALL_ERROR_STATUS);
originalData.remove(EXCEPTION_CLASS);
originalData.remove(EXCEPTION_MESSAGE);
}
final String mergedAdditionalData = asString(originalData);
UpdateSetMoreStep<AdyenResponsesRecord> step = DSL.using(conn, dialect, settings)
.update(ADYEN_RESPONSES)
.set(ADYEN_RESPONSES.PSP_REFERENCE, pspReference)
.set(ADYEN_RESPONSES.ADDITIONAL_DATA, mergedAdditionalData);
if (paymentServiceProviderResult != null) {
step = step.set(ADYEN_RESPONSES.PSP_RESULT, paymentServiceProviderResult.toString());
}
step.where(ADYEN_RESPONSES.RECORD_ID.equal(response.getRecordId()))
.execute();
return DSL.using(conn, dialect, settings)
.selectFrom(ADYEN_RESPONSES)
.where(ADYEN_RESPONSES.KB_PAYMENT_TRANSACTION_ID.equal(kbPaymentTransactionId.toString()))
.and(ADYEN_RESPONSES.KB_TENANT_ID.equal(kbTenantId.toString()))
.orderBy(ADYEN_RESPONSES.RECORD_ID.desc())
.limit(1)
.fetchOne();
}
});
}
示例2: editProblem
import org.jooq.UpdateSetMoreStep; //导入依赖的package包/类
@Override
public String editProblem(@Nonnull final String problemCode,
@Nonnull final ProblemDetailView problemDetailView,
@Nullable final String contentType,
@Nullable final byte[] content)
throws FormException {
validateProblemDetailView(problemDetailView);
editProblemLanguages(problemCode, problemDetailView);
final UpdateSetMoreStep<TasksRecord> whereStep =
jooq.update(TASKS)
.set(TASKS.CODE, problemDetailView.getCode())
.set(TASKS.NAME, problemDetailView.getName())
.set(TASKS.CONTENT, problemDetailView.getContent() != null ? String.valueOf(problemDetailView.getContent()) : null)
.set(TASKS.CHECKSRC, problemDetailView.getCheckerSource())
.set(TASKS.AUTHOR, problemDetailView.getAuthor())
.set(TASKS.DEFAULT_TIME_LIMIT, problemDetailView.getDefaultTimeLimit())
.set(TASKS.DEFAULT_MEMORY_LIMIT, problemDetailView.getDefaultMemoryLimit());
if (!problemDetailView.isHasAttachment()) {
whereStep.set(TASKS.FILETYPE, (String) null)
.set(TASKS.FILECONTENT, (byte[]) null);
} else {
if (contentType != null && content != null) {
whereStep.set(TASKS.FILETYPE, contentType)
.set(TASKS.FILECONTENT, content);
}
}
final UpdateResultStep<TasksRecord> step =
whereStep.where(TASKS.CODE.eq(problemCode))
.returning(TASKS.CODE);
try {
final TasksRecord problemRecord = step.fetchOne();
return problemRecord.getCode();
} catch (DataIntegrityViolationException ex) {
throw new FormException().addError("code", "unique");
}
}