instruction string | input string | output string | source_file string | priority int64 |
|---|---|---|---|---|
请完成以下Java代码 | public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public boolean isForEnabled() {
return forEnabled;
}
public void setForEnabled(boolean forEnabled) {
this.forEnabled = forEnabled;
}
public boolean isHostEnabled() {
return hostEnabled;
}
public void setHostEnabled(boolean hostEnabled) {
this.hostEnabled = hostEnabled;
}
public boolean isPortEnabled() {
return portEnabled;
}
public void setPortEnabled(boolean portEnabled) {
this.portEnabled = portEnabled;
}
public boolean isProtoEnabled() {
return protoEnabled;
}
public void setProtoEnabled(boolean protoEnabled) {
this.protoEnabled = protoEnabled;
}
public boolean isPrefixEnabled() {
return prefixEnabled;
}
public void setPrefixEnabled(boolean prefixEnabled) {
this.prefixEnabled = prefixEnabled;
}
public boolean isForAppend() {
return forAppend;
}
public void setForAppend(boolean forAppend) {
this.forAppend = forAppend;
}
public boolean isHostAppend() {
return hostAppend;
}
public void setHostAppend(boolean hostAppend) {
this.hostAppend = hostAppend; | }
public boolean isPortAppend() {
return portAppend;
}
public void setPortAppend(boolean portAppend) {
this.portAppend = portAppend;
}
public boolean isProtoAppend() {
return protoAppend;
}
public void setProtoAppend(boolean protoAppend) {
this.protoAppend = protoAppend;
}
public boolean isPrefixAppend() {
return prefixAppend;
}
public void setPrefixAppend(boolean prefixAppend) {
this.prefixAppend = prefixAppend;
}
} | repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webmvc\src\main\java\org\springframework\cloud\gateway\server\mvc\filter\XForwardedRequestHeadersFilterProperties.java | 1 |
请完成以下Java代码 | public Long countByTenantId(TenantId tenantId) {
return notificationTargetRepository.countByTenantId(tenantId.getId());
}
@Override
public NotificationTarget findByTenantIdAndExternalId(UUID tenantId, UUID externalId) {
return DaoUtil.getData(notificationTargetRepository.findByTenantIdAndExternalId(tenantId, externalId));
}
@Override
public NotificationTarget findByTenantIdAndName(UUID tenantId, String name) {
return DaoUtil.getData(notificationTargetRepository.findByTenantIdAndName(tenantId, name));
}
@Override
public PageData<NotificationTarget> findByTenantId(UUID tenantId, PageLink pageLink) {
return DaoUtil.toPageData(notificationTargetRepository.findByTenantId(tenantId, DaoUtil.toPageable(pageLink)));
}
@Override
public NotificationTargetId getExternalIdByInternal(NotificationTargetId internalId) {
return DaoUtil.toEntityId(notificationTargetRepository.getExternalIdByInternal(internalId.getId()), NotificationTargetId::new);
}
@Override
public PageData<NotificationTarget> findAllByTenantId(TenantId tenantId, PageLink pageLink) {
return findByTenantId(tenantId.getId(), pageLink); | }
@Override
protected Class<NotificationTargetEntity> getEntityClass() {
return NotificationTargetEntity.class;
}
@Override
protected JpaRepository<NotificationTargetEntity, UUID> getRepository() {
return notificationTargetRepository;
}
@Override
public EntityType getEntityType() {
return EntityType.NOTIFICATION_TARGET;
}
} | repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\sql\notification\JpaNotificationTargetDao.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class PaymentRequestProcessor implements Processor
{
private final ProcessLogger processLogger;
public PaymentRequestProcessor(@NonNull final ProcessLogger processLogger)
{
this.processLogger = processLogger;
}
@Override
public void process(final Exchange exchange) throws Exception
{
final ImportOrdersRouteContext ordersRouteContext = ProcessorHelper
.getPropertyOrThrowError(exchange, ROUTE_PROPERTY_IMPORT_ORDERS_CONTEXT, ImportOrdersRouteContext.class);
final JsonOrderPaymentCreateRequest orderPaymentCreateRequest = buildOrderPaymentCreateRequest(ordersRouteContext)
.orElse(null);
exchange.getIn().setBody(orderPaymentCreateRequest);
}
@NonNull
private Optional<JsonOrderPaymentCreateRequest> buildOrderPaymentCreateRequest(@NonNull final ImportOrdersRouteContext context)
{
final JsonPaymentMethod paymentMethod = context.getCompositeOrderNotNull().getJsonPaymentMethod();
final JsonOrderTransaction orderTransaction = context.getCompositeOrderNotNull().getOrderTransaction();
final JsonOrder order = context.getOrderNotNull().getJsonOrder();
final boolean isPaypalType = PaymentMethodType.PAY_PAL_PAYMENT_HANDLER.getValue().equals(paymentMethod.getShortName());
final boolean isPaid = TechnicalNameEnum.PAID.getValue().equals(orderTransaction.getStateMachine().getTechnicalName());
if (!(isPaypalType && isPaid))
{
processLogger.logMessage("Order " + order.getOrderNumber() + " (ID=" + order.getId() + "): Not sending current payment to metasfresh; it would have to be 'paypal' and 'paid'!"
+ " PaymentId = " + orderTransaction.getId()
+ " paidStatus = " + isPaid
+ " paypalType = " + isPaypalType, JsonMetasfreshId.toValue(context.getPInstanceId())); | return Optional.empty();
}
final String currencyCode = context.getCurrencyInfoProvider().getIsoCodeByCurrencyIdNotNull(order.getCurrencyId());
final String bPartnerIdentifier = context.getBPExternalIdentifier().getIdentifier();
return Optional.of(JsonOrderPaymentCreateRequest.builder()
.orgCode(context.getOrgCode())
.externalPaymentId(orderTransaction.getId())
.bpartnerIdentifier(bPartnerIdentifier)
.amount(orderTransaction.getAmount().getTotalPrice())
.currencyCode(currencyCode)
.orderIdentifier(ExternalIdentifierFormat.formatOldStyleExternalId(order.getId()))
.transactionDate(orderTransaction.getCreatedAt().toLocalDate())
.build());
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-shopware6\src\main\java\de\metas\camel\externalsystems\shopware6\order\processor\PaymentRequestProcessor.java | 2 |
请完成以下Java代码 | public class FetchAndLockRequest {
protected Date requestTime = ClockUtil.getCurrentTime();
protected FetchExternalTasksExtendedDto dto;
protected AsyncResponse asyncResponse;
protected String processEngineName;
protected Authentication authentication;
public Date getRequestTime() {
return requestTime;
}
public FetchAndLockRequest setRequestTime(Date requestTime) {
this.requestTime = requestTime;
return this;
}
public FetchExternalTasksExtendedDto getDto() {
return dto;
}
public FetchAndLockRequest setDto(FetchExternalTasksExtendedDto dto) {
this.dto = dto;
return this;
}
public AsyncResponse getAsyncResponse() {
return asyncResponse;
}
public FetchAndLockRequest setAsyncResponse(AsyncResponse asyncResponse) {
this.asyncResponse = asyncResponse;
return this;
}
public String getProcessEngineName() {
return processEngineName;
} | public FetchAndLockRequest setProcessEngineName(String processEngineName) {
this.processEngineName = processEngineName;
return this;
}
public Authentication getAuthentication() {
return authentication;
}
public FetchAndLockRequest setAuthentication(Authentication authentication) {
this.authentication = authentication;
return this;
}
public long getTimeoutTimestamp() {
FetchExternalTasksExtendedDto dto = getDto();
long requestTime = getRequestTime().getTime();
long asyncResponseTimeout = dto.getAsyncResponseTimeout();
return requestTime + asyncResponseTimeout;
}
@Override
public String toString() {
return "FetchAndLockRequest [requestTime=" + requestTime + ", dto=" + dto + ", asyncResponse=" + asyncResponse + ", processEngineName=" + processEngineName
+ ", authentication=" + authentication + "]";
}
} | repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\impl\FetchAndLockRequest.java | 1 |
请完成以下Java代码 | public void setLineStrokeType (String LineStrokeType)
{
set_Value (COLUMNNAME_LineStrokeType, LineStrokeType);
}
/** Get Line Stroke Type.
@return Type of the Line Stroke
*/
public String getLineStrokeType ()
{
return (String)get_Value(COLUMNNAME_LineStrokeType);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name); | }
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_PrintTableFormat.java | 1 |
请完成以下Java代码 | public static List<String> extractKeyword(String document, int size)
{
return TextRankKeyword.getKeywordList(document, size);
}
/**
* 自动摘要
* 分割目标文档时的默认句子分割符为,,。::“”??!!;;
*
* @param document 目标文档
* @param size 需要的关键句的个数
* @return 关键句列表
*/
public static List<String> extractSummary(String document, int size)
{
return TextRankSentence.getTopSentenceList(document, size);
}
/**
* 自动摘要
* 分割目标文档时的默认句子分割符为,,。::“”??!!;;
*
* @param document 目标文档
* @param max_length 需要摘要的长度
* @return 摘要文本
*/
public static String getSummary(String document, int max_length)
{
// Parameter size in this method refers to the string length of the summary required;
// The actual length of the summary generated may be short than the required length, but never longer;
return TextRankSentence.getSummary(document, max_length);
} | /**
* 自动摘要
*
* @param document 目标文档
* @param size 需要的关键句的个数
* @param sentence_separator 分割目标文档时的句子分割符,正则格式, 如:[。??!!;;]
* @return 关键句列表
*/
public static List<String> extractSummary(String document, int size, String sentence_separator)
{
return TextRankSentence.getTopSentenceList(document, size, sentence_separator);
}
/**
* 自动摘要
*
* @param document 目标文档
* @param max_length 需要摘要的长度
* @param sentence_separator 分割目标文档时的句子分割符,正则格式, 如:[。??!!;;]
* @return 摘要文本
*/
public static String getSummary(String document, int max_length, String sentence_separator)
{
// Parameter size in this method refers to the string length of the summary required;
// The actual length of the summary generated may be short than the required length, but never longer;
return TextRankSentence.getSummary(document, max_length, sentence_separator);
}
} | repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\HanLP.java | 1 |
请完成以下Java代码 | public static ActivatePlanItemDefinitionMapping createActivatePlanItemDefinitionMappingFor(String planItemDefinitionId, String condition) {
return new ActivatePlanItemDefinitionMapping(planItemDefinitionId, condition);
}
public static TerminatePlanItemDefinitionMapping createTerminatePlanItemDefinitionMappingFor(String planItemDefinitionId) {
return new TerminatePlanItemDefinitionMapping(planItemDefinitionId);
}
public static TerminatePlanItemDefinitionMapping createTerminatePlanItemDefinitionMappingFor(String planItemDefinitionId, String condition) {
return new TerminatePlanItemDefinitionMapping(planItemDefinitionId, condition);
}
public static MoveToAvailablePlanItemDefinitionMapping createMoveToAvailablePlanItemDefinitionMappingFor(String planItemDefinitionId) {
return new MoveToAvailablePlanItemDefinitionMapping(planItemDefinitionId);
}
public static MoveToAvailablePlanItemDefinitionMapping createMoveToAvailablePlanItemDefinitionMappingFor(String planItemDefinitionId, String condition) {
return new MoveToAvailablePlanItemDefinitionMapping(planItemDefinitionId, condition);
}
public static MoveToAvailablePlanItemDefinitionMapping createMoveToAvailablePlanItemDefinitionMappingFor(
String planItemDefinitionId, Map<String, Object> withLocalVariables) { | return new MoveToAvailablePlanItemDefinitionMapping(planItemDefinitionId, withLocalVariables);
}
public static WaitingForRepetitionPlanItemDefinitionMapping createWaitingForRepetitionPlanItemDefinitionMappingFor(String planItemDefinitionId) {
return new WaitingForRepetitionPlanItemDefinitionMapping(planItemDefinitionId);
}
public static WaitingForRepetitionPlanItemDefinitionMapping createWaitingForRepetitionPlanItemDefinitionMappingFor(String planItemDefinitionId, String condition) {
return new WaitingForRepetitionPlanItemDefinitionMapping(planItemDefinitionId, condition);
}
public static RemoveWaitingForRepetitionPlanItemDefinitionMapping createRemoveWaitingForRepetitionPlanItemDefinitionMappingFor(String planItemDefinitionId) {
return new RemoveWaitingForRepetitionPlanItemDefinitionMapping(planItemDefinitionId);
}
public static RemoveWaitingForRepetitionPlanItemDefinitionMapping createRemoveWaitingForRepetitionPlanItemDefinitionMappingFor(String planItemDefinitionId, String condition) {
return new RemoveWaitingForRepetitionPlanItemDefinitionMapping(planItemDefinitionId, condition);
}
} | repos\flowable-engine-main\modules\flowable-cmmn-api\src\main\java\org\flowable\cmmn\api\migration\PlanItemDefinitionMappingBuilder.java | 1 |
请完成以下Java代码 | public IQualityInvoiceLineGroup getGroup()
{
return qualityInvoiceLineGroup;
}
/* package */ void setGroup(final IQualityInvoiceLineGroup qualityInvoiceLineGroup)
{
Check.errorIf(this.qualityInvoiceLineGroup != null,
"This instance {} was already added to qualityInvoiceLineGroup {}; can't be added to {}",
this, this.qualityInvoiceLineGroup, qualityInvoiceLineGroup);
this.qualityInvoiceLineGroup = qualityInvoiceLineGroup;
}
@Override
public I_M_Product getM_Product()
{
return product;
}
@Override
public ProductId getProductId()
{
final I_M_Product product = getM_Product();
return product != null ? ProductId.ofRepoId(product.getM_Product_ID()) : null;
}
public void setM_Product(final I_M_Product product)
{
this.product = product;
}
@Override
public String getProductName()
{
return productName;
}
public void setProductName(final String productName)
{
this.productName = productName;
}
@Override
public BigDecimal getPercentage()
{
return percentage;
}
public void setPercentage(final BigDecimal percentage)
{
this.percentage = percentage;
}
@Override
public Quantity getQty()
{
return Quantity.of(qty, uom);
}
public void setQty(@NonNull final Quantity qty)
{
this.qty = qty.toBigDecimal();
this.uom = qty.getUOM();
}
@Override
public IPricingResult getPrice()
{
return pricingResult;
}
public void setPrice(final IPricingResult price)
{ | pricingResult = price;
}
@Override
public boolean isDisplayed()
{
return displayed;
}
public void setDisplayed(final boolean displayed)
{
this.displayed = displayed;
}
@Override
public String getDescription()
{
return description;
}
public void setDescription(final String description)
{
this.description = description;
}
@Override
public IHandlingUnitsInfo getHandlingUnitsInfo()
{
return handlingUnitsInfo;
}
public void setHandlingUnitsInfo(final IHandlingUnitsInfo handlingUnitsInfo)
{
this.handlingUnitsInfo = handlingUnitsInfo;
}
@Override
public I_PP_Order getPP_Order()
{
return ppOrder;
}
public void setPP_Order(I_PP_Order ppOrder)
{
this.ppOrder = ppOrder;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java\de\metas\materialtracking\qualityBasedInvoicing\invoicing\impl\QualityInvoiceLine.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public static class LinkAttachment {
@XmlElement(name = "Name")
protected String name;
@XmlElement(name = "Link", required = true)
protected String link;
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the link property.
*
* @return | * possible object is
* {@link String }
*
*/
public String getLink() {
return link;
}
/**
* Sets the value of the link property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLink(String value) {
this.link = value;
}
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\AttachmentsType.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public void initExecutor() {
wsCallBackExecutor = Executors.newSingleThreadExecutor(ThingsBoardThreadFactory.forName(getExecutorPrefix() + "-service-ws-callback"));
}
@PreDestroy
public void shutdownExecutor() {
if (wsCallBackExecutor != null) {
wsCallBackExecutor.shutdownNow();
}
}
@Override
protected void onTbApplicationEvent(PartitionChangeEvent partitionChangeEvent) {
if (ServiceType.TB_CORE.equals(partitionChangeEvent.getServiceType())) {
currentPartitions.clear();
currentPartitions.addAll(partitionChangeEvent.getCorePartitions());
}
}
protected void forwardToSubscriptionManagerService(TenantId tenantId, EntityId entityId,
Consumer<SubscriptionManagerService> toSubscriptionManagerService,
Supplier<TransportProtos.ToCoreMsg> toCore) {
TopicPartitionInfo tpi = partitionService.resolve(ServiceType.TB_CORE, tenantId, entityId);
if (currentPartitions.contains(tpi)) {
if (subscriptionManagerService.isPresent()) {
toSubscriptionManagerService.accept(subscriptionManagerService.get());
} else {
log.warn("Possible misconfiguration because subscriptionManagerService is null!");
}
} else {
TransportProtos.ToCoreMsg toCoreMsg = toCore.get();
clusterService.pushMsgToCore(tpi, entityId.getId(), toCoreMsg, null);
}
}
protected <T> void addWsCallback(ListenableFuture<T> saveFuture, Consumer<T> callback) {
addCallback(saveFuture, callback, wsCallBackExecutor);
} | protected <T> void addCallback(ListenableFuture<T> saveFuture, Consumer<T> callback, Executor executor) {
Futures.addCallback(saveFuture, new FutureCallback<>() {
@Override
public void onSuccess(@Nullable T result) {
callback.accept(result);
}
@Override
public void onFailure(Throwable t) {}
}, executor);
}
protected static Consumer<Throwable> safeCallback(FutureCallback<Void> callback) {
if (callback != null) {
return callback::onFailure;
} else {
return throwable -> {};
}
}
} | repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\telemetry\AbstractSubscriptionService.java | 2 |
请完成以下Java代码 | private DataEntryDetailsRow toRow(
final boolean processed,
@NonNull final LookupValue uom,
@NonNull final FlatrateDataEntryDetail detail)
{
final ProductASIDescription productASIDescription = ProductASIDescription.ofString(attributeSetInstanceBL.getASIDescriptionById(detail.getAsiId()));
final DocumentId documentId = DataEntryDetailsRowUtil.createDocumentId(detail);
final BPartnerDepartment bPartnerDepartment = detail.getBPartnerDepartment();
final LookupValue department;
if (bPartnerDepartment.isNone())
{
department = null;
}
else
{
department = departmentLookup.findById(bPartnerDepartment.getId());
} | final DataEntryDetailsRow.DataEntryDetailsRowBuilder row = DataEntryDetailsRow.builder()
.processed(processed)
.id(documentId)
.asi(productASIDescription)
.department(department)
.uom(uom);
if (detail.getQuantity() != null)
{
row.qty(detail.getQuantity().toBigDecimal());
}
return row.build();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\contract\flatrate\model\DataEntryDetailsRowsLoader.java | 1 |
请完成以下Java代码 | public IndentingWriter createIndentingWriter(String contentId, Writer out) {
Function<Integer, String> indentingStrategy = this.indentingStrategies.getOrDefault(contentId,
this.defaultIndentingStrategy);
return new IndentingWriter(out, indentingStrategy);
}
/**
* Create an {@link IndentingWriterFactory} with a default indentation strategy of 4
* spaces.
* @return an {@link IndentingWriterFactory} with default settings
*/
public static IndentingWriterFactory withDefaultSettings() {
return create(new SimpleIndentStrategy(" "));
}
/**
* Create a {@link IndentingWriterFactory} with a single indenting strategy.
* @param defaultIndentingStrategy the default indenting strategy to use
* @return an {@link IndentingWriterFactory}
*/
public static IndentingWriterFactory create(Function<Integer, String> defaultIndentingStrategy) {
return new IndentingWriterFactory(new Builder(defaultIndentingStrategy));
}
/**
* Create a {@link IndentingWriterFactory}.
* @param defaultIndentingStrategy the default indenting strategy to use
* @param factory a consumer of the builder to apply further customizations
* @return an {@link IndentingWriterFactory}
*/
public static IndentingWriterFactory create(Function<Integer, String> defaultIndentingStrategy,
Consumer<Builder> factory) {
Builder factoryBuilder = new Builder(defaultIndentingStrategy);
factory.accept(factoryBuilder);
return new IndentingWriterFactory(factoryBuilder);
} | /**
* Settings customizer for {@link IndentingWriterFactory}.
*/
public static final class Builder {
private final Function<Integer, String> defaultIndentingStrategy;
private final Map<String, Function<Integer, String>> indentingStrategies = new HashMap<>();
private Builder(Function<Integer, String> defaultIndentingStrategy) {
this.defaultIndentingStrategy = defaultIndentingStrategy;
}
/**
* Register an indenting strategy for the specified content.
* @param contentId the identifier of the content to configure
* @param indentingStrategy the indent strategy for that particular content
* @return this for method chaining
* @see #createIndentingWriter(String, Writer)
*/
public Builder indentingStrategy(String contentId, Function<Integer, String> indentingStrategy) {
this.indentingStrategies.put(contentId, indentingStrategy);
return this;
}
}
} | repos\initializr-main\initializr-generator\src\main\java\io\spring\initializr\generator\io\IndentingWriterFactory.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public @Nullable String getUrl() {
return this.url;
}
public void setUrl(@Nullable String url) {
this.url = url;
}
public @Nullable Saml2MessageBinding getBinding() {
return this.binding;
}
public void setBinding(@Nullable Saml2MessageBinding binding) {
this.binding = binding;
}
public @Nullable Boolean getSignRequest() {
return this.signRequest;
}
public void setSignRequest(@Nullable Boolean signRequest) {
this.signRequest = signRequest;
}
}
/**
* Verification details for an Identity Provider.
*/
public static class Verification {
/**
* Credentials used for verification of incoming SAML messages.
*/
private List<Credential> credentials = new ArrayList<>();
public List<Credential> getCredentials() {
return this.credentials;
}
public void setCredentials(List<Credential> credentials) {
this.credentials = credentials;
}
public static class Credential {
/**
* Locations of the X.509 certificate used for verification of incoming
* SAML messages.
*/
private @Nullable Resource certificate;
public @Nullable Resource getCertificateLocation() {
return this.certificate;
}
public void setCertificateLocation(@Nullable Resource certificate) {
this.certificate = certificate;
}
}
} | }
/**
* Single logout details.
*/
public static class Singlelogout {
/**
* Location where SAML2 LogoutRequest gets sent to.
*/
private @Nullable String url;
/**
* Location where SAML2 LogoutResponse gets sent to.
*/
private @Nullable String responseUrl;
/**
* Whether to redirect or post logout requests.
*/
private @Nullable Saml2MessageBinding binding;
public @Nullable String getUrl() {
return this.url;
}
public void setUrl(@Nullable String url) {
this.url = url;
}
public @Nullable String getResponseUrl() {
return this.responseUrl;
}
public void setResponseUrl(@Nullable String responseUrl) {
this.responseUrl = responseUrl;
}
public @Nullable Saml2MessageBinding getBinding() {
return this.binding;
}
public void setBinding(@Nullable Saml2MessageBinding binding) {
this.binding = binding;
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-security-saml2\src\main\java\org\springframework\boot\security\saml2\autoconfigure\Saml2RelyingPartyProperties.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public AcknowledgeMode getAcknowledgeMode() {
return this.acknowledgeMode;
}
public void setAcknowledgeMode(AcknowledgeMode acknowledgeMode) {
this.acknowledgeMode = acknowledgeMode;
}
public boolean isTransacted() {
return this.transacted;
}
public void setTransacted(boolean transacted) {
this.transacted = transacted;
}
}
}
public enum DeliveryMode {
/**
* Does not require that the message be logged to stable storage. This is the
* lowest-overhead delivery mode but can lead to lost of message if the broker
* goes down.
*/
NON_PERSISTENT(1),
/*
* Instructs the JMS provider to log the message to stable storage as part of the
* client's send operation. | */
PERSISTENT(2);
private final int value;
DeliveryMode(int value) {
this.value = value;
}
public int getValue() {
return this.value;
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-jms\src\main\java\org\springframework\boot\jms\autoconfigure\JmsProperties.java | 2 |
请完成以下Java代码 | public class Person {
private String lastName;
private String firstName;
private LocalDate dateOfBirth;
public Person() {
}
public Person(String firstName, String lastName, LocalDate dateOfBirth) {
this.firstName = firstName;
this.lastName = lastName;
this.dateOfBirth = dateOfBirth;
}
public LocalDate getDateOfBirth() {
return dateOfBirth;
}
public void setDateOfBirth(LocalDate dateOfBirth) {
this.dateOfBirth = dateOfBirth; | }
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
} | repos\tutorials-master\spring-aop-2\src\main\java\com\baeldung\performancemonitor\Person.java | 1 |
请完成以下Java代码 | private static boolean hasEnumDictAnnotation(MetadataReader reader) {
try {
return reader.getAnnotationMetadata().hasAnnotation(EnumDict.class.getName());
} catch (Exception e) {
return false;
}
}
/**
* 处理单个枚举类
*/
private static void processEnumClass(String classname) {
try {
Class<?> clazz = Class.forName(classname);
EnumDict enumDict = clazz.getAnnotation(EnumDict.class);
if (enumDict != null) {
String key = enumDict.value();
if (oConvertUtils.isNotEmpty(key)) {
Method method = clazz.getDeclaredMethod(METHOD_NAME);
List<DictModel> list = (List<DictModel>) method.invoke(null);
enumDictData.put(key, list);
log.debug("成功加载枚举字典: {} -> {}", key, classname);
}
}
} catch (Exception e) {
log.debug("处理枚举类异常: {} - {}", classname, e.getMessage());
}
}
/**
* 用于后端字典翻译 SysDictServiceImpl#queryManyDictByKeys(java.util.List, java.util.List)
*
* @param dictCodeList 字典编码列表
* @param keys 键值列表
* @return 字典数据映射 | */
public static Map<String, List<DictModel>> queryManyDictByKeys(List<String> dictCodeList, List<String> keys) {
Map<String, List<DictModel>> enumDict = getEnumDictData();
Map<String, List<DictModel>> map = new HashMap<>();
// 使用更高效的查找方式
Set<String> dictCodeSet = new HashSet<>(dictCodeList);
Set<String> keySet = new HashSet<>(keys);
for (String code : enumDict.keySet()) {
if (dictCodeSet.contains(code)) {
List<DictModel> dictItemList = enumDict.get(code);
for (DictModel dm : dictItemList) {
String value = dm.getValue();
if (keySet.contains(value)) {
// 修复bug:获取或创建该dictCode对应的list,而不是每次都创建新的list
List<DictModel> list = map.computeIfAbsent(code, k -> new ArrayList<>());
list.add(new DictModel(value, dm.getText()));
//break;
}
}
}
}
return map;
}
} | repos\JeecgBoot-main\jeecg-boot\jeecg-boot-base-core\src\main\java\org\jeecg\common\system\util\ResourceUtil.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class DatadogProperties extends StepRegistryProperties {
/**
* Datadog API key.
*/
private @Nullable String apiKey;
/**
* Datadog application key. Not strictly required, but improves the Datadog experience
* by sending meter descriptions, types, and base units to Datadog.
*/
private @Nullable String applicationKey;
/**
* Whether to publish descriptions metadata to Datadog. Turn this off to minimize the
* amount of metadata sent.
*/
private boolean descriptions = true;
/**
* Tag that will be mapped to "host" when shipping metrics to Datadog.
*/
private String hostTag = "instance";
/**
* URI to ship metrics to. Set this if you need to publish metrics to a Datadog site
* other than US, or to an internal proxy en-route to Datadog.
*/
private String uri = "https://api.datadoghq.com";
public @Nullable String getApiKey() {
return this.apiKey;
}
public void setApiKey(@Nullable String apiKey) {
this.apiKey = apiKey;
}
public @Nullable String getApplicationKey() {
return this.applicationKey;
}
public void setApplicationKey(@Nullable String applicationKey) {
this.applicationKey = applicationKey;
}
public boolean isDescriptions() {
return this.descriptions; | }
public void setDescriptions(boolean descriptions) {
this.descriptions = descriptions;
}
public String getHostTag() {
return this.hostTag;
}
public void setHostTag(String hostTag) {
this.hostTag = hostTag;
}
public String getUri() {
return this.uri;
}
public void setUri(String uri) {
this.uri = uri;
}
} | repos\spring-boot-4.0.1\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\export\datadog\DatadogProperties.java | 2 |
请完成以下Java代码 | public final boolean isOldValues()
{
return useOldValues;
}
public static final boolean isOldValues(final Object model)
{
return getWrapper(model).isOldValues();
}
public Evaluatee2 asEvaluatee()
{
return new Evaluatee2()
{
@Override
public String get_ValueAsString(final String variableName)
{
if (!has_Variable(variableName))
{
return "";
}
final Object value = POJOWrapper.this.getValuesMap().get(variableName);
return value == null ? "" : value.toString();
}
@Override
public boolean has_Variable(final String variableName)
{
return POJOWrapper.this.hasColumnName(variableName);
}
@Override
public String get_ValueOldAsString(final String variableName)
{
throw new UnsupportedOperationException("not implemented");
}
};
}
public IModelInternalAccessor getModelInternalAccessor()
{ | if (_modelInternalAccessor == null)
{
_modelInternalAccessor = new POJOModelInternalAccessor(this);
}
return _modelInternalAccessor;
}
POJOModelInternalAccessor _modelInternalAccessor = null;
public static IModelInternalAccessor getModelInternalAccessor(final Object model)
{
final POJOWrapper wrapper = getWrapper(model);
if (wrapper == null)
{
return null;
}
return wrapper.getModelInternalAccessor();
}
public boolean isProcessed()
{
return hasColumnName("Processed")
? StringUtils.toBoolean(getValue("Processed", Object.class))
: false;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\wrapper\POJOWrapper.java | 1 |
请完成以下Spring Boot application配置 | management.endpoints.web.exposure.include=*
management.metrics.enable.root=true
management.metrics.enable.jvm=true
management.endpoint.restart.enabled=true
spring.datasource.tomcat.jmx-enabled=false
management.endpoint.shutdown.enabled=true
spring.config.import=file:./additional.properties,optional:file:/Users/home/config/jdbc.properties
#---
spring.profiles.active=@spring.profiles.active@
my.prop=used-always-in-all-profiles
#---
spring.config.activate.on-profile=dev
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.url=jdbc:mysql://localhost:3306/db
#spring.datasource.username=root
#spring.datasource.password=root
#---
spring.config.activate.on-profile=production
#spring.datasource.driver-class-name=org.h2.Driver
# | spring.datasource.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1
#spring.datasource.username=sa
#spring.datasource.password=sa
#---
spring.profiles.group.production=proddb,prodquartz
#---
spring.config.activate.on-profile=proddb
db=url_to_production_db
#---
spring.config.activate.on-profile=prodquartz
quartz=url_to_quartz_scheduler | repos\tutorials-master\spring-boot-modules\spring-boot-environment\src\main\resources\application.properties | 2 |
请在Spring Boot框架中完成以下Java代码 | public class RestVariable extends EngineRestVariable {
public enum RestVariableScope {
LOCAL, GLOBAL
}
private RestVariableScope variableScope;
@ApiModelProperty(example = "global", value = "Scope of the variable.", notes = "If local, the variable is explicitly defined on the resource it’s requested from. When global, the variable is defined on the parent (or any parent in the parent-tree) of the resource it’s requested from. When writing a variable and the scope is omitted, global is assumed.")
@JsonIgnore
public RestVariableScope getVariableScope() {
return variableScope;
}
public void setVariableScope(RestVariableScope variableScope) {
this.variableScope = variableScope;
}
public String getScope() {
String scope = null;
if (variableScope != null) {
scope = variableScope.name().toLowerCase();
}
return scope; | }
public void setScope(String scope) {
setVariableScope(getScopeFromString(scope));
}
public static RestVariableScope getScopeFromString(String scope) {
if (scope != null) {
for (RestVariableScope s : RestVariableScope.values()) {
if (s.name().equalsIgnoreCase(scope)) {
return s;
}
}
throw new FlowableIllegalArgumentException("Invalid variable scope: '" + scope + "'");
} else {
return null;
}
}
} | repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\engine\variable\RestVariable.java | 2 |
请完成以下Java代码 | public Map<DocumentId, DataEntryDetailsRow> getDocumentId2TopLevelRows()
{
return rowsHolder.getDocumentId2TopLevelRows();
}
@Override
public DocumentIdsSelection getDocumentIdsToInvalidate(@NonNull final TableRecordReferenceSet recordRefs)
{
return recordRefs.streamIds(
I_C_Flatrate_DataEntry_Detail.Table_Name,
repoId -> FlatrateDataEntryDetailId.ofRepoId(flatrateDataEntryId, repoId))
.map(DataEntryDetailsRowUtil::createDocumentId)
.filter(rowsHolder.isRelevantForRefreshingByDocumentId())
.collect(DocumentIdsSelection.toDocumentIdsSelection());
}
@Override
public void invalidateAll()
{
invalidate(DocumentIdsSelection.ALL);
}
@Override
public void invalidate(@NonNull final DocumentIdsSelection rowIds)
{
final Function<DocumentId, FlatrateDataEntryDetailId> idMapper = documentId -> FlatrateDataEntryDetailId.ofRepoId(flatrateDataEntryId, documentId.toInt());
final ImmutableSet<FlatrateDataEntryDetailId> dataEntryIds = rowsHolder.getRecordIdsToRefresh(rowIds, idMapper);
final Predicate<FlatrateDataEntryDetail> loadFilter = dataEntry -> dataEntryIds.contains(dataEntry.getId());
final List<DataEntryDetailsRow> newRows = loader.loadMatchingRows(loadFilter) | .stream()
// .map(newRow -> newRow) // we are just replacing the stale rows
.collect(ImmutableList.toImmutableList());
rowsHolder.compute(rows -> rows.replacingRows(rowIds, newRows));
}
private void saveAll()
{
final Map<DocumentId, DataEntryDetailsRow> documentId2TopLevelRows = getDocumentId2TopLevelRows();
final FlatrateDataEntry entry = flatrateDataEntryRepo.getById(flatrateDataEntryId);
for (final FlatrateDataEntryDetail detail : entry.getDetails())
{
final DocumentId documentId = DataEntryDetailsRowUtil.createDocumentId(detail);
final DataEntryDetailsRow row = documentId2TopLevelRows.get(documentId);
if(row.getQty() != null)
{
final Quantity quantity = Quantitys.of(row.getQty(), entry.getUomId());
detail.setQuantity(quantity);
}
else
{
detail.setQuantity(null);
}
}
flatrateDataEntryRepo.save(entry);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\contract\flatrate\model\DataEntryDetailsRowsData.java | 1 |
请完成以下Java代码 | public void parseSendTask(Element sendTaskElement, ScopeImpl scope, ActivityImpl activity) {
}
public void parseMultiInstanceLoopCharacteristics(Element activityElement, Element multiInstanceLoopCharacteristicsElement, ActivityImpl activity) {
}
public void parseIntermediateTimerEventDefinition(Element timerEventDefinition, ActivityImpl timerActivity) {
}
public void parseRootElement(Element rootElement, List<ProcessDefinitionEntity> processDefinitions) {
}
public void parseReceiveTask(Element receiveTaskElement, ScopeImpl scope, ActivityImpl activity) {
}
public void parseIntermediateSignalCatchEventDefinition(Element signalEventDefinition, ActivityImpl signalActivity) {
}
public void parseBoundarySignalEventDefinition(Element signalEventDefinition, boolean interrupting, ActivityImpl signalActivity) {
}
public void parseEventBasedGateway(Element eventBasedGwElement, ScopeImpl scope, ActivityImpl activity) {
}
public void parseTransaction(Element transactionElement, ScopeImpl scope, ActivityImpl activity) {
}
public void parseCompensateEventDefinition(Element compensateEventDefinition, ActivityImpl compensationActivity) {
}
public void parseIntermediateThrowEvent(Element intermediateEventElement, ScopeImpl scope, ActivityImpl activity) {
}
public void parseIntermediateCatchEvent(Element intermediateEventElement, ScopeImpl scope, ActivityImpl activity) {
}
public void parseBoundaryEvent(Element boundaryEventElement, ScopeImpl scopeElement, ActivityImpl nestedActivity) {
} | public void parseIntermediateMessageCatchEventDefinition(Element messageEventDefinition, ActivityImpl nestedActivity) {
}
public void parseBoundaryMessageEventDefinition(Element element, boolean interrupting, ActivityImpl messageActivity) {
}
public void parseBoundaryEscalationEventDefinition(Element escalationEventDefinition, boolean interrupting, ActivityImpl boundaryEventActivity) {
}
public void parseBoundaryConditionalEventDefinition(Element element, boolean interrupting, ActivityImpl conditionalActivity) {
}
public void parseIntermediateConditionalEventDefinition(Element conditionalEventDefinition, ActivityImpl conditionalActivity) {
}
public void parseConditionalStartEventForEventSubprocess(Element element, ActivityImpl conditionalActivity, boolean interrupting) {
}
@Override
public void parseIoMapping(Element extensionElements, ActivityImpl activity, IoMapping inputOutput) {
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\bpmn\parser\AbstractBpmnParseListener.java | 1 |
请完成以下Java代码 | public static void main(String... args) throws Exception {
MongoDbInit.startMongoDb();
DocumentApp app = new DocumentApp();
app.process();
MongoDbInit.stopMongoDb();
}
public void process() {
Map<String, Object> map = new HashMap<>();
map.put("mongodb-server-host-1", "localhost:27017");
try (DocumentCollectionManagerFactory managerFactory = configuration.get(Settings.of(map));
DocumentCollectionManager manager = managerFactory.get(DB_NAME);) {
DocumentEntity documentEntity = DocumentEntity.of(DOCUMENT_COLLECTION);
documentEntity.add(Document.of(KEY_NAME, "100"));
documentEntity.add(Document.of("name", "JNoSQL in Action"));
documentEntity.add(Document.of("pages", 620));
//CREATE
DocumentEntity saved = manager.insert(documentEntity); | //READ
DocumentQuery query = select().from(DOCUMENT_COLLECTION).where(KEY_NAME).eq("100").build();
List<DocumentEntity> entities = manager.select(query);
System.out.println(entities.get(0));
//UPDATE
saved.add(Document.of("author", "baeldung"));
DocumentEntity updated = manager.update(saved);
System.out.println(updated);
//DELETE
DocumentDeleteQuery deleteQuery = delete().from(DOCUMENT_COLLECTION).where(KEY_NAME).eq("100").build();
manager.delete(deleteQuery);
List<DocumentEntity> documentEntityList = manager.select(select().from(DOCUMENT_COLLECTION).build());
System.out.println(documentEntityList);
}
}
} | repos\tutorials-master\persistence-modules\jnosql\jnosql-diana\src\main\java\com\baeldung\jnosql\diana\document\DocumentApp.java | 1 |
请完成以下Java代码 | public static String getSessionAttr(HttpServletRequest request, String key) {
HttpSession session = request.getSession();
if (session == null) {
return null;
}
Object value = session.getAttribute(key);
if (value == null) {
return null;
}
return value.toString();
}
/**
* 获取 session 中的 long 属性
* @param request 请求
* @param key 属性名
* @return 属性值
*/
public static long getLongSessionAttr(HttpServletRequest request, String key) {
String value = getSessionAttr(request, key);
if (value == null) {
return 0;
}
return Long.parseLong(value);
}
/**
* session 中设置属性
* @param request 请求 | * @param key 属性名
*/
public static void setSessionAttr(HttpServletRequest request, String key, Object value) {
HttpSession session = request.getSession();
if (session == null) {
return;
}
session.setAttribute(key, value);
}
/**
* 移除 session 中的属性
* @param request 请求
* @param key 属性名
*/
public static void removeSessionAttr(HttpServletRequest request, String key) {
HttpSession session = request.getSession();
if (session == null) {
return;
}
session.removeAttribute(key);
}
} | repos\kkFileView-master\server\src\main\java\cn\keking\utils\WebUtils.java | 1 |
请完成以下Java代码 | public void divide(final BigDecimal divisor, final int scale, final RoundingMode roundingMode)
{
value = value.divide(divisor, scale, roundingMode);
}
public boolean comparesEqualTo(final BigDecimal val)
{
return value.compareTo(val) == 0;
}
public int signum()
{
return value.signum();
}
public MutableBigDecimal min(final MutableBigDecimal value)
{
if (this.value.compareTo(value.getValue()) <= 0)
{
return this;
} | else
{
return value;
}
}
public MutableBigDecimal max(final MutableBigDecimal value)
{
if (this.value.compareTo(value.getValue()) >= 0)
{
return this;
}
else
{
return value;
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\org\adempiere\util\lang\MutableBigDecimal.java | 1 |
请完成以下Java代码 | public CompletionStage<AsyncResultSet> fetchNextPage() throws IllegalStateException {
return delegate.fetchNextPage();
}
@Override
public boolean wasApplied() {
return delegate.wasApplied();
}
public ListenableFuture<List<Row>> allRows(Executor executor) {
List<Row> allRows = new ArrayList<>();
SettableFuture<List<Row>> resultFuture = SettableFuture.create();
this.processRows(originalStatement, delegate, allRows, resultFuture, executor);
return resultFuture;
}
private void processRows(Statement statement,
AsyncResultSet resultSet,
List<Row> allRows,
SettableFuture<List<Row>> resultFuture,
Executor executor) {
allRows.addAll(loadRows(resultSet));
if (resultSet.hasMorePages()) {
ByteBuffer nextPagingState = resultSet.getExecutionInfo().getPagingState();
Statement<?> nextStatement = statement.setPagingState(nextPagingState);
TbResultSetFuture resultSetFuture = executeAsyncFunction.apply(nextStatement);
Futures.addCallback(resultSetFuture,
new FutureCallback<TbResultSet>() {
@Override
public void onSuccess(@Nullable TbResultSet result) {
processRows(nextStatement, result,
allRows, resultFuture, executor);
}
@Override | public void onFailure(Throwable t) {
resultFuture.setException(t);
}
}, executor != null ? executor : MoreExecutors.directExecutor()
);
} else {
resultFuture.set(allRows);
}
}
List<Row> loadRows(AsyncResultSet resultSet) {
return Lists.newArrayList(resultSet.currentPage());
}
} | repos\thingsboard-master\common\dao-api\src\main\java\org\thingsboard\server\dao\nosql\TbResultSet.java | 1 |
请完成以下Java代码 | public AuthUser getAuthUser(HttpServletRequest request) {
return new AuthUserImpl();
}
static final class AuthUserImpl implements AuthUser {
@Override
public boolean authTarget(String target, PrivilegeType privilegeType) {
// fake implementation, always return true
return true;
}
@Override
public boolean isSuperUser() {
// fake implementation, always return true
return true;
} | @Override
public String getNickName() {
return "FAKE_NICK_NAME";
}
@Override
public String getLoginName() {
return "FAKE_LOGIN_NAME";
}
@Override
public String getId() {
return "FAKE_EMP_ID";
}
}
} | repos\spring-boot-student-master\spring-boot-student-sentinel-dashboard\src\main\java\com\alibaba\csp\sentinel\dashboard\auth\FakeAuthServiceImpl.java | 1 |
请完成以下Java代码 | public abstract class TransportHealthChecker<C extends TransportMonitoringConfig> extends BaseHealthChecker<C, TransportMonitoringTarget> {
@Value("${monitoring.calculated_fields.enabled:true}")
private boolean calculatedFieldsMonitoringEnabled;
public TransportHealthChecker(C config, TransportMonitoringTarget target) {
super(config, target);
}
@Override
protected void initialize() {
entityService.checkEntities(config, target);
}
@Override
protected String createTestPayload(String testValue) {
return JacksonUtil.newObjectNode().set(TEST_TELEMETRY_KEY, new TextNode(testValue)).toString();
} | @Override
protected Object getInfo() {
return new TransportInfo(getTransportType(), target);
}
@Override
protected String getKey() {
return getTransportType().name().toLowerCase() + (target.getQueue().equals("Main") ? "" : target.getQueue()) + "Transport";
}
protected abstract TransportType getTransportType();
@Override
protected boolean isCfMonitoringEnabled() {
return calculatedFieldsMonitoringEnabled;
}
} | repos\thingsboard-master\monitoring\src\main\java\org\thingsboard\monitoring\service\transport\TransportHealthChecker.java | 1 |
请完成以下Java代码 | public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public Long getResourceId() {
return resourceId;
} | public void setResourceId(Long resourceId) {
this.resourceId = resourceId;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", roleId=").append(roleId);
sb.append(", resourceId=").append(resourceId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\UmsRoleResourceRelation.java | 1 |
请完成以下Java代码 | public void setM_AttributeSet_ID (final int M_AttributeSet_ID)
{
if (M_AttributeSet_ID < 0)
set_ValueNoCheck (COLUMNNAME_M_AttributeSet_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_AttributeSet_ID, M_AttributeSet_ID);
}
@Override
public int getM_AttributeSet_ID()
{
return get_ValueAsInt(COLUMNNAME_M_AttributeSet_ID);
}
@Override
public void setM_AttributeUse_ID (final int M_AttributeUse_ID)
{
if (M_AttributeUse_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_AttributeUse_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_AttributeUse_ID, M_AttributeUse_ID);
}
@Override
public int getM_AttributeUse_ID()
{ | return get_ValueAsInt(COLUMNNAME_M_AttributeUse_ID);
}
@Override
public void setSeqNo (final int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, SeqNo);
}
@Override
public int getSeqNo()
{
return get_ValueAsInt(COLUMNNAME_SeqNo);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_AttributeUse.java | 1 |
请完成以下Java代码 | static IEditableView asEditableView(final IView view)
{
if (view instanceof IEditableView)
{
return (IEditableView)view;
}
else
{
throw new AdempiereException("View is not editable")
.setParameter("view", view);
}
}
void patchViewRow(RowEditingContext ctx, List<JSONDocumentChangedEvent> fieldChangeRequests); | default LookupValuesPage getFieldTypeahead(RowEditingContext ctx, String fieldName, String query) {throw new UnsupportedOperationException();}
default LookupValuesList getFieldDropdown(RowEditingContext ctx, String fieldName) {throw new UnsupportedOperationException();}
@Builder
@Getter
@ToString(exclude = "documentsCollection")
class RowEditingContext
{
@NonNull private final ViewId viewId;
@NonNull private final DocumentId rowId;
@NonNull private final DocumentCollection documentsCollection;
@NonNull private final IUserRolePermissions userRolePermissions;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\view\IEditableView.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public Set<String> getScopes() {
return this.scopes;
}
public void setScopes(Set<String> scopes) {
this.scopes = scopes;
}
}
/**
* Token settings of the registered client.
*/
public static class Token {
/**
* Time-to-live for an authorization code.
*/
private Duration authorizationCodeTimeToLive = Duration.ofMinutes(5);
/**
* Time-to-live for an access token.
*/
private Duration accessTokenTimeToLive = Duration.ofMinutes(5);
/**
* Token format for an access token.
*/
private String accessTokenFormat = "self-contained";
/**
* Time-to-live for a device code.
*/
private Duration deviceCodeTimeToLive = Duration.ofMinutes(5);
/**
* Whether refresh tokens are reused or a new refresh token is issued when
* returning the access token response.
*/
private boolean reuseRefreshTokens = true;
/**
* Time-to-live for a refresh token.
*/
private Duration refreshTokenTimeToLive = Duration.ofMinutes(60);
/**
* JWS algorithm for signing the ID Token.
*/
private String idTokenSignatureAlgorithm = "RS256";
public Duration getAuthorizationCodeTimeToLive() {
return this.authorizationCodeTimeToLive;
}
public void setAuthorizationCodeTimeToLive(Duration authorizationCodeTimeToLive) {
this.authorizationCodeTimeToLive = authorizationCodeTimeToLive;
}
public Duration getAccessTokenTimeToLive() {
return this.accessTokenTimeToLive;
}
public void setAccessTokenTimeToLive(Duration accessTokenTimeToLive) {
this.accessTokenTimeToLive = accessTokenTimeToLive;
}
public String getAccessTokenFormat() {
return this.accessTokenFormat; | }
public void setAccessTokenFormat(String accessTokenFormat) {
this.accessTokenFormat = accessTokenFormat;
}
public Duration getDeviceCodeTimeToLive() {
return this.deviceCodeTimeToLive;
}
public void setDeviceCodeTimeToLive(Duration deviceCodeTimeToLive) {
this.deviceCodeTimeToLive = deviceCodeTimeToLive;
}
public boolean isReuseRefreshTokens() {
return this.reuseRefreshTokens;
}
public void setReuseRefreshTokens(boolean reuseRefreshTokens) {
this.reuseRefreshTokens = reuseRefreshTokens;
}
public Duration getRefreshTokenTimeToLive() {
return this.refreshTokenTimeToLive;
}
public void setRefreshTokenTimeToLive(Duration refreshTokenTimeToLive) {
this.refreshTokenTimeToLive = refreshTokenTimeToLive;
}
public String getIdTokenSignatureAlgorithm() {
return this.idTokenSignatureAlgorithm;
}
public void setIdTokenSignatureAlgorithm(String idTokenSignatureAlgorithm) {
this.idTokenSignatureAlgorithm = idTokenSignatureAlgorithm;
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-security-oauth2-authorization-server\src\main\java\org\springframework\boot\security\oauth2\server\authorization\autoconfigure\servlet\OAuth2AuthorizationServerProperties.java | 2 |
请完成以下Java代码 | public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassWord() {
return passWord;
}
public void setPassWord(String passWord) {
this.passWord = passWord;
}
public UserSexEnum getUserSex() {
return userSex; | }
public void setUserSex(UserSexEnum userSex) {
this.userSex = userSex;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
} | repos\spring-boot-leaning-master\1.x\第07课:Spring Boot 集成 MyBatis\spring-boot-mybatis-annotation\src\main\java\com\neo\entity\UserEntity.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public ZuulPostProcessor zuulPostProcessor(@Autowired RouteLocator routeLocator, @Autowired ZuulController zuulController, @Autowired(required = false) ErrorController errorController) {
return new ZuulPostProcessor(routeLocator, zuulController, errorController);
}
private enum LookupHandlerCallbackFilter implements CallbackFilter {
INSTANCE;
@Override
public int accept(Method method) {
if (METHOD.equals(method.getName())) {
return 0;
}
return 1;
}
}
private enum LookupHandlerMethodInterceptor implements MethodInterceptor {
INSTANCE;
@Override
public Object intercept(Object target, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
if (ERROR_PATH.equals(args[0])) {
// by entering this branch we avoid the ZuulHandlerMapping.lookupHandler method to trigger the
// NoSuchMethodError
return null;
}
return methodProxy.invokeSuper(target, args);
}
}
private static final class ZuulPostProcessor implements BeanPostProcessor {
private final RouteLocator routeLocator;
private final ZuulController zuulController;
private final boolean hasErrorController;
ZuulPostProcessor(RouteLocator routeLocator, ZuulController zuulController, ErrorController errorController) {
this.routeLocator = routeLocator; | this.zuulController = zuulController;
this.hasErrorController = (errorController != null);
}
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
if (hasErrorController && (bean instanceof ZuulHandlerMapping)) {
Enhancer enhancer = new Enhancer();
enhancer.setSuperclass(ZuulHandlerMapping.class);
enhancer.setCallbackFilter(LookupHandlerCallbackFilter.INSTANCE); // only for lookupHandler
enhancer.setCallbacks(new Callback[] { LookupHandlerMethodInterceptor.INSTANCE, NoOp.INSTANCE });
Constructor<?> ctor = ZuulHandlerMapping.class.getConstructors()[0];
return enhancer.create(ctor.getParameterTypes(), new Object[] { routeLocator, zuulController });
}
return bean;
}
}
} | repos\tutorials-master\spring-cloud-modules\spring-cloud-zuul\spring-zuul-ui\src\main\java\com\baeldung\spring\cloud\zuul\filter\ZuulConfiguration.java | 2 |
请完成以下Java代码 | private ConnectionConfig createConnectionConfig(HttpClientSettings settings) {
ConnectionConfig.Builder builder = ConnectionConfig.custom();
PropertyMapper map = PropertyMapper.get();
map.from(settings::connectTimeout)
.as(Duration::toMillis)
.to((timeout) -> builder.setConnectTimeout(timeout, TimeUnit.MILLISECONDS));
map.from(settings::readTimeout)
.asInt(Duration::toMillis)
.to((timeout) -> builder.setSocketTimeout(timeout, TimeUnit.MILLISECONDS));
this.connectionConfigCustomizer.accept(builder);
return builder.build();
}
private RequestConfig createDefaultRequestConfig() {
RequestConfig.Builder builder = RequestConfig.custom();
this.defaultRequestConfigCustomizer.accept(builder);
return builder.build();
}
/**
* Factory that can be used to optionally create a {@link TlsSocketStrategy} given an | * {@link SslBundle}.
*
* @since 4.0.0
*/
public interface TlsSocketStrategyFactory {
/**
* Return the {@link TlsSocketStrategy} to use for the given bundle.
* @param sslBundle the SSL bundle or {@code null}
* @return the {@link TlsSocketStrategy} to use or {@code null}
*/
@Nullable TlsSocketStrategy getTlsSocketStrategy(@Nullable SslBundle sslBundle);
}
} | repos\spring-boot-4.0.1\module\spring-boot-http-client\src\main\java\org\springframework\boot\http\client\HttpComponentsHttpClientBuilder.java | 1 |
请完成以下Java代码 | public String getVersion() {
return version;
}
@CamundaQueryParam("version")
public void setVersion(String version) {
this.version = version;
}
@Override
protected boolean isValidSortByValue(String value) {
return VALID_SORT_BY_VALUES.contains(value);
}
@Override
protected SchemaLogQuery createNewQuery(ProcessEngine engine) {
return engine.getManagementService().createSchemaLogQuery();
} | @Override
protected void applyFilters(SchemaLogQuery query) {
if(this.version != null) {
query.version(this.version);
}
}
@Override
protected void applySortBy(SchemaLogQuery query, String sortBy, Map<String, Object> parameters, ProcessEngine engine) {
if(sortBy.equals(SORT_BY_TIMESTAMP_VALUE)) {
query.orderByTimestamp();
}
}
} | repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\SchemaLogQueryDto.java | 1 |
请完成以下Java代码 | public class C_Queue_Processor_Manage extends JavaProcess
{
private static final String PARAM_Action = "Action";
private static final String ACTION_RESTART = "RESTART";
private static final String ACTION_STOP = "STOP";
private static final String ACTION_START = "START";
private int p_C_Queue_Processor_ID = -1;
private String action;
@Override
protected void prepare()
{
final IADTableDAO adTableDAO = Services.get(IADTableDAO.class);
if (getTable_ID() == adTableDAO.retrieveTableId(I_C_Queue_Processor.Table_Name))
{
p_C_Queue_Processor_ID = getRecord_ID();
}
for (final ProcessInfoParameter para : getParametersAsArray())
{
final String name = para.getParameterName();
if (para.getParameter() == null)
{
continue;
}
if (PARAM_Action.equals(name))
{
action = para.getParameter().toString();
}
}
}
@Override
protected String doIt() throws Exception | {
if (p_C_Queue_Processor_ID <= 0)
{
throw new FillMandatoryException(I_C_Queue_Processor.COLUMNNAME_C_Queue_Processor_ID);
}
if (action == null)
{
throw new FillMandatoryException(PARAM_Action);
}
final I_C_Queue_Processor processorDef = InterfaceWrapperHelper.create(getCtx(), p_C_Queue_Processor_ID, I_C_Queue_Processor.class, ITrx.TRXNAME_None);
final IQueueProcessorsExecutor executor = Services.get(IQueueProcessorExecutorService.class).getExecutor();
if (ACTION_START.equals(action))
{
executor.addQueueProcessor(processorDef);
}
else if (ACTION_STOP.equals(action))
{
executor.removeQueueProcessor(p_C_Queue_Processor_ID);
}
else if (ACTION_RESTART.equals(action))
{
executor.removeQueueProcessor(p_C_Queue_Processor_ID);
executor.addQueueProcessor(processorDef);
}
else
{
throw new AdempiereException("@NotSupported@ @Action@: " + action);
}
return "OK";
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java\de\metas\async\process\C_Queue_Processor_Manage.java | 1 |
请完成以下Java代码 | public String toString()
{
return "runnable-wrapper-for[" + command + "]";
}
public void run()
{
try
{
logger.debug("execute - Going to invoke command.run() within delegate thread-pool");
command.run();
logger.debug("execute - Done invoking command.run() within delegate thread-pool");
}
catch (final Throwable t)
{
logger.error("execute - Caught throwable while running command=" + command + "; -> rethrow", t);
throw t;
}
finally
{
semaphore.release();
logger.debug("Released semaphore={}", semaphore);
}
}
};
try | {
delegate.execute(r); // don't expect RejectedExecutionException because delegate has a small queue that can hold runnables after semaphore-release and before they can actually start
}
catch (final RejectedExecutionException e)
{
semaphore.release();
logger.error("execute - Caught RejectedExecutionException while trying to submit task=" + r + " to delegate thread-pool=" + delegate + "; -> released semaphore=" + semaphore + " and rethrow", e);
throw e;
}
}
public boolean hasAvailablePermits()
{
return semaphore.availablePermits() > 0;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\org\adempiere\util\concurrent\BlockingExecutorWrapper.java | 1 |
请完成以下Java代码 | protected boolean shouldPerformPaContextSwitch(DelegateExecution execution) {
if(execution == null) {
return false;
} else {
ProcessApplicationReference targetPa = ProcessApplicationContextUtil.getTargetProcessApplication((ExecutionEntity) execution);
return targetPa != null && !targetPa.equals(Context.getCurrentProcessApplication());
}
}
protected boolean doValidate(Object submittedValue, FormFieldValidatorContext validatorContext) {
FormFieldValidator validator;
if(clazz != null) {
// resolve validator using Fully Qualified Classname
Object validatorObject = ReflectUtil.instantiate(clazz);
if(validatorObject instanceof FormFieldValidator) {
validator = (FormFieldValidator) validatorObject;
} else {
throw new ProcessEngineException("Validator class '"+clazz+"' is not an instance of "+ FormFieldValidator.class.getName());
}
} else {
//resolve validator using expression
Object validatorObject = delegateExpression.getValue(validatorContext.getExecution());
if (validatorObject instanceof FormFieldValidator) {
validator = (FormFieldValidator) validatorObject; | } else {
throw new ProcessEngineException("Validator expression '"+delegateExpression+"' does not resolve to instance of "+ FormFieldValidator.class.getName());
}
}
FormFieldValidatorInvocation invocation = new FormFieldValidatorInvocation(validator, submittedValue, validatorContext);
try {
Context
.getProcessEngineConfiguration()
.getDelegateInterceptor()
.handleInvocation(invocation);
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new ProcessEngineException(e);
}
return invocation.getInvocationResult();
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\form\validator\DelegateFormFieldValidator.java | 1 |
请完成以下Java代码 | public Map<String, Object> getTokenAttributes() {
return this.attributes;
}
@Override
public Builder<?> toBuilder() {
return new Builder<>(this);
}
/**
* A builder preserving the concrete {@link Authentication} type
*
* @since 7.0
*/
public static class Builder<B extends Builder<B>>
extends AbstractOAuth2TokenAuthenticationBuilder<OAuth2AccessToken, B> {
private Map<String, Object> attributes;
protected Builder(BearerTokenAuthentication token) {
super(token);
this.attributes = token.getTokenAttributes();
}
/**
* Use this principal. Must be of type {@link OAuth2AuthenticatedPrincipal}
* @param principal the principal to use
* @return the {@link Builder} for further configurations
*/
@Override
public B principal(@Nullable Object principal) {
Assert.isInstanceOf(OAuth2AuthenticatedPrincipal.class, principal,
"principal must be of type OAuth2AuthenticatedPrincipal");
this.attributes = ((OAuth2AuthenticatedPrincipal) principal).getAttributes();
return super.principal(principal);
}
/** | * A synonym for {@link #token(OAuth2AccessToken)}
* @param token the token to use
* @return the {@link Builder} for further configurations
*/
@Override
public B credentials(@Nullable Object token) {
Assert.isInstanceOf(OAuth2AccessToken.class, token, "token must be of type OAuth2AccessToken");
return token((OAuth2AccessToken) token);
}
/**
* Use this token. Must have a {@link OAuth2AccessToken#getTokenType()} as
* {@link OAuth2AccessToken.TokenType#BEARER}.
* @param token the token to use
* @return the {@link Builder} for further configurations
*/
@Override
public B token(OAuth2AccessToken token) {
Assert.isTrue(token.getTokenType() == OAuth2AccessToken.TokenType.BEARER, "token must be a bearer token");
super.credentials(token);
return super.token(token);
}
/**
* {@inheritDoc}
*/
@Override
public BearerTokenAuthentication build() {
return new BearerTokenAuthentication(this);
}
}
} | repos\spring-security-main\oauth2\oauth2-resource-server\src\main\java\org\springframework\security\oauth2\server\resource\authentication\BearerTokenAuthentication.java | 1 |
请完成以下Java代码 | public void onModelChange(final Object model, final ModelChangeType changeType)
{
if (changeType.isNewOrChange())
{
if (changeType.isAfter())
{
queueService.enqueue(extractRequests(model, ModelToIndexEventType.CREATED_OR_UPDATED, getSourceTables()));
}
}
else if (changeType.isDelete())
{
if (changeType.isBefore())
{
queueService.enqueue(extractRequests(model, ModelToIndexEventType.REMOVED, getSourceTables()));
}
}
}
public static List<ModelToIndexEnqueueRequest> extractRequests(
@NonNull final Object model,
@NonNull final ModelToIndexEventType eventType,
@NonNull final FTSConfigSourceTablesMap sourceTablesMap)
{
final TableName tableName = TableName.ofString(InterfaceWrapperHelper.getModelTableName(model));
final int recordId = InterfaceWrapperHelper.getId(model);
final TableRecordReference recordRef = TableRecordReference.of(tableName.getAsString(), recordId);
final boolean recordIsActive = InterfaceWrapperHelper.isActive(model);
final ImmutableList<FTSConfigSourceTable> sourceTables = sourceTablesMap.getByTableName(tableName);
final ArrayList<ModelToIndexEnqueueRequest> result = new ArrayList<>(sourceTables.size());
for (final FTSConfigSourceTable sourceTable : sourceTables)
{
final TableRecordReference recordRefEffective;
final ModelToIndexEventType eventTypeEffective;
final TableRecordReference parentRecordRef = extractParentRecordRef(model, sourceTable);
if (parentRecordRef != null)
{
recordRefEffective = parentRecordRef;
eventTypeEffective = ModelToIndexEventType.CREATED_OR_UPDATED;
}
else | {
recordRefEffective = recordRef;
if (recordIsActive)
{
eventTypeEffective = eventType;
}
else
{
eventTypeEffective = ModelToIndexEventType.REMOVED;
}
}
result.add(ModelToIndexEnqueueRequest.builder()
.ftsConfigId(sourceTable.getFtsConfigId())
.eventType(eventTypeEffective)
.sourceModelRef(recordRefEffective)
.build());
}
return result;
}
@Nullable
private static TableRecordReference extractParentRecordRef(@NonNull final Object model, @NonNull final FTSConfigSourceTable sourceTable)
{
final TableAndColumnName parentColumnName = sourceTable.getParentColumnName();
if (parentColumnName == null)
{
return null;
}
final int parentId = InterfaceWrapperHelper.getValue(model, parentColumnName.getColumnNameAsString())
.map(NumberUtils::asIntegerOrNull)
.orElse(-1);
if (parentId <= 0)
{
return null;
}
return TableRecordReference.of(parentColumnName.getTableNameAsString(), parentId);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.elasticsearch\src\main\java\de\metas\fulltextsearch\indexer\queue\model_interceptor\EnqueueSourceModelInterceptor.java | 1 |
请完成以下Java代码 | public List<RuleInputClauseContainer> getInputEntries() {
return inputEntries;
}
public void addInputEntry(RuleInputClauseContainer inputEntry) {
this.inputEntries.add(inputEntry);
}
public void setInputEntries(List<RuleInputClauseContainer> inputEntries) {
this.inputEntries = inputEntries;
}
public List<RuleOutputClauseContainer> getOutputEntries() {
return outputEntries;
}
public void addOutputEntry(RuleOutputClauseContainer outputEntry) { | this.outputEntries.add(outputEntry);
}
public void setOutputEntries(List<RuleOutputClauseContainer> outputEntries) {
this.outputEntries = outputEntries;
}
public void setRuleNumber(int ruleNumber) {
this.ruleNumber = ruleNumber;
}
public int getRuleNumber() {
return ruleNumber;
}
} | repos\flowable-engine-main\modules\flowable-dmn-model\src\main\java\org\flowable\dmn\model\DecisionRule.java | 1 |
请完成以下Java代码 | public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getLengthInSeconds() {
return lengthInSeconds;
}
public void setLengthInSeconds(int lengthInSeconds) {
this.lengthInSeconds = lengthInSeconds;
}
public String getCompositor() {
return compositor;
}
public void setCompositor(String compositor) {
this.compositor = compositor;
} | public String getSinger() {
return singer;
}
public void setSinger(String singer) {
this.singer = singer;
}
public LocalDateTime getReleased() {
return released;
}
public void setReleased(LocalDateTime released) {
this.released = released;
}
public String getGenre() {
return genre;
}
public void setGenre(String genre) {
this.genre = genre;
}
} | repos\tutorials-master\persistence-modules\spring-data-jpa-repo\src\main\java\com\baeldung\jpa\domain\Song.java | 1 |
请完成以下Java代码 | private void printPackageLabels(@NonNull final DeliveryOrder deliveryOrder)
{
final int adProcessId = retrievePackageLableAdProcessId();
final ITableRecordReference deliveryOrderTableRecordReference = //
derKurierDeliveryOrderService.toTableRecordReference(deliveryOrder);
final ImmutableList<DeliveryPosition> deliveryPositions = deliveryOrder.getDeliveryPositions();
for (final DeliveryPosition deliveryPosition : deliveryPositions)
{
final DerKurierDeliveryData derKurierDeliveryData = //
DerKurierDeliveryData.ofDeliveryPosition(deliveryPosition);
ProcessInfo.builder()
.setTitle("Label-" + derKurierDeliveryData.getParcelNumber())
.setCtx(Env.getCtx())
.setAD_Process_ID(adProcessId)
.setRecord(deliveryOrderTableRecordReference) // we want the jasper to be archived and attached to the delivery order
.addParameter(
IMassPrintingService.PARAM_PrintCopies,
PrintCopies.ONE.toInt())
.addParameter(
I_DerKurier_DeliveryOrderLine.COLUMNNAME_DerKurier_DeliveryOrderLine_ID,
deliveryOrderTableRecordReference.getRecord_ID())
.setPrintPreview(false)
// Execute report in a new transaction
.buildAndPrepareExecution()
.onErrorThrowException(true)
.executeSync();
Loggables.addLog("Created package label for {}", deliveryOrderTableRecordReference);
}
}
private int retrievePackageLableAdProcessId()
{
final Properties ctx = Env.getCtx();
final int adClientId = Env.getAD_Client_ID(ctx); | final int adOrgId = Env.getAD_Org_ID(ctx);
final String sysconfigKey = DerKurierConstants.SYSCONFIG_DERKURIER_LABEL_PROCESS_ID;
final int adProcessId = Services.get(ISysConfigBL.class).getIntValue(sysconfigKey, -1, adClientId, adOrgId);
Check.errorIf(adProcessId <= 0, "Missing sysconfig value for 'Der Kurier' package label jasper report; name={}; AD_Client_ID={}; AD_Org_ID={}",
sysconfigKey, adClientId, adOrgId);
return adProcessId;
}
/**
* Returns an empty list, because https://leoz.derkurier.de:13000/rs/api/v1/document/label does not yet work,
* so we need to fire up our own jasper report and print them ourselves. This is done in {@link #completeDeliveryOrder(DeliveryOrder)}.
*/
@NonNull
@Override
public List<PackageLabels> getPackageLabelsList(@NonNull final DeliveryOrder deliveryOrder)
{
return ImmutableList.of();
}
@Override
public @NonNull JsonDeliveryAdvisorResponse adviseShipment(final @NonNull JsonDeliveryAdvisorRequest request)
{
return JsonDeliveryAdvisorResponse.builder()
.requestId(request.getId())
.shipperProduct(JsonShipperProduct.builder()
.code(OVERNIGHT.getCode())
.build())
.build();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.derkurier\src\main\java\de\metas\shipper\gateway\derkurier\DerKurierClient.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class POSOrderId implements RepoIdAware
{
int repoId;
private POSOrderId(final int repoId)
{
this.repoId = Check.assumeGreaterThanZero(repoId, "C_POS_Order_ID");
}
@JsonCreator
public static POSOrderId ofRepoId(final int repoId)
{
return new POSOrderId(repoId);
}
@Nullable
public static POSOrderId ofRepoIdOrNull(final int repoId)
{
return repoId > 0 ? new POSOrderId(repoId) : null;
}
public static int toRepoId(@Nullable final OrderId orderId) | {
return orderId != null ? orderId.getRepoId() : -1;
}
@Override
@JsonValue
public int getRepoId()
{
return repoId;
}
public static boolean equals(@Nullable final POSOrderId id1, @Nullable final POSOrderId id2)
{
return Objects.equals(id1, id2);
}
public TableRecordReference toRecordRef() {return TableRecordReference.of(I_C_POS_Order.Table_Name, repoId);}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.pos.base\src\main\java\de\metas\pos\POSOrderId.java | 2 |
请完成以下Java代码 | private void setM_InventoryLine(final I_C_Invoice_Candidate ic, final I_M_InventoryLine inventoryLine)
{
Check.assumeNotNull(ic, "ic not null");
Check.assumeNotNull(inventoryLine, "inventoryLine not null");
TableRecordCacheLocal.setReferencedValue(ic, inventoryLine);
}
@Override
public void invalidateCandidatesFor(final Object model)
{
final IInvoiceCandDAO invoiceCandDAO = Services.get(IInvoiceCandDAO.class);
invoiceCandDAO.invalidateCandsThatReference(TableRecordReference.of(model));
}
@Override
public String getSourceTable()
{
return I_M_InventoryLine.Table_Name;
}
@Override
public boolean isUserInChargeUserEditable()
{
return false;
}
@Override
public void setOrderedData(final I_C_Invoice_Candidate ic)
{
final I_M_InventoryLine inventoryLine = getM_InventoryLine(ic);
final org.compiere.model.I_M_InOutLine originInOutLine = inventoryLine.getM_InOutLine();
Check.assumeNotNull(originInOutLine, "InventoryLine {0} must have an origin inoutline set", inventoryLine);
final I_M_InOut inOut = originInOutLine.getM_InOut();
final I_C_Order order = inOut.getC_Order();
if (inOut.getC_Order_ID() > 0)
{
ic.setC_Order(order); // also set the order; even if the iol does not directly refer to an order line, it is there because of that order
ic.setDateOrdered(order.getDateOrdered());
}
else if (ic.getC_Order_ID() <= 0)
{
// don't attempt to "clear" the order data if it is already set/known.
ic.setC_Order(null); | ic.setDateOrdered(inOut.getMovementDate());
}
final I_M_Inventory inventory = inventoryLine.getM_Inventory();
final DocStatus inventoryDocStatus = DocStatus.ofCode(inventory.getDocStatus());
if (inventoryDocStatus.isCompletedOrClosed())
{
final BigDecimal qtyMultiplier = ONE.negate();
final BigDecimal qtyDelivered = inventoryLine.getQtyInternalUse().multiply(qtyMultiplier);
ic.setQtyEntered(qtyDelivered);
ic.setQtyOrdered(qtyDelivered);
}
else
{
// Corrected, voided etc document. Set qty to zero.
ic.setQtyOrdered(ZERO);
ic.setQtyEntered(ZERO);
}
final IProductBL productBL = Services.get(IProductBL.class);
final UomId stockingUOMId = productBL.getStockUOMId(inventoryLine.getM_Product_ID());
ic.setC_UOM_ID(UomId.toRepoId(stockingUOMId));
}
@Override
public void setDeliveredData(final I_C_Invoice_Candidate ic)
{
final BigDecimal qtyDelivered = ic.getQtyOrdered();
ic.setQtyDelivered(qtyDelivered); // when changing this, make sure to threat ProductType.Service specially
final BigDecimal qtyInUOM = Services.get(IUOMConversionBL.class)
.convertFromProductUOM(
ProductId.ofRepoId(ic.getM_Product_ID()),
UomId.ofRepoId(ic.getC_UOM_ID()),
qtyDelivered);
ic.setQtyDeliveredInUOM(qtyInUOM);
ic.setDeliveryDate(ic.getDateOrdered());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\spi\impl\M_InventoryLine_Handler.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public DataResponse<VariableInstanceResponse> getVariableInstances(@ApiParam(hidden = true) @RequestParam Map<String, String> allRequestParams) {
VariableInstanceQueryRequest query = new VariableInstanceQueryRequest();
// Populate query based on request
if (allRequestParams.get("excludeTaskVariables") != null) {
query.setExcludeTaskVariables(Boolean.valueOf(allRequestParams.get("excludeTaskVariables")));
}
if (allRequestParams.get("taskId") != null) {
query.setTaskId(allRequestParams.get("taskId"));
}
if (allRequestParams.get("planItemInstanceId") != null) {
query.setPlanItemInstanceId(allRequestParams.get("planItemInstanceId"));
}
if (allRequestParams.get("caseInstanceId") != null) { | query.setCaseInstanceId(allRequestParams.get("caseInstanceId"));
}
if (allRequestParams.get("variableName") != null) {
query.setVariableName(allRequestParams.get("variableName"));
}
if (allRequestParams.get("variableNameLike") != null) {
query.setVariableNameLike(allRequestParams.get("variableNameLike"));
}
if (allRequestParams.get("excludeLocalVariables") != null) {
query.setExcludeLocalVariables(Boolean.valueOf(allRequestParams.get("excludeLocalVariables")));
}
return getQueryResponse(query, allRequestParams);
}
} | repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\runtime\variable\VariableInstanceCollectionResource.java | 2 |
请完成以下Java代码 | private static final class OrderLineWarehouseDestProviderContext implements IReceiptScheduleWarehouseDestProvider.IContext
{
public static OrderLineWarehouseDestProviderContext of(final Properties ctx, final org.compiere.model.I_C_OrderLine orderLine)
{
return new OrderLineWarehouseDestProviderContext(ctx, orderLine);
}
private final Properties ctx;
private final org.compiere.model.I_C_OrderLine orderLine;
private OrderLineWarehouseDestProviderContext(final Properties ctx, final org.compiere.model.I_C_OrderLine orderLine)
{
super();
this.ctx = ctx;
this.orderLine = orderLine;
}
@Override
public String toString()
{
return MoreObjects.toStringHelper(this).addValue(orderLine).toString();
}
@Override
public Properties getCtx()
{
return ctx;
}
@Override
public int getAD_Client_ID()
{
return orderLine.getAD_Client_ID();
}
@Override
public int getAD_Org_ID()
{ | return orderLine.getAD_Org_ID();
}
@Override
public int getM_Product_ID()
{
return orderLine.getM_Product_ID();
}
@Override
public int getM_Warehouse_ID()
{
return orderLine.getM_Warehouse_ID();
}
@Override
public I_M_AttributeSetInstance getM_AttributeSetInstance()
{
return orderLine.getM_AttributeSetInstance();
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\inoutcandidate\spi\impl\OrderLineReceiptScheduleProducer.java | 1 |
请完成以下Java代码 | public void ignoreFailureDuePreconditionNotMet(DbOperation ignoredOperation, String preconditionMessage, DbOperation failedOperation) {
logDebug(
"101",
"Ignoring '{}' database operation failure due to an unmet precondition. {}: '{}'",
ignoredOperation.toString(),
preconditionMessage,
failedOperation.toString());
}
public void debugDisabledPessimisticLocks() {
logDebug(
"106", "No exclusive lock is acquired on H2, " +
"as pessimistic locks are disabled on this database.");
}
public void logTaskWithoutExecution(String taskId) {
logDebug("108",
"Execution of external task {} is null. This indicates that the task was concurrently completed or deleted. "
+ "It is not returned by the current fetch and lock command.",
taskId);
}
public ProcessEngineException multipleTenantsForCamundaFormDefinitionKeyException(String camundaFormDefinitionKey) {
return new ProcessEngineException(exceptionMessage(
"109",
"Cannot resolve a unique Camunda Form definition for key '{}' because it exists for multiple tenants.",
camundaFormDefinitionKey
));
}
public void concurrentModificationFailureIgnored(DbOperation operation) {
logDebug(
"110",
"An OptimisticLockingListener attempted to ignore a failure of: {}. "
+ "Since the database aborted the transaction, ignoring the failure "
+ "is not possible and an exception is thrown instead.",
operation
);
} | // exception code 110 is already taken. See requiredCamundaAdminOrPermissionException() for details.
public static List<SQLException> findRelatedSqlExceptions(Throwable exception) {
List<SQLException> sqlExceptionList = new ArrayList<>();
Throwable cause = exception;
do {
if (cause instanceof SQLException) {
SQLException sqlEx = (SQLException) cause;
sqlExceptionList.add(sqlEx);
while (sqlEx.getNextException() != null) {
sqlExceptionList.add(sqlEx.getNextException());
sqlEx = sqlEx.getNextException();
}
}
cause = cause.getCause();
} while (cause != null);
return sqlExceptionList;
}
public static String collectExceptionMessages(Throwable cause) {
StringBuilder message = new StringBuilder(cause.getMessage());
//collect real SQL exception messages in case of batch processing
Throwable exCause = cause;
do {
if (exCause instanceof BatchExecutorException) {
final List<SQLException> relatedSqlExceptions = findRelatedSqlExceptions(exCause);
StringBuilder sb = new StringBuilder();
for (SQLException sqlException : relatedSqlExceptions) {
sb.append(sqlException).append("\n");
}
message.append("\n").append(sb);
}
exCause = exCause.getCause();
} while (exCause != null);
return message.toString();
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\db\EnginePersistenceLogger.java | 1 |
请完成以下Java代码 | public List<Long> getPzn() {
if (pzn == null) {
pzn = new ArrayList<Long>();
}
return this.pzn;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() { | return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.msv3.schema.v1\src\main\java-xjc\de\metas\vertical\pharma\vendor\gateway\msv3\schema\v1\VerfuegbarkeitsanfrageBulkAntwort.java | 1 |
请完成以下Java代码 | public final String getName()
{
return NAME;
} // getName
@Override
public String toString()
{
return getName();
}
@Override
protected ColorUIResource getPrimary1()
{
return LOGO_TEXT_COLOR;
}
@Override
protected ColorUIResource getPrimary3()
{
// used for:
// * standard scrollbar thumb's background color - NOTE: we replace it with our scrollbarUI
// * panel backgrounds
// return new ColorUIResource(247, 255, 238); // very very light green
return getWhite();
}
@Override
protected ColorUIResource getSecondary3()
{
return getPrimary3();
}
protected ColorUIResource getRed()
{
return COLOR_RED;
}
@Override
public ColorUIResource getFocusColor()
{
return LOGO_TEXT_COLOR;
}
/**
* Table header border.
*
* This is a slightly changed version of {@link javax.swing.plaf.metal.MetalBorders.TableHeaderBorder}.
*
* @author tsa
*
*/
public static class TableHeaderBorder extends javax.swing.border.AbstractBorder
{
private static final long serialVersionUID = 1L;
private final Insets editorBorderInsets = new Insets(2, 2, 2, 2);
private final Color borderColor;
public TableHeaderBorder(final Color borderColor)
{ | super();
this.borderColor = borderColor;
}
@Override
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int w, final int h)
{
g.translate(x, y);
g.setColor(borderColor);
g.drawLine(w - 1, 0, w - 1, h - 1); // right line
g.drawLine(1, h - 1, w - 1, h - 1); // bottom line
// g.setColor(MetalLookAndFeel.getControlHighlight());
// g.drawLine(0, 0, w - 2, 0); // top line
// g.drawLine(0, 0, 0, h - 2); // left line
g.translate(-x, -y);
}
@Override
public Insets getBorderInsets(final Component c, final Insets insets)
{
insets.set(editorBorderInsets.top, editorBorderInsets.left, editorBorderInsets.bottom, editorBorderInsets.right);
return insets;
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\plaf\MetasFreshTheme.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void deleteHistoricTaskLogEntry(long logNr) {
getDataManager().deleteHistoricTaskLogEntry(logNr);
}
@Override
public void deleteHistoricTaskLogEntriesForProcessDefinition(String processDefinitionId) {
getDataManager().deleteHistoricTaskLogEntriesByProcessDefinitionId(processDefinitionId);
}
@Override
public void deleteHistoricTaskLogEntriesForScopeDefinition(String scopeType, String scopeDefinitionId) {
getDataManager().deleteHistoricTaskLogEntriesByScopeDefinitionId(scopeType, scopeDefinitionId);
}
@Override
public void deleteHistoricTaskLogEntriesForTaskId(String taskId) {
getDataManager().deleteHistoricTaskLogEntriesByTaskId(taskId);
}
@Override
public void bulkDeleteHistoricTaskLogEntriesForTaskIds(Collection<String> taskIds) {
getDataManager().bulkDeleteHistoricTaskLogEntriesForTaskIds(taskIds);
}
@Override
public void deleteHistoricTaskLogEntriesForNonExistingProcessInstances() {
getDataManager().deleteHistoricTaskLogEntriesForNonExistingProcessInstances();
} | @Override
public void deleteHistoricTaskLogEntriesForNonExistingCaseInstances() {
getDataManager().deleteHistoricTaskLogEntriesForNonExistingCaseInstances();
}
@Override
public void createHistoricTaskLogEntry(HistoricTaskLogEntryBuilder historicTaskLogEntryBuilder) {
HistoricTaskLogEntryEntity historicTaskLogEntryEntity = getDataManager().create();
historicTaskLogEntryEntity.setUserId(historicTaskLogEntryBuilder.getUserId());
historicTaskLogEntryEntity.setTimeStamp(historicTaskLogEntryBuilder.getTimeStamp());
historicTaskLogEntryEntity.setTaskId(historicTaskLogEntryBuilder.getTaskId());
historicTaskLogEntryEntity.setTenantId(historicTaskLogEntryBuilder.getTenantId());
historicTaskLogEntryEntity.setProcessInstanceId(historicTaskLogEntryBuilder.getProcessInstanceId());
historicTaskLogEntryEntity.setProcessDefinitionId(historicTaskLogEntryBuilder.getProcessDefinitionId());
historicTaskLogEntryEntity.setExecutionId(historicTaskLogEntryBuilder.getExecutionId());
historicTaskLogEntryEntity.setScopeId(historicTaskLogEntryBuilder.getScopeId());
historicTaskLogEntryEntity.setScopeDefinitionId(historicTaskLogEntryBuilder.getScopeDefinitionId());
historicTaskLogEntryEntity.setSubScopeId(historicTaskLogEntryBuilder.getSubScopeId());
historicTaskLogEntryEntity.setScopeType(historicTaskLogEntryBuilder.getScopeType());
historicTaskLogEntryEntity.setType(historicTaskLogEntryBuilder.getType());
historicTaskLogEntryEntity.setData(historicTaskLogEntryBuilder.getData());
getDataManager().insert(historicTaskLogEntryEntity);
}
} | repos\flowable-engine-main\modules\flowable-task-service\src\main\java\org\flowable\task\service\impl\persistence\entity\HistoricTaskLogEntryEntityManagerImpl.java | 2 |
请完成以下Java代码 | public boolean isAccountNonExpired() {
return accountNonExpired;
}
public void setAccountNonExpired(boolean accountNonExpired) {
this.accountNonExpired = accountNonExpired;
}
public boolean isAccountNonLocked() {
return accountNonLocked;
}
public void setAccountNonLocked(boolean accountNonLocked) {
this.accountNonLocked = accountNonLocked;
} | public boolean isCredentialsNonExpired() {
return credentialsNonExpired;
}
public void setCredentialsNonExpired(boolean credentialsNonExpired) {
this.credentialsNonExpired = credentialsNonExpired;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
} | repos\SpringAll-master\36.Spring-Security-ValidateCode\src\main\java\cc\mrbird\domain\MyUser.java | 1 |
请完成以下Java代码 | public int getAD_AlertProcessor_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_AlertProcessor_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Alert Processor Log.
@param AD_AlertProcessorLog_ID
Result of the execution of the Alert Processor
*/
public void setAD_AlertProcessorLog_ID (int AD_AlertProcessorLog_ID)
{
if (AD_AlertProcessorLog_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_AlertProcessorLog_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_AlertProcessorLog_ID, Integer.valueOf(AD_AlertProcessorLog_ID));
}
/** Get Alert Processor Log.
@return Result of the execution of the Alert Processor
*/
public int getAD_AlertProcessorLog_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_AlertProcessorLog_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set BinaryData.
@param BinaryData
Binary Data
*/
public void setBinaryData (byte[] BinaryData)
{
set_Value (COLUMNNAME_BinaryData, BinaryData);
}
/** Get BinaryData.
@return Binary Data
*/
public byte[] getBinaryData ()
{
return (byte[])get_Value(COLUMNNAME_BinaryData);
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set Error.
@param IsError
An Error occured in the execution
*/
public void setIsError (boolean IsError)
{
set_Value (COLUMNNAME_IsError, Boolean.valueOf(IsError));
}
/** Get Error.
@return An Error occured in the execution
*/
public boolean isError ()
{
Object oo = get_Value(COLUMNNAME_IsError);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Reference.
@param Reference
Reference for this record
*/
public void setReference (String Reference)
{
set_Value (COLUMNNAME_Reference, Reference);
} | /** Get Reference.
@return Reference for this record
*/
public String getReference ()
{
return (String)get_Value(COLUMNNAME_Reference);
}
/** Set Summary.
@param Summary
Textual summary of this request
*/
public void setSummary (String Summary)
{
set_Value (COLUMNNAME_Summary, Summary);
}
/** Get Summary.
@return Textual summary of this request
*/
public String getSummary ()
{
return (String)get_Value(COLUMNNAME_Summary);
}
/** Set Text Message.
@param TextMsg
Text Message
*/
public void setTextMsg (String TextMsg)
{
set_Value (COLUMNNAME_TextMsg, TextMsg);
}
/** Get Text Message.
@return Text Message
*/
public String getTextMsg ()
{
return (String)get_Value(COLUMNNAME_TextMsg);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_AlertProcessorLog.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class InfinispanCacheConfiguration {
@Bean
public SpringEmbeddedCacheManager cacheManager(CacheManagerCustomizers customizers,
EmbeddedCacheManager embeddedCacheManager) {
SpringEmbeddedCacheManager cacheManager = new SpringEmbeddedCacheManager(embeddedCacheManager);
return customizers.customize(cacheManager);
}
@Bean(destroyMethod = "stop")
@ConditionalOnMissingBean
public EmbeddedCacheManager infinispanCacheManager(CacheProperties cacheProperties,
ObjectProvider<ConfigurationBuilder> defaultConfigurationBuilder) throws IOException {
EmbeddedCacheManager cacheManager = createEmbeddedCacheManager(cacheProperties);
List<String> cacheNames = cacheProperties.getCacheNames();
if (!CollectionUtils.isEmpty(cacheNames)) {
cacheNames.forEach((cacheName) -> cacheManager.defineConfiguration(cacheName,
getDefaultCacheConfiguration(defaultConfigurationBuilder.getIfAvailable())));
}
return cacheManager;
}
private EmbeddedCacheManager createEmbeddedCacheManager(CacheProperties cacheProperties) throws IOException {
Resource location = cacheProperties.resolveConfigLocation(cacheProperties.getInfinispan().getConfig());
if (location != null) {
try (InputStream in = location.getInputStream()) { | return new DefaultCacheManager(in);
}
}
return new DefaultCacheManager();
}
private org.infinispan.configuration.cache.Configuration getDefaultCacheConfiguration(
@Nullable ConfigurationBuilder defaultConfigurationBuilder) {
if (defaultConfigurationBuilder != null) {
return defaultConfigurationBuilder.build();
}
return new ConfigurationBuilder().build();
}
} | repos\spring-boot-4.0.1\module\spring-boot-cache\src\main\java\org\springframework\boot\cache\autoconfigure\InfinispanCacheConfiguration.java | 2 |
请完成以下Java代码 | protected UpdateExternalTaskRetriesBuilder updateRetries(SetRetriesForExternalTasksDto retriesDto) {
ExternalTaskService externalTaskService = getProcessEngine().getExternalTaskService();
List<String> externalTaskIds = retriesDto.getExternalTaskIds();
List<String> processInstanceIds = retriesDto.getProcessInstanceIds();
ExternalTaskQuery externalTaskQuery = null;
ProcessInstanceQuery processInstanceQuery = null;
HistoricProcessInstanceQuery historicProcessInstanceQuery = null;
ExternalTaskQueryDto externalTaskQueryDto = retriesDto.getExternalTaskQuery();
if (externalTaskQueryDto != null) {
externalTaskQuery = externalTaskQueryDto.toQuery(getProcessEngine());
}
ProcessInstanceQueryDto processInstanceQueryDto = retriesDto.getProcessInstanceQuery();
if (processInstanceQueryDto != null) {
processInstanceQuery = processInstanceQueryDto.toQuery(getProcessEngine()); | }
HistoricProcessInstanceQueryDto historicProcessInstanceQueryDto = retriesDto.getHistoricProcessInstanceQuery();
if (historicProcessInstanceQueryDto != null) {
historicProcessInstanceQuery = historicProcessInstanceQueryDto.toQuery(getProcessEngine());
}
return externalTaskService.updateRetries()
.externalTaskIds(externalTaskIds)
.processInstanceIds(processInstanceIds)
.externalTaskQuery(externalTaskQuery)
.processInstanceQuery(processInstanceQuery)
.historicProcessInstanceQuery(historicProcessInstanceQuery);
}
} | repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\impl\ExternalTaskRestServiceImpl.java | 1 |
请完成以下Java代码 | public String getNm() {
return nm;
}
/**
* Sets the value of the nm property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNm(String value) {
this.nm = value;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link PartySEPAChoice } | *
*/
public PartySEPAChoice getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link PartySEPAChoice }
*
*/
public void setId(PartySEPAChoice value) {
this.id = value;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.payment.sepa\schema-pain_008_003_02\src\main\java-xjc\de\metas\payment\sepa\jaxb\sct\pain_008_003_02\PartyIdentificationSEPA1.java | 1 |
请完成以下Java代码 | public static <T> T returnValueThrowOnNull(T value, RuntimeException exception) {
if (value == null) {
throw exception;
}
return value;
}
/**
* Resolves the {@link Object invocation target} for the given {@link Method}.
*
* If the {@link Method} is {@link Modifier#STATIC} then {@literal null} is returned,
* otherwise {@link Object target} will be returned.
*
* @param <T> {@link Class type} of the {@link Object target}. | * @param target {@link Object} on which the {@link Method} will be invoked.
* @param method {@link Method} to invoke on the {@link Object}.
* @return the resolved {@link Object invocation method}.
* @see java.lang.Object
* @see java.lang.reflect.Method
*/
public static <T> T resolveInvocationTarget(T target, Method method) {
return Modifier.isStatic(method.getModifiers()) ? null : target;
}
@FunctionalInterface
public interface ExceptionThrowingOperation<T> {
T run() throws Exception;
}
} | repos\spring-boot-data-geode-main\spring-geode-project\spring-geode\src\main\java\org\springframework\geode\core\util\ObjectUtils.java | 1 |
请完成以下Java代码 | public void setRfQ_SelectedWinners_QtySum (java.math.BigDecimal RfQ_SelectedWinners_QtySum)
{
throw new IllegalArgumentException ("RfQ_SelectedWinners_QtySum is virtual column"); }
/** Get Selected winners Qty.
@return Selected winners Qty */
@Override
public java.math.BigDecimal getRfQ_SelectedWinners_QtySum ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_RfQ_SelectedWinners_QtySum);
if (bd == null)
return BigDecimal.ZERO;
return bd;
}
/** Set Use line quantity.
@param UseLineQty Use line quantity */
@Override
public void setUseLineQty (boolean UseLineQty)
{
set_Value (COLUMNNAME_UseLineQty, Boolean.valueOf(UseLineQty));
} | /** Get Use line quantity.
@return Use line quantity */
@Override
public boolean isUseLineQty ()
{
Object oo = get_Value(COLUMNNAME_UseLineQty);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.rfq\src\main\java-gen\de\metas\rfq\model\X_C_RfQLine.java | 1 |
请完成以下Java代码 | protected List<Group> findGroupsById(String id) {
String searchExpression = ldapConfigurator.getLdapQueryBuilder().buildQueryGroupsById(ldapConfigurator, id);
return executeGroupQuery(searchExpression);
}
protected List<Group> findAllGroups() {
String searchExpression = ldapConfigurator.getQueryAllGroups();
List<Group> groups = executeGroupQuery(searchExpression);
return groups;
}
protected List<Group> executeGroupQuery(final String searchExpression) {
LDAPTemplate ldapTemplate = new LDAPTemplate(ldapConfigurator);
return ldapTemplate.execute(new LDAPCallBack<List<Group>>() {
@Override
public List<Group> executeInContext(InitialDirContext initialDirContext) {
List<Group> groups = new ArrayList<>();
try {
String baseDn = ldapConfigurator.getGroupBaseDn() != null ? ldapConfigurator.getGroupBaseDn() : ldapConfigurator.getBaseDn();
NamingEnumeration<?> namingEnum = initialDirContext.search(baseDn, searchExpression, createSearchControls());
while (namingEnum.hasMore()) { // Should be only one
SearchResult result = (SearchResult) namingEnum.next();
GroupEntity group = new GroupEntityImpl();
if (ldapConfigurator.getGroupIdAttribute() != null) {
group.setId(result.getAttributes().get(ldapConfigurator.getGroupIdAttribute()).get().toString());
}
if (ldapConfigurator.getGroupNameAttribute() != null) {
group.setName(result.getAttributes().get(ldapConfigurator.getGroupNameAttribute()).get().toString()); | }
if (ldapConfigurator.getGroupTypeAttribute() != null) {
group.setType(result.getAttributes().get(ldapConfigurator.getGroupTypeAttribute()).get().toString());
}
groups.add(group);
}
namingEnum.close();
return groups;
} catch (NamingException e) {
throw new FlowableException("Could not find groups " + searchExpression, e);
}
}
});
}
protected SearchControls createSearchControls() {
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE);
searchControls.setTimeLimit(ldapConfigurator.getSearchTimeLimit());
return searchControls;
}
} | repos\flowable-engine-main\modules\flowable-ldap\src\main\java\org\flowable\ldap\impl\LDAPGroupQueryImpl.java | 1 |
请完成以下Java代码 | public static String wechatEncode(String password){
password = password + WECAHT_SALT;
return processEncode(password);
}
public static boolean wehcatValidation(String str, String token){
boolean flag = false;
if(wechatEncode(str).equals(token)){
flag = true;
}
return flag;
}
public static String processEncode(String password) {
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (Exception e) {
throw new RuntimeException(e);
}
char[] charArray = password.toCharArray();
byte[] byteArray = new byte[charArray.length]; | for (int i = 0; i < charArray.length; i++)
byteArray[i] = (byte) charArray[i];
byte[] md5Bytes = md5.digest(byteArray);
StringBuffer hexValue = new StringBuffer();
for (int i = 0; i < md5Bytes.length; i++) {
int val = ((int) md5Bytes[i]) & 0xff;
if (val < 16) {
hexValue.append("0");
}
hexValue.append(Integer.toHexString(val));
}
return hexValue.toString();
}
public static void main(String[] args) {
System.out.println(MD5Util.encode("abel"));
System.out.println(MD5Util.encode("admin"));
}
} | repos\springBoot-master\springboot-springSecurity4\src\main\java\com\yy\example\utils\MD5Util.java | 1 |
请完成以下Java代码 | public List<TenantId> findTenantIdsByTenantProfileId(TenantProfileId tenantProfileId) {
log.trace("Executing findTenantsByTenantProfileId [{}]", tenantProfileId);
return tenantDao.findTenantIdsByTenantProfileId(tenantProfileId);
}
@Override
public Tenant findTenantByName(String name) {
log.trace("Executing findTenantByName [{}]", name);
return tenantDao.findTenantByName(TenantId.SYS_TENANT_ID, name);
}
@Override
public void deleteTenants() {
log.trace("Executing deleteTenants");
tenantsRemover.removeEntities(TenantId.SYS_TENANT_ID, TenantId.SYS_TENANT_ID);
}
@Override
public PageData<TenantId> findTenantsIds(PageLink pageLink) {
log.trace("Executing findTenantsIds");
Validator.validatePageLink(pageLink);
return tenantDao.findTenantsIds(pageLink);
}
@Override
public List<Tenant> findTenantsByIds(TenantId callerId, List<TenantId> tenantIds) {
log.trace("Executing findTenantsByIds, callerId [{}], tenantIds [{}]", callerId, tenantIds);
return tenantDao.findTenantsByIds(callerId.getId(), toUUIDs(tenantIds));
}
@Override
public boolean tenantExists(TenantId tenantId) {
return existsTenantCache.getAndPutInTransaction(tenantId, () -> tenantDao.existsById(tenantId, tenantId.getId()), false);
}
private final PaginatedRemover<TenantId, Tenant> tenantsRemover = new PaginatedRemover<>() { | @Override
protected PageData<Tenant> findEntities(TenantId tenantId, TenantId id, PageLink pageLink) {
return tenantDao.findTenants(tenantId, pageLink);
}
@Override
protected void removeEntity(TenantId tenantId, Tenant entity) {
deleteTenant(TenantId.fromUUID(entity.getUuidId()));
}
};
@Override
public Optional<HasId<?>> findEntity(TenantId tenantId, EntityId entityId) {
return Optional.ofNullable(findTenantById(TenantId.fromUUID(entityId.getId())));
}
@Override
public FluentFuture<Optional<HasId<?>>> findEntityAsync(TenantId tenantId, EntityId entityId) {
return FluentFuture.from(findTenantByIdAsync(tenantId, TenantId.fromUUID(entityId.getId())))
.transform(Optional::ofNullable, directExecutor());
}
@Override
public EntityType getEntityType() {
return EntityType.TENANT;
}
} | repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\tenant\TenantServiceImpl.java | 1 |
请完成以下Java代码 | public class DeviceCacheKey implements VersionedCacheKey {
@Serial
private static final long serialVersionUID = 6366389552842340207L;
private final TenantId tenantId;
private final DeviceId deviceId;
private final String deviceName;
public DeviceCacheKey(DeviceId deviceId) {
this(null, deviceId, null);
}
public DeviceCacheKey(TenantId tenantId, DeviceId deviceId) {
this(tenantId, deviceId, null);
}
public DeviceCacheKey(TenantId tenantId, String deviceName) {
this(tenantId, null, deviceName);
} | @Override
public String toString() {
if (deviceId == null) {
return tenantId + "_n_" + deviceName;
} else if (tenantId == null) {
return deviceId.toString();
} else {
return tenantId + "_" + deviceId;
}
}
@Override
public boolean isVersioned() {
return deviceId != null;
}
} | repos\thingsboard-master\common\cache\src\main\java\org\thingsboard\server\cache\device\DeviceCacheKey.java | 1 |
请完成以下Java代码 | public ObjectNode getElement(String elementId) throws IllegalStateException {
FlowElement flowElement = bpmnModel.getFlowElement(elementId);
if (flowElement == null) {
throw new IllegalStateException("No flow element with id " + elementId + " found in bpmnmodel " + bpmnModel.getMainProcess().getId());
}
PropertiesParser propertiesParser = summaryParsers.get(flowElement.getClass().getSimpleName());
ObjectNode bpmnProperties = getBpmnProperties(elementId, processInfo);
if (propertiesParser != null) {
return propertiesParser.parseElement(flowElement, bpmnProperties, objectMapper);
} else {
// if there is no parser for an element we have to use the default summary parser.
return defaultParser.parseElement(flowElement, bpmnProperties, objectMapper);
}
}
public ObjectNode getSummary() {
ObjectNode summary = objectMapper.createObjectNode();
for (Process process : bpmnModel.getProcesses()) {
for (FlowElement flowElement : process.getFlowElements()) {
summary.set(flowElement.getId(), getElement(flowElement.getId()));
}
} | return summary;
}
protected ObjectNode getBpmnProperties(String elementId, ObjectNode processInfoNode) {
JsonNode bpmnNode = processInfoNode.get(BPMN_NODE);
if (bpmnNode != null) {
JsonNode elementNode = bpmnNode.get(elementId);
if (elementNode == null) {
return objectMapper.createObjectNode();
} else {
return (ObjectNode) elementNode;
}
} else {
return objectMapper.createObjectNode();
}
}
} | repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\dynamic\DynamicProcessDefinitionSummary.java | 1 |
请完成以下Java代码 | public class CaseExecutionVariableCmd implements Command<Void>, Serializable {
private static final long serialVersionUID = 1L;
protected String caseExecutionId;
protected Map<String, Object> variables;
protected Map<String, Object> variablesLocal;
protected Collection<String> variablesDeletions;
protected Collection<String> variablesLocalDeletions;
protected CaseExecutionEntity caseExecution;
public CaseExecutionVariableCmd(String caseExecutionId, Map<String, Object> variables, Map<String, Object> variablesLocal,
Collection<String> variablesDeletions, Collection<String> variablesLocalDeletions) {
this.caseExecutionId = caseExecutionId;
this.variables = variables;
this.variablesLocal = variablesLocal;
this.variablesDeletions = variablesDeletions;
this.variablesLocalDeletions = variablesLocalDeletions;
}
public CaseExecutionVariableCmd(CaseExecutionCommandBuilderImpl builder) {
this(builder.getCaseExecutionId(), builder.getVariables(), builder.getVariablesLocal(),
builder.getVariableDeletions(), builder.getVariableLocalDeletions());
}
public Void execute(CommandContext commandContext) {
ensureNotNull("caseExecutionId", caseExecutionId);
caseExecution = commandContext
.getCaseExecutionManager()
.findCaseExecutionById(caseExecutionId);
ensureNotNull(CaseExecutionNotFoundException.class, "There does not exist any case execution with id: '" + caseExecutionId + "'", "caseExecution", caseExecution);
for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkUpdateCaseInstance(caseExecution);
}
if (variablesDeletions != null && !variablesDeletions.isEmpty()) {
caseExecution.removeVariables(variablesDeletions);
} | if (variablesLocalDeletions != null && !variablesLocalDeletions.isEmpty()) {
caseExecution.removeVariablesLocal(variablesLocalDeletions);
}
if (variables != null && !variables.isEmpty()) {
caseExecution.setVariables(variables);
}
if (variablesLocal != null && !variablesLocal.isEmpty()) {
caseExecution.setVariablesLocal(variablesLocal);
}
return null;
}
public CaseExecutionEntity getCaseExecution() {
return caseExecution;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmmn\cmd\CaseExecutionVariableCmd.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public List<City> findByDescriptionAndScore(@RequestParam(value = "description") String description,
@RequestParam(value = "score") Integer score) {
return cityService.findByDescriptionAndScore(description, score);
}
/**
* OR 语句查询
*
* @param description
* @param score
* @return
*/
@RequestMapping(value = "/api/city/or/find", method = RequestMethod.GET)
public List<City> findByDescriptionOrScore(@RequestParam(value = "description") String description,
@RequestParam(value = "score") Integer score) {
return cityService.findByDescriptionOrScore(description, score);
}
/**
* 查询城市描述
*
* @param description
* @return
*/
@RequestMapping(value = "/api/city/description/find", method = RequestMethod.GET)
public List<City> findByDescription(@RequestParam(value = "description") String description) {
return cityService.findByDescription(description); | }
/**
* NOT 语句查询
*
* @param description
* @return
*/
@RequestMapping(value = "/api/city/description/not/find", method = RequestMethod.GET)
public List<City> findByDescriptionNot(@RequestParam(value = "description") String description) {
return cityService.findByDescriptionNot(description);
}
/**
* LIKE 语句查询
*
* @param description
* @return
*/
@RequestMapping(value = "/api/city/like/find", method = RequestMethod.GET)
public List<City> findByDescriptionLike(@RequestParam(value = "description") String description) {
return cityService.findByDescriptionLike(description);
}
} | repos\springboot-learning-example-master\spring-data-elasticsearch-crud\src\main\java\org\spring\springboot\controller\CityRestController.java | 2 |
请完成以下Java代码 | private void validateSOTrx(
@NonNull final I_C_Flatrate_Term contract,
@NonNull final SOTrx documentSOTrx,
final int documentLineSeqNo)
{
final OrderId initiatingContractOrderId = OrderId.ofRepoIdOrNull(contract.getC_Order_Term_ID());
Check.assumeNotNull(initiatingContractOrderId, "C_Order_Term_ID cannot be null on CallOrder contracts!");
final I_C_Order initiatingContractOrder = orderBL.getById(initiatingContractOrderId);
if (initiatingContractOrder.isSOTrx() == documentSOTrx.toBoolean())
{
return;
} | if (initiatingContractOrder.isSOTrx())
{
throw new AdempiereException(MSG_SALES_CALL_ORDER_CONTRACT_TRX_NOT_MATCH,
contract.getDocumentNo(),
documentLineSeqNo)
.markAsUserValidationError();
}
throw new AdempiereException(MSG_PURCHASE_CALL_ORDER_CONTRACT_TRX_NOT_MATCH,
contract.getDocumentNo(),
documentLineSeqNo)
.markAsUserValidationError();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\callorder\CallOrderContractService.java | 1 |
请在Spring Boot框架中完成以下Java代码 | private static Optional<JsonNode> readDataJsonNode(@NonNull final ResponseEntity<String> response)
{
try
{
final JsonNode rootJsonNode = objectMapper.readValue(response.getBody(), JsonNode.class);
return Optional.ofNullable(rootJsonNode.get(JSON_NODE_DATA));
}
catch (final JsonProcessingException e)
{
throw new RuntimeException(e);
}
}
@Builder
private static class AuthToken
{
@NonNull
private final String clientId;
@NonNull
private final String clientSecret;
@NonNull
private Instant validUntil;
@Nullable
@Getter
private String bearer;
public GetBearerRequest toGetBearerRequest()
{
return GetBearerRequest.builder()
.grantType("client_credentials")
.clientId(clientId)
.clientSecret(clientSecret)
.build();
}
public void updateBearer(@NonNull final String bearer, @NonNull final Instant validUntil)
{ | this.bearer = bearer;
this.validUntil = validUntil;
}
public boolean isExpired()
{
return bearer == null || Instant.now().isAfter(validUntil);
}
@NonNull
public String getBearerNotNull()
{
if (bearer == null)
{
throw new RuntimeException("AuthToken.bearer is null!");
}
return bearer;
}
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-shopware6\src\main\java\de\metas\camel\externalsystems\shopware6\api\ShopwareClient.java | 2 |
请完成以下Java代码 | public FlatrateTerm getById(@NonNull final FlatrateTermId id)
{
return cache.getOrLoad(id, this::getById0);
}
private FlatrateTerm getById0(@NonNull final FlatrateTermId id)
{
final I_C_Flatrate_Term term = flatrateDAO.getById(id);
final OrgId orgId = OrgId.ofRepoId(term.getAD_Org_ID());
final I_C_Flatrate_Conditions flatrateConditionsRecord = term.getC_Flatrate_Conditions();
final ProductId productId = ProductId.ofRepoId(term.getM_Product_ID());
final I_C_UOM termUom = uomDAO.getById(CoalesceUtil.coalesceSuppliersNotNull(
() -> UomId.ofRepoIdOrNull(term.getC_UOM_ID()),
() -> productBL.getStockUOMId(productId)));
final BPartnerLocationAndCaptureId billPartnerLocationAndCaptureId = ContractLocationHelper.extractBillToLocationId(term);
final DocumentLocation billLocation = ContractLocationHelper.extractBillLocation(term);
final BPartnerLocationAndCaptureId dropshipLPartnerLocationAndCaptureId = ContractLocationHelper.extractDropshipLocationId(term);
return FlatrateTerm.builder()
.id(id) | .orgId(orgId)
.billPartnerLocationAndCaptureId(billPartnerLocationAndCaptureId)
.billLocation(billLocation)
.dropshipPartnerLocationAndCaptureId(dropshipLPartnerLocationAndCaptureId)
.productId(productId)
.flatrateConditionsId(ConditionsId.ofRepoId(term.getC_Flatrate_Conditions_ID()))
.pricingSystemId(PricingSystemId.ofRepoIdOrNull(term.getM_PricingSystem_ID()))
.isSimulation(term.isSimulation())
.status(FlatrateTermStatus.ofNullableCode(term.getContractStatus()))
.userInChargeId(UserId.ofRepoIdOrNull(term.getAD_User_InCharge_ID()))
.startDate(TimeUtil.asInstant(term.getStartDate()))
.endDate(TimeUtil.asInstant(term.getEndDate()))
.masterStartDate(TimeUtil.asInstant(term.getMasterStartDate()))
.masterEndDate(TimeUtil.asInstant(term.getMasterEndDate()))
.plannedQtyPerUnit(Quantity.of(term.getPlannedQtyPerUnit(), termUom))
.deliveryRule(DeliveryRule.ofNullableCode(term.getDeliveryRule()))
.deliveryViaRule(DeliveryViaRule.ofNullableCode(term.getDeliveryViaRule()))
.invoiceRule(InvoiceRule.ofCode(flatrateConditionsRecord.getInvoiceRule()))
.build();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\FlatrateTermRepo.java | 1 |
请完成以下Java代码 | private <S> List<ContentFilter<T>> adapt(List<S> list, Function<S, ContentFilter<T>> mapper) {
return list.stream().map(mapper).toList();
}
@Override
public Layer getLayer() {
return this.layer;
}
@Override
public boolean contains(T item) {
return isIncluded(item) && !isExcluded(item);
}
private boolean isIncluded(T item) {
if (this.includes.isEmpty()) {
return true;
}
for (ContentFilter<T> include : this.includes) {
if (include.matches(item)) {
return true;
}
} | return false;
}
private boolean isExcluded(T item) {
if (this.excludes.isEmpty()) {
return false;
}
for (ContentFilter<T> exclude : this.excludes) {
if (exclude.matches(item)) {
return true;
}
}
return false;
}
} | repos\spring-boot-4.0.1\loader\spring-boot-loader-tools\src\main\java\org\springframework\boot\loader\tools\layer\IncludeExcludeContentSelector.java | 1 |
请完成以下Java代码 | public IProcessPreconditionsContext toPreconditionsContext()
{
return new GridTabAsPreconditionsContext(this);
}
private static final class GridTabAsPreconditionsContext implements IProcessPreconditionsContext
{
private final GridTab gridTab;
private GridTabAsPreconditionsContext(final GridTab gridTab)
{
this.gridTab = gridTab;
}
@Override
public String toString()
{
return MoreObjects.toStringHelper(this).addValue(gridTab).toString();
}
@Override
public AdWindowId getAdWindowId()
{
return gridTab.getAdWindowId();
}
@Override
public AdTabId getAdTabId()
{
return AdTabId.ofRepoId(gridTab.getAD_Tab_ID());
}
@Override
public String getTableName()
{
return gridTab.getTableName();
}
@Override
public <T> T getSelectedModel(final Class<T> modelClass)
{
return gridTab.getModel(modelClass);
}
@Override
public <T> List<T> getSelectedModels(final Class<T> modelClass)
{
// backward compatibility
return streamSelectedModels(modelClass) | .collect(ImmutableList.toImmutableList());
}
@NonNull
@Override
public <T> Stream<T> streamSelectedModels(@NonNull final Class<T> modelClass)
{
return Stream.of(getSelectedModel(modelClass));
}
@Override
public int getSingleSelectedRecordId()
{
return gridTab.getRecord_ID();
}
@Override
public SelectionSize getSelectionSize()
{
// backward compatibility
return SelectionSize.ofSize(1);
}
@Override
public <T> IQueryFilter<T> getQueryFilter(@NonNull Class<T> recordClass)
{
return gridTab.createCurrentRecordsQueryFilter(recordClass);
}
}
} // GridTab | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\GridTab.java | 1 |
请完成以下Java代码 | private NameResolver of(final String targetAuthority, int defaultPort) {
requireNonNull(targetAuthority, "targetAuthority");
// Determine target ips
final String[] hosts = PATTERN_COMMA.split(targetAuthority);
final List<EquivalentAddressGroup> targets = new ArrayList<>(hosts.length);
for (final String host : hosts) {
final URI uri = URI.create("//" + host);
int port = uri.getPort();
if (port == -1) {
port = defaultPort;
}
targets.add(new EquivalentAddressGroup(new InetSocketAddress(uri.getHost(), port)));
}
if (targets.isEmpty()) {
throw new IllegalArgumentException("Must have at least one target, but was: " + targetAuthority);
}
return new StaticNameResolver(targetAuthority, targets);
}
@Override
public String getDefaultScheme() {
return STATIC_SCHEME;
} | @Override
protected boolean isAvailable() {
return true;
}
@Override
protected int priority() {
return 4; // Less important than DNS
}
@Override
public String toString() {
return "StaticNameResolverProvider [scheme=" + getDefaultScheme() + "]";
}
} | repos\grpc-spring-master\grpc-client-spring-boot-starter\src\main\java\net\devh\boot\grpc\client\nameresolver\StaticNameResolverProvider.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public SqlSessionFactory sqlSessionFactory() throws Exception {
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
// 设置 orders 数据源
bean.setDataSource(this.dataSource());
// 设置 entity 所在包
bean.setTypeAliasesPackage("cn.iocoder.springboot.lab17.dynamicdatasource.dataobject");
// 设置 config 路径
bean.setConfigLocation(new PathMatchingResourcePatternResolver().getResource("classpath:mybatis-config.xml"));
// 设置 mapper 路径
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/orders/*.xml"));
return bean.getObject();
}
/**
* 创建 MyBatis SqlSessionTemplate | */
@Bean(name = "ordersSqlSessionTemplate")
public SqlSessionTemplate sqlSessionTemplate() throws Exception {
return new SqlSessionTemplate(this.sqlSessionFactory());
}
/**
* 创建 orders 数据源的 TransactionManager 事务管理器
*/
@Bean(name = DBConstants.TX_MANAGER_ORDERS)
public PlatformTransactionManager transactionManager() {
return new DataSourceTransactionManager(this.dataSource());
}
} | repos\SpringBoot-Labs-master\lab-17\lab-17-dynamic-datasource-mybatis\src\main\java\cn\iocoder\springboot\lab17\dynamicdatasource\config\MyBatisOrdersConfig.java | 2 |
请完成以下Java代码 | public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set Export Processor Type.
@param EXP_Processor_Type_ID Export Processor Type */
public void setEXP_Processor_Type_ID (int EXP_Processor_Type_ID)
{
if (EXP_Processor_Type_ID < 1)
set_ValueNoCheck (COLUMNNAME_EXP_Processor_Type_ID, null);
else
set_ValueNoCheck (COLUMNNAME_EXP_Processor_Type_ID, Integer.valueOf(EXP_Processor_Type_ID));
}
/** Get Export Processor Type.
@return Export Processor Type */
public int getEXP_Processor_Type_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_EXP_Processor_Type_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Comment/Help.
@param Help
Comment or Hint
*/
public void setHelp (String Help)
{
set_Value (COLUMNNAME_Help, Help);
}
/** Get Comment/Help.
@return Comment or Hint
*/
public String getHelp ()
{
return (String)get_Value(COLUMNNAME_Help);
}
/** Set Java Class.
@param JavaClass Java Class */
public void setJavaClass (String JavaClass)
{
set_Value (COLUMNNAME_JavaClass, JavaClass);
}
/** Get Java Class.
@return Java Class */
public String getJavaClass ()
{
return (String)get_Value(COLUMNNAME_JavaClass);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity | */
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Set Search Key.
@param Value
Search key for the record in the format required - must be unique
*/
public void setValue (String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
/** Get Search Key.
@return Search key for the record in the format required - must be unique
*/
public String getValue ()
{
return (String)get_Value(COLUMNNAME_Value);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_EXP_Processor_Type.java | 1 |
请完成以下Java代码 | public boolean update(final T model)
{
boolean updated = false;
for (final IQueryUpdater<T> updater : queryUpdaters)
{
if (updater.update(model))
{
updated = true;
}
}
return updated;
}
@Override
public String getSql(final Properties ctx, final List<Object> params)
{
buildSql(ctx);
params.addAll(sqlParams);
return sql;
}
private void buildSql(final Properties ctx)
{
if (sqlBuilt)
{
return;
}
if (queryUpdaters.isEmpty())
{ | throw new AdempiereException("Cannot build sql update query for an empty " + CompositeQueryUpdater.class);
}
final StringBuilder sql = new StringBuilder();
final List<Object> params = new ArrayList<>();
for (final IQueryUpdater<T> updater : queryUpdaters)
{
final ISqlQueryUpdater<T> sqlUpdater = (ISqlQueryUpdater<T>)updater;
final String sqlChunk = sqlUpdater.getSql(ctx, params);
if (Check.isEmpty(sqlChunk))
{
continue;
}
if (sql.length() > 0)
{
sql.append(", ");
}
sql.append(sqlChunk);
}
this.sql = sql.toString();
this.sqlParams = params;
this.sqlBuilt = true;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\dao\impl\CompositeQueryUpdater.java | 1 |
请完成以下Java代码 | public int toInt()
{
return precision;
}
public BigDecimal roundIfNeeded(@NonNull final BigDecimal amt)
{
if (amt.scale() > precision)
{
return amt.setScale(precision, getRoundingMode());
}
else
{
return amt;
}
} | public BigDecimal round(@NonNull final BigDecimal amt)
{
return amt.setScale(precision, getRoundingMode());
}
public RoundingMode getRoundingMode()
{
return RoundingMode.HALF_UP;
}
public CurrencyPrecision min(final CurrencyPrecision other)
{
return this.precision <= other.precision ? this : other;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\currency\CurrencyPrecision.java | 1 |
请完成以下Java代码 | private BigDecimal allocateQtyPlannedForPeriod(final I_C_Period period)
{
BigDecimal qtySum = null;
for (final DailyFlatrateDataEntry entry : _flatrateDataEntriesByDay.values())
{
final Date day = entry.getDay();
if (!periodBL.isInPeriod(period, day))
{
continue;
}
final BigDecimal qty = entry.allocateQtyPlanned();
if (qtySum == null)
{
qtySum = qty;
}
else
{
qtySum = qtySum.add(qty);
}
}
return qtySum;
}
private void assertDailyFlatrateDataEntriesAreFullyAllocated(final I_C_Flatrate_Term contract)
{
for (final DailyFlatrateDataEntry entry : _flatrateDataEntriesByDay.values())
{
if (!entry.isFullyAllocated())
{
throw new AdempiereException("Daily entry shall be fully allocated: " + entry
+ "\n Contract period: " + contract.getStartDate() + "->" + contract.getEndDate());
}
}
}
private static final class DailyFlatrateDataEntry
{
public static DailyFlatrateDataEntry of(final Date day)
{
return new DailyFlatrateDataEntry(day);
}
private final Date day;
private BigDecimal qtyPlanned = BigDecimal.ZERO;
private BigDecimal qtyPlannedAllocated = BigDecimal.ZERO; | private DailyFlatrateDataEntry(final Date day)
{
super();
Check.assumeNotNull(day, "day not null");
this.day = day;
}
@Override
public String toString()
{
return MoreObjects.toStringHelper(this)
.add("day", day)
.add("qtyPlanned", qtyPlanned)
.add("qtyPlannedAllocated", qtyPlannedAllocated)
.toString();
}
public Date getDay()
{
return day;
}
public void addQtyPlanned(final BigDecimal qtyPlannedToAdd)
{
if (qtyPlannedToAdd == null || qtyPlannedToAdd.signum() == 0)
{
return;
}
qtyPlanned = qtyPlanned.add(qtyPlannedToAdd);
}
public BigDecimal allocateQtyPlanned()
{
final BigDecimal qtyPlannedToAllocate = qtyPlanned.subtract(qtyPlannedAllocated);
qtyPlannedAllocated = qtyPlanned;
return qtyPlannedToAllocate;
}
public boolean isFullyAllocated()
{
return qtyPlannedAllocated.compareTo(qtyPlanned) == 0;
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java\de\metas\procurement\base\PMMContractBuilder.java | 1 |
请完成以下Java代码 | public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
} | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Person person = (Person) o;
return Objects.equals(id, person.id);
}
@Override
public int hashCode() {
return Objects.hash(id);
}
} | repos\tutorials-master\persistence-modules\java-jpa-4\src\main\java\com\baeldung\jpa\emclear\Person.java | 1 |
请完成以下Java代码 | public static JsonOLCandCreateBulkResponse multiStatus(@NonNull final List<JsonOLCand> olCands, @NonNull @Singular final List<JsonErrorItem> errors)
{
return new JsonOLCandCreateBulkResponse(olCands, errors);
}
@NonNull
public static JsonOLCandCreateBulkResponse ok(@NonNull final List<JsonOLCand> olCands)
{
return new JsonOLCandCreateBulkResponse(olCands, null);
}
@NonNull
public static JsonOLCandCreateBulkResponse error(@NonNull final JsonErrorItem error)
{
return new JsonOLCandCreateBulkResponse(null, ImmutableList.of(error));
} | @JsonInclude(JsonInclude.Include.NON_NULL)
@Getter
private final List<JsonOLCand> result;
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@Getter
private final List<JsonErrorItem> errors;
@JsonCreator
private JsonOLCandCreateBulkResponse(
@JsonProperty("result") @Nullable final List<JsonOLCand> olCands,
@JsonProperty("errors") @Nullable @Singular final List<JsonErrorItem> errors)
{
this.result = olCands != null ? ImmutableList.copyOf(olCands) : ImmutableList.of();
this.errors = errors != null ? ImmutableList.copyOf(errors) : ImmutableList.of();
}
} | repos\metasfresh-new_dawn_uat\misc\de-metas-common\de-metas-common-ordercandidates\src\main\java\de\metas\common\ordercandidates\v2\response\JsonOLCandCreateBulkResponse.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void onSuccess(@Nullable Void tmp) {
log.trace("[{}] Success save attributes with target firmware!", deviceId);
}
@Override
public void onFailure(Throwable t) {
log.error("[{}] Failed to save attributes with target firmware!", deviceId, t);
}
})
.build());
}
private void remove(Device device, OtaPackageType otaPackageType) {
remove(device, otaPackageType, OtaPackageUtil.getAttributeKeys(otaPackageType));
}
private void remove(Device device, OtaPackageType otaPackageType, List<String> attributesKeys) {
telemetryService.deleteAttributes(AttributesDeleteRequest.builder()
.tenantId(device.getTenantId())
.entityId(device.getId())
.scope(AttributeScope.SHARED_SCOPE)
.keys(attributesKeys) | .callback(new FutureCallback<>() {
@Override
public void onSuccess(@Nullable Void tmp) {
log.trace("[{}] Success remove target {} attributes!", device.getId(), otaPackageType);
tbClusterService.pushMsgToCore(DeviceAttributesEventNotificationMsg.onDelete(device.getTenantId(), device.getId(), DataConstants.SHARED_SCOPE, attributesKeys), null);
}
@Override
public void onFailure(Throwable t) {
log.error("[{}] Failed to remove target {} attributes!", device.getId(), otaPackageType, t);
}
})
.build());
}
} | repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\ota\DefaultOtaPackageStateService.java | 2 |
请完成以下Java代码 | public String getName()
{
return isScriptEditor() ? "Script" : "Editor";
}
@Override
public String getIcon()
{
return isScriptEditor() ? "Script16" : "Editor16";
}
@Override
public boolean isAvailable()
{
final GridField gridField = getEditor().getField();
if (gridField == null)
{
return false;
}
final int displayType = gridField.getDisplayType();
if (displayType == DisplayType.Text || displayType == DisplayType.URL)
{
if (gridField.getFieldLength() > gridField.getDisplayLength())
{
return true;
}
else
{
return false;
}
}
else if (displayType == DisplayType.TextLong
|| displayType == DisplayType.Memo)
{
return true;
}
else
{
return false;
}
}
@Override
public boolean isRunnable()
{
return true;
}
@Override
public void run()
{
final VEditor editor = getEditor();
final GridField gridField = editor.getField();
final Object value = editor.getValue();
final String text = value == null ? null : value.toString();
final boolean editable = editor.isReadWrite(); | final String textNew = startEditor(gridField, text, editable);
if (editable)
{
gridField.getGridTab().setValue(gridField, textNew);
}
// TODO: i think is handled above
// Data Binding
// try
// {
// fireVetoableChange(m_columnName, m_oldText, getText());
// }
// catch (PropertyVetoException pve)
// {
// }
}
protected String startEditor(final GridField gridField, final String text, final boolean editable)
{
final Properties ctx = Env.getCtx();
final String columnName = gridField.getColumnName();
final String title = Services.get(IMsgBL.class).translate(ctx, columnName);
final int windowNo = gridField.getWindowNo();
final Frame frame = Env.getWindow(windowNo);
final String textNew;
if (gridField.getDisplayType() == DisplayType.TextLong)
{
// Start it
HTMLEditor ed = new HTMLEditor (frame, title, text, editable);
textNew = ed.getHtmlText();
}
else
{
final Container comp = (Container)getEditor();
final int fieldLength = gridField.getFieldLength();
textNew = Editor.startEditor(comp, title, text, editable, fieldLength);
}
return textNew;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\org\compiere\grid\ed\menu\TextEditorContextMenuAction.java | 1 |
请完成以下Java代码 | private static Method findPublicAccessibleMethod(Method method) {
if (method == null || !Modifier.isPublic(method.getModifiers())) {
return null;
}
if (method.isAccessible() || Modifier.isPublic(method.getDeclaringClass().getModifiers())) {
return method;
}
for (Class<?> cls : method.getDeclaringClass().getInterfaces()) {
Method mth = null;
try {
mth = findPublicAccessibleMethod(cls.getMethod(method.getName(), method.getParameterTypes()));
if (mth != null) {
return mth;
}
} catch (NoSuchMethodException ignore) {
// do nothing
}
}
Class<?> cls = method.getDeclaringClass().getSuperclass();
if (cls != null) {
Method mth = null;
try {
mth = findPublicAccessibleMethod(cls.getMethod(method.getName(), method.getParameterTypes()));
if (mth != null) {
return mth; | }
} catch (NoSuchMethodException ignore) {
// do nothing
}
}
return null;
}
protected Method findAccessibleMethod(Method method) {
Method result = findPublicAccessibleMethod(method);
if (result == null && method != null && Modifier.isPublic(method.getModifiers())) {
result = method;
try {
method.setAccessible(true);
} catch (SecurityException e) {
result = null;
}
}
return result;
}
} | repos\Activiti-develop\activiti-core-common\activiti-juel-jakarta\src\main\java\org\activiti\core\el\juel\tree\impl\ast\AstNode.java | 1 |
请完成以下Java代码 | private ImmutableMultimap<String, String> getHeaders(@NonNull final HttpServletRequest request)
{
final ImmutableMultimap.Builder<String, String> requestHeaders = ImmutableMultimap.builder();
final Enumeration<String> allHeaderNames = request.getHeaderNames();
while (allHeaderNames != null && allHeaderNames.hasMoreElements())
{
final String currentHeaderName = allHeaderNames.nextElement();
requestHeaders.putAll(currentHeaderName, Collections.list(request.getHeaders(currentHeaderName)));
}
return requestHeaders.build();
}
@Nullable
private String getRequestBody(@NonNull final CachedBodyHttpServletRequest requestWrapper)
{
try
{
final ObjectMapper objectMapper = JsonObjectMapperHolder.sharedJsonObjectMapper();
if (requestWrapper.getContentLength() <= 0)
{
return null;
}
final Object body = objectMapper.readValue(requestWrapper.getInputStream(), Object.class);
return toJson(body);
}
catch (final IOException e)
{
throw new AdempiereException("Failed to parse request body!", e);
}
} | @Nullable
private String toJson(@Nullable final Object obj)
{
if (obj == null)
{
return null;
}
try
{
return JsonObjectMapperHolder.sharedJsonObjectMapper().writeValueAsString(obj);
}
catch (final JsonProcessingException e)
{
throw new AdempiereException("Failed to parse object!", e);
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.util.web\src\main\java\de\metas\util\web\audit\dto\ApiRequestMapper.java | 1 |
请完成以下Java代码 | public class DefaultAppPluginRegistry<T extends AppPlugin> implements AppPluginRegistry<T> {
/** the interface type of plugins managed by this registry */
protected final Class<T> pluginType;
protected Map<String, T> pluginsMap;
public DefaultAppPluginRegistry(Class<T> pluginType) {
this.pluginType = pluginType;
}
protected void loadPlugins() {
ServiceLoader<T> loader = ServiceLoader.load(pluginType);
Iterator<T> iterator = loader.iterator();
Map<String, T> map = new HashMap<String, T>();
while (iterator.hasNext()) {
T plugin = iterator.next();
map.put(plugin.getId(), plugin);
}
this.pluginsMap = map; | }
@Override
public List<T> getPlugins() {
if (pluginsMap == null) {
loadPlugins();
}
return new ArrayList<T>(pluginsMap.values());
}
@Override
public T getPlugin(String id) {
if (pluginsMap == null) {
loadPlugins();
}
return pluginsMap.get(id);
}
} | repos\camunda-bpm-platform-master\webapps\assembly\src\main\java\org\camunda\bpm\webapp\plugin\impl\DefaultAppPluginRegistry.java | 1 |
请完成以下Java代码 | public void setBuchungsdatum(Date buchungsdatum) {
this.buchungsdatum = buchungsdatum;
}
public Date getValuta() {
return valuta;
}
public void setValuta(Date valuta) {
this.valuta = valuta;
}
public String getBuchungsschluessel() {
return buchungsschluessel;
}
public void setBuchungsschluessel(String buchungsschluessel) {
this.buchungsschluessel = buchungsschluessel;
}
public String getReferenz() {
return referenz;
}
public void setReferenz(String referenz) {
this.referenz = referenz;
}
public String getBankReferenz() {
return bankReferenz;
}
public void setBankReferenz(String bankReferenz) {
this.bankReferenz = bankReferenz;
}
public BigDecimal getUrsprungsbetrag() {
return ursprungsbetrag;
}
public void setUrsprungsbetrag(BigDecimal ursprungsbetrag) {
this.ursprungsbetrag = ursprungsbetrag;
}
public String getUrsprungsbetragWaehrung() {
return ursprungsbetragWaehrung;
}
public void setUrsprungsbetragWaehrung(String ursprungsbetragWaehrung) {
this.ursprungsbetragWaehrung = ursprungsbetragWaehrung;
}
public BigDecimal getGebuehrenbetrag() {
return gebuehrenbetrag;
}
public void setGebuehrenbetrag(BigDecimal gebuehrenbetrag) {
this.gebuehrenbetrag = gebuehrenbetrag;
}
public String getGebuehrenbetragWaehrung() {
return gebuehrenbetragWaehrung;
}
public void setGebuehrenbetragWaehrung(String gebuehrenbetragWaehrung) {
this.gebuehrenbetragWaehrung = gebuehrenbetragWaehrung;
}
public String getMehrzweckfeld() {
return mehrzweckfeld;
}
public void setMehrzweckfeld(String mehrzweckfeld) {
this.mehrzweckfeld = mehrzweckfeld;
}
public BigInteger getGeschaeftsvorfallCode() {
return geschaeftsvorfallCode;
}
public void setGeschaeftsvorfallCode(BigInteger geschaeftsvorfallCode) {
this.geschaeftsvorfallCode = geschaeftsvorfallCode;
}
public String getBuchungstext() {
return buchungstext;
} | public void setBuchungstext(String buchungstext) {
this.buchungstext = buchungstext;
}
public String getPrimanotennummer() {
return primanotennummer;
}
public void setPrimanotennummer(String primanotennummer) {
this.primanotennummer = primanotennummer;
}
public String getVerwendungszweck() {
return verwendungszweck;
}
public void setVerwendungszweck(String verwendungszweck) {
this.verwendungszweck = verwendungszweck;
}
public String getPartnerBlz() {
return partnerBlz;
}
public void setPartnerBlz(String partnerBlz) {
this.partnerBlz = partnerBlz;
}
public String getPartnerKtoNr() {
return partnerKtoNr;
}
public void setPartnerKtoNr(String partnerKtoNr) {
this.partnerKtoNr = partnerKtoNr;
}
public String getPartnerName() {
return partnerName;
}
public void setPartnerName(String partnerName) {
this.partnerName = partnerName;
}
public String getTextschluessel() {
return textschluessel;
}
public void setTextschluessel(String textschluessel) {
this.textschluessel = textschluessel;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.base\src\main\java\de\schaeffer\compiere\mt940\BankstatementLine.java | 1 |
请完成以下Java代码 | protected void initializeOutputParameter(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, CallableElement callableElement) {
ExpressionManager expressionManager = context.getExpressionManager();
List<CamundaOut> outputs = getOutputs(element);
for (CamundaOut output : outputs) {
// create new parameter
CallableElementParameter parameter = new CallableElementParameter();
callableElement.addOutput(parameter);
// all variables
String variables = output.getCamundaVariables();
if ("all".equals(variables)) {
parameter.setAllVariables(true);
continue;
}
// source/sourceExpression
String source = output.getCamundaSource();
if (source == null || source.isEmpty()) {
source = output.getCamundaSourceExpression();
}
ParameterValueProvider sourceValueProvider = createParameterValueProvider(source, expressionManager);
parameter.setSourceValueProvider(sourceValueProvider);
// target
String target = output.getCamundaTarget(); | parameter.setTarget(target);
}
}
protected List<CamundaIn> getInputs(CmmnElement element) {
PlanItemDefinition definition = getDefinition(element);
return queryExtensionElementsByClass(definition, CamundaIn.class);
}
protected List<CamundaOut> getOutputs(CmmnElement element) {
PlanItemDefinition definition = getDefinition(element);
return queryExtensionElementsByClass(definition, CamundaOut.class);
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmmn\handler\ProcessOrCaseTaskItemHandler.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public abstract class HistoricMilestoneInstanceBaseResource {
private static Map<String, QueryProperty> allowedSortProperties = new HashMap<>();
static {
allowedSortProperties.put("milestoneName", MilestoneInstanceQueryProperty.MILESTONE_NAME);
allowedSortProperties.put("timestamp", MilestoneInstanceQueryProperty.MILESTONE_TIMESTAMP);
}
@Autowired
protected CmmnRestResponseFactory restResponseFactory;
@Autowired
protected CmmnHistoryService historyService;
@Autowired(required=false)
protected CmmnRestApiInterceptor restApiInterceptor;
protected DataResponse<HistoricMilestoneInstanceResponse> getQueryResponse(HistoricMilestoneInstanceQueryRequest queryRequest, Map<String, String> allRequestParams) {
HistoricMilestoneInstanceQuery query = historyService.createHistoricMilestoneInstanceQuery();
Optional.ofNullable(queryRequest.getId()).ifPresent(query::milestoneInstanceId); | Optional.ofNullable(queryRequest.getName()).ifPresent(query::milestoneInstanceName);
Optional.ofNullable(queryRequest.getCaseInstanceId()).ifPresent(query::milestoneInstanceCaseInstanceId);
Optional.ofNullable(queryRequest.getCaseDefinitionId()).ifPresent(query::milestoneInstanceCaseInstanceId);
Optional.ofNullable(queryRequest.getReachedBefore()).ifPresent(query::milestoneInstanceReachedBefore);
Optional.ofNullable(queryRequest.getReachedAfter()).ifPresent(query::milestoneInstanceReachedAfter);
if (restApiInterceptor != null) {
restApiInterceptor.accessHistoryMilestoneInfoWithQuery(query, queryRequest);
}
return paginateList(allRequestParams, queryRequest, query, "timestamp", allowedSortProperties,
restResponseFactory::createHistoricMilestoneInstanceResponseList);
}
} | repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\history\milestone\HistoricMilestoneInstanceBaseResource.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public List<ShippingFulfillment> getFulfillments()
{
return fulfillments;
}
public void setFulfillments(List<ShippingFulfillment> fulfillments)
{
this.fulfillments = fulfillments;
}
public ShippingFulfillmentPagedCollection total(Integer total)
{
this.total = total;
return this;
}
/**
* The total number of fulfillments in the specified order. Note: If no fulfillments are found for the order, this field is returned with a value of 0.
*
* @return total
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "The total number of fulfillments in the specified order. Note: If no fulfillments are found for the order, this field is returned with a value of 0.")
public Integer getTotal()
{
return total;
}
public void setTotal(Integer total)
{
this.total = total;
}
public ShippingFulfillmentPagedCollection warnings(List<Error> warnings)
{
this.warnings = warnings;
return this;
}
public ShippingFulfillmentPagedCollection addWarningsItem(Error warningsItem)
{
if (this.warnings == null)
{
this.warnings = new ArrayList<>();
}
this.warnings.add(warningsItem);
return this;
}
/**
* This array is only returned if one or more errors or warnings occur with the call request.
*
* @return warnings
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "This array is only returned if one or more errors or warnings occur with the call request.")
public List<Error> getWarnings()
{
return warnings; | }
public void setWarnings(List<Error> warnings)
{
this.warnings = warnings;
}
@Override
public boolean equals(Object o)
{
if (this == o)
{
return true;
}
if (o == null || getClass() != o.getClass())
{
return false;
}
ShippingFulfillmentPagedCollection shippingFulfillmentPagedCollection = (ShippingFulfillmentPagedCollection)o;
return Objects.equals(this.fulfillments, shippingFulfillmentPagedCollection.fulfillments) &&
Objects.equals(this.total, shippingFulfillmentPagedCollection.total) &&
Objects.equals(this.warnings, shippingFulfillmentPagedCollection.warnings);
}
@Override
public int hashCode()
{
return Objects.hash(fulfillments, total, warnings);
}
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("class ShippingFulfillmentPagedCollection {\n");
sb.append(" fulfillments: ").append(toIndentedString(fulfillments)).append("\n");
sb.append(" total: ").append(toIndentedString(total)).append("\n");
sb.append(" warnings: ").append(toIndentedString(warnings)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o)
{
if (o == null)
{
return "null";
}
return o.toString().replace("\n", "\n ");
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-ebay\ebay-api-client\src\main\java\de\metas\camel\externalsystems\ebay\api\model\ShippingFulfillmentPagedCollection.java | 2 |
请完成以下Java代码 | public class NotificationRequestInfoEntity extends NotificationRequestEntity {
private String templateName;
private JsonNode templateConfig;
public NotificationRequestInfoEntity(NotificationRequestEntity requestEntity, String templateName, Object templateConfig) {
super(requestEntity);
this.templateName = templateName;
this.templateConfig = (JsonNode) templateConfig;
}
@Override
public NotificationRequestInfo toData() {
NotificationRequest request = super.toData();
List<NotificationDeliveryMethod> deliveryMethods;
if (request.getStats() != null) {
Set<NotificationDeliveryMethod> methods = new HashSet<>(request.getStats().getSent().keySet());
methods.addAll(request.getStats().getErrors().keySet());
deliveryMethods = new ArrayList<>(methods); | } else {
NotificationTemplateConfig templateConfig = fromJson(this.templateConfig, NotificationTemplateConfig.class);
if (templateConfig == null && request.getTemplate() != null) {
templateConfig = request.getTemplate().getConfiguration();
}
if (templateConfig != null) {
deliveryMethods = templateConfig.getDeliveryMethodsTemplates().entrySet().stream()
.filter(entry -> entry.getValue().isEnabled())
.map(Map.Entry::getKey).collect(Collectors.toList());
} else {
deliveryMethods = Collections.emptyList();
}
}
return new NotificationRequestInfo(request, templateName, deliveryMethods);
}
} | repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\model\sql\NotificationRequestInfoEntity.java | 1 |
请完成以下Java代码 | public final class DelegatingOAuth2TokenValidator<T extends OAuth2Token> implements OAuth2TokenValidator<T> {
private final Collection<OAuth2TokenValidator<T>> tokenValidators;
/**
* Constructs a {@code DelegatingOAuth2TokenValidator} using the provided validators.
* @param tokenValidators the {@link Collection} of {@link OAuth2TokenValidator}s to
* use
*/
public DelegatingOAuth2TokenValidator(Collection<OAuth2TokenValidator<T>> tokenValidators) {
Assert.notNull(tokenValidators, "tokenValidators cannot be null");
this.tokenValidators = new ArrayList<>(tokenValidators);
}
/**
* Constructs a {@code DelegatingOAuth2TokenValidator} using the provided validators.
* @param tokenValidators the collection of {@link OAuth2TokenValidator}s to use
*/ | @SafeVarargs
public DelegatingOAuth2TokenValidator(OAuth2TokenValidator<T>... tokenValidators) {
this(Arrays.asList(tokenValidators));
}
@Override
public OAuth2TokenValidatorResult validate(T token) {
Collection<OAuth2Error> errors = new ArrayList<>();
for (OAuth2TokenValidator<T> validator : this.tokenValidators) {
errors.addAll(validator.validate(token).getErrors());
}
return OAuth2TokenValidatorResult.failure(errors);
}
} | repos\spring-security-main\oauth2\oauth2-core\src\main\java\org\springframework\security\oauth2\core\DelegatingOAuth2TokenValidator.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void setupHostKeyStorage()
{
Services.registerService(IHttpSessionProvider.class, new SpringHttpSessionProvider());
final IHostKeyBL hostKeyBL = Services.get(IHostKeyBL.class);
// when this method is called, there is not DB connection yet.
// so provide the storage implementation as a supplier when it's actually needed and when (hopefully)
// the system is ready
hostKeyBL.setHostKeyStorage(() -> {
final ISysConfigBL sysConfigBL = Services.get(ISysConfigBL.class);
final IHostKeyStorage hostKeyStorageImpl;
final String hostKeyStorage = sysConfigBL.getValue(PRINTING_WEBUI_HOST_KEY_STORAGE_MODE, "cookies");
if (hostKeyStorage.toLowerCase().startsWith("cookie".toLowerCase()))
{
hostKeyStorageImpl = new HttpCookieHostKeyStorage();
}
else
{
// https://github.com/metasfresh/metasfresh/issues/1274
hostKeyStorageImpl = new SessionRemoteHostStorage();
}
return hostKeyStorageImpl;
});
}
private static final class SpringHttpSessionProvider implements IHttpSessionProvider
{ | @Override
public HttpServletRequest getCurrentRequest()
{
return getRequestAttributes().getRequest();
}
@Override
public HttpServletResponse getCurrentResponse()
{
return getRequestAttributes().getResponse();
}
private ServletRequestAttributes getRequestAttributes()
{
final RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
if (requestAttributes instanceof ServletRequestAttributes)
{
return (ServletRequestAttributes)requestAttributes;
}
else
{
throw new IllegalStateException("Not called in the context of an HTTP request (" + requestAttributes + ")");
}
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\config\HostKeyConfig.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public OmsOrderDetail detail(Long id) {
return orderDao.getDetail(id);
}
@Override
public int updateReceiverInfo(OmsReceiverInfoParam receiverInfoParam) {
OmsOrder order = new OmsOrder();
order.setId(receiverInfoParam.getOrderId());
order.setReceiverName(receiverInfoParam.getReceiverName());
order.setReceiverPhone(receiverInfoParam.getReceiverPhone());
order.setReceiverPostCode(receiverInfoParam.getReceiverPostCode());
order.setReceiverDetailAddress(receiverInfoParam.getReceiverDetailAddress());
order.setReceiverProvince(receiverInfoParam.getReceiverProvince());
order.setReceiverCity(receiverInfoParam.getReceiverCity());
order.setReceiverRegion(receiverInfoParam.getReceiverRegion());
order.setModifyTime(new Date());
int count = orderMapper.updateByPrimaryKeySelective(order);
//插入操作记录
OmsOrderOperateHistory history = new OmsOrderOperateHistory();
history.setOrderId(receiverInfoParam.getOrderId());
history.setCreateTime(new Date());
history.setOperateMan("后台管理员");
history.setOrderStatus(receiverInfoParam.getStatus());
history.setNote("修改收货人信息");
orderOperateHistoryMapper.insert(history);
return count;
}
@Override
public int updateMoneyInfo(OmsMoneyInfoParam moneyInfoParam) {
OmsOrder order = new OmsOrder();
order.setId(moneyInfoParam.getOrderId());
order.setFreightAmount(moneyInfoParam.getFreightAmount());
order.setDiscountAmount(moneyInfoParam.getDiscountAmount());
order.setModifyTime(new Date()); | int count = orderMapper.updateByPrimaryKeySelective(order);
//插入操作记录
OmsOrderOperateHistory history = new OmsOrderOperateHistory();
history.setOrderId(moneyInfoParam.getOrderId());
history.setCreateTime(new Date());
history.setOperateMan("后台管理员");
history.setOrderStatus(moneyInfoParam.getStatus());
history.setNote("修改费用信息");
orderOperateHistoryMapper.insert(history);
return count;
}
@Override
public int updateNote(Long id, String note, Integer status) {
OmsOrder order = new OmsOrder();
order.setId(id);
order.setNote(note);
order.setModifyTime(new Date());
int count = orderMapper.updateByPrimaryKeySelective(order);
OmsOrderOperateHistory history = new OmsOrderOperateHistory();
history.setOrderId(id);
history.setCreateTime(new Date());
history.setOperateMan("后台管理员");
history.setOrderStatus(status);
history.setNote("修改备注信息:"+note);
orderOperateHistoryMapper.insert(history);
return count;
}
} | repos\mall-master\mall-admin\src\main\java\com\macro\mall\service\impl\OmsOrderServiceImpl.java | 2 |
请完成以下Java代码 | public Timestamp getDateTo ()
{
return (Timestamp)get_Value(COLUMNNAME_DateTo);
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
public I_S_Resource getS_Resource() throws RuntimeException
{
return (I_S_Resource)MTable.get(getCtx(), I_S_Resource.Table_Name)
.getPO(getS_Resource_ID(), get_TrxName()); }
/** Set Resource.
@param S_Resource_ID
Resource
*/
public void setS_Resource_ID (int S_Resource_ID)
{
if (S_Resource_ID < 1)
set_ValueNoCheck (COLUMNNAME_S_Resource_ID, null);
else
set_ValueNoCheck (COLUMNNAME_S_Resource_ID, Integer.valueOf(S_Resource_ID));
}
/** Get Resource.
@return Resource
*/
public int getS_Resource_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_S_Resource_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Get Record ID/ColumnName | @return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), String.valueOf(getS_Resource_ID()));
}
/** Set Resource Unavailability.
@param S_ResourceUnAvailable_ID Resource Unavailability */
public void setS_ResourceUnAvailable_ID (int S_ResourceUnAvailable_ID)
{
if (S_ResourceUnAvailable_ID < 1)
set_ValueNoCheck (COLUMNNAME_S_ResourceUnAvailable_ID, null);
else
set_ValueNoCheck (COLUMNNAME_S_ResourceUnAvailable_ID, Integer.valueOf(S_ResourceUnAvailable_ID));
}
/** Get Resource Unavailability.
@return Resource Unavailability */
public int getS_ResourceUnAvailable_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_S_ResourceUnAvailable_ID);
if (ii == null)
return 0;
return ii.intValue();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_S_ResourceUnAvailable.java | 1 |
请完成以下Java代码 | public I_A_RegistrationAttribute getA_RegistrationAttribute() throws RuntimeException
{
return (I_A_RegistrationAttribute)MTable.get(getCtx(), I_A_RegistrationAttribute.Table_Name)
.getPO(getA_RegistrationAttribute_ID(), get_TrxName()); }
/** Set Registration Attribute.
@param A_RegistrationAttribute_ID
Asset Registration Attribute
*/
public void setA_RegistrationAttribute_ID (int A_RegistrationAttribute_ID)
{
if (A_RegistrationAttribute_ID < 1)
set_ValueNoCheck (COLUMNNAME_A_RegistrationAttribute_ID, null);
else
set_ValueNoCheck (COLUMNNAME_A_RegistrationAttribute_ID, Integer.valueOf(A_RegistrationAttribute_ID));
}
/** Get Registration Attribute.
@return Asset Registration Attribute
*/
public int getA_RegistrationAttribute_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_A_RegistrationAttribute_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
} | public I_M_Product getM_Product() throws RuntimeException
{
return (I_M_Product)MTable.get(getCtx(), I_M_Product.Table_Name)
.getPO(getM_Product_ID(), get_TrxName()); }
/** Set Product.
@param M_Product_ID
Product, Service, Item
*/
public void setM_Product_ID (int M_Product_ID)
{
if (M_Product_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Product_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID));
}
/** Get Product.
@return Product, Service, Item
*/
public int getM_Product_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
if (ii == null)
return 0;
return ii.intValue();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_A_RegistrationProduct.java | 1 |
请完成以下Java代码 | public void onBeforeReverse(@NonNull final I_PP_Order order)
{
final PPOrderId ppOrderId = PPOrderId.ofRepoId(order.getPP_Order_ID());
reverseIssueSchedules(ppOrderId);
}
@DocValidate(timings = ModelValidator.TIMING_AFTER_COMPLETE)
public void onAfterComplete(@NonNull final I_PP_Order order)
{
final PPOrderId ppOrderId = PPOrderId.ofRepoId(order.getPP_Order_ID());
final ImmutableList<I_PP_Order_Candidate> candidates = ppOrderCandidateDAO.getByOrderId(ppOrderId);
if (!ppOrderBL.isAtLeastOneCandidateMaturing(candidates))
{
return;
}
if (candidates.size() > 1)
{
throw new AdempiereException("More than one candidate found for maturing !");
} | // dev-note: use WorkPackage, otherwise PP_Cost_Collector is posted before PP_Order and therefore posting is failing
HUMaturingWorkpackageProcessor.prepareWorkpackage()
.ppOrder(order)
.enqueue();
}
private void reverseIssueSchedules(@NonNull final PPOrderId ppOrderId)
{
ppOrderIssueScheduleRepository.deleteNotProcessedByOrderId(ppOrderId);
if (ppOrderIssueScheduleRepository.matchesByOrderId(ppOrderId))
{
throw new AdempiereException("Reversing processed issue schedules is not allowed");
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\pporder\interceptor\PP_Order.java | 1 |
请完成以下Java代码 | public class Data {
@SerializedName("order_id")
@Expose
private Integer orderId;
@SerializedName("state_id")
@Expose
private Integer stateId;
@SerializedName("state_kind")
@Expose
private String stateKind;
@SerializedName("crew_id")
@Expose
private Integer crewId;
@SerializedName("prior_crew_id")
@Expose
private Integer priorCrewId;
@SerializedName("driver_id")
@Expose
private Integer driverId;
@SerializedName("car_id")
@Expose
private Integer carId;
@SerializedName("server_time_offset")
@Expose
private Integer serverTimeOffset;
@SerializedName("start_time")
@Expose
private String startTime;
@SerializedName("source_time")
@Expose
private String sourceTime;
@SerializedName("finish_time")
@Expose
private Object finishTime;
@SerializedName("source")
@Expose
private String source;
@SerializedName("source_lat")
@Expose
private Float sourceLat;
@SerializedName("source_lon")
@Expose
private Float sourceLon;
@SerializedName("destination")
@Expose
private String destination;
@SerializedName("destination_lat")
@Expose
private Float destinationLat;
@SerializedName("destination_lon")
@Expose
private Float destinationLon;
@SerializedName("stops")
@Expose
private List<Object> stops = null;
@SerializedName("customer")
@Expose
private String customer; | @SerializedName("passenger")
@Expose
private String passenger;
@SerializedName("phone")
@Expose
private String phone;
@SerializedName("client_id")
@Expose
private Integer clientId;
@SerializedName("client_employee_id")
@Expose
private Integer clientEmployeeId;
@SerializedName("order_crew_group_id")
@Expose
private Integer orderCrewGroupId;
@SerializedName("tariff_id")
@Expose
private Integer tariffId;
@SerializedName("order_params")
@Expose
private List<Object> orderParams = null;
@SerializedName("creation_way")
@Expose
private String creationWay;
@SerializedName("is_prior")
@Expose
private Boolean isPrior;
@SerializedName("is_really_prior")
@Expose
private Boolean isReallyPrior;
@SerializedName("email")
@Expose
private String email;
@SerializedName("prior_to_current_before_minutes")
@Expose
private Integer priorToCurrentBeforeMinutes;
@SerializedName("flight_number")
@Expose
private String flightNumber;
@SerializedName("car_mark")
@Expose
private String carMark;
@SerializedName("car_model")
@Expose
private String carModel;
@SerializedName("car_color")
@Expose
private String carColor;
@SerializedName("car_number")
@Expose
private String carNumber;
@SerializedName("confirmed")
@Expose
private String confirmed;
} | repos\SpringBoot-Projects-FullStack-master\Part-9.SpringBoot-React-Projects\Project-2.SpringBoot-React-ShoppingMall\fullstack\backend\src\main\java\com\urunov\model\gson\bitMasterApi\orderState\Data.java | 1 |
请完成以下Java代码 | public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), String.valueOf(getA_Depreciation_Table_Detail_ID()));
}
/** Set Period/Yearly.
@param A_Period Period/Yearly */
public void setA_Period (int A_Period)
{
set_Value (COLUMNNAME_A_Period, Integer.valueOf(A_Period));
}
/** Get Period/Yearly.
@return Period/Yearly */
public int getA_Period ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_A_Period);
if (ii == null)
return 0;
return ii.intValue();
}
/** A_Table_Rate_Type AD_Reference_ID=53255 */
public static final int A_TABLE_RATE_TYPE_AD_Reference_ID=53255;
/** Amount = AM */
public static final String A_TABLE_RATE_TYPE_Amount = "AM";
/** Rate = RT */
public static final String A_TABLE_RATE_TYPE_Rate = "RT";
/** Set Type.
@param A_Table_Rate_Type Type */
public void setA_Table_Rate_Type (String A_Table_Rate_Type)
{
set_ValueNoCheck (COLUMNNAME_A_Table_Rate_Type, A_Table_Rate_Type);
}
/** Get Type.
@return Type */ | public String getA_Table_Rate_Type ()
{
return (String)get_Value(COLUMNNAME_A_Table_Rate_Type);
}
/** Set Processed.
@param Processed
The document has been processed
*/
public void setProcessed (boolean Processed)
{
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
}
/** Get Processed.
@return The document has been processed
*/
public boolean isProcessed ()
{
Object oo = get_Value(COLUMNNAME_Processed);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_A_Depreciation_Table_Detail.java | 1 |
请完成以下Java代码 | private RedisTemplate getRedisTemplate() {
RedisTemplate redisTemplate = (RedisTemplate) ApplicationContextUtil.getBean("redisTemplate");
redisTemplate.setKeySerializer(new StringRedisSerializer());
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
return redisTemplate;
}
@Override
public V get(K k) throws CacheException {
return (V) getRedisTemplate().opsForHash().get(this.cacheName,k.toString());
}
@Override
public V put(K k, V v) throws CacheException {
getRedisTemplate().opsForHash().put(this.cacheName,k.toString(), v);
return null;
}
@Override
public V remove(K k) throws CacheException { | return (V) getRedisTemplate().opsForHash().delete(this.cacheName,k.toString());
}
@Override
public void clear() throws CacheException {
getRedisTemplate().opsForHash().delete(this.cacheName);
}
@Override
public int size() {
return getRedisTemplate().opsForHash().size(this.cacheName).intValue();
}
@Override
public Set<K> keys() {
return getRedisTemplate().opsForHash().keys(this.cacheName);
}
@Override
public Collection<V> values() {
return getRedisTemplate().opsForHash().values(this.cacheName);
}
} | repos\springboot-demo-master\shiro\src\main\java\com\et\shiro\cache\RedisCache.java | 1 |
请完成以下Java代码 | public void setNotice (String Notice)
{
set_Value (COLUMNNAME_Notice, Notice);
}
/** Get Notice.
@return Contains last write notice
*/
public String getNotice ()
{
return (String)get_Value(COLUMNNAME_Notice);
}
/** Set Priority.
@param Priority
Indicates if this request is of a high, medium or low priority.
*/
public void setPriority (int Priority)
{
set_Value (COLUMNNAME_Priority, Integer.valueOf(Priority));
}
/** Get Priority.
@return Indicates if this request is of a high, medium or low priority.
*/
public int getPriority ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Priority);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Relative URL.
@param RelativeURL
Contains the relative URL for the container
*/
public void setRelativeURL (String RelativeURL)
{
set_Value (COLUMNNAME_RelativeURL, RelativeURL);
}
/** Get Relative URL.
@return Contains the relative URL for the container
*/
public String getRelativeURL ()
{
return (String)get_Value(COLUMNNAME_RelativeURL);
}
/** Set StructureXML.
@param StructureXML
Autogenerated Containerdefinition as XML Code
*/
public void setStructureXML (String StructureXML)
{
set_Value (COLUMNNAME_StructureXML, StructureXML);
} | /** Get StructureXML.
@return Autogenerated Containerdefinition as XML Code
*/
public String getStructureXML ()
{
return (String)get_Value(COLUMNNAME_StructureXML);
}
/** Set Title.
@param Title
Name this entity is referred to as
*/
public void setTitle (String Title)
{
set_Value (COLUMNNAME_Title, Title);
}
/** Get Title.
@return Name this entity is referred to as
*/
public String getTitle ()
{
return (String)get_Value(COLUMNNAME_Title);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_CM_Container.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public List<Country> getAllByWeekend(Country country) {
if (country.getPage() != null && country.getRows() != null) {
PageHelper.startPage(country.getPage(), country.getRows());
}
Weekend<Country> weekend = Weekend.of(Country.class);
WeekendCriteria<Country, Object> criteria = weekend.weekendCriteria();
if (country.getCountryname() != null && country.getCountryname().length() > 0) {
criteria.andLike(Country::getCountryname, "%" + country.getCountryname() + "%");
}
if (country.getCountrycode() != null && country.getCountrycode().length() > 0) {
criteria.andLike(Country::getCountrycode, "%" + country.getCountrycode() + "%");
}
return countryMapper.selectByExample(weekend);
}
public Country getById(Integer id) { | return countryMapper.selectByPrimaryKey(id);
}
public void deleteById(Integer id) {
countryMapper.deleteByPrimaryKey(id);
}
public void save(Country country) {
if (country.getId() != null) {
countryMapper.updateByPrimaryKey(country);
} else {
countryMapper.insert(country);
}
}
} | repos\MyBatis-Spring-Boot-master\src\main\java\tk\mybatis\springboot\service\CountryService.java | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.