instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请完成以下Java代码
|
public IQueryOrderByBuilder<T> clear()
{
orderBys.clear();
return this;
}
@Override
public QueryOrderByBuilder<T> copy()
{
final QueryOrderByBuilder<T> copy = new QueryOrderByBuilder<T>();
copy.orderBys.addAll(this.orderBys);
return copy;
}
@Override
public IQueryOrderByBuilder<T> addColumn(final String columnName)
{
final Direction direction = Direction.Ascending;
final Nulls nulls = getNulls(direction);
return addColumn(columnName, direction, nulls);
}
@Override
public IQueryOrderByBuilder<T> addColumn(ModelColumn<T, ?> column)
{
final String columnName = column.getColumnName();
return addColumn(columnName);
}
@Override
public IQueryOrderByBuilder<T> addColumnAscending(@NonNull final String columnName)
{
final Direction direction = Direction.Ascending;
final Nulls nulls = getNulls(direction);
return addColumn(columnName, direction, nulls);
}
@Override
public IQueryOrderByBuilder<T> addColumnDescending(@NonNull final String columnName)
{
final Direction direction = Direction.Descending;
final Nulls nulls = getNulls(direction);
return addColumn(columnName, direction, nulls);
}
@Override
public IQueryOrderByBuilder<T> addColumn(
@NonNull final String columnName,
@NonNull final Direction direction,
@NonNull final Nulls nulls)
{
final QueryOrderByItem orderByItem = new QueryOrderByItem(columnName, direction, nulls);
orderBys.add(orderByItem);
return this;
|
}
@Override
public IQueryOrderByBuilder<T> addColumn(@NonNull final ModelColumn<T, ?> column, final Direction direction, final Nulls nulls)
{
final String columnName = column.getColumnName();
return addColumn(columnName, direction, nulls);
}
private Nulls getNulls(final Direction direction)
{
// NOTE: keeping backward compatibility
// i.e. postgresql 9.1. specifications:
// "By default, null values sort as if larger than any non-null value;
// that is, NULLS FIRST is the default for DESC order, and NULLS LAST otherwise."
//
// see https://www.postgresql.org/docs/9.5/queries-order.html
if (direction == Direction.Descending)
{
return Nulls.First;
}
else
{
return Nulls.Last;
}
}
@Override
public IQueryOrderBy createQueryOrderBy()
{
final QueryOrderBy orderBy = new QueryOrderBy(orderBys);
return orderBy;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\dao\impl\QueryOrderByBuilder.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class BatchConfig {
@Autowired
private RestHighLevelClient restHighLevelClient;
@Bean
public FlatFileItemReader<Product> reader() {
return new FlatFileItemReaderBuilder<Product>().name("productReader")
.resource(new FileSystemResource("products.csv"))
.delimited()
.names("id", "name", "category", "price", "stock")
.fieldSetMapper(new BeanWrapperFieldSetMapper<>() {{
setTargetType(Product.class);
}})
.build();
}
@Bean
public ItemWriter<Product> writer(RestHighLevelClient restHighLevelClient) {
return products -> {
for (Product product : products) {
try {
IndexRequest request = new IndexRequest("products").id(product.getId())
.source(Map.of("name", product.getName(), "category", product.getCategory(), "price", product.getPrice(), "stock", product.getStock()));
restHighLevelClient.index(request, RequestOptions.DEFAULT);
} catch (Exception e) {
|
System.err.println("Failed to index product: " + product.getId() + ", error: " + e.getMessage());
}
}
};
}
@Bean
public Job importJob(JobRepository jobRepository, PlatformTransactionManager transactionManager, RestHighLevelClient restHighLevelClient) {
return new JobBuilder("importJob", jobRepository)
.start(new StepBuilder("importStep", jobRepository)
.<Product, Product>chunk(10, transactionManager)
.reader(reader())
.writer(writer(restHighLevelClient))
.build())
.build();
}
}
|
repos\tutorials-master\persistence-modules\spring-data-elasticsearch\src\main\java\com\baeldung\elasticsearch\importcsv\BatchConfig.java
| 2
|
请完成以下Java代码
|
public void setQty (final @Nullable BigDecimal Qty)
{
set_Value (COLUMNNAME_Qty, Qty);
}
@Override
public BigDecimal getQty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyCalculated (final @Nullable BigDecimal QtyCalculated)
{
set_Value (COLUMNNAME_QtyCalculated, QtyCalculated);
}
@Override
public BigDecimal getQtyCalculated()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyCalculated);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setUOM (final java.lang.String UOM)
{
set_Value (COLUMNNAME_UOM, UOM);
}
@Override
public java.lang.String getUOM()
|
{
return get_ValueAsString(COLUMNNAME_UOM);
}
@Override
public void setWarehouseValue (final java.lang.String WarehouseValue)
{
set_Value (COLUMNNAME_WarehouseValue, WarehouseValue);
}
@Override
public java.lang.String getWarehouseValue()
{
return get_ValueAsString(COLUMNNAME_WarehouseValue);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_I_Forecast.java
| 1
|
请完成以下Java代码
|
public class Author {
private String name;
private Long authorId;
private List<String> genres;
private List<Book> books;
public Author(String name, Long id, List<String> genres, List<Book> books) {
this.name = name;
this.authorId = id;
this.genres = genres;
this.books = books;
}
public Long getAuthorId() {
|
return authorId;
}
public String getName() {
return name;
}
public List<String> getGenres() {
return genres;
}
public List<Book> getBooks() {
return books;
}
}
|
repos\tutorials-master\core-java-modules\core-java-functional\src\main\java\com\baeldung\monads\Author.java
| 1
|
请完成以下Java代码
|
public ResponseEntity<?> createShippingPackages(
@PathVariable("warehouseId") @NonNull final String warehouseId,
@RequestBody final JsonOutOfStockNoticeRequest request)
{
try
{
final JsonOutOfStockResponse response = warehouseService.handleOutOfStockRequest(warehouseId, request);
return ResponseEntity.ok(response);
}
catch (final Exception ex)
{
Loggables.addLog(ex.getLocalizedMessage(), ex);
return ResponseEntity.badRequest().body(JsonErrors.ofThrowable(ex, getAdLanguage()));
}
}
@Operation(summary = "Create or update warehouses.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successfully created or updated warehouse(s)"),
@ApiResponse(responseCode = "401", description = "You are not authorized to create or update the resource"),
@ApiResponse(responseCode = "403", description = "Accessing the resource you were trying to reach is forbidden"),
@ApiResponse(responseCode = "422", description = "The request entity could not be processed")
})
@PutMapping("{orgCode}")
public ResponseEntity<JsonResponseUpsert> upsertWarehouses(
@Parameter(required = true, description = ORG_CODE_PARAMETER_DOC)
@PathVariable("orgCode") @Nullable final String orgCode, // may be null if called from other metasfresh-code
@RequestBody @NonNull final JsonRequestWarehouseUpsert request)
{
|
final JsonResponseUpsert responseUpsert = warehouseRestService.upsertWarehouses(orgCode, request);
return ResponseEntity.ok(responseUpsert);
}
@GetMapping("/resolveLocator")
@NonNull
public JsonResolveLocatorResponse resolveLocatorScannedCode(
@RequestParam("scannedBarcode") final String scannedBarcode)
{
try
{
return JsonResolveLocatorResponse.ok(warehouseRestService.resolveLocatorScannedCode(ScannedCode.ofString(scannedBarcode)));
}
catch (final Exception ex)
{
return JsonResolveLocatorResponse.error(ex, getAdLanguage());
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\v2\warehouse\WarehouseRestController.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private JsonRequestBPartnerUpsertItem buildJsonRequestBPartnerUpsertItem(
@NonNull final String externalBPId,
@NonNull final AlbertaConnectionDetails albertaConnectionDetails,
@NonNull final Map<String, Object> externalBPIdentifier2Api,
@NonNull final String orgCode)
{
final Object api = externalBPIdentifier2Api.get(externalBPId);
if (api == null)
{
throw new RuntimeException("No api found for externalBPId:" + externalBPId + ", externalBPIdentifier2Type=" + externalBPIdentifier2Api);
}
if (api instanceof DoctorApi)
{
return getJsonRequestBPartnerUpsertItemForDoctor(externalBPId, (DoctorApi)api, albertaConnectionDetails, orgCode);
}
else if (api instanceof PharmacyApi)
{
return getJsonRequestBPartnerUpsertItemForPharmacy(externalBPId, (PharmacyApi)api, albertaConnectionDetails, orgCode);
}
else
{
throw new RuntimeException("Unsupported api type: " + api);
}
}
@NonNull
private JsonRequestBPartnerUpsertItem getJsonRequestBPartnerUpsertItemForDoctor(
@NonNull final String doctorId,
@NonNull final DoctorApi doctorApi,
@NonNull final AlbertaConnectionDetails connectionDetails,
@NonNull final String orgCode)
{
try
{
final Doctor doctor = doctorApi.getDoctor(connectionDetails.getApiKey(), doctorId);
return DataMapper.mapDoctorToUpsertRequest(doctor, orgCode);
}
|
catch (final ApiException e)
{
throw new RuntimeException("Unexpected exception when retrieving doctor information", e);
}
}
@NonNull
private JsonRequestBPartnerUpsertItem getJsonRequestBPartnerUpsertItemForPharmacy(
@NonNull final String pharmacyId,
@NonNull final PharmacyApi pharmacyApi,
@NonNull final AlbertaConnectionDetails connectionDetails,
@NonNull final String orgCode)
{
try
{
final Pharmacy pharmacy = pharmacyApi.getPharmacy(connectionDetails.getApiKey(), pharmacyId);
return DataMapper.mapPharmacyToUpsertRequest(pharmacy, orgCode);
}
catch (final ApiException e)
{
throw new RuntimeException("Unexpected exception when retrieving pharmacy information", e);
}
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\alberta\de-metas-camel-alberta-camelroutes\src\main\java\de\metas\camel\externalsystems\alberta\ordercandidate\processor\CreateMissingBPartnerProcessor.java
| 2
|
请完成以下Java代码
|
private void loadPointcuts()
{
final Class<?> annotatedClass = getAnnotatedClass();
for (final Method method : annotatedClass.getDeclaredMethods())
{
final CalloutMethod annCalloutMethod = method.getAnnotation(CalloutMethod.class);
if (annCalloutMethod != null)
{
loadPointcut(annCalloutMethod, method);
}
}
}
private void loadPointcut(final CalloutMethod annModelChange, final Method method)
{
final CalloutMethodPointcut pointcut = createPointcut(annModelChange, method);
addPointcutToMap(pointcut);
}
private CalloutMethodPointcut createPointcut(final CalloutMethod annModelChange, final Method method)
{
if (method.getReturnType() != void.class)
{
throw new CalloutInitException("Return type should be void for " + method);
}
final Class<?>[] parameterTypes = method.getParameterTypes();
if (parameterTypes == null || parameterTypes.length == 0)
{
throw new CalloutInitException("Invalid method " + method + ": It has no arguments");
}
if (parameterTypes.length < 1 || parameterTypes.length > 2)
{
throw new CalloutInitException("Invalid method " + method + ": It shall have following paramters: model and optionally ICalloutField");
}
//
// Validate parameter 1: Model Class for binding
final Class<?> modelClass = parameterTypes[0];
{
//
// Validate Model Class's TableName
final String tableName = InterfaceWrapperHelper.getTableNameOrNull(modelClass);
if (Check.isEmpty(tableName))
{
throw new CalloutInitException("Cannot find tablename for " + modelClass);
}
if (tableName != null && !tableName.contains(tableName))
{
throw new CalloutInitException("Table " + tableName + " is not in the list of allowed tables names specified by " + Callout.class + " annotation: " + tableName);
}
}
//
// Validate parameter 2: ICalloutField
final boolean paramCalloutFieldRequired;
if (parameterTypes.length >= 2)
{
if (!ICalloutField.class.isAssignableFrom(parameterTypes[1]))
{
throw new CalloutInitException("Invalid method " + method + ": second parameter shall be " + ICalloutField.class + " or not specified at all");
}
|
paramCalloutFieldRequired = true;
}
else
{
paramCalloutFieldRequired = false;
}
return new CalloutMethodPointcut(modelClass,
method,
annModelChange.columnNames(),
paramCalloutFieldRequired,
annModelChange.skipIfCopying(),
annModelChange.skipIfIndirectlyCalled());
}
private void addPointcutToMap(final CalloutMethodPointcut pointcut)
{
//
// Add pointcut to map
for (final String columnName : pointcut.getColumnNames())
{
final CalloutMethodPointcutKey key = CalloutMethodPointcutKey.of(columnName);
mapPointcuts.put(key, pointcut);
columnNames.add(columnName);
}
logger.debug("Loaded {}", pointcut);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\callout\annotations\api\impl\AnnotatedCalloutInstanceFactory.java
| 1
|
请完成以下Java代码
|
public void deleteInventoryLineHUs(@NonNull final InventoryLineId inventoryLineId)
{
queryBL.createQueryBuilder(I_M_InventoryLine_HU.class)
.addEqualsFilter(I_M_InventoryLine_HU.COLUMN_M_InventoryLine_ID, inventoryLineId)
.create()
.delete();
}
public Inventory updateById(final InventoryId inventoryId, UnaryOperator<Inventory> updater)
{
final Inventory inventory = loadById(inventoryId);
final Inventory inventoryChanged = updater.apply(inventory);
if (Objects.equals(inventory, inventoryChanged))
{
return inventory;
}
saveInventory(inventoryChanged);
return inventoryChanged;
}
public void updateInventoryLineByRecord(final I_M_InventoryLine inventoryLineRecord, UnaryOperator<InventoryLine> updater)
{
final InventoryId inventoryId = extractInventoryId(inventoryLineRecord);
final InventoryLine inventoryLine = toInventoryLine(inventoryLineRecord);
final InventoryLine inventoryLineChanged = updater.apply(inventoryLine);
if (Objects.equals(inventoryLine, inventoryLineChanged))
{
return;
}
saveInventoryLineHURecords(inventoryLine, inventoryId);
}
public Stream<InventoryReference> streamReferences(InventoryQuery query)
{
final ImmutableList<I_M_Inventory> inventories = inventoryDAO.stream(query).collect(ImmutableList.toImmutableList());
return inventories.stream().map(this::toInventoryJobReference);
}
private InventoryReference toInventoryJobReference(final I_M_Inventory inventory)
{
return InventoryReference.builder()
|
.inventoryId(extractInventoryId(inventory))
.documentNo(inventory.getDocumentNo())
.movementDate(extractMovementDate(inventory))
.warehouseId(WarehouseId.ofRepoId(inventory.getM_Warehouse_ID()))
.responsibleId(extractResponsibleId(inventory))
.build();
}
public void updateByQuery(@NonNull final InventoryQuery query, @NonNull final UnaryOperator<Inventory> updater)
{
final ImmutableList<I_M_Inventory> inventoriesRecords = inventoryDAO.stream(query).collect(ImmutableList.toImmutableList());
if (inventoriesRecords.isEmpty()) {return;}
warmUp(inventoriesRecords);
for (final I_M_Inventory inventoryRecord : inventoriesRecords)
{
final Inventory inventory = toInventory(inventoryRecord);
final Inventory inventoryChanged = updater.apply(inventory);
if (!Objects.equals(inventory, inventoryChanged))
{
saveInventory(inventoryChanged);
}
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\inventory\InventoryLoaderAndSaver.java
| 1
|
请完成以下Java代码
|
public class Album {
private Integer id;
private Integer userId;
private String title;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUserId() {
|
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
|
repos\tutorials-master\spring-cloud-modules\spring-cloud-openfeign\src\main\java\com\baeldung\cloud\openfeign\model\Album.java
| 1
|
请完成以下Spring Boot application配置
|
#spring:
# mail: # 配置发送告警的邮箱
# host: smtp.163.com
# port: 465
# protocol: smtps
# username: yudaoyuanma@163.com
# password: '***'
# default-encoding: UTF-8
## properties:
## smtp:
## auth: true
## starttls:
## enable: true
## required: true
spring:
mail: # 配置发送告警的邮箱
host: smtp.exmail.qq.com
port: 465
protocol: smtps
username: yunai.
|
wang@medcloud.cn
password: '***'
default-encoding: UTF-8
properties:
smtp:
auth: true
starttls:
enable: true
required: true
|
repos\SpringBoot-Labs-master\lab-50\lab-50-demo\src\main\resources\application.yml
| 2
|
请完成以下Java代码
|
public class M_InOut_ResetPackingLines extends JavaProcess implements IProcessPrecondition
{
@Override
protected void prepare()
{
// nothing
}
@Override
protected String doIt() throws Exception
{
final I_M_InOut inout = InterfaceWrapperHelper.create(getCtx(), getRecord_ID(), I_M_InOut.class, getTrxName());
Services.get(IHUInOutBL.class).recreatePackingMaterialLines(inout);
return "@Success@";
}
|
/**
* Returns <code>true</code> for unprocessed shipments only.
*/
@Override
public ProcessPreconditionsResolution checkPreconditionsApplicable(final IProcessPreconditionsContext context)
{
if (!I_M_InOut.Table_Name.equals(context.getTableName()))
{
return ProcessPreconditionsResolution.reject();
}
final I_M_InOut inout = context.getSelectedModel(I_M_InOut.class);
return ProcessPreconditionsResolution.acceptIf(inout.isSOTrx() && !inout.isProcessed());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\inout\process\M_InOut_ResetPackingLines.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private ProdInsertReq makeProdInsertReq(ProdInsertReq prodInsertReq){
ProdInsertReq newProduct = new ProdInsertReq();
//使用BeanUtils复制属性,注意顺序!
BeanUtils.copyProperties(prodInsertReq,newProduct);
newProduct.setId(KeyGenerator.getKey());
//新增产品默认销量为0
newProduct.setSales(0);
//新增产品默认状态是上架
newProduct.setProdState(ProdStateEnum.OPEN.getCode());
return newProduct;
}
/**
* 组装新增类别对象
* @param categoryEntity
* @return
*/
private CategoryEntity makeCateInsert(CategoryEntity categoryEntity){
CategoryEntity newCategory = new CategoryEntity();
BeanUtils.copyProperties(categoryEntity,newCategory);
newCategory.setId(KeyGenerator.getKey());
return newCategory;
|
}
/**
* 组装新增品牌对象
* @param brandInsertReq
* @return
*/
private BrandInsertReq makeBrandInsert(BrandInsertReq brandInsertReq){
BrandInsertReq newBrand = new BrandInsertReq();
BeanUtils.copyProperties(brandInsertReq,newBrand);
newBrand.setId(KeyGenerator.getKey());
return newBrand;
}
}
|
repos\SpringBoot-Dubbo-Docker-Jenkins-master\Gaoxi-Product\src\main\java\com\gaoxi\product\service\ProductServiceImpl.java
| 2
|
请完成以下Java代码
|
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
public Object resolveValue(ObjectMapper objectMapper) {
if (value instanceof String && objectMapper != null) {
try {
return objectMapper.readValue("\"" + value + "\"", Date.class);
} catch (Exception e) {
// ignore the exception
}
}
|
return value;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
public static QueryOperator getQueryOperator(String name) {
return NAME_OPERATOR_MAP.get(name);
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\ConditionQueryParameterDto.java
| 1
|
请完成以下Java代码
|
public List<InformationRequirement> getRequiredDecisions() {
return requiredDecisions;
}
public void setRequiredDecisions(List<InformationRequirement> requiredDecisions) {
this.requiredDecisions = requiredDecisions;
}
public void addRequiredDecision(InformationRequirement requiredDecision) {
this.requiredDecisions.add(requiredDecision);
}
public List<InformationRequirement> getRequiredInputs() {
return requiredInputs;
}
public void setRequiredInputs(List<InformationRequirement> requiredInputs) {
this.requiredInputs = requiredInputs;
}
public void addRequiredInput(InformationRequirement requiredInput) {
this.requiredInputs.add(requiredInput);
}
public List<AuthorityRequirement> getAuthorityRequirements() {
return authorityRequirements;
}
public void setAuthorityRequirements(List<AuthorityRequirement> authorityRequirements) {
this.authorityRequirements = authorityRequirements;
}
public void addAuthorityRequirement(AuthorityRequirement authorityRequirement) {
this.authorityRequirements.add(authorityRequirement);
}
public Expression getExpression() {
return expression;
}
public void setExpression(Expression expression) {
this.expression = expression;
|
}
public boolean isForceDMN11() {
return forceDMN11;
}
public void setForceDMN11(boolean forceDMN11) {
this.forceDMN11 = forceDMN11;
}
@JsonIgnore
public DmnDefinition getDmnDefinition() {
return dmnDefinition;
}
public void setDmnDefinition(DmnDefinition dmnDefinition) {
this.dmnDefinition = dmnDefinition;
}
}
|
repos\flowable-engine-main\modules\flowable-dmn-model\src\main\java\org\flowable\dmn\model\Decision.java
| 1
|
请完成以下Java代码
|
public int getS_Resource_ID()
{
return get_ValueAsInt(COLUMNNAME_S_Resource_ID);
}
@Override
public void setScrappedQty (final @Nullable BigDecimal ScrappedQty)
{
set_Value (COLUMNNAME_ScrappedQty, ScrappedQty);
}
@Override
public BigDecimal getScrappedQty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_ScrappedQty);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setSetupTimeReal (final @Nullable BigDecimal SetupTimeReal)
{
set_Value (COLUMNNAME_SetupTimeReal, SetupTimeReal);
}
@Override
public BigDecimal getSetupTimeReal()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_SetupTimeReal);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setUser1_ID (final int User1_ID)
{
if (User1_ID < 1)
set_Value (COLUMNNAME_User1_ID, null);
else
|
set_Value (COLUMNNAME_User1_ID, User1_ID);
}
@Override
public int getUser1_ID()
{
return get_ValueAsInt(COLUMNNAME_User1_ID);
}
@Override
public void setUser2_ID (final int User2_ID)
{
if (User2_ID < 1)
set_Value (COLUMNNAME_User2_ID, null);
else
set_Value (COLUMNNAME_User2_ID, User2_ID);
}
@Override
public int getUser2_ID()
{
return get_ValueAsInt(COLUMNNAME_User2_ID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_PP_Cost_Collector.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public @NotNull Iterable<Order> list() {
return this.orderService.getAllOrders();
}
@PostMapping
public ResponseEntity<Order> create(@RequestBody OrderForm form) {
List<OrderProductDto> formDtos = form.getProductOrders();
validateProductsExistence(formDtos);
Order order = new Order();
order.setStatus(OrderStatus.PAID.name());
order = this.orderService.create(order);
List<OrderProduct> orderProducts = new ArrayList<>();
for (OrderProductDto dto : formDtos) {
orderProducts.add(orderProductService.create(new OrderProduct(order, productService.getProduct(dto
.getProduct()
.getId()), dto.getQuantity())));
}
order.setOrderProducts(orderProducts);
this.orderService.update(order);
String uri = ServletUriComponentsBuilder
.fromCurrentServletMapping()
.path("/orders/{id}")
.buildAndExpand(order.getId())
.toString();
HttpHeaders headers = new HttpHeaders();
headers.add("Location", uri);
return new ResponseEntity<>(order, headers, HttpStatus.CREATED);
}
private void validateProductsExistence(List<OrderProductDto> orderProducts) {
List<OrderProductDto> list = orderProducts
.stream()
.filter(op -> Objects.isNull(productService.getProduct(op
.getProduct()
.getId())))
|
.collect(Collectors.toList());
if (!CollectionUtils.isEmpty(list)) {
new ResourceNotFoundException("Product not found");
}
}
public static class OrderForm {
private List<OrderProductDto> productOrders;
public List<OrderProductDto> getProductOrders() {
return productOrders;
}
public void setProductOrders(List<OrderProductDto> productOrders) {
this.productOrders = productOrders;
}
}
}
|
repos\tutorials-master\spring-boot-modules\spring-boot-angular\src\main\java\com\baeldung\ecommerce\controller\OrderController.java
| 2
|
请完成以下Java代码
|
public static LockedExternalTaskImpl fromEntity(ExternalTaskEntity externalTaskEntity, List<String> variablesToFetch, boolean isLocal, boolean deserializeVariables, boolean includeExtensionProperties) {
LockedExternalTaskImpl result = new LockedExternalTaskImpl();
result.id = externalTaskEntity.getId();
result.topicName = externalTaskEntity.getTopicName();
result.workerId = externalTaskEntity.getWorkerId();
result.lockExpirationTime = externalTaskEntity.getLockExpirationTime();
result.createTime = externalTaskEntity.getCreateTime();
result.retries = externalTaskEntity.getRetries();
result.errorMessage = externalTaskEntity.getErrorMessage();
result.errorDetails = externalTaskEntity.getErrorDetails();
result.processInstanceId = externalTaskEntity.getProcessInstanceId();
result.executionId = externalTaskEntity.getExecutionId();
result.activityId = externalTaskEntity.getActivityId();
result.activityInstanceId = externalTaskEntity.getActivityInstanceId();
result.processDefinitionId = externalTaskEntity.getProcessDefinitionId();
result.processDefinitionKey = externalTaskEntity.getProcessDefinitionKey();
result.processDefinitionVersionTag = externalTaskEntity.getProcessDefinitionVersionTag();
|
result.tenantId = externalTaskEntity.getTenantId();
result.priority = externalTaskEntity.getPriority();
result.businessKey = externalTaskEntity.getBusinessKey();
ExecutionEntity execution = externalTaskEntity.getExecution();
result.variables = new VariableMapImpl();
execution.collectVariables(result.variables, variablesToFetch, isLocal, deserializeVariables);
if(includeExtensionProperties) {
result.extensionProperties = (Map<String, String>) execution.getActivity().getProperty(BpmnProperties.EXTENSION_PROPERTIES.getName());
}
if(result.extensionProperties == null) {
result.extensionProperties = Collections.emptyMap();
}
return result;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\externaltask\LockedExternalTaskImpl.java
| 1
|
请完成以下Java代码
|
private ITranslatableString getProductName(final ProductId productId)
{
return productNames.computeIfAbsent(productId, this::retrieveProductName);
}
private ITranslatableString retrieveProductName(final ProductId productId)
{
return TranslatableStrings.anyLanguage(productService.getProductValueAndName(productId));
}
@NonNull
public static Quantity extractQtyEntered(final I_DD_OrderLine ddOrderLine)
{
return Quantitys.of(ddOrderLine.getQtyEntered(), UomId.ofRepoId(ddOrderLine.getC_UOM_ID()));
}
private void processPendingRequests()
{
if (!pendingCollectProductsFromDDOrderIds.isEmpty())
{
ddOrderService.getProductIdsByDDOrderIds(pendingCollectProductsFromDDOrderIds)
|
.forEach(this::collectProduct);
pendingCollectProductsFromDDOrderIds.clear();
}
if (!pendingCollectQuantitiesFromDDOrderIds.isEmpty())
{
ddOrderService.streamLinesByDDOrderIds(pendingCollectQuantitiesFromDDOrderIds)
.forEach(this::collectQuantity);
pendingCollectQuantitiesFromDDOrderIds.clear();
}
}
private ITranslatableString getPlantName(final ResourceId resourceId)
{
return resourceNames.computeIfAbsent(resourceId, id -> TranslatableStrings.constant(sourceDocService.getPlantName(id)));
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.distribution.rest-api\src\main\java\de\metas\distribution\mobileui\launchers\facets\DistributionFacetsCollector.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
String fileName = fileAttribute.getName();
String filePassword = fileAttribute.getFilePassword();
boolean forceUpdatedCache = fileAttribute.forceUpdatedCache();
String fileTree = null;
// 判断文件名是否存在(redis缓存读取)
if (forceUpdatedCache || !StringUtils.hasText(fileHandlerService.getConvertedFile(fileName)) || !ConfigConstants.isCacheEnabled()) {
ReturnResponse<String> response = DownloadUtils.downLoad(fileAttribute, fileName);
if (response.isFailure()) {
return otherFilePreview.notSupportedFile(model, fileAttribute, response.getMsg());
}
String filePath = response.getContent();
try {
fileTree = compressFileReader.unRar(filePath, filePassword, fileName, fileAttribute);
} catch (Exception e) {
if (e.getMessage().toLowerCase().contains(Rar_PASSWORD_MSG)) {
model.addAttribute("needFilePassword", true);
return EXEL_FILE_PREVIEW_PAGE;
}else {
logger.error("Error processing RAR file: " + e.getMessage(), e);
}
|
}
if (!ObjectUtils.isEmpty(fileTree)) {
//是否保留压缩包源文件
if (!fileAttribute.isCompressFile() && ConfigConstants.getDeleteSourceFile()) {
KkFileUtils.deleteFileByPath(filePath);
}
if (ConfigConstants.isCacheEnabled()) {
// 加入缓存
fileHandlerService.addConvertedFile(fileName, fileTree);
}
} else {
return otherFilePreview.notSupportedFile(model, fileAttribute, "该压缩包文件无法处理!");
}
} else {
fileTree = fileHandlerService.getConvertedFile(fileName);
}
model.addAttribute("fileName", fileName);
model.addAttribute("fileTree", fileTree);
return COMPRESS_FILE_PREVIEW_PAGE;
}
}
|
repos\kkFileView-master\server\src\main\java\cn\keking\service\impl\CompressFilePreviewImpl.java
| 2
|
请完成以下Java代码
|
public EventDefinitionParse sourceUrl(URL url) {
if (name == null) {
name(url.toString());
}
setStreamSource(new UrlStreamSource(url));
return this;
}
public EventDefinitionParse sourceUrl(String url) {
try {
return sourceUrl(new URL(url));
} catch (MalformedURLException e) {
throw new FlowableException("malformed url: " + url, e);
}
}
public EventDefinitionParse sourceResource(String resource) {
if (name == null) {
name(resource);
}
setStreamSource(new ResourceStreamSource(resource));
return this;
}
public EventDefinitionParse sourceString(String string) {
if (name == null) {
name("string");
}
setStreamSource(new StringStreamSource(string));
return this;
}
|
protected void setStreamSource(StreamSource streamSource) {
if (this.streamSource != null) {
throw new FlowableException("invalid: multiple sources " + this.streamSource + " and " + streamSource);
}
this.streamSource = streamSource;
}
/*
* ------------------- GETTERS AND SETTERS -------------------
*/
public List<EventDefinitionEntity> getEventDefinitions() {
return eventDefinitions;
}
public EventDeploymentEntity getDeployment() {
return deployment;
}
public void setDeployment(EventDeploymentEntity deployment) {
this.deployment = deployment;
}
public EventModel getEventModel() {
return eventModel;
}
public void setEventModel(EventModel eventModel) {
this.eventModel = eventModel;
}
}
|
repos\flowable-engine-main\modules\flowable-event-registry\src\main\java\org\flowable\eventregistry\impl\parser\EventDefinitionParse.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
protected boolean isEligibleForScheduling(final InOutLineWithQualityIssues model)
{
return model != null && model.getM_InOutLine_ID() > 0;
}
;
@Override
protected Properties extractCtxFromItem(final InOutLineWithQualityIssues item)
{
return Env.getCtx();
}
@Override
protected String extractTrxNameFromItem(final InOutLineWithQualityIssues item)
{
return ITrx.TRXNAME_ThreadInherited;
}
@Override
protected Object extractModelToEnqueueFromItem(final Collector collector, final InOutLineWithQualityIssues item)
{
return TableRecordReference.of(I_M_InOutLine.Table_Name, item.getM_InOutLine_ID());
}
};
@Override
public Result processWorkPackage(final I_C_Queue_WorkPackage workPackage, final String localTrxName)
{
|
// Services
final IQueueDAO queueDAO = Services.get(IQueueDAO.class);
final IRequestBL requestBL = Services.get(IRequestBL.class);
// retrieve the items (inout lines) that were enqueued and put them in a list
final List<I_M_InOutLine> lines = queueDAO.retrieveAllItems(workPackage, I_M_InOutLine.class);
// for each line that was enqueued, create a R_Request containing the information from the inout line and inout
for (final I_M_InOutLine line : lines)
{
requestBL.createRequestFromInOutLineWithQualityIssues(line);
}
return Result.SUCCESS;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\request\service\async\spi\impl\C_Request_CreateFromInout_Async.java
| 2
|
请完成以下Java代码
|
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
public org.compiere.model.I_EXP_Processor getEXP_Processor() throws RuntimeException
{
return (org.compiere.model.I_EXP_Processor)MTable.get(getCtx(), org.compiere.model.I_EXP_Processor.Table_Name)
.getPO(getEXP_Processor_ID(), get_TrxName()); }
/** Set Export Processor.
@param EXP_Processor_ID Export Processor */
public void setEXP_Processor_ID (int EXP_Processor_ID)
{
if (EXP_Processor_ID < 1)
set_ValueNoCheck (COLUMNNAME_EXP_Processor_ID, null);
else
set_ValueNoCheck (COLUMNNAME_EXP_Processor_ID, Integer.valueOf(EXP_Processor_ID));
}
/** Get Export Processor.
@return Export Processor */
public int getEXP_Processor_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_EXP_Processor_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Processor Parameter.
@param EXP_ProcessorParameter_ID Processor Parameter */
public void setEXP_ProcessorParameter_ID (int EXP_ProcessorParameter_ID)
{
if (EXP_ProcessorParameter_ID < 1)
set_ValueNoCheck (COLUMNNAME_EXP_ProcessorParameter_ID, null);
else
set_ValueNoCheck (COLUMNNAME_EXP_ProcessorParameter_ID, Integer.valueOf(EXP_ProcessorParameter_ID));
}
/** Get Processor Parameter.
@return Processor Parameter */
public int getEXP_ProcessorParameter_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_EXP_ProcessorParameter_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 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 Parameter Value.
@param ParameterValue Parameter Value */
public void setParameterValue (String ParameterValue)
{
set_Value (COLUMNNAME_ParameterValue, ParameterValue);
}
/** Get Parameter Value.
@return Parameter Value */
public String getParameterValue ()
{
return (String)get_Value(COLUMNNAME_ParameterValue);
}
/** 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_ProcessorParameter.java
| 1
|
请完成以下Java代码
|
public Iterator<I_C_Printing_Queue> createItemsIterator()
{
return new SingletonIterator<I_C_Printing_Queue>(item);
}
@Override
public Iterator<I_C_Printing_Queue> createRelatedItemsIterator(final I_C_Printing_Queue item)
{
final List<I_C_Printing_Queue> list = Collections.emptyList();
return list.iterator();
}
@Override
public String getTrxName()
{
return trxName;
}
@Override
public boolean isPrinted(@NonNull final I_C_Printing_Queue item)
{
if (persistPrintedFlag)
{
return super.isPrinted(item);
|
}
else
{
return temporaryPrinted;
}
}
@Override
public void markPrinted(@NonNull final I_C_Printing_Queue item)
{
if (persistPrintedFlag)
{
super.markPrinted(item);
}
else
{
temporaryPrinted = true;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.printing\de.metas.printing.base\src\main\java\de\metas\printing\api\impl\SingletonPrintingQueueSource.java
| 1
|
请完成以下Java代码
|
private IAllocationDestination createAllocationDestination(final @NonNull InventoryLine inventoryLine, final @NonNull InventoryLineHU inventoryLineHU)
{
if (inventoryLineHU.getHuId() == null)
{
if (inventoryLineHU.getHuQRCode() != null)
{
return HUProducerDestination.of(inventoryLineHU.getHuQRCode().getPackingInstructionsId())
.setHUStatus(X_M_HU.HUSTATUS_Active)
.setLocatorId(inventoryLine.getLocatorId());
}
else
{
final InventoryLinePackingInstructions packingInstructions = inventoryLine.getPackingInstructions();
if (packingInstructions.isVHU())
{
return HUProducerDestination.ofVirtualPI()
.setHUStatus(X_M_HU.HUSTATUS_Active)
.setLocatorId(inventoryLine.getLocatorId());
}
else
{
final LUTUProducerDestination lutuProducer = new LUTUProducerDestination();
lutuProducer.setHUStatus(X_M_HU.HUSTATUS_Active);
lutuProducer.setLocatorId(inventoryLine.getLocatorId());
lutuProducer.setTUPI(packingInstructions.getTuPIItemProductId(), inventoryLine.getProductId());
if (packingInstructions.getLuPIId() != null)
{
lutuProducer.setLUPI(packingInstructions.getLuPIId());
lutuProducer.setMaxLUsInfinite();
}
else
{
|
lutuProducer.setNoLU();
}
return lutuProducer;
}
}
}
else
{
final I_M_HU hu = handlingUnitsBL.getById(inventoryLineHU.getHuId());
return HUListAllocationSourceDestination.of(hu, AllocationStrategyType.UNIFORM);
}
}
private static List<I_M_HU> extractCreatedHUs(
@NonNull final IAllocationDestination huDestination)
{
if (huDestination instanceof IHUProducerAllocationDestination)
{
return ((IHUProducerAllocationDestination)huDestination).getCreatedHUs();
}
else
{
throw new HUException("No HU was created by " + huDestination);
}
}
private boolean isIgnoreOnInventoryMinusAndNoHU()
{
return sysConfigBL.getBooleanValue(SYSCONFIG_IgnoreOnInventoryMinusAndNoHU, false);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\inventory\impl\SyncInventoryQtyToHUsCommand.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void onError(Throwable e) {
callback.onError(e);
}
}
@Override
public ExecutorService getCallbackExecutor() {
return transportCallbackExecutor;
}
@Override
public boolean hasSession(TransportProtos.SessionInfoProto sessionInfo) {
return sessions.containsKey(toSessionId(sessionInfo));
}
|
@Override
public void createGaugeStats(String statsName, AtomicInteger number) {
statsFactory.createGauge(StatsType.TRANSPORT + "." + statsName, number);
statsMap.put(statsName, number);
}
@Scheduled(fixedDelayString = "${transport.stats.print-interval-ms:60000}")
public void printStats() {
if (statsEnabled && !statsMap.isEmpty()) {
String values = statsMap.entrySet().stream()
.map(kv -> kv.getKey() + " [" + kv.getValue() + "]").collect(Collectors.joining(", "));
log.info("Transport Stats: {}", values);
}
}
}
|
repos\thingsboard-master\common\transport\transport-api\src\main\java\org\thingsboard\server\common\transport\service\DefaultTransportService.java
| 2
|
请完成以下Java代码
|
public void setId(String id) {
this.id = id;
}
@CamundaQueryParam(value="type", converter = IntegerConverter.class)
public void setType(Integer type) {
this.type = type;
}
@CamundaQueryParam(value="userIdIn", converter = StringArrayConverter.class)
public void setUserIdIn(String[] userIdIn) {
this.userIdIn = userIdIn;
}
@CamundaQueryParam(value="groupIdIn", converter = StringArrayConverter.class)
public void setGroupIdIn(String[] groupIdIn) {
this.groupIdIn = groupIdIn;
}
@CamundaQueryParam(value="resourceType", converter = IntegerConverter.class)
public void setResourceType(int resourceType) {
this.resourceType = resourceType;
}
@CamundaQueryParam("resourceId")
public void setResourceId(String resourceId) {
this.resourceId = resourceId;
}
protected boolean isValidSortByValue(String value) {
return VALID_SORT_BY_VALUES.contains(value);
}
protected AuthorizationQuery createNewQuery(ProcessEngine engine) {
return engine.getAuthorizationService().createAuthorizationQuery();
}
|
protected void applyFilters(AuthorizationQuery query) {
if (id != null) {
query.authorizationId(id);
}
if (type != null) {
query.authorizationType(type);
}
if (userIdIn != null) {
query.userIdIn(userIdIn);
}
if (groupIdIn != null) {
query.groupIdIn(groupIdIn);
}
if (resourceType != null) {
query.resourceType(resourceType);
}
if (resourceId != null) {
query.resourceId(resourceId);
}
}
@Override
protected void applySortBy(AuthorizationQuery query, String sortBy, Map<String, Object> parameters, ProcessEngine engine) {
if (sortBy.equals(SORT_BY_RESOURCE_ID)) {
query.orderByResourceId();
} else if (sortBy.equals(SORT_BY_RESOURCE_TYPE)) {
query.orderByResourceType();
}
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\authorization\AuthorizationQueryDto.java
| 1
|
请完成以下Java代码
|
public class ReladomoConnectionManager implements SourcelessConnectionManager {
private static ReladomoConnectionManager instance;
private XAConnectionManager xaConnectionManager;
private final String databaseName = "myDb";
public static synchronized ReladomoConnectionManager getInstance() {
if (instance == null) {
instance = new ReladomoConnectionManager();
}
return instance;
}
private ReladomoConnectionManager() {
this.createConnectionManager();
}
private XAConnectionManager createConnectionManager() {
xaConnectionManager = new XAConnectionManager();
xaConnectionManager.setDriverClassName("org.h2.Driver");
xaConnectionManager.setJdbcConnectionString("jdbc:h2:mem:" + databaseName);
xaConnectionManager.setJdbcUser("sa");
xaConnectionManager.setJdbcPassword("");
xaConnectionManager.setPoolName("My Connection Pool");
xaConnectionManager.setInitialSize(1);
xaConnectionManager.setPoolSize(10);
xaConnectionManager.initialisePool();
return xaConnectionManager;
}
@Override
public BulkLoader createBulkLoader() throws BulkLoaderException {
return null;
}
@Override
|
public Connection getConnection() {
return xaConnectionManager.getConnection();
}
@Override
public DatabaseType getDatabaseType() {
return H2DatabaseType.getInstance();
}
@Override
public TimeZone getDatabaseTimeZone() {
return TimeZone.getDefault();
}
@Override
public String getDatabaseIdentifier() {
return databaseName;
}
public void createTables() throws Exception {
Path ddlPath = Paths.get(ClassLoader.getSystemResource("sql").toURI());
try (Connection conn = xaConnectionManager.getConnection(); Stream<Path> list = Files.list(ddlPath);) {
list.forEach(path -> {
try {
RunScript.execute(conn, Files.newBufferedReader(path));
} catch (SQLException | IOException exc) {
exc.printStackTrace();
}
});
}
}
}
|
repos\tutorials-master\libraries-data-db-2\src\main\java\com\baeldung\libraries\reladomo\ReladomoConnectionManager.java
| 1
|
请完成以下Java代码
|
public String toString()
{
return MoreObjects.toStringHelper(this)
.omitNullValues()
.add("windowId", windowId)
.add("id", id)
.add("tablId", tabId)
.add("rowId", rowId)
.toString();
}
@JsonIgnore
protected final void setUnboxPasswordFields()
{
this.unboxPasswordFields = true;
}
@JsonIgnore
public WindowId getWindowId()
{
return windowId;
}
@JsonIgnore
public DocumentId getId()
{
return id;
}
@JsonIgnore
public String getTabId()
{
return tabId;
}
@JsonIgnore
public DocumentId getRowId()
{
return rowId;
}
public final void setDeleted()
{
deleted = Boolean.TRUE;
}
@JsonAnyGetter
private Map<String, Object> getOtherProperties()
{
return otherProperties;
}
@JsonAnySetter
private void putOtherProperty(final String name, final Object jsonValue)
{
|
otherProperties.put(name, jsonValue);
}
protected final JSONDocumentBase putDebugProperty(final String name, final Object jsonValue)
{
otherProperties.put("debug-" + name, jsonValue);
return this;
}
public final void setFields(final Collection<JSONDocumentField> fields)
{
setFields(fields == null ? null : Maps.uniqueIndex(fields, JSONDocumentField::getField));
}
@JsonIgnore
protected final void setFields(final Map<String, JSONDocumentField> fieldsByName)
{
this.fieldsByName = fieldsByName;
if (unboxPasswordFields && fieldsByName != null && !fieldsByName.isEmpty())
{
fieldsByName.forEach((fieldName, field) -> field.unboxPasswordField());
}
}
@JsonIgnore
protected final int getFieldsCount()
{
return fieldsByName == null ? 0 : fieldsByName.size();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\datatypes\json\JSONDocumentBase.java
| 1
|
请完成以下Java代码
|
public class ExpressionPlanItemLifecycleListener implements PlanItemInstanceLifecycleListener {
protected String sourceState;
protected String targetState;
protected Expression expression;
public ExpressionPlanItemLifecycleListener(String sourceState, String targetState, Expression expression) {
this.sourceState = sourceState;
this.targetState = targetState;
this.expression = expression;
}
@Override
public String getSourceState() {
return sourceState;
}
@Override
public String getTargetState() {
|
return targetState;
}
@Override
public void stateChanged(DelegatePlanItemInstance planItemInstance, String oldState, String newState) {
expression.getValue(planItemInstance);
}
/**
* returns the expression text for this task listener.
*/
public String getExpressionText() {
return expression.getExpressionText();
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\listener\ExpressionPlanItemLifecycleListener.java
| 1
|
请完成以下Java代码
|
private JWK getJwk() {
return this.jwk;
}
}
/**
* A context that holds client authentication-specific state and is used by
* {@link NimbusJwtClientAuthenticationParametersConverter} when attempting to
* customize the JSON Web Token (JWS) client assertion.
*
* @param <T> the type of {@link AbstractOAuth2AuthorizationGrantRequest}
* @since 5.7
*/
public static final class JwtClientAuthenticationContext<T extends AbstractOAuth2AuthorizationGrantRequest> {
private final T authorizationGrantRequest;
private final JwsHeader.Builder headers;
private final JwtClaimsSet.Builder claims;
private JwtClientAuthenticationContext(T authorizationGrantRequest, JwsHeader.Builder headers,
JwtClaimsSet.Builder claims) {
this.authorizationGrantRequest = authorizationGrantRequest;
this.headers = headers;
this.claims = claims;
}
/**
* Returns the {@link AbstractOAuth2AuthorizationGrantRequest authorization grant
* request}.
* @return the {@link AbstractOAuth2AuthorizationGrantRequest authorization grant
* request}
|
*/
public T getAuthorizationGrantRequest() {
return this.authorizationGrantRequest;
}
/**
* Returns the {@link JwsHeader.Builder} to be used to customize headers of the
* JSON Web Token (JWS).
* @return the {@link JwsHeader.Builder} to be used to customize headers of the
* JSON Web Token (JWS)
*/
public JwsHeader.Builder getHeaders() {
return this.headers;
}
/**
* Returns the {@link JwtClaimsSet.Builder} to be used to customize claims of the
* JSON Web Token (JWS).
* @return the {@link JwtClaimsSet.Builder} to be used to customize claims of the
* JSON Web Token (JWS)
*/
public JwtClaimsSet.Builder getClaims() {
return this.claims;
}
}
}
|
repos\spring-security-main\oauth2\oauth2-client\src\main\java\org\springframework\security\oauth2\client\endpoint\NimbusJwtClientAuthenticationParametersConverter.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public FlatFileItemReader<String> flatFileItemReader() {
return new FlatFileItemReaderBuilder<String>()
.name("itemReader")
.resource(new ClassPathResource("data.csv"))
.lineMapper(new PassThroughLineMapper())
.saveState(true)
.build();
}
@Bean
public RestartItemProcessor itemProcessor() {
return new RestartItemProcessor();
}
@Bean
public ItemWriter<String> itemWriter() {
return items -> {
System.out.println("Writing items:");
for (String item : items) {
System.out.println("- " + item);
|
}
};
}
static class RestartItemProcessor implements ItemProcessor<String, String> {
private boolean failOnItem3 = true;
public void setFailOnItem3(boolean failOnItem3) {
this.failOnItem3 = failOnItem3;
}
@Override
public String process(String item) throws Exception {
System.out.println("Processing: " + item + " (failOnItem3=" + failOnItem3 + ")");
if (failOnItem3 && item.equals("Item3")) {
throw new RuntimeException("Simulated failure on Item3");
}
return "PROCESSED " + item;
}
}
}
|
repos\tutorials-master\spring-batch-2\src\main\java\com\baeldung\restartjob\BatchConfig.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public Date getCollectDate() {
return collectDate;
}
/**
* 汇总日期
*/
public void setCollectDate(Date collectDate) {
this.collectDate = collectDate;
}
/**
* 总金额
*/
public BigDecimal getTotalAmount() {
return totalAmount;
}
/**
* 总金额
*/
public void setTotalAmount(BigDecimal totalAmount) {
this.totalAmount = totalAmount;
}
/**
* 总笔数
*/
public Integer getTotalNum() {
return totalNum;
}
/**
* 总笔数
*/
public void setTotalNum(Integer totalNum) {
this.totalNum = totalNum;
}
/**
* 最后ID
*
* @return
*/
public Long getLastId() {
return lastId;
}
/**
* 最后ID
|
*
* @return
*/
public void setLastId(Long lastId) {
this.lastId = lastId;
}
/**
* 风险预存期
*/
public Integer getRiskDay() {
return riskDay;
}
/**
* 风险预存期
*/
public void setRiskDay(Integer riskDay) {
this.riskDay = riskDay;
}
}
|
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\account\vo\DailyCollectAccountHistoryVo.java
| 2
|
请完成以下Java代码
|
public static EligibleCarrierAdviseRequest of(@NonNull final ShipmentSchedule shipmentSchedule)
{
return EligibleCarrierAdviseRequest.builder()
.shipmentScheduleId(shipmentSchedule.getId())
.shipperId(shipmentSchedule.getShipperId())
.isProcessed(shipmentSchedule.isProcessed())
.isClosed(shipmentSchedule.isClosed())
.isActive(shipmentSchedule.isActive())
.quantityToDeliver(shipmentSchedule.getQuantityToDeliver().toBigDecimal())
.carrierAdvisingStatus(shipmentSchedule.getCarrierAdvisingStatus())
.build();
}
}
public boolean isEligibleForAutoCarrierAdvise(@NonNull final I_M_ShipmentSchedule shipmentSchedule)
{
final EligibleCarrierAdviseRequest request = EligibleCarrierAdviseRequest.of(shipmentSchedule, shipmentScheduleEffectiveBL);
return isEligibleForCarrierAdvise(request.toBuilder().isAuto(true).build());
}
public boolean isNotEligibleForManualCarrierAdvise(@NonNull final ShipmentSchedule shipmentSchedule, final boolean isIncludeCarrierAdviseManual)
{
final EligibleCarrierAdviseRequest request = EligibleCarrierAdviseRequest.of(shipmentSchedule);
return !isEligibleForCarrierAdvise(request.toBuilder().isIncludeCarrierAdviseManual(isIncludeCarrierAdviseManual).build());
}
private boolean isEligibleForCarrierAdvise(@NonNull final EligibleCarrierAdviseRequest request)
{
|
if (request.getShipperId() == null
|| request.isProcessed()
|| request.isClosed()
|| !request.isActive()
|| request.getQuantityToDeliver().signum() <= 0)
{
return false;
}
final CarrierAdviseStatus carrierAdviseStatus = request.getCarrierAdvisingStatus();
if (request.isAuto)
{
if (carrierAdviseStatus != null && !carrierAdviseStatus.isEligibleForAutoEnqueue()) {return false;}
}
else
{ // Manual
if (carrierAdviseStatus == null || !carrierAdviseStatus.isEligibleForManualEnqueue()) {return false;}
if (!request.isIncludeCarrierAdviseManual && carrierAdviseStatus.isManual()) {return false;}
}
final ShipmentScheduleId shipmentScheduleId = request.getShipmentScheduleId();
if (shipmentScheduleId == null) {return true;}
return !pickingJobScheduleRepository.anyMatch(PickingJobScheduleQuery.builder().onlyShipmentScheduleId(shipmentScheduleId).build());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\inoutcandidate\ShipmentScheduleService.java
| 1
|
请完成以下Java代码
|
public BigDecimal getQtyReview()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyReview);
return bd != null ? bd : BigDecimal.ZERO;
}
/**
* RejectReason AD_Reference_ID=541422
* Reference name: QtyNotPicked RejectReason
*/
public static final int REJECTREASON_AD_Reference_ID=541422;
/** NotFound = N */
public static final String REJECTREASON_NotFound = "N";
/** Damaged = D */
public static final String REJECTREASON_Damaged = "D";
@Override
public void setRejectReason (final @Nullable java.lang.String RejectReason)
{
set_Value (COLUMNNAME_RejectReason, RejectReason);
}
@Override
public java.lang.String getRejectReason()
{
return get_ValueAsString(COLUMNNAME_RejectReason);
}
/**
* Status AD_Reference_ID=540734
* Reference name: M_Picking_Candidate_Status
*/
public static final int STATUS_AD_Reference_ID=540734;
/** Closed = CL */
public static final String STATUS_Closed = "CL";
|
/** InProgress = IP */
public static final String STATUS_InProgress = "IP";
/** Processed = PR */
public static final String STATUS_Processed = "PR";
/** Voided = VO */
public static final String STATUS_Voided = "VO";
@Override
public void setStatus (final java.lang.String Status)
{
set_Value (COLUMNNAME_Status, Status);
}
@Override
public java.lang.String getStatus()
{
return get_ValueAsString(COLUMNNAME_Status);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java-gen\de\metas\handlingunits\model\X_M_Picking_Candidate.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public @Nullable String getToken() {
return this.token;
}
public void setToken(@Nullable String token) {
this.token = token;
}
public Format getFormat() {
return this.format;
}
public void setFormat(Format format) {
this.format = format;
}
public enum Format {
/**
* Push metrics in text format.
*/
TEXT,
/**
* Push metrics in protobuf format.
*/
PROTOBUF
|
}
public enum Scheme {
/**
* Use HTTP to push metrics.
*/
HTTP,
/**
* Use HTTPS to push metrics.
*/
HTTPS
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\export\prometheus\PrometheusProperties.java
| 2
|
请完成以下Java代码
|
public ImmutablePair<BigDecimal, Integer> getAsQuantity()
{
try
{
final List<String> parts = Splitter.on(QTY_SEPARATOR).splitToList(value);
if (parts.size() != 2)
{
throw new AdempiereException("Cannot get Quantity from " + this);
}
return ImmutablePair.of(new BigDecimal(parts.get(0)), Integer.parseInt(parts.get(1)));
}
catch (AdempiereException ex)
{
throw ex;
}
|
catch (final Exception ex)
{
throw new AdempiereException("Cannot get Quantity from " + this, ex);
}
}
@NonNull
public String getAsString() {return value;}
@NonNull
public <T> T deserializeTo(@NonNull final Class<T> targetClass)
{
return JSONObjectMapper.forClass(targetClass).readValue(value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\rest_workflows\facets\WorkflowLaunchersFacetId.java
| 1
|
请完成以下Java代码
|
public final List<I_C_DunningLevel> retrieveDunningLevels(final I_C_Dunning dunning)
{
final Properties ctx = InterfaceWrapperHelper.getCtx(dunning);
final String trxName = InterfaceWrapperHelper.getTrxName(dunning);
final int dunningId = dunning.getC_Dunning_ID();
return retrieveDunningLevels(ctx, dunningId, trxName);
}
@Override
public final List<I_C_DunningDoc_Line> retrieveDunningDocLines(@NonNull final I_C_DunningDoc dunningDoc)
{
return Services.get(IQueryBL.class).createQueryBuilder(I_C_DunningDoc_Line.class)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_C_DunningDoc_Line.COLUMN_C_DunningDoc_ID, dunningDoc.getC_DunningDoc_ID())
.orderBy()
.addColumn(I_C_DunningDoc_Line.COLUMN_C_DunningDoc_Line_ID).endOrderBy()
.create()
.list();
}
@Override
public final List<I_C_DunningDoc_Line_Source> retrieveDunningDocLineSources(@NonNull final I_C_DunningDoc_Line line)
{
return Services.get(IQueryBL.class)
.createQueryBuilder(I_C_DunningDoc_Line_Source.class)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_C_DunningDoc_Line_Source.COLUMN_C_DunningDoc_Line_ID, line.getC_DunningDoc_Line_ID())
.orderBy()
.addColumn(I_C_DunningDoc_Line_Source.COLUMN_C_DunningDoc_Line_Source_ID).endOrderBy()
.create()
.list();
}
@Cached(cacheName = I_C_DunningLevel.Table_Name + "_for_C_Dunning_ID")
/* package */ List<I_C_DunningLevel> retrieveDunningLevels(@CacheCtx Properties ctx, int dunningId, @CacheTrx String trxName)
|
{
return Services.get(IQueryBL.class).createQueryBuilder(I_C_DunningLevel.class, ctx, trxName)
.addEqualsFilter(I_C_DunningLevel.COLUMNNAME_C_Dunning_ID, dunningId)
.addOnlyActiveRecordsFilter()
.orderBy()
.addColumn(I_C_DunningLevel.COLUMNNAME_DaysAfterDue)
.addColumn(I_C_DunningLevel.COLUMNNAME_DaysBetweenDunning)
.addColumn(I_C_DunningLevel.COLUMNNAME_C_DunningLevel_ID)
.endOrderBy()
.create()
.list();
}
protected abstract List<I_C_Dunning_Candidate> retrieveDunningCandidates(IDunningContext context, IDunningCandidateQuery query);
protected abstract I_C_Dunning_Candidate retrieveDunningCandidate(IDunningContext context, IDunningCandidateQuery query);
protected abstract Iterator<I_C_Dunning_Candidate> retrieveDunningCandidatesIterator(IDunningContext context, IDunningCandidateQuery query);
@Override
public I_C_DunningDoc getByIdInTrx(@NonNull final DunningDocId dunningDocId)
{
return load(dunningDocId, I_C_DunningDoc.class);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.dunning\src\main\java\de\metas\dunning\api\impl\AbstractDunningDAO.java
| 1
|
请完成以下Java代码
|
private void skipSeparatorIfPresent()
{
if (position < sequence.length() && sequence.charAt(position) == SEPARATOR_CHAR)
{
position++;
}
}
public int remainingLength()
{
return sequence.length() - position;
}
public boolean startsWith(String prefix)
{
return sequence.startsWith(prefix, position);
}
private char readChar()
|
{
return sequence.charAt(position++);
}
public String read(int length)
{
String s = peek(length);
position += length;
return s;
}
public String peek(int length)
{
return sequence.substring(position, position + length);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\gs1\GS1SequenceReader.java
| 1
|
请完成以下Java代码
|
public static String usingCustomOutputStream(String input) throws IOException {
if (input == null) {
return null;
}
String output;
try (CustomOutputStream outputStream = new CustomOutputStream(); PrintStream printStream = new PrintStream(outputStream)) {
printStream.print(input);
output = outputStream.toString();
}
return output;
}
|
private static class CustomOutputStream extends OutputStream {
private StringBuilder stringBuilder = new StringBuilder();
@Override
public void write(int b) throws IOException {
this.stringBuilder.append((char) b);
}
@Override
public String toString() {
return this.stringBuilder.toString();
}
}
}
|
repos\tutorials-master\core-java-modules\core-java-io-conversions-2\src\main\java\com\baeldung\printstreamtostring\PrintStreamToStringUtil.java
| 1
|
请完成以下Java代码
|
public int getC_Flatrate_Matching_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Flatrate_Matching_ID);
}
@Override
public de.metas.contracts.model.I_C_Flatrate_Transition getC_Flatrate_Transition()
{
return get_ValueAsPO(COLUMNNAME_C_Flatrate_Transition_ID, de.metas.contracts.model.I_C_Flatrate_Transition.class);
}
@Override
public void setC_Flatrate_Transition(final de.metas.contracts.model.I_C_Flatrate_Transition C_Flatrate_Transition)
{
set_ValueFromPO(COLUMNNAME_C_Flatrate_Transition_ID, de.metas.contracts.model.I_C_Flatrate_Transition.class, C_Flatrate_Transition);
}
@Override
public void setC_Flatrate_Transition_ID (final int C_Flatrate_Transition_ID)
{
if (C_Flatrate_Transition_ID < 1)
set_Value (COLUMNNAME_C_Flatrate_Transition_ID, null);
else
set_Value (COLUMNNAME_C_Flatrate_Transition_ID, C_Flatrate_Transition_ID);
}
@Override
public int getC_Flatrate_Transition_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Flatrate_Transition_ID);
}
@Override
public void setM_PricingSystem_ID (final int M_PricingSystem_ID)
{
if (M_PricingSystem_ID < 1)
set_Value (COLUMNNAME_M_PricingSystem_ID, null);
else
set_Value (COLUMNNAME_M_PricingSystem_ID, M_PricingSystem_ID);
}
@Override
public int getM_PricingSystem_ID()
{
return get_ValueAsInt(COLUMNNAME_M_PricingSystem_ID);
}
@Override
public void setM_Product_Category_Matching_ID (final int M_Product_Category_Matching_ID)
{
if (M_Product_Category_Matching_ID < 1)
set_Value (COLUMNNAME_M_Product_Category_Matching_ID, null);
else
set_Value (COLUMNNAME_M_Product_Category_Matching_ID, M_Product_Category_Matching_ID);
}
@Override
public int getM_Product_Category_Matching_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_Category_Matching_ID);
|
}
@Override
public void setM_Product_ID (final int M_Product_ID)
{
if (M_Product_ID < 1)
set_Value (COLUMNNAME_M_Product_ID, null);
else
set_Value (COLUMNNAME_M_Product_ID, M_Product_ID);
}
@Override
public int getM_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
@Override
public void setQtyPerDelivery (final BigDecimal QtyPerDelivery)
{
set_Value (COLUMNNAME_QtyPerDelivery, QtyPerDelivery);
}
@Override
public BigDecimal getQtyPerDelivery()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyPerDelivery);
return bd != null ? bd : BigDecimal.ZERO;
}
@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.contracts\src\main\java-gen\de\metas\contracts\model\X_C_Flatrate_Matching.java
| 1
|
请完成以下Java代码
|
public boolean isSummary ()
{
Object oo = get_Value(COLUMNNAME_IsSummary);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
@Override
public void setName (java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
@Override
public java.lang.String getName ()
{
return (java.lang.String)get_Value(COLUMNNAME_Name);
}
/** Set Board.
@param WEBUI_Board_ID Board */
@Override
public void setWEBUI_Board_ID (int WEBUI_Board_ID)
{
if (WEBUI_Board_ID < 1)
set_Value (COLUMNNAME_WEBUI_Board_ID, null);
else
set_Value (COLUMNNAME_WEBUI_Board_ID, Integer.valueOf(WEBUI_Board_ID));
}
/** Get Board.
@return Board */
@Override
public int getWEBUI_Board_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_WEBUI_Board_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Browse name.
@param WEBUI_NameBrowse Browse name */
|
@Override
public void setWEBUI_NameBrowse (java.lang.String WEBUI_NameBrowse)
{
set_Value (COLUMNNAME_WEBUI_NameBrowse, WEBUI_NameBrowse);
}
/** Get Browse name.
@return Browse name */
@Override
public java.lang.String getWEBUI_NameBrowse ()
{
return (java.lang.String)get_Value(COLUMNNAME_WEBUI_NameBrowse);
}
/** Set New record name.
@param WEBUI_NameNew New record name */
@Override
public void setWEBUI_NameNew (java.lang.String WEBUI_NameNew)
{
set_Value (COLUMNNAME_WEBUI_NameNew, WEBUI_NameNew);
}
/** Get New record name.
@return New record name */
@Override
public java.lang.String getWEBUI_NameNew ()
{
return (java.lang.String)get_Value(COLUMNNAME_WEBUI_NameNew);
}
/** Set New record name (breadcrumb).
@param WEBUI_NameNewBreadcrumb New record name (breadcrumb) */
@Override
public void setWEBUI_NameNewBreadcrumb (java.lang.String WEBUI_NameNewBreadcrumb)
{
set_Value (COLUMNNAME_WEBUI_NameNewBreadcrumb, WEBUI_NameNewBreadcrumb);
}
/** Get New record name (breadcrumb).
@return New record name (breadcrumb) */
@Override
public java.lang.String getWEBUI_NameNewBreadcrumb ()
{
return (java.lang.String)get_Value(COLUMNNAME_WEBUI_NameNewBreadcrumb);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Menu.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class RpNotifyRecord extends BaseEntity {
// private Long notifyId;
//
// public Long getNotifyId() {
// return notifyId;
// }
private Date createTime;
/** 最后一次通知时间 **/
private Date lastNotifyTime;
/** 通知次数 **/
private Integer notifyTimes = 0;
/** 限制通知次数 **/
private Integer limitNotifyTimes = 5;
/** 通知URL **/
private String url;
/** 商户编号 **/
private String merchantNo;
/** 商户订单号 **/
private String merchantOrderNo;
/** 通知类型 NotifyTypeEnum **/
private String notifyType;
public RpNotifyRecord() {
super();
}
public RpNotifyRecord(Date createTime, Date lastNotifyTime, Integer notifyTimes, Integer limitNotifyTimes, String url, String merchantNo,
String merchantOrderNo, NotifyStatusEnum status, NotifyTypeEnum type) {
super();
this.createTime = createTime;
this.lastNotifyTime = lastNotifyTime;
this.notifyTimes = notifyTimes;
this.limitNotifyTimes = limitNotifyTimes;
this.url = url;
this.merchantNo = merchantNo;
this.merchantOrderNo = merchantOrderNo;
this.notifyType = type.name();
super.setStatus(status.name());
}
/** 最后一次通知时间 **/
public Date getLastNotifyTime() {
return lastNotifyTime;
}
/** 最后一次通知时间 **/
public void setLastNotifyTime(Date lastNotifyTime) {
this.lastNotifyTime = lastNotifyTime;
}
/** 通知次数 **/
public Integer getNotifyTimes() {
return notifyTimes;
}
/** 通知次数 **/
public void setNotifyTimes(Integer notifyTimes) {
this.notifyTimes = notifyTimes;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
|
}
/** 限制通知次数 **/
public Integer getLimitNotifyTimes() {
return limitNotifyTimes;
}
/** 限制通知次数 **/
public void setLimitNotifyTimes(Integer limitNotifyTimes) {
this.limitNotifyTimes = limitNotifyTimes;
}
/** 通知URL **/
public String getUrl() {
return url;
}
/** 通知URL **/
public void setUrl(String url) {
this.url = url == null ? null : url.trim();
}
/** 商户编号 **/
public String getMerchantNo() {
return merchantNo;
}
/** 商户编号 **/
public void setMerchantNo(String merchantNo) {
this.merchantNo = merchantNo == null ? null : merchantNo.trim();
}
/** 商户订单号 **/
public String getMerchantOrderNo() {
return merchantOrderNo;
}
/** 商户订单号 **/
public void setMerchantOrderNo(String merchantOrderNo) {
this.merchantOrderNo = merchantOrderNo == null ? null : merchantOrderNo.trim();
}
public String getNotifyType() {
return notifyType;
}
public void setNotifyType(String notifyType) {
this.notifyType = notifyType;
}
}
|
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\notify\entity\RpNotifyRecord.java
| 2
|
请完成以下Java代码
|
public String getUsername() {
return username;
}
/**
* @param username the username to set
*/
public void setUsername(String username) {
this.username = username;
}
/**
* @return the firstname
*/
public String getFirstname() {
return firstname;
}
/**
|
* @param firstname the firstname to set
*/
public void setFirstname(String firstname) {
this.firstname = firstname;
}
/**
* @return the lastname
*/
public String getLastname() {
return lastname;
}
/**
* @param lastname the lastname to set
*/
public void setLastname(String lastname) {
this.lastname = lastname;
}
}
|
repos\spring-data-examples-main\jpa\example\src\main\java\example\springdata\jpa\caching\User.java
| 1
|
请完成以下Java代码
|
public void apply(String userId, UserAddressAddedEvent event) {
Address address = new Address(event.getCity(), event.getState(), event.getPostCode());
UserAddress userAddress = Optional.ofNullable(readRepository.getUserAddress(userId))
.orElse(new UserAddress());
Set<Address> addresses = Optional.ofNullable(userAddress.getAddressByRegion()
.get(address.getState()))
.orElse(new HashSet<>());
addresses.add(address);
userAddress.getAddressByRegion()
.put(address.getState(), addresses);
readRepository.addUserAddress(userId, userAddress);
}
public void apply(String userId, UserAddressRemovedEvent event) {
Address address = new Address(event.getCity(), event.getState(), event.getPostCode());
UserAddress userAddress = readRepository.getUserAddress(userId);
if (userAddress != null) {
Set<Address> addresses = userAddress.getAddressByRegion()
.get(address.getState());
if (addresses != null)
addresses.remove(address);
readRepository.addUserAddress(userId, userAddress);
}
}
public void apply(String userId, UserContactAddedEvent event) {
|
Contact contact = new Contact(event.getContactType(), event.getContactDetails());
UserContact userContact = Optional.ofNullable(readRepository.getUserContact(userId))
.orElse(new UserContact());
Set<Contact> contacts = Optional.ofNullable(userContact.getContactByType()
.get(contact.getType()))
.orElse(new HashSet<>());
contacts.add(contact);
userContact.getContactByType()
.put(contact.getType(), contacts);
readRepository.addUserContact(userId, userContact);
}
public void apply(String userId, UserContactRemovedEvent event) {
Contact contact = new Contact(event.getContactType(), event.getContactDetails());
UserContact userContact = readRepository.getUserContact(userId);
if (userContact != null) {
Set<Contact> contacts = userContact.getContactByType()
.get(contact.getType());
if (contacts != null)
contacts.remove(contact);
readRepository.addUserContact(userId, userContact);
}
}
}
|
repos\tutorials-master\patterns-modules\cqrs-es\src\main\java\com\baeldung\patterns\escqrs\projectors\UserProjector.java
| 1
|
请完成以下Java代码
|
public class MessageIdentification2 {
@XmlElement(name = "MsgNmId")
protected String msgNmId;
@XmlElement(name = "MsgId")
protected String msgId;
/**
* Gets the value of the msgNmId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMsgNmId() {
return msgNmId;
}
/**
* Sets the value of the msgNmId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMsgNmId(String value) {
this.msgNmId = value;
}
/**
* Gets the value of the msgId property.
*
|
* @return
* possible object is
* {@link String }
*
*/
public String getMsgId() {
return msgId;
}
/**
* Sets the value of the msgId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMsgId(String value) {
this.msgId = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_02\MessageIdentification2.java
| 1
|
请完成以下Java代码
|
public void setPayPal_AuthorizationId (final @Nullable java.lang.String PayPal_AuthorizationId)
{
set_Value (COLUMNNAME_PayPal_AuthorizationId, PayPal_AuthorizationId);
}
@Override
public java.lang.String getPayPal_AuthorizationId()
{
return get_ValueAsString(COLUMNNAME_PayPal_AuthorizationId);
}
@Override
public void setPayPal_Order_ID (final int PayPal_Order_ID)
{
if (PayPal_Order_ID < 1)
set_ValueNoCheck (COLUMNNAME_PayPal_Order_ID, null);
else
set_ValueNoCheck (COLUMNNAME_PayPal_Order_ID, PayPal_Order_ID);
}
@Override
public int getPayPal_Order_ID()
{
return get_ValueAsInt(COLUMNNAME_PayPal_Order_ID);
}
@Override
public void setPayPal_OrderJSON (final @Nullable java.lang.String PayPal_OrderJSON)
{
set_Value (COLUMNNAME_PayPal_OrderJSON, PayPal_OrderJSON);
}
@Override
public java.lang.String getPayPal_OrderJSON()
{
return get_ValueAsString(COLUMNNAME_PayPal_OrderJSON);
}
@Override
public void setPayPal_PayerApproveUrl (final @Nullable java.lang.String PayPal_PayerApproveUrl)
{
set_Value (COLUMNNAME_PayPal_PayerApproveUrl, PayPal_PayerApproveUrl);
|
}
@Override
public java.lang.String getPayPal_PayerApproveUrl()
{
return get_ValueAsString(COLUMNNAME_PayPal_PayerApproveUrl);
}
@Override
public void setStatus (final java.lang.String Status)
{
set_Value (COLUMNNAME_Status, Status);
}
@Override
public java.lang.String getStatus()
{
return get_ValueAsString(COLUMNNAME_Status);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.paypal\src\main\java-gen\de\metas\payment\paypal\model\X_PayPal_Order.java
| 1
|
请完成以下Java代码
|
public static String checkBrowse(HttpServletRequest request) {
String userAgent = request.getHeader("USER-AGENT");
if (regex(OPERA, userAgent)) {
return OPERA;
}
if (regex(CHROME, userAgent)) {
return CHROME;
}
if (regex(FIREFOX, userAgent)) {
return FIREFOX;
}
if (regex(SAFARI, userAgent)) {
return SAFARI;
}
if (regex(SE360, userAgent)) {
return SE360;
}
if (regex(GREEN, userAgent)) {
return GREEN;
}
if (regex(QQ, userAgent)) {
return QQ;
}
if (regex(MAXTHON, userAgent)) {
return MAXTHON;
}
if (regex(IE11, userAgent)) {
return IE11;
}
if (regex(IE10, userAgent)) {
return IE10;
}
if (regex(IE9, userAgent)) {
return IE9;
}
if (regex(IE8, userAgent)) {
return IE8;
}
if (regex(IE7, userAgent)) {
return IE7;
}
if (regex(IE6, userAgent)) {
return IE6;
}
return OTHER;
}
public static boolean regex(String regex, String str) {
Pattern p = Pattern.compile(regex, Pattern.MULTILINE);
Matcher m = p.matcher(str);
return m.find();
}
private static Map<String, String> langMap = new HashMap<String, String>();
private final static String ZH = "zh";
private final static String ZH_CN = "zh-cn";
private final static String EN = "en";
private final static String EN_US = "en";
static
{
langMap.put(ZH, ZH_CN);
|
langMap.put(EN, EN_US);
}
public static String getBrowserLanguage(HttpServletRequest request) {
String browserLang = request.getLocale().getLanguage();
String browserLangCode = (String)langMap.get(browserLang);
if(browserLangCode == null)
{
browserLangCode = EN_US;
}
return browserLangCode;
}
/** 判断请求是否来自电脑端 */
public static boolean isDesktop(HttpServletRequest request) {
return !isMobile(request);
}
/** 判断请求是否来自移动端 */
public static boolean isMobile(HttpServletRequest request) {
String ua = request.getHeader("User-Agent").toLowerCase();
String type = "(phone|pad|pod|iphone|ipod|ios|ipad|android|mobile|blackberry|iemobile|mqqbrowser|juc|fennec|wosbrowser|browserng|webos|symbian|windows phone)";
Pattern pattern = Pattern.compile(type);
return pattern.matcher(ua).find();
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-boot-base-core\src\main\java\org\jeecg\common\util\BrowserUtils.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public final class OrgImageClassLoaderHook
{
public static OrgImageClassLoaderHook newInstance()
{
return new OrgImageClassLoaderHook();
}
// services
private static final transient Logger logger = LogManager.getLogger(OrgImageClassLoaderHook.class);
private static final CCache<OrgResourceNameContext, Optional<File>> imageLocalFileByOrgId = CCache.<OrgResourceNameContext, Optional<File>>builder()
.initialCapacity(10)
.tableName(I_AD_Image.Table_Name)
.additionalTableNameToResetFor(I_AD_ClientInfo.Table_Name) // FRESH-327
.additionalTableNameToResetFor(I_AD_OrgInfo.Table_Name) // FRESH-327
.additionalTableNameToResetFor(I_C_BPartner.Table_Name) // for C_BPartner.Logo_ID FRESH-356
.build();
private final OrgImageLocalFileLoader orgImageLocalFileLoader = new OrgImageLocalFileLoader();
private OrgImageClassLoaderHook()
{
}
@Nullable
public URL getResourceURLOrNull(
@NonNull final OrgId adOrgId,
@Nullable final String resourceName)
{
if (resourceName == null)
{
return null;
}
final OrgResourceNameContext context = OrgResourceNameContext.builder()
.orgId(adOrgId)
.resourceName(resourceName)
.build();
if (!orgImageLocalFileLoader.isLogoOrImageResourceName(context))
{
return null;
}
//
// Get the local image file
final File imageFile = getLocalImageFile(context)
.orElseGet(ImageUtils::getEmptyPNGFile);
//
// Convert the image file to URL
try
{
return imageFile.toURI().toURL();
}
catch (final MalformedURLException ex)
|
{
logger.warn("Failed converting the local image file to URL: {}", imageFile, ex);
return null;
}
}
private Optional<File> getLocalImageFile(@NonNull final OrgResourceNameContext context)
{
File imageFile = imageLocalFileByOrgId
.getOrLoad(context, orgImageLocalFileLoader::getImageLocalFile)
.orElse(null);
// If image file does not exist or it's not readable, try recreating it
if (imageFile != null && !imageFile.canRead())
{
imageLocalFileByOrgId.remove(context); // invalidate current cached record
imageFile = imageLocalFileByOrgId
.getOrLoad(context, orgImageLocalFileLoader::getImageLocalFile)
.orElse(null);
}
return Optional.ofNullable(imageFile);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.report\metasfresh-report-service\src\main\java\de\metas\report\jasper\class_loader\images\org\OrgImageClassLoaderHook.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class CommissionPoints
{
public static final CommissionPoints ZERO = new CommissionPoints(BigDecimal.ZERO);
@NonNull
BigDecimal points;
public static CommissionPoints of(@NonNull final String points)
{
return of(new BigDecimal(points));
}
@JsonCreator
public static CommissionPoints of(@NonNull final BigDecimal points)
{
if (points.signum() == 0)
{
return ZERO;
}
return new CommissionPoints(points);
}
public static CommissionPoints sum(@NonNull final Collection<CommissionPoints> augents)
{
final BigDecimal sum = augents.stream()
.map(CommissionPoints::toBigDecimal)
.reduce(ONE, BigDecimal::add);
return new CommissionPoints(sum);
}
private CommissionPoints(@NonNull final BigDecimal points)
{
this.points = points;
}
@JsonValue
public BigDecimal toBigDecimal()
{
return points;
}
public CommissionPoints multiply(@NonNull final BigDecimal multiplicant)
{
if (multiplicant.compareTo(ONE) == 0)
{
return this;
}
|
return new CommissionPoints(points.multiply(multiplicant));
}
public CommissionPoints add(@NonNull final CommissionPoints augent)
{
if (augent.isZero())
{
return this;
}
return CommissionPoints.of(toBigDecimal().add(augent.toBigDecimal()));
}
public CommissionPoints subtract(@NonNull final CommissionPoints augent)
{
if (augent.isZero())
{
return this;
}
return CommissionPoints.of(toBigDecimal().subtract(augent.toBigDecimal()));
}
@JsonIgnore
public boolean isZero()
{
final boolean isZero = points.signum() == 0;
return isZero;
}
public CommissionPoints computePercentageOf(
@NonNull final Percent commissionPercent,
final int precision)
{
final BigDecimal percentagePoints = commissionPercent.computePercentageOf(points, precision);
return CommissionPoints.of(percentagePoints);
}
public CommissionPoints negateIf(final boolean condition)
{
if (condition)
{
return CommissionPoints.of(points.negate());
}
return this;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\commission\commissioninstance\businesslogic\CommissionPoints.java
| 2
|
请完成以下Java代码
|
public class InOutInvoiceCandidateBL implements IInOutInvoiceCandidateBL
{
@Override
public boolean isApproveInOutForInvoicing(@NonNull final I_M_InOut inOut)
{
boolean isAllowToInvoice = false;
if (inOut.isInOutApprovedForInvoicing())
{
isAllowToInvoice = true;
}
final DocStatus inoutDocStatus = DocStatus.ofCode(inOut.getDocStatus());
if(inoutDocStatus.isCompletedOrClosed())
{
isAllowToInvoice = true;
}
if (!inOut.isActive())
{
isAllowToInvoice = false;
}
return isAllowToInvoice;
}
@Override
public void approveForInvoicingLinkedInvoiceCandidates(final I_M_InOut inOut)
{
Check.assumeNotNull(inOut, "InOut not null");
final IInvoiceCandDAO invoiceCandDAO = Services.get(IInvoiceCandDAO.class);
final boolean isApprovedForInvoicing = inOut.isInOutApprovedForInvoicing();
if (!isApprovedForInvoicing)
{
// nothing to do
return;
}
// get all the inout lines of the given inout
final List<I_M_InOutLine> inoutLines = Services.get(IInOutDAO.class).retrieveLines(inOut);
for (final I_M_InOutLine line : inoutLines)
{
// for each line, get all the linked invoice candidates
final List<I_C_Invoice_Candidate> candidates = invoiceCandDAO.retrieveInvoiceCandidatesForInOutLine(line);
for (final I_C_Invoice_Candidate candidate : candidates)
{
|
// because we are not allowed to set an invoice candidate as approved for invoicing if not all the valid inoutlines linked to it are approved for invoicing,
// we have to get all the linked lines and check them one by one
final List<I_M_InOutLine> inOutLinesForCandidate = invoiceCandDAO.retrieveInOutLinesForCandidate(candidate, I_M_InOutLine.class);
boolean isAllowInvoicing = true;
for (final I_M_InOutLine inOutLineForCandidate : inOutLinesForCandidate)
{
if(inOutLineForCandidate.getM_InOut_ID() == inOut.getM_InOut_ID())
{
// skip the current inout
continue;
}
final I_M_InOut inoutForCandidate = InterfaceWrapperHelper.create(inOutLineForCandidate.getM_InOut(), I_M_InOut.class);
// in case the inout entry is active, completed or closed but it doesn't have the flag isInOutApprovedForInvoicing set on true
// we shall not approve the candidate for invoicing
if (Services.get(IInOutInvoiceCandidateBL.class).isApproveInOutForInvoicing(inoutForCandidate) && !inoutForCandidate.isInOutApprovedForInvoicing())
{
isAllowInvoicing = false;
break;
}
}
candidate.setIsInOutApprovedForInvoicing(isAllowInvoicing);
// also set the ApprovalForInvoicing flag with the calculated value
// note that this flag is editable so it can be modifyied by the user anytime
candidate.setApprovalForInvoicing(isAllowInvoicing);
InterfaceWrapperHelper.save(candidate);
}
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\inout\api\impl\InOutInvoiceCandidateBL.java
| 1
|
请完成以下Java代码
|
public class User extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@Schema(description = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 编号
*/
private String code;
/**
* 账号
*/
private String account;
/**
* 密码
*/
private String password;
/**
* 昵称
*/
private String name;
/**
* 真名
*/
private String realName;
|
/**
* 头像
*/
private String avatar;
/**
* 邮箱
*/
private String email;
/**
* 手机
*/
private String phone;
/**
* 生日
*/
private Date birthday;
/**
* 性别
*/
private Integer sex;
/**
* 角色id
*/
private String roleId;
/**
* 部门id
*/
private String deptId;
/**
* 部门id
*/
private String postId;
}
|
repos\SpringBlade-master\blade-service-api\blade-user-api\src\main\java\org\springblade\system\user\entity\User.java
| 1
|
请完成以下Java代码
|
public int getBalance() {
return balance.get();
}
public int getTransactionCount() {
return transactionCount.get();
}
public int getCurrentThreadCASFailureCount() {
return currentThreadCASFailureCount.get();
}
public boolean withdraw(int amount) {
int current = getBalance();
maybeWait();
boolean result = balance.compareAndSet(current, current - amount);
if (result) {
transactionCount.incrementAndGet();
} else {
int currentCASFailureCount = currentThreadCASFailureCount.get();
currentThreadCASFailureCount.set(currentCASFailureCount + 1);
}
return result;
|
}
private void maybeWait() {
if ("thread1".equals(Thread.currentThread().getName())) {
sleepUninterruptibly(2, TimeUnit.SECONDS);
}
}
public boolean deposit(int amount) {
int current = balance.get();
boolean result = balance.compareAndSet(current, current + amount);
if (result) {
transactionCount.incrementAndGet();
} else {
int currentCASFailureCount = currentThreadCASFailureCount.get();
currentThreadCASFailureCount.set(currentCASFailureCount + 1);
}
return result;
}
}
|
repos\tutorials-master\core-java-modules\core-java-concurrency-advanced-3\src\main\java\com\baeldung\abaproblem\Account.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public boolean equals(final Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
final Cctop901991V other = (Cctop901991V)obj;
if (ESRNumber == null)
{
if (other.ESRNumber != null)
{
return false;
}
}
else if (!ESRNumber.equals(other.ESRNumber))
{
return false;
}
if (cInvoiceID == null)
{
if (other.cInvoiceID != null)
{
return false;
}
}
else if (!cInvoiceID.equals(other.cInvoiceID))
{
return false;
}
if (rate == null)
{
if (other.rate != null)
{
return false;
}
}
else if (!rate.equals(other.rate))
{
return false;
}
if (taxAmt == null)
{
if (other.taxAmt != null)
{
return false;
}
}
else if (!taxAmt.equals(other.taxAmt))
{
return false;
}
if (taxAmtSumTaxBaseAmt == null)
{
if (other.taxAmtSumTaxBaseAmt != null)
{
return false;
}
}
else if (!taxAmtSumTaxBaseAmt.equals(other.taxAmtSumTaxBaseAmt))
{
return false;
}
if (taxBaseAmt == null)
|
{
if (other.taxBaseAmt != null)
{
return false;
}
}
else if (!taxBaseAmt.equals(other.taxBaseAmt))
{
return false;
}
if (totalAmt == null)
{
if (other.totalAmt != null)
{
return false;
}
}
else if (!totalAmt.equals(other.totalAmt))
{
return false;
}
return true;
}
@Override
public String toString()
{
return "Cctop901991V [cInvoiceID=" + cInvoiceID + ", rate=" + rate + ", taxAmt=" + taxAmt + ", taxBaseAmt=" + taxBaseAmt + ", totalAmt=" + totalAmt + ", ESRNumber=" + ESRNumber
+ ", taxAmtSumTaxBaseAmt=" + taxAmtSumTaxBaseAmt + "]";
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java\de\metas\edi\esb\invoicexport\compudata\Cctop901991V.java
| 2
|
请完成以下Java代码
|
public abstract class ReferenceWalker<T> {
protected List<T> currentElements;
protected List<TreeVisitor<T>> preVisitor = new ArrayList<TreeVisitor<T>>();
protected List<TreeVisitor<T>> postVisitor = new ArrayList<TreeVisitor<T>>();
protected abstract Collection<T> nextElements();
public ReferenceWalker(T initialElement) {
currentElements = new LinkedList<T>();
currentElements.add(initialElement);
}
public ReferenceWalker(List<T> initialElements) {
currentElements = new LinkedList<T>(initialElements);
}
public ReferenceWalker<T> addPreVisitor(TreeVisitor<T> collector) {
this.preVisitor.add(collector);
return this;
}
public ReferenceWalker<T> addPostVisitor(TreeVisitor<T> collector) {
this.postVisitor.add(collector);
return this;
}
public T walkWhile() {
return walkWhile(new ReferenceWalker.NullCondition<T>());
}
public T walkUntil() {
return walkUntil(new ReferenceWalker.NullCondition<T>());
}
public T walkWhile(ReferenceWalker.WalkCondition<T> condition) {
while (!condition.isFulfilled(getCurrentElement())) {
for (TreeVisitor<T> collector : preVisitor) {
collector.visit(getCurrentElement());
}
currentElements.addAll(nextElements());
currentElements.remove(0);
for (TreeVisitor<T> collector : postVisitor) {
collector.visit(getCurrentElement());
}
}
return getCurrentElement();
}
|
public T walkUntil(ReferenceWalker.WalkCondition<T> condition) {
do {
for (TreeVisitor<T> collector : preVisitor) {
collector.visit(getCurrentElement());
}
currentElements.addAll(nextElements());
currentElements.remove(0);
for (TreeVisitor<T> collector : postVisitor) {
collector.visit(getCurrentElement());
}
} while (!condition.isFulfilled(getCurrentElement()));
return getCurrentElement();
}
public T getCurrentElement() {
return currentElements.isEmpty() ? null : currentElements.get(0);
}
public interface WalkCondition<S> {
boolean isFulfilled(S element);
}
public static class NullCondition<S> implements ReferenceWalker.WalkCondition<S> {
public boolean isFulfilled(S element) {
return element == null;
}
public static <S> ReferenceWalker.WalkCondition<S> notNull() {
return new NullCondition<S>();
}
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\tree\ReferenceWalker.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class TravelAgencyController {
@Autowired
private TravelDealRepository travelDealRepository;
private static final Log log = LogFactory.getLog(TravelAgencyController.class);
@RequestMapping(method = GET, path = "/deals")
public String deals() {
log.info("Client is requesting new deals!");
List<TravelDeal> travelDealList = travelDealRepository.findAll();
if (!travelDealList.isEmpty()) {
int randomDeal = new Random().nextInt(travelDealList.size());
return travelDealList.get(randomDeal)
.toString();
} else {
return "NO DEALS";
}
}
@RequestMapping(method = GET, path = "/")
@ResponseBody
|
public String get() throws UnknownHostException {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("Host: ")
.append(InetAddress.getLocalHost()
.getHostName())
.append("<br/>");
stringBuilder.append("IP: ")
.append(InetAddress.getLocalHost()
.getHostAddress())
.append("<br/>");
stringBuilder.append("Type: ")
.append("Travel Agency")
.append("<br/>");
return stringBuilder.toString();
}
}
|
repos\tutorials-master\spring-cloud-modules\spring-cloud-kubernetes\kubernetes-guide\travel-agency-service\src\main\java\com\baeldung\spring\cloud\kubernetes\travelagency\controller\TravelAgencyController.java
| 2
|
请完成以下Java代码
|
public void createPrivateAccess(final CreateRecordPrivateAccessRequest request)
{
I_AD_Private_Access accessRecord = queryPrivateAccess(request.getPrincipal(), request.getRecordRef())
.create()
.firstOnly(I_AD_Private_Access.class);
if (accessRecord == null)
{
accessRecord = InterfaceWrapperHelper.newInstance(I_AD_Private_Access.class);
accessRecord.setAD_User_ID(UserId.toRepoId(request.getPrincipal().getUserId()));
accessRecord.setAD_UserGroup_ID(UserGroupId.toRepoId(request.getPrincipal().getUserGroupId()));
accessRecord.setAD_Table_ID(request.getRecordRef().getAD_Table_ID());
accessRecord.setRecord_ID(request.getRecordRef().getRecord_ID());
}
accessRecord.setAD_Org_ID(OrgId.ANY.getRepoId());
accessRecord.setIsActive(true);
saveRecord(accessRecord);
}
@Override
public void deletePrivateAccess(final RemoveRecordPrivateAccessRequest request)
{
queryPrivateAccess(request.getPrincipal(), request.getRecordRef())
.create()
.delete();
}
private IQueryBuilder<I_AD_Private_Access> queryPrivateAccess(
@NonNull final Principal principal,
@NonNull final TableRecordReference recordRef)
{
return queryBL
.createQueryBuilder(I_AD_Private_Access.class)
.addEqualsFilter(I_AD_Private_Access.COLUMNNAME_AD_User_ID, principal.getUserId())
.addEqualsFilter(I_AD_Private_Access.COLUMNNAME_AD_UserGroup_ID, principal.getUserGroupId())
.addEqualsFilter(I_AD_Private_Access.COLUMNNAME_AD_Table_ID, recordRef.getAD_Table_ID())
.addEqualsFilter(I_AD_Private_Access.COLUMNNAME_Record_ID, recordRef.getRecord_ID());
}
@Override
public void createMobileApplicationAccess(@NonNull final CreateMobileApplicationAccessRequest request)
{
mobileApplicationPermissionsRepository.createMobileApplicationAccess(request);
resetCacheAfterTrxCommit();
}
@Override
public void deleteMobileApplicationAccess(@NonNull final MobileApplicationRepoId applicationId)
{
mobileApplicationPermissionsRepository.deleteMobileApplicationAccess(applicationId);
}
@Override
public void deleteUserOrgAccessByUserId(final UserId userId)
{
|
queryBL.createQueryBuilder(I_AD_User_OrgAccess.class)
.addEqualsFilter(I_AD_User_OrgAccess.COLUMNNAME_AD_User_ID, userId)
.create()
.delete();
}
@Override
public void deleteUserOrgAssignmentByUserId(final UserId userId)
{
queryBL.createQueryBuilder(I_C_OrgAssignment.class)
.addEqualsFilter(I_C_OrgAssignment.COLUMNNAME_AD_User_ID, userId)
.create()
.delete();
}
@Value(staticConstructor = "of")
private static class RoleOrgPermissionsCacheKey
{
RoleId roleId;
AdTreeId adTreeOrgId;
}
@Value(staticConstructor = "of")
private static class UserOrgPermissionsCacheKey
{
UserId userId;
AdTreeId adTreeOrgId;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\security\impl\UserRolePermissionsDAO.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class InvoiceCandidateDimensionFactory implements DimensionFactory<I_C_Invoice_Candidate>
{
@Override
public String getHandledTableName()
{
return I_C_Invoice_Candidate.Table_Name;
}
@Override
@NonNull
public Dimension getFromRecord(@NonNull final I_C_Invoice_Candidate record)
{
return Dimension.builder()
.projectId(ProjectId.ofRepoIdOrNull(record.getC_Project_ID()))
.campaignId(record.getC_Campaign_ID())
.activityId(ActivityId.ofRepoIdOrNull(record.getC_Activity_ID()))
.salesOrderId(OrderId.ofRepoIdOrNull(record.getC_OrderSO_ID()))
.userElementString1(record.getUserElementString1())
.userElementString2(record.getUserElementString2())
.userElementString3(record.getUserElementString3())
.userElementString4(record.getUserElementString4())
.userElementString5(record.getUserElementString5())
|
.userElementString6(record.getUserElementString6())
.userElementString7(record.getUserElementString7())
.build();
}
@Override
public void updateRecord(final I_C_Invoice_Candidate record, final Dimension from)
{
record.setC_Project_ID(ProjectId.toRepoId(from.getProjectId()));
record.setC_Campaign_ID(from.getCampaignId());
record.setC_Activity_ID(ActivityId.toRepoId(from.getActivityId()));
record.setC_OrderSO_ID(OrderId.toRepoId(from.getSalesOrderId()));
record.setUserElementString1(from.getUserElementString1());
record.setUserElementString2(from.getUserElementString2());
record.setUserElementString3(from.getUserElementString3());
record.setUserElementString4(from.getUserElementString4());
record.setUserElementString5(from.getUserElementString5());
record.setUserElementString6(from.getUserElementString6());
record.setUserElementString7(from.getUserElementString7());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\document\dimension\InvoiceCandidateDimensionFactory.java
| 2
|
请完成以下Java代码
|
public TreatmentType getTreatment() {
return treatment;
}
/**
* Sets the value of the treatment property.
*
* @param value
* allowed object is
* {@link TreatmentType }
*
*/
public void setTreatment(TreatmentType value) {
this.treatment = value;
}
/**
* Gets the value of the contact property.
*
* @return
* possible object is
* {@link ContactAddressType }
*
*/
public ContactAddressType getContact() {
return contact;
}
/**
* Sets the value of the contact property.
*
* @param value
* allowed object is
* {@link ContactAddressType }
*
*/
public void setContact(ContactAddressType value) {
this.contact = value;
}
/**
* Gets the value of the pending property.
*
* @return
* possible object is
* {@link PendingType }
*
*/
public PendingType getPending() {
return pending;
}
/**
* Sets the value of the pending property.
*
* @param value
* allowed object is
* {@link PendingType }
*
*/
|
public void setPending(PendingType value) {
this.pending = value;
}
/**
* Gets the value of the accepted property.
*
* @return
* possible object is
* {@link AcceptedType }
*
*/
public AcceptedType getAccepted() {
return accepted;
}
/**
* Sets the value of the accepted property.
*
* @param value
* allowed object is
* {@link AcceptedType }
*
*/
public void setAccepted(AcceptedType value) {
this.accepted = value;
}
/**
* Gets the value of the rejected property.
*
* @return
* possible object is
* {@link RejectedType }
*
*/
public RejectedType getRejected() {
return rejected;
}
/**
* Sets the value of the rejected property.
*
* @param value
* allowed object is
* {@link RejectedType }
*
*/
public void setRejected(RejectedType value) {
this.rejected = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_response\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\response\BodyType.java
| 1
|
请完成以下Java代码
|
private static void transformClass(String className, Instrumentation instrumentation) {
Class<?> targetCls = null;
ClassLoader targetClassLoader = null;
// see if we can get the class using forName
try {
targetCls = Class.forName(className);
targetClassLoader = targetCls.getClassLoader();
transform(targetCls, targetClassLoader, instrumentation);
return;
} catch (Exception ex) {
LOGGER.error("Class [{}] not found with Class.forName");
}
// otherwise iterate all loaded classes and find what we want
for(Class<?> clazz: instrumentation.getAllLoadedClasses()) {
if(clazz.getName().equals(className)) {
targetCls = clazz;
targetClassLoader = targetCls.getClassLoader();
|
transform(targetCls, targetClassLoader, instrumentation);
return;
}
}
throw new RuntimeException("Failed to find class [" + className + "]");
}
private static void transform(Class<?> clazz, ClassLoader classLoader, Instrumentation instrumentation) {
AtmTransformer dt = new AtmTransformer(clazz.getName(), classLoader);
instrumentation.addTransformer(dt, true);
try {
instrumentation.retransformClasses(clazz);
} catch (Exception ex) {
throw new RuntimeException("Transform failed for class: [" + clazz.getName() + "]", ex);
}
}
}
|
repos\tutorials-master\core-java-modules\core-java-jvm\src\main\java\com\baeldung\instrumentation\agent\MyInstrumentationAgent.java
| 1
|
请完成以下Java代码
|
public void setPOReference (final @Nullable java.lang.String POReference)
{
set_Value (COLUMNNAME_POReference, POReference);
}
@Override
public java.lang.String getPOReference()
{
return get_ValueAsString(COLUMNNAME_POReference);
}
@Override
public void setQtyDeliveredInUOM (final @Nullable BigDecimal QtyDeliveredInUOM)
{
set_Value (COLUMNNAME_QtyDeliveredInUOM, QtyDeliveredInUOM);
}
@Override
public BigDecimal getQtyDeliveredInUOM()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyDeliveredInUOM);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyEntered (final BigDecimal QtyEntered)
|
{
set_Value (COLUMNNAME_QtyEntered, QtyEntered);
}
@Override
public BigDecimal getQtyEntered()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyEntered);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyInvoicedInUOM (final @Nullable BigDecimal QtyInvoicedInUOM)
{
set_Value (COLUMNNAME_QtyInvoicedInUOM, QtyInvoicedInUOM);
}
@Override
public BigDecimal getQtyInvoicedInUOM()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyInvoicedInUOM);
return bd != null ? bd : BigDecimal.ZERO;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java-gen\de\metas\contracts\model\X_C_CallOrderSummary.java
| 1
|
请完成以下Java代码
|
public void shutdown() {
this.listener = null;
if (this.executor != null && this.usingExecutorResource) {
this.executor = SharedResourceHolder.release(this.executorResource, this.executor);
}
}
private SocketAddress getOwnAddress() {
final String address = this.properties.getAddress();
final int port = this.properties.getPort();
final SocketAddress target;
if (GrpcServerProperties.ANY_IP_ADDRESS.equals(address)) {
target = new InetSocketAddress(port);
} else {
target = new InetSocketAddress(InetAddresses.forString(address), port);
}
return target;
}
private String getOwnAddressString(final String fallback) {
try {
return getOwnAddress().toString().substring(1);
} catch (final IllegalArgumentException e) {
return fallback;
}
}
@Override
public String toString() {
return "SelfNameResolver [" + getOwnAddressString("<unavailable>") + "]";
}
/**
* The logic for assigning the own address.
|
*/
private final class Resolve implements Runnable {
private final Listener2 savedListener;
/**
* Creates a new Resolve that stores a snapshot of the relevant states of the resolver.
*
* @param listener The listener to send the results to.
*/
Resolve(final Listener2 listener) {
this.savedListener = requireNonNull(listener, "listener");
}
@Override
public void run() {
try {
this.savedListener.onResult(ResolutionResult.newBuilder()
.setAddresses(ImmutableList.of(
new EquivalentAddressGroup(getOwnAddress())))
.build());
} catch (final Exception e) {
this.savedListener.onError(Status.UNAVAILABLE
.withDescription("Failed to resolve own address").withCause(e));
} finally {
SelfNameResolver.this.syncContext.execute(() -> SelfNameResolver.this.resolving = false);
}
}
}
}
|
repos\grpc-spring-master\grpc-server-spring-boot-starter\src\main\java\net\devh\boot\grpc\server\nameresolver\SelfNameResolver.java
| 1
|
请完成以下Java代码
|
public List<DmnEvaluatedDecisionRule> getMatchingRules() {
return matchingRules;
}
public void setMatchingRules(List<DmnEvaluatedDecisionRule> matchingRules) {
this.matchingRules = matchingRules;
}
public String getCollectResultName() {
return collectResultName;
}
public void setCollectResultName(String collectResultName) {
this.collectResultName = collectResultName;
}
public TypedValue getCollectResultValue() {
return collectResultValue;
}
public void setCollectResultValue(TypedValue collectResultValue) {
this.collectResultValue = collectResultValue;
}
public long getExecutedDecisionElements() {
return executedDecisionElements;
}
public void setExecutedDecisionElements(long executedDecisionElements) {
this.executedDecisionElements = executedDecisionElements;
}
|
@Override
public String toString() {
return "DmnDecisionTableEvaluationEventImpl{" +
" key="+ decision.getKey() +
", name="+ decision.getName() +
", decisionLogic=" + decision.getDecisionLogic() +
", inputs=" + inputs +
", matchingRules=" + matchingRules +
", collectResultName='" + collectResultName + '\'' +
", collectResultValue=" + collectResultValue +
", executedDecisionElements=" + executedDecisionElements +
'}';
}
}
|
repos\camunda-bpm-platform-master\engine-dmn\engine\src\main\java\org\camunda\bpm\dmn\engine\impl\delegate\DmnDecisionTableEvaluationEventImpl.java
| 1
|
请完成以下Java代码
|
private Boolean isConnectionValid(JdbcTemplate jdbcTemplate) {
return jdbcTemplate.execute((ConnectionCallback<Boolean>) this::isConnectionValid);
}
private Boolean isConnectionValid(Connection connection) throws SQLException {
return connection.isValid(0);
}
/**
* Set the {@link DataSource} to use.
* @param dataSource the data source
*/
public void setDataSource(DataSource dataSource) {
this.dataSource = dataSource;
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
/**
* Set a specific validation query to use to validate a connection. If none is set, a
* validation based on {@link Connection#isValid(int)} is used.
* @param query the validation query to use
*/
public void setQuery(String query) {
this.query = query;
}
/**
* Return the validation query or {@code null}.
* @return the query
|
*/
public @Nullable String getQuery() {
return this.query;
}
/**
* {@link RowMapper} that expects and returns results from a single column.
*/
private static final class SingleColumnRowMapper implements RowMapper<Object> {
@Override
public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
ResultSetMetaData metaData = rs.getMetaData();
int columns = metaData.getColumnCount();
if (columns != 1) {
throw new IncorrectResultSetColumnCountException(1, columns);
}
Object result = JdbcUtils.getResultSetValue(rs, 1);
Assert.state(result != null, "'result' must not be null");
return result;
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-jdbc\src\main\java\org\springframework\boot\jdbc\health\DataSourceHealthIndicator.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public NewTopic topic2() {
return TopicBuilder.name("thing2")
.partitions(10)
.replicas(3)
.config(TopicConfig.COMPRESSION_TYPE_CONFIG, "zstd")
.build();
}
@Bean
public NewTopic topic3() {
return TopicBuilder.name("thing3")
.assignReplicas(0, List.of(0, 1))
.assignReplicas(1, List.of(1, 2))
.assignReplicas(2, List.of(2, 0))
.config(TopicConfig.COMPRESSION_TYPE_CONFIG, "zstd")
.build();
}
// end::topicBeans[]
// tag::brokerProps[]
@Bean
public NewTopic topic4() {
return TopicBuilder.name("defaultBoth")
.build();
}
@Bean
public NewTopic topic5() {
return TopicBuilder.name("defaultPart")
.replicas(1)
.build();
|
}
@Bean
public NewTopic topic6() {
return TopicBuilder.name("defaultRepl")
.partitions(3)
.build();
}
// end::brokerProps[]
// tag::newTopicsBean[]
@Bean
public KafkaAdmin.NewTopics topics456() {
return new NewTopics(
TopicBuilder.name("defaultBoth")
.build(),
TopicBuilder.name("defaultPart")
.replicas(1)
.build(),
TopicBuilder.name("defaultRepl")
.partitions(3)
.build());
}
// end::newTopicsBean[]
}
|
repos\spring-kafka-main\spring-kafka-docs\src\main\java\org\springframework\kafka\jdocs\topics\Config.java
| 2
|
请完成以下Java代码
|
public boolean isActive() {
return active;
}
public void setActive(boolean active) {
this.active = active;
}
@Override
public String toString() {
return "User [name=" + name + ", id=" + id + "]";
}
@Override
public boolean equals(Object o) {
|
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
User user = (User) o;
return id == user.id &&
age == user.age &&
Objects.equals(name, user.name) &&
Objects.equals(creationDate, user.creationDate) &&
Objects.equals(email, user.email) &&
Objects.equals(status, user.status);
}
@Override
public int hashCode() {
return Objects.hash(id, name, creationDate, age, email, status);
}
}
|
repos\tutorials-master\persistence-modules\spring-data-jpa-simple\src\main\java\com\baeldung\jpa\query\model\User.java
| 1
|
请完成以下Java代码
|
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getImplementationRef() {
return implementationRef;
}
public void setImplementationRef(String implementationRef) {
this.implementationRef = implementationRef;
}
public String getInMessageRef() {
return inMessageRef;
}
public void setInMessageRef(String inMessageRef) {
this.inMessageRef = inMessageRef;
}
public String getOutMessageRef() {
return outMessageRef;
}
public void setOutMessageRef(String outMessageRef) {
this.outMessageRef = outMessageRef;
}
public List<String> getErrorMessageRef() {
return errorMessageRef;
}
public void setErrorMessageRef(List<String> errorMessageRef) {
this.errorMessageRef = errorMessageRef;
}
|
public Operation clone() {
Operation clone = new Operation();
clone.setValues(this);
return clone;
}
public void setValues(Operation otherElement) {
super.setValues(otherElement);
setName(otherElement.getName());
setImplementationRef(otherElement.getImplementationRef());
setInMessageRef(otherElement.getInMessageRef());
setOutMessageRef(otherElement.getOutMessageRef());
errorMessageRef = new ArrayList<String>();
if (otherElement.getErrorMessageRef() != null && !otherElement.getErrorMessageRef().isEmpty()) {
errorMessageRef.addAll(otherElement.getErrorMessageRef());
}
}
}
|
repos\Activiti-develop\activiti-core\activiti-bpmn-model\src\main\java\org\activiti\bpmn\model\Operation.java
| 1
|
请完成以下Java代码
|
public String toString()
{
StringBuffer sb = new StringBuffer ("X_U_BlackListCheque[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set Bank Name.
@param BankName Bank Name */
public void setBankName (String BankName)
{
set_Value (COLUMNNAME_BankName, BankName);
}
/** Get Bank Name.
@return Bank Name */
public String getBankName ()
{
return (String)get_Value(COLUMNNAME_BankName);
}
/** Set Cheque No.
@param ChequeNo Cheque No */
public void setChequeNo (String ChequeNo)
{
set_Value (COLUMNNAME_ChequeNo, ChequeNo);
}
/** Get Cheque No.
|
@return Cheque No */
public String getChequeNo ()
{
return (String)get_Value(COLUMNNAME_ChequeNo);
}
/** Set Black List Cheque.
@param U_BlackListCheque_ID Black List Cheque */
public void setU_BlackListCheque_ID (int U_BlackListCheque_ID)
{
if (U_BlackListCheque_ID < 1)
set_ValueNoCheck (COLUMNNAME_U_BlackListCheque_ID, null);
else
set_ValueNoCheck (COLUMNNAME_U_BlackListCheque_ID, Integer.valueOf(U_BlackListCheque_ID));
}
/** Get Black List Cheque.
@return Black List Cheque */
public int getU_BlackListCheque_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_U_BlackListCheque_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_U_BlackListCheque.java
| 1
|
请完成以下Java代码
|
public static <T> List<T> asArrayList(T[] values) {
ArrayList<T> result = new ArrayList<>();
Collections.addAll(result, values);
return result;
}
public static <T> Set<T> asHashSet(T... elements) {
Set<T> set = new HashSet<>();
Collections.addAll(set, elements);
return set;
}
public static <S, T> void addToMapOfLists(Map<S, List<T>> map, S key, T value) {
List<T> list = map.get(key);
if (list == null) {
list = new ArrayList<>();
map.put(key, list);
}
list.add(value);
}
public static <S, T> void mergeMapsOfLists(Map<S, List<T>> map, Map<S, List<T>> toAdd) {
for (Entry<S, List<T>> entry : toAdd.entrySet()) {
for (T listener : entry.getValue()) {
CollectionUtil.addToMapOfLists(map, entry.getKey(), listener);
}
}
}
public static <S, T> void addToMapOfSets(Map<S, Set<T>> map, S key, T value) {
Set<T> set = map.get(key);
if (set == null) {
set = new HashSet<>();
map.put(key, set);
}
set.add(value);
}
public static <S, T> void addCollectionToMapOfSets(Map<S, Set<T>> map, S key, Collection<T> values) {
Set<T> set = map.get(key);
if (set == null) {
set = new HashSet<>();
map.put(key, set);
}
set.addAll(values);
}
/**
* Chops a list into non-view sublists of length partitionSize. Note: the argument list
* may be included in the result.
*/
public static <T> List<List<T>> partition(List<T> list, final int partitionSize) {
List<List<T>> parts = new ArrayList<>();
final int listSize = list.size();
if (listSize <= partitionSize) {
// no need for partitioning
parts.add(list);
|
} else {
for (int i = 0; i < listSize; i += partitionSize) {
parts.add(new ArrayList<>(list.subList(i, Math.min(listSize, i + partitionSize))));
}
}
return parts;
}
public static <T> List<T> collectInList(Iterator<T> iterator) {
List<T> result = new ArrayList<>();
while (iterator.hasNext()) {
result.add(iterator.next());
}
return result;
}
public static <T> T getLastElement(final Iterable<T> elements) {
T lastElement = null;
if (elements instanceof List) {
return ((List<T>) elements).get(((List<T>) elements).size() - 1);
}
for (T element : elements) {
lastElement = element;
}
return lastElement;
}
public static boolean isEmpty(Collection<?> collection) {
return collection == null || collection.isEmpty();
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\util\CollectionUtil.java
| 1
|
请完成以下Java代码
|
public class ImportImpl extends CmmnModelElementInstanceImpl implements Import {
protected static Attribute<String> locationAttribute;
protected static Attribute<String> namespaceAttribute;
protected static Attribute<String> importTypeAttribute;
public ImportImpl(ModelTypeInstanceContext instanceContext) {
super(instanceContext);
}
public String getNamespace() {
return namespaceAttribute.getValue(this);
}
public void setNamespace(String namespace) {
namespaceAttribute.setValue(this, namespace);
}
public String getLocation() {
return locationAttribute.getValue(this);
}
public void setLocation(String location) {
locationAttribute.setValue(this, location);
}
public String getImportType() {
return importTypeAttribute.getValue(this);
}
public void setImportType(String importType) {
importTypeAttribute.setValue(this, importType);
}
|
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Import.class, CMMN_ELEMENT_IMPORT)
.namespaceUri(CMMN11_NS)
.instanceProvider(new ModelTypeInstanceProvider<Import>() {
public Import newInstance(ModelTypeInstanceContext instanceContext) {
return new ImportImpl(instanceContext);
}
});
namespaceAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_NAMESPACE)
.build();
locationAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_LOCATION)
.required()
.build();
importTypeAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_IMPORT_TYPE)
.required()
.build();
typeBuilder.build();
}
}
|
repos\camunda-bpm-platform-master\model-api\cmmn-model\src\main\java\org\camunda\bpm\model\cmmn\impl\instance\ImportImpl.java
| 1
|
请完成以下Java代码
|
protected void discardPutBuffer(RingBuffer ringBuffer, long uid) {
LOGGER.warn("Rejected putting buffer for uid:{}. {}", uid, ringBuffer);
}
/**
* Policy for {@link RejectedTakeBufferHandler}, throws {@link RuntimeException} after logging
*/
protected void exceptionRejectedTakeBuffer(RingBuffer ringBuffer) {
LOGGER.warn("Rejected take buffer. {}", ringBuffer);
throw new RuntimeException("Rejected take buffer. " + ringBuffer);
}
/**
* Initialize flags as CAN_PUT_FLAG
*/
private PaddedAtomicLong[] initFlags(int bufferSize) {
PaddedAtomicLong[] flags = new PaddedAtomicLong[bufferSize];
for (int i = 0; i < bufferSize; i++) {
flags[i] = new PaddedAtomicLong(CAN_PUT_FLAG);
}
return flags;
}
/**
* Getters
*/
public long getTail() {
return tail.get();
}
public long getCursor() {
return cursor.get();
}
|
public int getBufferSize() {
return bufferSize;
}
/**
* Setters
*/
public void setBufferPaddingExecutor(BufferPaddingExecutor bufferPaddingExecutor) {
this.bufferPaddingExecutor = bufferPaddingExecutor;
}
public void setRejectedPutHandler(RejectedPutBufferHandler rejectedPutHandler) {
this.rejectedPutHandler = rejectedPutHandler;
}
public void setRejectedTakeHandler(RejectedTakeBufferHandler rejectedTakeHandler) {
this.rejectedTakeHandler = rejectedTakeHandler;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("RingBuffer [bufferSize=").append(bufferSize)
.append(", tail=").append(tail)
.append(", cursor=").append(cursor)
.append(", paddingThreshold=").append(paddingThreshold).append("]");
return builder.toString();
}
}
|
repos\Spring-Boot-In-Action-master\id-spring-boot-starter\src\main\java\com\baidu\fsg\uid\buffer\RingBuffer.java
| 1
|
请完成以下Java代码
|
public void setTitle (final @Nullable java.lang.String Title)
{
set_Value (COLUMNNAME_Title, Title);
}
@Override
public java.lang.String getTitle()
{
return get_ValueAsString(COLUMNNAME_Title);
}
@Override
public void setUnlockAccount (final @Nullable java.lang.String UnlockAccount)
{
set_Value (COLUMNNAME_UnlockAccount, UnlockAccount);
}
@Override
public java.lang.String getUnlockAccount()
{
return get_ValueAsString(COLUMNNAME_UnlockAccount);
}
@Override
public void setUserPIN (final @Nullable java.lang.String UserPIN)
|
{
set_Value (COLUMNNAME_UserPIN, UserPIN);
}
@Override
public java.lang.String getUserPIN()
{
return get_ValueAsString(COLUMNNAME_UserPIN);
}
@Override
public void setValue (final @Nullable java.lang.String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
@Override
public java.lang.String getValue()
{
return get_ValueAsString(COLUMNNAME_Value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_User.java
| 1
|
请完成以下Java代码
|
private static void appendToExpression(StringBuilder currentExpression, Operator operator, long currentOperand) {
currentExpression.append(operator.getSymbol())
.append(currentOperand);
}
private static void removeFromExpression(StringBuilder currentExpression, Operator operator, long currentOperand) {
currentExpression.setLength(currentExpression.length() - operator.getSymbolLength() - String.valueOf(currentOperand)
.length());
}
private enum Operator {
ADDITION("+"),
SUBTRACTION("-"),
MULTIPLICATION("*"),
NONE("");
private final String symbol;
private final int symbolLength;
Operator(String symbol) {
this.symbol = symbol;
this.symbolLength = symbol.length();
}
public String getSymbol() {
return symbol;
}
public int getSymbolLength() {
return symbolLength;
}
}
|
private static class Equation {
private final String digits;
private final int target;
public Equation(String digits, int target) {
this.digits = digits;
this.target = target;
}
public String getDigits() {
return digits;
}
public int getTarget() {
return target;
}
}
}
|
repos\tutorials-master\core-java-modules\core-java-string-algorithms-5\src\main\java\com\baeldung\backtracking\Backtracking.java
| 1
|
请完成以下Java代码
|
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
|
请在Spring Boot框架中完成以下Java代码
|
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
public Credentials getCredentials() {
return credentials;
}
public void setCredentials(Credentials credentials) {
this.credentials = credentials;
}
public List<String> getDefaultRecipients() {
return defaultRecipients;
}
|
public void setDefaultRecipients(List<String> defaultRecipients) {
this.defaultRecipients = defaultRecipients;
}
public Map<String, String> getAdditionalHeaders() {
return additionalHeaders;
}
public void setAdditionalHeaders(Map<String, String> additionalHeaders) {
this.additionalHeaders = additionalHeaders;
}
@Bean
@ConfigurationProperties(prefix = "item")
public Item item(){
return new Item();
}
}
|
repos\tutorials-master\spring-boot-modules\spring-boot-core\src\main\java\com\baeldung\configurationproperties\ConfigProperties.java
| 2
|
请完成以下Java代码
|
public void setMigrateToCaseDefinitionId(String caseDefinitionId) {
this.migrateToCaseDefinitionId = caseDefinitionId;
}
public void setMigrateToCaseDefinition(String caseDefinitionKey, Integer caseDefinitionVersion) {
this.migrateToCaseDefinitionKey = caseDefinitionKey;
this.migrateToCaseDefinitionVersion = caseDefinitionVersion;
}
public void setMigrateToCaseDefinition(String caseDefinitionKey, Integer caseDefinitionVersion, String caseDefinitionTenantId) {
this.migrateToCaseDefinitionKey = caseDefinitionKey;
this.migrateToCaseDefinitionVersion = caseDefinitionVersion;
this.migrateToCaseDefinitionTenantId = caseDefinitionTenantId;
}
@Override
public String getMigrateToCaseDefinitionId() {
return this.migrateToCaseDefinitionId;
}
@Override
public String getMigrateToCaseDefinitionKey() {
|
return this.migrateToCaseDefinitionKey;
}
@Override
public Integer getMigrateToCaseDefinitionVersion() {
return this.migrateToCaseDefinitionVersion;
}
@Override
public String getMigrateToCaseDefinitionTenantId() {
return this.migrateToCaseDefinitionTenantId;
}
@Override
public String asJsonString() {
return HistoricCaseInstanceMigrationDocumentConverter.convertToJsonString(this);
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\migration\HistoricCaseInstanceMigrationDocumentImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Batch completeBatch(String batchId, String status) {
BatchEntity batchEntity = findById(batchId);
batchEntity.setCompleteTime(getClock().getCurrentTime());
batchEntity.setStatus(status);
return batchEntity;
}
@Override
public void deleteBatches(BatchQueryImpl batchQuery) {
dataManager.deleteBatches(batchQuery);
}
@Override
public void delete(String batchId) {
BatchEntity batch = dataManager.findById(batchId);
List<BatchPart> batchParts = getBatchPartEntityManager().findBatchPartsByBatchId(batch.getId());
if (batchParts != null && batchParts.size() > 0) {
|
for (BatchPart batchPart : batchParts) {
getBatchPartEntityManager().deleteBatchPartEntityAndResources((BatchPartEntity) batchPart);
}
}
ByteArrayRef batchDocRefId = batch.getBatchDocRefId();
if (batchDocRefId != null && batchDocRefId.getId() != null) {
batchDocRefId.delete(serviceConfiguration.getEngineName());
}
delete(batch);
}
protected BatchPartEntityManager getBatchPartEntityManager() {
return serviceConfiguration.getBatchPartEntityManager();
}
}
|
repos\flowable-engine-main\modules\flowable-batch-service\src\main\java\org\flowable\batch\service\impl\persistence\entity\BatchEntityManagerImpl.java
| 2
|
请完成以下Java代码
|
public String getHandleNote() {
return handleNote;
}
public void setHandleNote(String handleNote) {
this.handleNote = handleNote;
}
public String getHandleMan() {
return handleMan;
}
public void setHandleMan(String handleMan) {
this.handleMan = handleMan;
}
public String getReceiveMan() {
return receiveMan;
}
public void setReceiveMan(String receiveMan) {
this.receiveMan = receiveMan;
}
public Date getReceiveTime() {
return receiveTime;
}
public void setReceiveTime(Date receiveTime) {
this.receiveTime = receiveTime;
}
public String getReceiveNote() {
return receiveNote;
}
public void setReceiveNote(String receiveNote) {
this.receiveNote = receiveNote;
}
@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(", orderId=").append(orderId);
sb.append(", companyAddressId=").append(companyAddressId);
|
sb.append(", productId=").append(productId);
sb.append(", orderSn=").append(orderSn);
sb.append(", createTime=").append(createTime);
sb.append(", memberUsername=").append(memberUsername);
sb.append(", returnAmount=").append(returnAmount);
sb.append(", returnName=").append(returnName);
sb.append(", returnPhone=").append(returnPhone);
sb.append(", status=").append(status);
sb.append(", handleTime=").append(handleTime);
sb.append(", productPic=").append(productPic);
sb.append(", productName=").append(productName);
sb.append(", productBrand=").append(productBrand);
sb.append(", productAttr=").append(productAttr);
sb.append(", productCount=").append(productCount);
sb.append(", productPrice=").append(productPrice);
sb.append(", productRealPrice=").append(productRealPrice);
sb.append(", reason=").append(reason);
sb.append(", description=").append(description);
sb.append(", proofPics=").append(proofPics);
sb.append(", handleNote=").append(handleNote);
sb.append(", handleMan=").append(handleMan);
sb.append(", receiveMan=").append(receiveMan);
sb.append(", receiveTime=").append(receiveTime);
sb.append(", receiveNote=").append(receiveNote);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
|
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\OmsOrderReturnApply.java
| 1
|
请完成以下Java代码
|
public void setSales(final Boolean sales)
{
this.sales = sales;
this.salesSet = true;
}
public void setSalesDefault(final Boolean salesDefault)
{
this.salesDefault = salesDefault;
this.salesDefaultSet = true;
}
public void setPurchase(final Boolean purchase)
{
this.purchase = purchase;
this.purchaseSet = true;
}
public void setPurchaseDefault(final Boolean purchaseDefault)
{
|
this.purchaseDefault = purchaseDefault;
this.purchaseDefaultSet = true;
}
public void setSubjectMatter(final Boolean subjectMatter)
{
this.subjectMatter = subjectMatter;
this.subjectMatterSet = true;
}
public void setSyncAdvise(final SyncAdvise syncAdvise)
{
this.syncAdvise = syncAdvise;
this.syncAdviseSet = true;
}
}
|
repos\metasfresh-new_dawn_uat\misc\de-metas-common\de-metas-common-bpartner\src\main\java\de\metas\common\bpartner\v1\request\JsonRequestContact.java
| 1
|
请完成以下Java代码
|
public boolean retainAll(Collection<?> c)
{
return termFrequencyMap.values().retainAll(c);
}
@Override
public void clear()
{
termFrequencyMap.clear();
}
/**
* 提取关键词(非线程安全)
*
* @param termList
* @param size
* @return
*/
@Override
public List<String> getKeywords(List<Term> termList, int size)
{
clear();
add(termList);
Collection<TermFrequency> topN = top(size);
List<String> r = new ArrayList<String>(topN.size());
for (TermFrequency termFrequency : topN)
{
r.add(termFrequency.getTerm());
}
return r;
}
/**
* 提取关键词(线程安全)
|
*
* @param document 文档内容
* @param size 希望提取几个关键词
* @return 一个列表
*/
public static List<String> getKeywordList(String document, int size)
{
return new TermFrequencyCounter().getKeywords(document, size);
}
@Override
public String toString()
{
final int max = 100;
return top(Math.min(max, size())).toString();
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\mining\word\TermFrequencyCounter.java
| 1
|
请完成以下Java代码
|
public class FileMonitor {
public static void main(String[] args) throws Exception {
File folder = FileUtils.getTempDirectory();
startFileMonitor(folder);
}
/**
* @param folder
* @throws Exception
*/
public static void startFileMonitor(File folder) throws Exception {
FileAlterationObserver observer = new FileAlterationObserver(folder);
FileAlterationMonitor monitor = new FileAlterationMonitor(5000);
FileAlterationListener fal = new FileAlterationListenerAdaptor() {
|
@Override
public void onFileCreate(File file) {
// on create action
}
@Override
public void onFileDelete(File file) {
// on delete action
}
};
observer.addListener(fal);
monitor.addObserver(observer);
monitor.start();
}
}
|
repos\tutorials-master\libraries-apache-commons-io\src\main\java\com\baeldung\commons\io\FileMonitor.java
| 1
|
请完成以下Java代码
|
public int getPP_Cost_Collector_ImportAuditItem_ID()
{
return get_ValueAsInt(COLUMNNAME_PP_Cost_Collector_ImportAuditItem_ID);
}
@Override
public org.eevolution.model.I_PP_Order getPP_Order()
{
return get_ValueAsPO(COLUMNNAME_PP_Order_ID, org.eevolution.model.I_PP_Order.class);
}
@Override
public void setPP_Order(org.eevolution.model.I_PP_Order PP_Order)
{
set_ValueFromPO(COLUMNNAME_PP_Order_ID, org.eevolution.model.I_PP_Order.class, PP_Order);
}
|
@Override
public void setPP_Order_ID (int PP_Order_ID)
{
if (PP_Order_ID < 1)
set_Value (COLUMNNAME_PP_Order_ID, null);
else
set_Value (COLUMNNAME_PP_Order_ID, Integer.valueOf(PP_Order_ID));
}
@Override
public int getPP_Order_ID()
{
return get_ValueAsInt(COLUMNNAME_PP_Order_ID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_PP_Cost_Collector_ImportAuditItem.java
| 1
|
请完成以下Java代码
|
public void createVendorReturnInOutForHUs(final List<I_M_HU> hus, final Timestamp movementDate)
{
MultiVendorHUReturnsInOutProducer.newInstance()
.setMovementDate(movementDate)
.addHUsToReturn(hus)
.create();
}
public List<InOutId> createCustomerReturnsFromCandidates(@NonNull final List<CustomerReturnLineCandidate> candidates)
{
return customerReturnsWithoutHUsProducer.create(candidates);
}
public I_M_InOutLine createCustomerReturnLine(@NonNull final CreateCustomerReturnLineReq request)
{
return customerReturnsWithoutHUsProducer.createReturnLine(request);
}
public void assignHandlingUnitToHeaderAndLine(
@NonNull final org.compiere.model.I_M_InOutLine customerReturnLine,
@NonNull final I_M_HU hu)
{
final ImmutableList<I_M_HU> hus = ImmutableList.of(hu);
|
assignHandlingUnitsToHeaderAndLine(customerReturnLine, hus);
}
public void assignHandlingUnitsToHeaderAndLine(
@NonNull final org.compiere.model.I_M_InOutLine customerReturnLine,
@NonNull final List<I_M_HU> hus)
{
if (hus.isEmpty())
{
return;
}
final InOutId customerReturnId = InOutId.ofRepoId(customerReturnLine.getM_InOut_ID());
final I_M_InOut customerReturn = huInOutBL.getById(customerReturnId, I_M_InOut.class);
huInOutBL.addAssignedHandlingUnits(customerReturn, hus);
huInOutBL.setAssignedHandlingUnits(customerReturnLine, hus);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\inout\returns\ReturnsServiceFacade.java
| 1
|
请完成以下Java代码
|
public IStringExpression resolvePartial(final Evaluatee ctx)
{
try
{
boolean changed = false;
final IStringExpression expressionBaseLangNew = expressionBaseLang.resolvePartial(ctx);
if (!expressionBaseLang.equals(expressionBaseLangNew))
{
changed = true;
}
final IStringExpression expressionTrlNew = expressionTrl.resolvePartial(Evaluatees.excludingVariables(ctx, adLanguageParam.getName()));
if (!changed && !expressionTrl.equals(expressionTrlNew))
{
changed = true;
}
|
if (!changed)
{
return this;
}
return new TranslatableParameterizedStringExpression(adLanguageParam, expressionBaseLangNew, expressionTrlNew);
}
catch (final Exception e)
{
throw ExpressionEvaluationException.wrapIfNeeded(e)
.addExpression(this);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\expression\api\TranslatableParameterizedStringExpression.java
| 1
|
请完成以下Java代码
|
public ManufacturingJob processEvent(final ManufacturingJob job, final JsonManufacturingOrderEvent event)
{
job.assertUserReporting();
if (event.getIssueTo() != null)
{
final JsonManufacturingOrderEvent.IssueTo issueTo = event.getIssueTo();
return manufacturingJobService.issueRawMaterials(job, PPOrderIssueScheduleProcessRequest.builder()
.activityId(PPOrderRoutingActivityId.ofRepoId(job.getPpOrderId(), event.getWfActivityId()))
.issueScheduleId(PPOrderIssueScheduleId.ofString(issueTo.getIssueStepId()))
.huWeightGrossBeforeIssue(issueTo.getHuWeightGrossBeforeIssue())
.qtyIssued(issueTo.getQtyIssued())
.qtyRejected(issueTo.getQtyRejected())
.qtyRejectedReasonCode(QtyRejectedReasonCode.ofNullableCode(issueTo.getQtyRejectedReasonCode()).orElse(null))
// Manual issues from mobile UI shall fail for IssueOnlyForReceived lines
.failIfIssueOnlyForReceived(true)
.build());
|
}
else if (event.getReceiveFrom() != null)
{
final JsonManufacturingOrderEvent.ReceiveFrom receiveFrom = event.getReceiveFrom();
return manufacturingJobService.receiveGoods(receiveFrom, job, SystemTime.asZonedDateTime());
}
else
{
throw new AdempiereException("Cannot handle: " + event);
}
}
public QueryLimit getLaunchersLimit()
{
return manufacturingJobService.getLaunchersLimit();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing.rest-api\src\main\java\de\metas\manufacturing\workflows_api\ManufacturingRestService.java
| 1
|
请完成以下Java代码
|
public LookupDataSourceContext.Builder newContextForFetchingList()
{
return LookupDataSourceContext.builder(tableName)
.setRequiredParameters(parameters)
.requiresAD_Language()
.requiresUserRolePermissionsKey();
}
@Override
public LookupValuesPage retrieveEntities(final LookupDataSourceContext evalCtx)
{
final String filter = evalCtx.getFilter();
return labelsValuesLookupDataSource.findEntities(evalCtx, filter);
}
public Set<Object> normalizeStringIds(final Set<String> stringIds)
{
if (stringIds.isEmpty())
{
return ImmutableSet.of();
}
if (isLabelsValuesUseNumericKey())
{
return stringIds.stream()
.map(LabelsLookup::convertToInt)
.collect(ImmutableSet.toImmutableSet());
}
else
{
|
return ImmutableSet.copyOf(stringIds);
}
}
private static int convertToInt(final String stringId)
{
try
{
return Integer.parseInt(stringId);
}
catch (final Exception ex)
{
throw new AdempiereException("Failed converting `" + stringId + "` to int.", ex);
}
}
public ColumnSql getSqlForFetchingValueIdsByLinkId(@NonNull final String tableNameOrAlias)
{
final String sql = "SELECT array_agg(" + labelsValueColumnName + ")"
+ " FROM " + labelsTableName
+ " WHERE " + labelsLinkColumnName + "=" + tableNameOrAlias + "." + linkColumnName
+ " AND IsActive='Y'";
return ColumnSql.ofSql(sql, tableNameOrAlias);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\model\lookup\LabelsLookup.java
| 1
|
请完成以下Java代码
|
public boolean isGraphic()
{
final String name = getName().trim().toLowerCase();
return name.endsWith(".gif") || name.endsWith(".jpg") || name.endsWith(".png");
}
public boolean isXML()
{
final String name = getName().trim().toLowerCase();
return name.endsWith(".xml");
}
public AttachmentEntry withAdditionalLinkedRecord(@NonNull final TableRecordReference modelRef)
{
if (getLinkedRecords().contains(modelRef))
{
return this;
}
return toBuilder().linkedRecord(modelRef).build();
}
public AttachmentEntry withAdditionalTag(@NonNull final String tagName, @NonNull final String tagValue)
{
return toBuilder()
.tags(getTags().withTag(tagName, tagValue))
.build();
}
public AttachmentEntry withRemovedLinkedRecord(@NonNull final TableRecordReference modelRef)
{
final HashSet<TableRecordReference> linkedRecords = new HashSet<>(getLinkedRecords());
if (linkedRecords.remove(modelRef))
{
return toBuilder().clearLinkedRecords().linkedRecords(linkedRecords).build();
}
else
{
return this;
}
}
public AttachmentEntry withoutLinkedRecords()
{
return toBuilder().clearLinkedRecords().build();
}
public AttachmentEntry withAdditionalLinkedRecords(@NonNull final List<TableRecordReference> additionalLinkedRecords)
{
if (getLinkedRecords().containsAll(additionalLinkedRecords))
{
return this;
}
final Set<TableRecordReference> tmp = new HashSet<>(getLinkedRecords());
tmp.addAll(additionalLinkedRecords);
return toBuilder().linkedRecords(tmp).build();
}
public AttachmentEntry withRemovedLinkedRecords(@NonNull final List<TableRecordReference> linkedRecordsToRemove)
{
final HashSet<TableRecordReference> linkedRecords = new HashSet<>(getLinkedRecords());
if (linkedRecords.removeAll(linkedRecordsToRemove))
{
|
return toBuilder().clearLinkedRecords().linkedRecords(linkedRecords).build();
}
else
{
return this;
}
}
public AttachmentEntry withAdditionalTag(@NonNull final AttachmentTags attachmentTags)
{
return toBuilder()
.tags(getTags().withTags(attachmentTags))
.build();
}
public AttachmentEntry withoutTags(@NonNull final AttachmentTags attachmentTags)
{
return toBuilder()
.tags(getTags().withoutTags(attachmentTags))
.build();
}
/**
* @return the attachment's filename as seen from the given {@code tableRecordReference}. Note that different records might share the same attachment, but refer to it under different file names.
*/
@NonNull
public String getFilename(@NonNull final TableRecordReference tableRecordReference)
{
if (linkedRecord2AttachmentName == null)
{
return filename;
}
return CoalesceUtil.coalesceNotNull(
linkedRecord2AttachmentName.get(tableRecordReference),
filename);
}
public boolean hasLinkToRecord(@NonNull final TableRecordReference tableRecordReference)
{
return linkedRecords.contains(tableRecordReference);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\attachments\AttachmentEntry.java
| 1
|
请完成以下Java代码
|
public void addImplicitUpdateListener(TypedValueUpdateListener listener) {
updateListeners.add(listener);
}
/**
* @return the type name of the value
*/
public String getTypeName() {
if (serializerName == null) {
return ValueType.NULL.getName();
} else {
return getSerializer().getType().getName();
}
}
/**
|
* If the variable value could not be loaded, this returns the error message.
*
* @return an error message indicating why the variable value could not be loaded.
*/
public String getErrorMessage() {
return errorMessage;
}
@Override
public void postLoad() {
}
public void clear() {
cachedValue = null;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\util\TypedValueField.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getHostHeader() {
return this.hostHeader;
}
public void setHostHeader(String hostHeader) {
this.hostHeader = hostHeader;
}
public void setProtocolHeaderHttpsValue(String protocolHeaderHttpsValue) {
this.protocolHeaderHttpsValue = protocolHeaderHttpsValue;
}
public String getPortHeader() {
return this.portHeader;
}
public void setPortHeader(String portHeader) {
this.portHeader = portHeader;
}
public @Nullable String getRemoteIpHeader() {
return this.remoteIpHeader;
}
public void setRemoteIpHeader(@Nullable String remoteIpHeader) {
this.remoteIpHeader = remoteIpHeader;
}
public @Nullable String getTrustedProxies() {
return this.trustedProxies;
}
|
public void setTrustedProxies(@Nullable String trustedProxies) {
this.trustedProxies = trustedProxies;
}
}
/**
* When to use APR.
*/
public enum UseApr {
/**
* Always use APR and fail if it's not available.
*/
ALWAYS,
/**
* Use APR if it is available.
*/
WHEN_AVAILABLE,
/**
* Never use APR.
*/
NEVER
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-tomcat\src\main\java\org\springframework\boot\tomcat\autoconfigure\TomcatServerProperties.java
| 2
|
请完成以下Java代码
|
protected AnnotatedBeanDefinitionReader newAnnotatedBeanDefinitionReader(BeanDefinitionRegistry registry) {
return new AnnotatedBeanDefinitionReader(registry, getEnvironment());
}
protected ClassPathBeanDefinitionScanner newClassBeanDefinitionScanner(BeanDefinitionRegistry registry) {
return new ClassPathBeanDefinitionScanner(registry, isUsingDefaultFilters(), getEnvironment());
}
/**
* Re-registers Singleton beans registered with the previous {@link ConfigurableListableBeanFactory BeanFactory}
* (prior to refresh) with this {@link ApplicationContext}, iff this context was previously active
* and subsequently refreshed.
*
* @see org.springframework.beans.factory.config.ConfigurableListableBeanFactory#copyConfigurationFrom(ConfigurableBeanFactory)
* @see org.springframework.beans.factory.config.ConfigurableListableBeanFactory#registerSingleton(String, Object)
* @see #getBeanFactory()
*/
@Override
protected void onRefresh() {
super.onRefresh();
ConfigurableListableBeanFactory currentBeanFactory = getBeanFactory();
if (this.beanFactory != null) {
Arrays.stream(ArrayUtils.nullSafeArray(this.beanFactory.getSingletonNames(), String.class))
.filter(singletonBeanName -> !currentBeanFactory.containsSingleton(singletonBeanName))
.forEach(singletonBeanName -> currentBeanFactory
.registerSingleton(singletonBeanName, this.beanFactory.getSingleton(singletonBeanName)));
if (isCopyConfigurationEnabled()) {
currentBeanFactory.copyConfigurationFrom(this.beanFactory);
}
}
}
/**
* Stores a reference to the previous {@link ConfigurableListableBeanFactory} in order to copy its configuration
* and state on {@link ApplicationContext} refresh invocations.
*
* @see #getBeanFactory()
*/
@Override
protected void prepareRefresh() {
this.beanFactory = (DefaultListableBeanFactory) SpringExtensions.safeGetValue(this::getBeanFactory);
super.prepareRefresh();
}
|
/**
* @inheritDoc
*/
@Override
public void register(Class<?>... componentClasses) {
Arrays.stream(ArrayUtils.nullSafeArray(componentClasses, Class.class))
.filter(Objects::nonNull)
.forEach(this.componentClasses::add);
}
/**
* @inheritDoc
*/
@Override
public void scan(String... basePackages) {
Arrays.stream(ArrayUtils.nullSafeArray(basePackages, String.class))
.filter(StringUtils::hasText)
.forEach(this.basePackages::add);
}
}
|
repos\spring-boot-data-geode-main\spring-geode-project\spring-geode\src\main\java\org\springframework\geode\context\annotation\RefreshableAnnotationConfigApplicationContext.java
| 1
|
请完成以下Java代码
|
public TypedValue createValue(Object value, Map<String, Object> valueInfo) {
ObjectValueBuilder builder = Variables.objectValue(value);
if(valueInfo != null) {
applyValueInfo(builder, valueInfo);
}
return builder.create();
}
public Map<String, Object> getValueInfo(TypedValue typedValue) {
if(!(typedValue instanceof ObjectValue)) {
throw new IllegalArgumentException("Value not of type Object.");
}
ObjectValue objectValue = (ObjectValue) typedValue;
Map<String, Object> valueInfo = new HashMap<String, Object>();
String serializationDataFormat = objectValue.getSerializationDataFormat();
if(serializationDataFormat != null) {
valueInfo.put(VALUE_INFO_SERIALIZATION_DATA_FORMAT, serializationDataFormat);
}
String objectTypeName = objectValue.getObjectTypeName();
if(objectTypeName != null) {
valueInfo.put(VALUE_INFO_OBJECT_TYPE_NAME, objectTypeName);
}
if (objectValue.isTransient()) {
valueInfo.put(VALUE_INFO_TRANSIENT, objectValue.isTransient());
}
|
return valueInfo;
}
public SerializableValue createValueFromSerialized(String serializedValue, Map<String, Object> valueInfo) {
SerializedObjectValueBuilder builder = Variables.serializedObjectValue(serializedValue);
if(valueInfo != null) {
applyValueInfo(builder, valueInfo);
}
return builder.create();
}
protected void applyValueInfo(ObjectValueBuilder builder, Map<String, Object> valueInfo) {
String objectValueTypeName = (String) valueInfo.get(VALUE_INFO_OBJECT_TYPE_NAME);
if (builder instanceof SerializedObjectValueBuilder) {
((SerializedObjectValueBuilder) builder).objectTypeName(objectValueTypeName);
}
String serializationDataFormat = (String) valueInfo.get(VALUE_INFO_SERIALIZATION_DATA_FORMAT);
if(serializationDataFormat != null) {
builder.serializationDataFormat(serializationDataFormat);
}
builder.setTransient(isTransient(valueInfo));
}
}
|
repos\camunda-bpm-platform-master\commons\typed-values\src\main\java\org\camunda\bpm\engine\variable\impl\type\ObjectTypeImpl.java
| 1
|
请完成以下Java代码
|
public void setBeanClassLoader(ClassLoader classLoader) {
this.classLoader = classLoader;
}
protected @Nullable ClassLoader getClassLoader() {
return this.classLoader;
}
protected void addHeader(Headers headers, String headerName, Class<?> clazz) {
if (this.classIdMapping.containsKey(clazz)) {
headers.add(new RecordHeader(headerName, this.classIdMapping.get(clazz)));
}
else {
headers.add(new RecordHeader(headerName, clazz.getName().getBytes(StandardCharsets.UTF_8)));
}
}
protected String retrieveHeader(Headers headers, String headerName) {
String classId = retrieveHeaderAsString(headers, headerName);
if (classId == null) {
throw new MessageConversionException(
"failed to convert Message content. Could not resolve " + headerName + " in header");
}
return classId;
}
protected @Nullable String retrieveHeaderAsString(Headers headers, String headerName) {
Header header = headers.lastHeader(headerName);
if (header != null) {
String classId = null;
if (header.value() != null) {
classId = new String(header.value(), StandardCharsets.UTF_8);
|
}
return classId;
}
return null;
}
private void createReverseMap() {
this.classIdMapping.clear();
for (Map.Entry<String, Class<?>> entry : this.idClassMapping.entrySet()) {
String id = entry.getKey();
Class<?> clazz = entry.getValue();
this.classIdMapping.put(clazz, id.getBytes(StandardCharsets.UTF_8));
}
}
public Map<String, Class<?>> getIdClassMapping() {
return Collections.unmodifiableMap(this.idClassMapping);
}
/**
* Configure the TypeMapper to use default key type class.
* @param isKey Use key type headers if true
* @since 2.1.3
*/
public void setUseForKey(boolean isKey) {
if (isKey) {
setClassIdFieldName(AbstractJavaTypeMapper.KEY_DEFAULT_CLASSID_FIELD_NAME);
setContentClassIdFieldName(AbstractJavaTypeMapper.KEY_DEFAULT_CONTENT_CLASSID_FIELD_NAME);
setKeyClassIdFieldName(AbstractJavaTypeMapper.KEY_DEFAULT_KEY_CLASSID_FIELD_NAME);
}
}
}
|
repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\support\mapping\AbstractJavaTypeMapper.java
| 1
|
请完成以下Java代码
|
public java.lang.String getDescription()
{
return get_ValueAsString(COLUMNNAME_Description);
}
/**
* DocumentFlavor AD_Reference_ID=541225
* Reference name: C_DocType_PrintOptions_DocumentFlavor
*/
public static final int DOCUMENTFLAVOR_AD_Reference_ID=541225;
/** EMail = E */
public static final String DOCUMENTFLAVOR_EMail = "E";
/** Print = P */
public static final String DOCUMENTFLAVOR_Print = "P";
@Override
public void setDocumentFlavor (final @Nullable java.lang.String DocumentFlavor)
{
set_Value (COLUMNNAME_DocumentFlavor, DocumentFlavor);
}
@Override
public java.lang.String getDocumentFlavor()
{
return get_ValueAsString(COLUMNNAME_DocumentFlavor);
}
@Override
public void setDocumentNo (final @Nullable java.lang.String DocumentNo)
{
set_ValueNoCheck (COLUMNNAME_DocumentNo, DocumentNo);
}
@Override
public java.lang.String getDocumentNo()
{
return get_ValueAsString(COLUMNNAME_DocumentNo);
}
@Override
public void setHelp (final @Nullable java.lang.String Help)
{
set_Value (COLUMNNAME_Help, Help);
}
@Override
public java.lang.String getHelp()
{
return get_ValueAsString(COLUMNNAME_Help);
}
@Override
public void setIsDirectEnqueue (final boolean IsDirectEnqueue)
{
set_Value (COLUMNNAME_IsDirectEnqueue, IsDirectEnqueue);
}
@Override
public boolean isDirectEnqueue()
{
return get_ValueAsBoolean(COLUMNNAME_IsDirectEnqueue);
}
@Override
public void setIsDirectProcessQueueItem (final boolean IsDirectProcessQueueItem)
{
set_Value (COLUMNNAME_IsDirectProcessQueueItem, IsDirectProcessQueueItem);
}
@Override
public boolean isDirectProcessQueueItem()
{
return get_ValueAsBoolean(COLUMNNAME_IsDirectProcessQueueItem);
}
@Override
public void setIsFileSystem (final boolean IsFileSystem)
{
set_Value (COLUMNNAME_IsFileSystem, IsFileSystem);
}
@Override
|
public boolean isFileSystem()
{
return get_ValueAsBoolean(COLUMNNAME_IsFileSystem);
}
@Override
public void setIsReport (final boolean IsReport)
{
set_Value (COLUMNNAME_IsReport, IsReport);
}
@Override
public boolean isReport()
{
return get_ValueAsBoolean(COLUMNNAME_IsReport);
}
@Override
public void setName (final java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
@Override
public void setPOReference (final @Nullable java.lang.String POReference)
{
set_Value (COLUMNNAME_POReference, POReference);
}
@Override
public java.lang.String getPOReference()
{
return get_ValueAsString(COLUMNNAME_POReference);
}
@Override
public void setRecord_ID (final int Record_ID)
{
if (Record_ID < 0)
set_Value (COLUMNNAME_Record_ID, null);
else
set_Value (COLUMNNAME_Record_ID, Record_ID);
}
@Override
public int getRecord_ID()
{
return get_ValueAsInt(COLUMNNAME_Record_ID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Archive.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void addIssueProgress(@NonNull final I_S_TimeBooking record)
{
record.setBookedSeconds(BigDecimal.valueOf(HmmUtils.hmmToSeconds(record.getHoursAndMinutes())));
final I_S_TimeBooking oldRecord = InterfaceWrapperHelper.createOld(record, I_S_TimeBooking.class);
final long deltaBookedSeconds = record.getBookedSeconds().subtract(oldRecord.getBookedSeconds()).longValue();
final AddIssueProgressRequest addIssueProgressRequest = AddIssueProgressRequest
.builder()
.issueId(IssueId.ofRepoId(record.getS_Issue_ID()))
.bookedEffort(Effort.ofSeconds(deltaBookedSeconds))
.build();
issueService.addIssueProgress(addIssueProgressRequest);
}
|
@CalloutMethod(columnNames = { I_S_TimeBooking.COLUMNNAME_HoursAndMinutes })
public void validateHmmInput(@NonNull final I_S_TimeBooking record)
{
final String hoursAndMinutes = record.getHoursAndMinutes();
if (Check.isBlank(hoursAndMinutes))
{
return;
}
if (!HmmUtils.matches(hoursAndMinutes))
{
throw new AdempiereException(INCORRECT_FORMAT_MSG_KEY)
.markAsUserValidationError();
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.serviceprovider\src\main\java\de\metas\serviceprovider\timebooking\S_TimeBooking.java
| 2
|
请完成以下Java代码
|
private static void exportToPlantUml(View view) throws WorkspaceWriterException {
StringWriter stringWriter = new StringWriter();
PlantUMLWriter plantUMLWriter = new PlantUMLWriter();
plantUMLWriter.write(view, stringWriter);
System.out.println(stringWriter.toString());
}
private static Workspace getSoftwareSystem() {
Workspace workspace = new Workspace("Payment Gateway", "Payment Gateway");
Model model = workspace.getModel();
Person user = model.addPerson("Merchant", "Merchant");
SoftwareSystem paymentTerminal = model.addSoftwareSystem(PAYMENT_TERMINAL, "Payment Terminal");
user.uses(paymentTerminal, "Makes payment");
SoftwareSystem fraudDetector = model.addSoftwareSystem(FRAUD_DETECTOR, "Fraud Detector");
paymentTerminal.uses(fraudDetector, "Obtains fraud score");
ViewSet viewSet = workspace.getViews();
SystemContextView contextView = viewSet.createSystemContextView(workspace.getModel().getSoftwareSystemWithName(PAYMENT_TERMINAL), SOFTWARE_SYSTEM_VIEW, "Payment Gateway Diagram");
|
contextView.addAllElements();
return workspace;
}
private static void addStyles(ViewSet viewSet) {
Styles styles = viewSet.getConfiguration().getStyles();
styles.addElementStyle(Tags.ELEMENT).color("#000000");
styles.addElementStyle(Tags.PERSON).background("#ffbf00").shape(Shape.Person);
styles.addElementStyle(Tags.CONTAINER).background("#facc2E");
styles.addRelationshipStyle(Tags.RELATIONSHIP).routing(Routing.Orthogonal);
styles.addRelationshipStyle(Tags.ASYNCHRONOUS).dashed(true);
styles.addRelationshipStyle(Tags.SYNCHRONOUS).dashed(false);
}
}
|
repos\tutorials-master\spring-structurizr\src\main\java\com\baeldung\structurizr\StructurizrSimple.java
| 1
|
请完成以下Java代码
|
public class FeatureTemplate implements ICacheAble
{
/**
* 用来解析模板的正则表达式
*/
static final Pattern pattern = Pattern.compile("%x\\[(-?\\d*),(\\d*)]");
String template;
/**
* 每个部分%x[-2,0]的位移,其中int[0]储存第一个数(-2),int[1]储存第二个数(0)
*/
ArrayList<int[]> offsetList;
List<String> delimiterList;
public FeatureTemplate()
{
}
public static FeatureTemplate create(String template)
{
FeatureTemplate featureTemplate = new FeatureTemplate();
featureTemplate.delimiterList = new LinkedList<String>();
featureTemplate.offsetList = new ArrayList<int[]>(3);
featureTemplate.template = template;
Matcher matcher = pattern.matcher(template);
int start = 0;
while (matcher.find())
{
featureTemplate.delimiterList.add(template.substring(start, matcher.start()));
start = matcher.end();
featureTemplate.offsetList.add(new int[]{Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2))});
}
return featureTemplate;
}
public char[] generateParameter(Table table, int current)
{
StringBuilder sb = new StringBuilder();
int i = 0;
for (String d : delimiterList)
{
sb.append(d);
int[] offset = offsetList.get(i++);
sb.append(table.get(current + offset[0], offset[1]));
}
char[] o = new char[sb.length()];
sb.getChars(0, sb.length(), o, 0);
return o;
}
|
@Override
public void save(DataOutputStream out) throws IOException
{
out.writeUTF(template);
out.writeInt(offsetList.size());
for (int[] offset : offsetList)
{
out.writeInt(offset[0]);
out.writeInt(offset[1]);
}
out.writeInt(delimiterList.size());
for (String s : delimiterList)
{
out.writeUTF(s);
}
}
@Override
public boolean load(ByteArray byteArray)
{
template = byteArray.nextUTF();
int size = byteArray.nextInt();
offsetList = new ArrayList<int[]>(size);
for (int i = 0; i < size; ++i)
{
offsetList.add(new int[]{byteArray.nextInt(), byteArray.nextInt()});
}
size = byteArray.nextInt();
delimiterList = new ArrayList<String>(size);
for (int i = 0; i < size; ++i)
{
delimiterList.add(byteArray.nextUTF());
}
return true;
}
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder("FeatureTemplate{");
sb.append("template='").append(template).append('\'');
sb.append(", delimiterList=").append(delimiterList);
sb.append('}');
return sb.toString();
}
public String getTemplate()
{
return template;
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\model\crf\FeatureTemplate.java
| 1
|
请完成以下Java代码
|
public void prepareInUI(final IClientUIAsyncExecutor<InitialValueType, ResultType, PartialResultType> executor)
{
// nothing at this level
}
@Override
public abstract ResultType runInBackground(IClientUIAsyncExecutor<InitialValueType, ResultType, PartialResultType> executor);
@Override
public void partialUpdateUI(final IClientUIAsyncExecutor<InitialValueType, ResultType, PartialResultType> executor, final PartialResultType partialResult)
{
logger.warn("Got a partial result which was not handled. Usually this happens when developer publishes partial results but it does not implement the partialUpdateUI method."
+ "\n Partial result: " + partialResult
+ "\n Runnable(this): " + this
+ "\n Executor: " + executor);
|
}
@Override
public void finallyUpdateUI(final IClientUIAsyncExecutor<InitialValueType, ResultType, PartialResultType> executor, final ResultType result)
{
// nothing at this level
}
@Override
public void handleExceptionInUI(final IClientUIAsyncExecutor<InitialValueType, ResultType, PartialResultType> executor, final Throwable ex)
{
throw AdempiereException.wrapIfNeeded(ex);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\adempiere\form\IClientUIAsyncInvoker.java
| 1
|
请完成以下Java代码
|
default void lazyLoad() {
// no-op
}
/**
* Return true if this container is capable of (and configured to) create batches
* of consumed messages.
* @return true if enabled.
* @since 2.2.4
*/
default boolean isConsumerBatchEnabled() {
return false;
}
/**
* Set the queue names.
* @param queues the queue names.
* @since 2.4
*/
void setQueueNames(String... queues);
/**
* Set auto startup.
* @param autoStart true to auto start.
* @since 2.4
*/
void setAutoStartup(boolean autoStart);
/**
* Get the message listener.
* @return The message listener object.
* @since 2.4
*/
|
@Nullable
Object getMessageListener();
/**
* Set the listener id.
* @param id the id.
* @since 2.4
*/
void setListenerId(String id);
@Override
default void afterPropertiesSet() {
}
}
|
repos\spring-amqp-main\spring-rabbit\src\main\java\org\springframework\amqp\rabbit\listener\MessageListenerContainer.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public @Nullable Duration getCacheDuration() {
return this.cacheDuration;
}
public void setCacheDuration(@Nullable Duration cacheDuration) {
this.cacheDuration = cacheDuration;
}
public boolean isFallbackToSystemLocale() {
return this.fallbackToSystemLocale;
}
public void setFallbackToSystemLocale(boolean fallbackToSystemLocale) {
this.fallbackToSystemLocale = fallbackToSystemLocale;
}
public boolean isAlwaysUseMessageFormat() {
return this.alwaysUseMessageFormat;
}
public void setAlwaysUseMessageFormat(boolean alwaysUseMessageFormat) {
this.alwaysUseMessageFormat = alwaysUseMessageFormat;
|
}
public boolean isUseCodeAsDefaultMessage() {
return this.useCodeAsDefaultMessage;
}
public void setUseCodeAsDefaultMessage(boolean useCodeAsDefaultMessage) {
this.useCodeAsDefaultMessage = useCodeAsDefaultMessage;
}
public @Nullable List<Resource> getCommonMessages() {
return this.commonMessages;
}
public void setCommonMessages(@Nullable List<Resource> commonMessages) {
this.commonMessages = commonMessages;
}
}
|
repos\spring-boot-4.0.1\core\spring-boot-autoconfigure\src\main\java\org\springframework\boot\autoconfigure\context\MessageSourceProperties.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public EntityLinkDataManager getEntityLinkDataManager() {
return entityLinkDataManager;
}
public EntityLinkServiceConfiguration setEntityLinkDataManager(EntityLinkDataManager entityLinkDataManager) {
this.entityLinkDataManager = entityLinkDataManager;
return this;
}
public HistoricEntityLinkDataManager getHistoricEntityLinkDataManager() {
return historicEntityLinkDataManager;
}
public EntityLinkServiceConfiguration setHistoricEntityLinkDataManager(HistoricEntityLinkDataManager historicEntityLinkDataManager) {
this.historicEntityLinkDataManager = historicEntityLinkDataManager;
return this;
}
public EntityLinkEntityManager getEntityLinkEntityManager() {
return entityLinkEntityManager;
}
public EntityLinkServiceConfiguration setEntityLinkEntityManager(EntityLinkEntityManager entityLinkEntityManager) {
this.entityLinkEntityManager = entityLinkEntityManager;
return this;
}
public HistoricEntityLinkEntityManager getHistoricEntityLinkEntityManager() {
|
return historicEntityLinkEntityManager;
}
public EntityLinkServiceConfiguration setHistoricEntityLinkEntityManager(HistoricEntityLinkEntityManager historicEntityLinkEntityManager) {
this.historicEntityLinkEntityManager = historicEntityLinkEntityManager;
return this;
}
@Override
public ObjectMapper getObjectMapper() {
return objectMapper;
}
@Override
public EntityLinkServiceConfiguration setObjectMapper(ObjectMapper objectMapper) {
this.objectMapper = objectMapper;
return this;
}
}
|
repos\flowable-engine-main\modules\flowable-entitylink-service\src\main\java\org\flowable\entitylink\service\EntityLinkServiceConfiguration.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public @Nullable String getDateFormat() {
return this.dateFormat;
}
public void setDateFormat(@Nullable String dateFormat) {
this.dateFormat = dateFormat;
}
/**
* Enumeration of levels of strictness. Values are the same as those on
* {@link com.google.gson.Strictness} that was introduced in Gson 2.11. To maximize
* backwards compatibility, the Gson enum is not used directly.
*/
public enum Strictness {
/**
* Lenient compliance.
|
*/
LENIENT,
/**
* Strict compliance with some small deviations for legacy reasons.
*/
LEGACY_STRICT,
/**
* Strict compliance.
*/
STRICT
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-gson\src\main\java\org\springframework\boot\gson\autoconfigure\GsonProperties.java
| 2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.