instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请完成以下Java代码
|
public void setM_HU_PI_Version(final de.metas.handlingunits.model.I_M_HU_PI_Version M_HU_PI_Version)
{
set_ValueFromPO(COLUMNNAME_M_HU_PI_Version_ID, de.metas.handlingunits.model.I_M_HU_PI_Version.class, M_HU_PI_Version);
}
@Override
public void setM_HU_PI_Version_ID (final int M_HU_PI_Version_ID)
{
if (M_HU_PI_Version_ID < 1)
set_Value (COLUMNNAME_M_HU_PI_Version_ID, null);
else
set_Value (COLUMNNAME_M_HU_PI_Version_ID, M_HU_PI_Version_ID);
}
@Override
public int getM_HU_PI_Version_ID()
{
return get_ValueAsInt(COLUMNNAME_M_HU_PI_Version_ID);
}
@Override
public void setM_Locator_ID (final int M_Locator_ID)
{
if (M_Locator_ID < 1)
set_Value (COLUMNNAME_M_Locator_ID, null);
else
set_Value (COLUMNNAME_M_Locator_ID, M_Locator_ID);
}
@Override
public int getM_Locator_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Locator_ID);
}
@Override
public void setM_Product_Category_ID (final int M_Product_Category_ID)
{
throw new IllegalArgumentException ("M_Product_Category_ID is virtual column"); }
@Override
public int getM_Product_Category_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_Category_ID);
}
@Override
|
public void setM_Product_ID (final int M_Product_ID)
{
throw new IllegalArgumentException ("M_Product_ID is virtual column"); }
@Override
public int getM_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
@Override
public void setSerialNo (final @Nullable java.lang.String SerialNo)
{
throw new IllegalArgumentException ("SerialNo is virtual column"); }
@Override
public java.lang.String getSerialNo()
{
return get_ValueAsString(COLUMNNAME_SerialNo);
}
@Override
public void setServiceContract (final @Nullable java.lang.String ServiceContract)
{
throw new IllegalArgumentException ("ServiceContract is virtual column"); }
@Override
public java.lang.String getServiceContract()
{
return get_ValueAsString(COLUMNNAME_ServiceContract);
}
@Override
public void setValue (final java.lang.String Value)
{
set_ValueNoCheck (COLUMNNAME_Value, Value);
}
@Override
public java.lang.String getValue()
{
return get_ValueAsString(COLUMNNAME_Value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java-gen\de\metas\handlingunits\model\X_M_HU.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class LMQRCode implements IHUQRCode
{
@NonNull GlobalQRCode code;
@NonNull BigDecimal weightInKg;
@Nullable LocalDate bestBeforeDate;
@Nullable String lotNumber;
@Nullable String productNo;
public static boolean isHandled(@NonNull final GlobalQRCode globalQRCode)
{
return LMQRCodeParser.isHandled(globalQRCode);
}
@NonNull
public static LMQRCode fromGlobalQRCodeJsonString(@NonNull final String qrCodeString)
{
return LMQRCodeParser.fromGlobalQRCodeJsonString(qrCodeString);
}
public static LMQRCode fromGlobalQRCode(@NonNull final GlobalQRCode globalQRCode)
{
return LMQRCodeParser.fromGlobalQRCode(globalQRCode);
}
@Override
|
@Deprecated
public String toString() {return getAsString();}
@Override
public String getAsString() {return code.getAsString();}
public boolean isWeightRequired() {return true;}
@Override
public Optional<BigDecimal> getWeightInKg() {return Optional.of(weightInKg);}
@Override
public Optional<LocalDate> getBestBeforeDate() {return Optional.ofNullable(bestBeforeDate);}
@Override
public Optional<String> getLotNumber() {return StringUtils.trimBlankToOptional(lotNumber);}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\qrcodes\leich_und_mehl\LMQRCode.java
| 2
|
请完成以下Java代码
|
public class HttpHeaderSecurityFilter implements Filter {
protected final List<HeaderSecurityProvider> headerSecurityProviders = new ArrayList<HeaderSecurityProvider>() {{
add(new XssProtectionProvider());
add(new ContentSecurityPolicyProvider());
add(new ContentTypeOptionsProvider());
add(new StrictTransportSecurityProvider());
}};
public void init(FilterConfig filterConfig) {
for (HeaderSecurityProvider provider : headerSecurityProviders) {
Map<String, String> filterParams = provider.initParams();
for (Map.Entry<String, String> filterParam : filterParams.entrySet()) {
String key = filterParam.getKey();
String value = filterConfig.getInitParameter(key);
if (value != null) {
filterParam.setValue(value);
}
}
provider.parseParams();
}
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
if (response instanceof HttpServletResponse) {
HttpServletResponse httpResponse = (HttpServletResponse) response;
|
for (HeaderSecurityProvider provider : headerSecurityProviders) {
if (!provider.isDisabled()) {
String headerName = provider.getHeaderName();
String headerValue = provider.getHeaderValue(request.getServletContext());
httpResponse.setHeader(headerName, headerValue);
}
}
}
chain.doFilter(request, response);
}
public void destroy() {
}
}
|
repos\camunda-bpm-platform-master\webapps\assembly\src\main\java\org\camunda\bpm\webapp\impl\security\filter\headersec\HttpHeaderSecurityFilter.java
| 1
|
请完成以下Java代码
|
public CustomizedRedisCache getMissingCache(String cacheName) {
// 有效时间,初始化获取默认的有效时间
Long expirationSecondTime = getExpirationSecondTime(cacheName);
// 自动刷新时间,默认是0
Long preloadSecondTime = getPreloadSecondTime(cacheName);
logger.info("缓存 cacheName:{},过期时间:{}, 自动刷新时间:{}", cacheName, expirationSecondTime, preloadSecondTime);
// 是否在运行时创建Cache
Boolean dynamic = (Boolean) ReflectionUtils.getFieldValue(getInstance(), SUPER_FIELD_DYNAMIC);
// 是否允许存放NULL
Boolean cacheNullValues = (Boolean) ReflectionUtils.getFieldValue(getInstance(), SUPER_FIELD_CACHENULLVALUES);
return dynamic ? new CustomizedRedisCache(cacheName, (this.isUsePrefix() ? this.getCachePrefix().prefix(cacheName) : null),
this.getRedisOperations(), expirationSecondTime, preloadSecondTime, cacheNullValues) : null;
}
/**
* 根据缓存名称设置缓存的有效时间和刷新时间,单位秒
*
* @param cacheTimes
*/
public void setCacheTimess(Map<String, CacheTime> cacheTimes) {
this.cacheTimes = (cacheTimes != null ? new ConcurrentHashMap<String, CacheTime>(cacheTimes) : null);
}
/**
* 设置默认的过去时间, 单位:秒
|
*
* @param defaultExpireTime
*/
@Override
public void setDefaultExpiration(long defaultExpireTime) {
super.setDefaultExpiration(defaultExpireTime);
this.defaultExpiration = defaultExpireTime;
}
@Deprecated
@Override
public void setExpires(Map<String, Long> expires) {
}
}
|
repos\spring-boot-student-master\spring-boot-student-cache-redis-2\src\main\java\com\xiaolyuh\redis\cache\CustomizedRedisCacheManager.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public static class Unpick
{
@Nullable String unpickToTargetQRCode;
}
@Nullable
Unpick unpick;
@Value
@Builder
@Jacksonized
public static class DropTo
{
@Nullable ScannedCode qrCode;
}
@Nullable DropTo dropTo;
@Builder
@Jacksonized
private JsonDistributionEvent(
@NonNull final String wfProcessId,
@NonNull final String wfActivityId,
@Nullable final DistributionJobLineId lineId,
@Nullable final DistributionJobStepId distributionStepId,
//
@Nullable final PickFrom pickFrom,
@Nullable final Unpick unpick,
@Nullable final DropTo dropTo)
{
if (CoalesceUtil.countNotNulls(pickFrom, dropTo, unpick) != 1)
{
throw new AdempiereException("One and only one action like pickFrom, dropTo etc shall be specified in an event.");
|
}
this.wfProcessId = wfProcessId;
this.wfActivityId = wfActivityId;
this.lineId = lineId;
this.distributionStepId = distributionStepId;
//
this.pickFrom = pickFrom;
this.dropTo = dropTo;
this.unpick = unpick;
}
@NonNull
@JsonIgnore
public DropTo getDropToNonNull()
{
return Check.assumeNotNull(dropTo, "dropTo shall not be null: {}", this);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.distribution.rest-api\src\main\java\de\metas\distribution\mobileui\rest_api\json\JsonDistributionEvent.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public Date getCreateTime() {
return job.getCreateTime();
}
@Override
public String getId() {
return job.getId();
}
@Override
public int getRetries() {
return job.getRetries();
}
@Override
public String getExceptionMessage() {
return job.getExceptionMessage();
}
@Override
public String getTenantId() {
return job.getTenantId();
}
@Override
public String getJobHandlerType() {
return job.getJobHandlerType();
}
@Override
public String getJobHandlerConfiguration() {
return job.getJobHandlerConfiguration();
|
}
@Override
public String getCustomValues() {
return job.getCustomValues();
}
@Override
public String getLockOwner() {
return job.getLockOwner();
}
@Override
public Date getLockExpirationTime() {
return job.getLockExpirationTime();
}
@Override
public String toString() {
return new StringJoiner(", ", AcquiredExternalWorkerJobImpl.class.getSimpleName() + "[", "]")
.add("job=" + job)
.toString();
}
}
|
repos\flowable-engine-main\modules\flowable-job-service\src\main\java\org\flowable\job\service\impl\AcquiredExternalWorkerJobImpl.java
| 2
|
请完成以下Java代码
|
public class Book {
@PrimaryKeyColumn(name = "id", ordinal = 0, type = PrimaryKeyType.CLUSTERED, ordering = Ordering.DESCENDING)
private UUID id;
@PrimaryKeyColumn(name = "title", ordinal = 1, type = PrimaryKeyType.PARTITIONED)
private String title;
@PrimaryKeyColumn(name = "publisher", ordinal = 2, type = PrimaryKeyType.PARTITIONED)
private String publisher;
@Column
private Set<String> tags = new HashSet<>();
public Book() {
}
public Book(final UUID id, final String title, final String publisher, final Set<String> tags) {
this.id = id;
this.title = title;
this.publisher = publisher;
this.tags.addAll(tags);
}
public UUID getId() {
return id;
}
public String getTitle() {
|
return title;
}
public String getPublisher() {
return publisher;
}
public Set getTags() {
return tags;
}
public void setId(final UUID id) {
this.id = id;
}
public void setTitle(final String title) {
this.title = title;
}
public void setPublisher(final String publisher) {
this.publisher = publisher;
}
public void setTags(final Set<String> tags) {
this.tags = tags;
}
}
|
repos\tutorials-master\persistence-modules\spring-data-cassandra\src\main\java\com\baeldung\spring\data\cassandra\model\Book.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public PaymentDocumentType getType()
{
return PaymentDocumentType.RegularPayment;
}
@Override
public final String getDocumentNo()
{
if (!Check.isEmpty(documentNo, true))
{
return documentNo;
}
final TableRecordReference reference = getReference();
if (reference != null)
{
return "<" + reference.getRecord_ID() + ">";
}
return "?";
}
@Override
public CurrencyId getCurrencyId()
{
return amountToAllocateInitial.getCurrencyId();
}
@Override
public void addAllocatedAmt(@NonNull final Money allocatedAmtToAdd)
{
allocatedAmt = allocatedAmt.add(allocatedAmtToAdd);
amountToAllocate = amountToAllocate.subtract(allocatedAmtToAdd);
}
@Override
public LocalDate getDate()
{
|
return dateTrx;
}
@Override
public boolean isFullyAllocated()
{
return getAmountToAllocate().signum() == 0;
}
private Money getOpenAmtRemaining()
{
final Money totalAllocated = allocatedAmt;
return openAmtInitial.subtract(totalAllocated);
}
@Override
public Money calculateProjectedOverUnderAmt(@NonNull final Money amountToAllocate)
{
return getOpenAmtRemaining().subtract(amountToAllocate);
}
@Override
public boolean canPay(@NonNull final PayableDocument payable)
{
return true;
}
@Override
public Money getPaymentDiscountAmt()
{
return amountToAllocate.toZero();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.base\src\main\java\de\metas\banking\payment\paymentallocation\service\PaymentDocument.java
| 2
|
请完成以下Java代码
|
public Class<? extends BaseElement> getHandledType() {
return ThrowEvent.class;
}
@Override
protected void executeParse(BpmnParse bpmnParse, ThrowEvent intermediateEvent) {
ActivityImpl nestedActivityImpl = createActivityOnCurrentScope(bpmnParse, intermediateEvent, BpmnXMLConstants.ELEMENT_EVENT_THROW);
EventDefinition eventDefinition = null;
if (!intermediateEvent.getEventDefinitions().isEmpty()) {
eventDefinition = intermediateEvent.getEventDefinitions().get(0);
}
nestedActivityImpl.setAsync(intermediateEvent.isAsynchronous());
nestedActivityImpl.setExclusive(!intermediateEvent.isNotExclusive());
if (eventDefinition instanceof SignalEventDefinition) {
bpmnParse.getBpmnParserHandlers().parseElement(bpmnParse, eventDefinition);
} else if (eventDefinition instanceof org.flowable.bpmn.model.CompensateEventDefinition) {
bpmnParse.getBpmnParserHandlers().parseElement(bpmnParse, eventDefinition);
} else if (eventDefinition == null) {
nestedActivityImpl.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createIntermediateThrowNoneEventActivityBehavior(intermediateEvent));
} else {
LOGGER.warn("Unsupported intermediate throw event type for throw event {}", intermediateEvent.getId());
}
}
//
// Seems not to be used anymore?
//
// protected CompensateEventDefinition createCompensateEventDefinition(BpmnParse bpmnParse, org.activiti.bpmn.model.CompensateEventDefinition eventDefinition, ScopeImpl scopeElement) {
|
// if (StringUtils.isNotEmpty(eventDefinition.getActivityRef())) {
// if (scopeElement.findActivity(eventDefinition.getActivityRef()) == null) {
// bpmnParse.getBpmnModel().addProblem("Invalid attribute value for 'activityRef': no activity with id '" + eventDefinition.getActivityRef() +
// "' in current scope " + scopeElement.getId(), eventDefinition);
// }
// }
//
// CompensateEventDefinition compensateEventDefinition = new CompensateEventDefinition();
// compensateEventDefinition.setActivityRef(eventDefinition.getActivityRef());
// compensateEventDefinition.setWaitForCompletion(eventDefinition.isWaitForCompletion());
//
// return compensateEventDefinition;
// }
}
|
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\bpmn\parser\handler\IntermediateThrowEventParseHandler.java
| 1
|
请完成以下Java代码
|
public Timestamp getDateNextRun(boolean requery)
{
if (requery)
{
InterfaceWrapperHelper.refresh(impProcessor);
}
return impProcessor.getDateNextRun();
}
@Override
public void setDateNextRun(Timestamp dateNextWork)
{
impProcessor.setDateNextRun(dateNextWork);
}
@Override
public Timestamp getDateLastRun()
{
return impProcessor.getDateLastRun();
}
@Override
public void setDateLastRun(Timestamp dateLastRun)
{
impProcessor.setDateLastRun(dateLastRun);
|
}
@Override
public boolean saveOutOfTrx()
{
InterfaceWrapperHelper.save(impProcessor, ITrx.TRXNAME_None);
return true;
}
@Override
public AdempiereProcessorLog[] getLogs()
{
final List<AdempiereProcessorLog> list = Services.get(IIMPProcessorDAO.class).retrieveAdempiereProcessorLogs(impProcessor);
return list.toArray(new AdempiereProcessorLog[list.size()]);
}
@Override
public String get_TableName()
{
return I_IMP_Processor.Table_Name;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\server\rpl\api\impl\IMPProcessorAdempiereProcessorAdapter.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class InventoryValuationService
{
private static final String SQL_SELECT = "SELECT * FROM de_metas_acct.report_InventoryValue("
+ " p_DateAcct => ?,"
+ " p_M_Product_ID => ?,"
+ " p_M_Warehouse_ID => ?,"
+ " p_AD_Language => ?"
+ ")";
public InventoryValuationResponse report(final InventoryValuationRequest request)
{
final String adLanguage = CoalesceUtil.coalesceNotNull(request.getAdLanguage(), Language.getBaseAD_Language());
final ImmutableList<InventoryValue> rows = DB.retrieveRows(
SQL_SELECT,
new Object[] { request.getDateAcct(), request.getProductId(), request.getWarehouseId(), adLanguage },
InventoryValuationService::retrieveInventoryValueRow
);
return InventoryValuationResponse.builder()
.lines(rows)
.build();
}
private static InventoryValue retrieveInventoryValueRow(final ResultSet rs) throws SQLException
{
return InventoryValue.builder()
.combination(rs.getString("combination"))
.description(rs.getString("description"))
.activityName(rs.getString("ActivityName"))
.warehouseName(rs.getString("WarehouseName"))
.productValue(rs.getString("ProductValue"))
.productName(rs.getString("ProductName"))
.qty(rs.getBigDecimal("Qty"))
.uomSymbol(rs.getString("UOMSymbol"))
|
.accounted(retrieveAmounts(rs, "Acct"))
.costing(retrieveAmounts(rs, "Costing"))
.inventoryValueAcctAmt(retrieveBigDecimalOrZero(rs, "InventoryValueAcctAmt"))
.build();
}
private static InventoryValue.Amounts retrieveAmounts(@NonNull final ResultSet rs, @NonNull final String prefix) throws SQLException
{
return InventoryValue.Amounts.builder()
.costPrice(retrieveBigDecimalOrZero(rs, prefix + "_CostPrice"))
.expectedAmt(retrieveBigDecimalOrZero(rs, prefix + "_ExpectedAmt"))
.errorAmt(retrieveBigDecimalOrZero(rs, prefix + "_ErrorAmt"))
.build();
}
@NonNull
private static BigDecimal retrieveBigDecimalOrZero(final @NonNull ResultSet rs, final @NonNull String columnName) throws SQLException
{
return CoalesceUtil.coalesceNotNull(rs.getBigDecimal(columnName), BigDecimal.ZERO);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\inventory\InventoryValuationService.java
| 2
|
请完成以下Java代码
|
private boolean detachAndDropPartition(String table, long partitionTs) {
Map<Long, SqlPartition> cachedPartitions = tablesPartitions.get(table);
if (cachedPartitions != null) cachedPartitions.remove(partitionTs);
String tablePartition = table + "_" + partitionTs;
String detachPsqlStmtStr = "ALTER TABLE " + table + " DETACH PARTITION " + tablePartition;
// hotfix of ERROR: partition "integration_debug_event_1678323600000" already pending detach in partitioned table "public.integration_debug_event"
// https://github.com/thingsboard/thingsboard/issues/8271
// if (getCurrentServerVersion() >= PSQL_VERSION_14) {
// detachPsqlStmtStr += " CONCURRENTLY";
// }
String dropStmtStr = "DROP TABLE " + tablePartition;
try {
getJdbcTemplate().execute(detachPsqlStmtStr);
getJdbcTemplate().execute(dropStmtStr);
return true;
} catch (DataAccessException e) {
log.error("[{}] Error occurred trying to detach and drop the partition {} ", table, partitionTs, e);
}
return false;
}
private static long getPartitionEndTime(long startTime, long partitionDurationMs) {
return startTime + partitionDurationMs;
}
public List<Long> fetchPartitions(String table) {
List<Long> partitions = new ArrayList<>();
List<String> partitionsTables = getJdbcTemplate().queryForList(SELECT_PARTITIONS_STMT, String.class, table);
for (String partitionTableName : partitionsTables) {
String partitionTsStr = partitionTableName.substring(table.length() + 1);
try {
partitions.add(Long.parseLong(partitionTsStr));
} catch (NumberFormatException nfe) {
log.debug("Failed to parse table name: {}", partitionTableName);
|
}
}
return partitions;
}
public long calculatePartitionStartTime(long ts, long partitionDuration) {
return ts - (ts % partitionDuration);
}
private synchronized int getCurrentServerVersion() {
if (currentServerVersion == null) {
try {
currentServerVersion = getJdbcTemplate().queryForObject("SELECT current_setting('server_version_num')", Integer.class);
} catch (Exception e) {
log.warn("Error occurred during fetch of the server version", e);
}
if (currentServerVersion == null) {
currentServerVersion = 0;
}
}
return currentServerVersion;
}
protected JdbcTemplate getJdbcTemplate() {
return jdbcTemplate;
}
}
|
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\sqlts\insert\sql\SqlPartitioningRepository.java
| 1
|
请完成以下Java代码
|
public void addMissingAcctRecords()
{
// NOTE: a step forward would be to use POAccountingInfo and do something similar to PO.insert_Accounting
DB.executeFunctionCallEx(ITrx.TRXNAME_None, "select createM_Product_Category_Acct()", null);
Loggables.addLog("Added missing M_Product_Category_Acct records");
}
@Value(staticConstructor = "of")
private static class ProductCategoryIdAndAcctSchemaId
{
@NonNull ProductCategoryId productCategoryId;
@NonNull AcctSchemaId acctSchemaId;
}
@EqualsAndHashCode
@ToString
private static final class ProductCategoryAccountsCollection
{
private final ImmutableMap<ProductCategoryIdAndAcctSchemaId, ProductCategoryAccounts> map;
|
public ProductCategoryAccountsCollection(final List<ProductCategoryAccounts> list)
{
this.map = Maps.uniqueIndex(
list,
productCategoryAcct -> ProductCategoryIdAndAcctSchemaId.of(productCategoryAcct.getProductCategoryId(), productCategoryAcct.getAcctSchemaId()));
}
public Optional<ProductCategoryAccounts> getBy(
@NonNull final ProductCategoryId productCategoryId,
@NonNull final AcctSchemaId acctSchemaId)
{
final ProductCategoryIdAndAcctSchemaId key = ProductCategoryIdAndAcctSchemaId.of(productCategoryId, acctSchemaId);
return Optional.ofNullable(map.get(key));
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\accounts\ProductCategoryAccountsRepository.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class ProductService {
private final Set<Product> products = new HashSet<>();
{
products.add(new Product("Book", 23.90, 1));
products.add(new Product("Pen", 44.34, 2));
}
public Product findById(int id) {
return products.stream()
.filter(obj -> obj.getId() == id)
.findFirst()
.orElseThrow(() -> new ItemNotFoundException("Product not found"));
}
public Product findByName(String name) {
return products.stream()
.filter(obj -> obj.getName()
.equalsIgnoreCase(name))
.findFirst()
.orElseThrow(() -> new ItemNotFoundException("Product not found"));
}
public Set<Product> findAll() {
return products;
|
}
public Product save(Product product) {
if (!StringUtils.hasLength(product.getName()) || product.getPrice() == 0.0) {
throw new IllegalArgumentException();
}
int newId = products.stream()
.mapToInt(Product::getId)
.max()
.getAsInt() + 1;
product.setId(newId);
products.add(product);
return product;
}
public static class ItemNotFoundException extends RuntimeException {
/**
*
*/
private static final long serialVersionUID = 1L;
public ItemNotFoundException(String msg) {
super(msg);
}
}
}
|
repos\tutorials-master\spring-boot-modules\spring-boot-mvc-2\src\main\java\com\baeldung\springbootmvc\svc\ProductService.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class Article {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String title;
private String body;
private String author;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
|
this.title = title;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
}
|
repos\tutorials-master\persistence-modules\spring-boot-persistence-5\src\main\java\com\baeldung\db2database\entity\Article.java
| 2
|
请完成以下Java代码
|
public void setIncludeSubDomains(boolean includeSubDomains) {
this.subdomain = includeSubDomains ? " ; includeSubDomains" : "";
updateDelegate();
}
/**
* <p>
* Sets if preload should be included. Default is false
* </p>
*
* <p>
* See <a href="https://hstspreload.org/">Website hstspreload.org</a> for additional
* details.
* </p>
* @param preload if preload should be included
* @since 5.2.0
*/
public void setPreload(boolean preload) {
this.preload = preload ? " ; preload" : "";
updateDelegate();
}
/**
* Sets the max age of the header. Default is a year.
* @param maxAge the max age of the header
*/
public void setMaxAge(Duration maxAge) {
this.maxAge = "max-age=" + maxAge.getSeconds();
|
updateDelegate();
}
private void updateDelegate() {
Builder builder = StaticServerHttpHeadersWriter.builder();
builder.header(STRICT_TRANSPORT_SECURITY, this.maxAge + this.subdomain + this.preload);
this.delegate = builder.build();
}
private boolean isSecure(ServerWebExchange exchange) {
String scheme = exchange.getRequest().getURI().getScheme();
boolean isSecure = scheme != null && scheme.equalsIgnoreCase("https");
return isSecure;
}
}
|
repos\spring-security-main\web\src\main\java\org\springframework\security\web\server\header\StrictTransportSecurityServerHttpHeadersWriter.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private TreeSet<TransactionDetail> extractAllTransactionDetails(
@NonNull final Candidate candidate,
@NonNull final TransactionDetail changedTransactionDetail)
{
final ImmutableList<TransactionDetail> otherTransactionDetails = candidate.getTransactionDetails()
.stream()
.filter(transactionDetail -> transactionDetail.getTransactionId() != changedTransactionDetail.getTransactionId())
.collect(ImmutableList.toImmutableList());
// note: using TreeSet to make sure we don't end up with duplicated transactionDetails
final TreeSet<TransactionDetail> newTransactionDetailsSet = new TreeSet<>(Comparator.comparing(TransactionDetail::getTransactionId));
newTransactionDetailsSet.addAll(otherTransactionDetails);
newTransactionDetailsSet.add(changedTransactionDetail);
return newTransactionDetailsSet;
}
/**
* @param transactionCreatedEvent note that creating a new candidate doesn't make sense for a {@link TransactionDeletedEvent}
*/
@VisibleForTesting
static CandidateBuilder createBuilderForNewUnrelatedCandidate(
@NonNull final TransactionCreatedEvent transactionCreatedEvent,
@NonNull final BigDecimal quantity)
{
final CandidateBuilder builder = Candidate.builderForEventDescriptor(transactionCreatedEvent.getEventDescriptor());
// TODO INVENTORY_UP/DOWN are not CandidateTypes, but business-cases!
|
if (quantity.signum() <= 0)
{
final CandidateType type = transactionCreatedEvent.getInventoryLineId() > 0 ? CandidateType.INVENTORY_DOWN : CandidateType.UNEXPECTED_DECREASE;
return builder.type(type)
.materialDescriptor(transactionCreatedEvent.getMaterialDescriptor().withQuantity(quantity.negate()))
.minMaxDescriptor(transactionCreatedEvent.getMinMaxDescriptor());
}
else
{
final CandidateType type = transactionCreatedEvent.getInventoryLineId() > 0 ? CandidateType.INVENTORY_UP : CandidateType.UNEXPECTED_INCREASE;
return builder.type(type)
.materialDescriptor(transactionCreatedEvent.getMaterialDescriptor());
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.material\dispo-service\src\main\java\de\metas\material\dispo\service\event\handler\TransactionEventHandler.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public String buildPermissionTree(String roleIds) throws PermissionException {
List treeData = null;
try {
treeData = pmsMenuService.listByRoleIds(roleIds);
if (StringUtil.isEmpty(treeData)) {
LOG.error("用户没有分配菜单权限");
throw new PermissionException(PermissionException.PERMISSION_USER_NOT_MENU, "该用户没有分配菜单权限"); // 该用户没有分配菜单权限
}
} catch (Exception e) {
LOG.error("根据角色查询菜单出现错误", e);
throw new PermissionException(PermissionException.PERMISSION_QUERY_MENU_BY_ROLE_ERROR, "根据角色查询菜单出现错误"); // 查询当前角色的
}
StringBuffer strJson = new StringBuffer();
buildAdminPermissionTree("0", strJson, treeData);
return strJson.toString();
}
/**
* 构建管理后台的树形权限功能菜单
*
* @param pId
* @param treeBuf
* @param menuList
*/
@SuppressWarnings("rawtypes")
private void buildAdminPermissionTree(String pId, StringBuffer treeBuf, List menuList) {
List<Map> listMap = getSonMenuListByPid(pId.toString(), menuList);
for (Map map : listMap) {
String id = map.get("id").toString();// id
String name = map.get("name").toString();// 名称
String isLeaf = map.get("isLeaf").toString();// 是否叶子
String level = map.get("level").toString();// 菜单层级(1、2、3、4)
String url = map.get("url").toString(); // ACTION访问地址
String navTabId = "";
if (!StringUtil.isEmpty(map.get("targetName"))) {
navTabId = map.get("targetName").toString(); // 用于刷新查询页面
}
if ("1".equals(level)) {
treeBuf.append("<div class='accordionHeader'>");
treeBuf.append("<h2> <span>Folder</span> " + name + "</h2>");
treeBuf.append("</div>");
treeBuf.append("<div class='accordionContent'>");
}
if ("YES".equals(isLeaf)) {
treeBuf.append("<li><a href='" + url + "' target='navTab' rel='" + navTabId + "'>" + name + "</a></li>");
} else {
if ("1".equals(level)) {
treeBuf.append("<ul class='tree treeFolder'>");
} else {
treeBuf.append("<li><a>" + name + "</a>");
treeBuf.append("<ul>");
}
buildAdminPermissionTree(id, treeBuf, menuList);
if ("1".equals(level)) {
treeBuf.append("</ul>");
} else {
treeBuf.append("</ul></li>");
}
}
|
if ("1".equals(level)) {
treeBuf.append("</div>");
}
}
}
/**
* 根据(pId)获取(menuList)中的所有子菜单集合.
*
* @param pId
* 父菜单ID.
* @param menuList
* 菜单集合.
* @return sonMenuList.
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
private List<Map> getSonMenuListByPid(String pId, List menuList) {
List sonMenuList = new ArrayList<Object>();
for (Object menu : menuList) {
Map map = (Map) menu;
if (map != null) {
String parentId = map.get("pId").toString();// 父id
if (parentId.equals(pId)) {
sonMenuList.add(map);
}
}
}
return sonMenuList;
}
}
|
repos\roncoo-pay-master\roncoo-pay-web-boss\src\main\java\com\roncoo\pay\controller\login\LoginController.java
| 2
|
请完成以下Java代码
|
public String[] getWhereClauses(final List<Object> params)
{
return new String[0];
}
@Override
public String getText()
{
return null;
}
@Override
public void save(final Properties ctx, final int windowNo, final IInfoWindowGridRowBuilders builders)
{
for (final Map.Entry<Integer, Integer> e : recordId2asi.entrySet())
{
final Integer recordId = e.getKey();
if (recordId == null || recordId <= 0)
{
continue;
}
final Integer asiId = e.getValue();
if (asiId == null || asiId <= 0)
{
continue;
}
final OrderLineProductASIGridRowBuilder productQtyBuilder = new OrderLineProductASIGridRowBuilder();
productQtyBuilder.setSource(recordId, asiId);
builders.addGridTabRowBuilder(recordId, productQtyBuilder);
}
}
@Override
public void prepareEditor(final CEditor editor, final Object value, final int rowIndexModel, final int columnIndexModel)
{
final VPAttributeContext attributeContext = new VPAttributeContext(rowIndexModel);
|
editor.putClientProperty(IVPAttributeContext.ATTR_NAME, attributeContext);
// nothing
}
@Override
public String getProductCombinations()
{
// nothing to do
return null;
}
@Override
public String toString()
{
return ObjectUtils.toString(this);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\adempiere\gui\search\InfoProductASIController.java
| 1
|
请完成以下Java代码
|
public String getHelp ()
{
return (String)get_Value(COLUMNNAME_Help);
}
/** Set Import Processor Type.
@param IMP_Processor_Type_ID Import Processor Type */
public void setIMP_Processor_Type_ID (int IMP_Processor_Type_ID)
{
if (IMP_Processor_Type_ID < 1)
set_ValueNoCheck (COLUMNNAME_IMP_Processor_Type_ID, null);
else
set_ValueNoCheck (COLUMNNAME_IMP_Processor_Type_ID, Integer.valueOf(IMP_Processor_Type_ID));
}
/** Get Import Processor Type.
@return Import Processor Type */
public int getIMP_Processor_Type_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_IMP_Processor_Type_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Java Class.
@param JavaClass Java Class */
public void setJavaClass (String JavaClass)
{
set_Value (COLUMNNAME_JavaClass, JavaClass);
}
/** Get Java Class.
@return Java Class */
public String getJavaClass ()
{
|
return (String)get_Value(COLUMNNAME_JavaClass);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Set Search Key.
@param Value
Search key for the record in the format required - must be unique
*/
public void setValue (String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
/** Get Search Key.
@return Search key for the record in the format required - must be unique
*/
public String getValue ()
{
return (String)get_Value(COLUMNNAME_Value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_IMP_Processor_Type.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class CassandraBufferedRateReadExecutor extends AbstractBufferedRateExecutor<CassandraStatementTask, TbResultSetFuture, TbResultSet> {
public CassandraBufferedRateReadExecutor(
@Value("${cassandra.query.buffer_size}") int queueLimit,
@Value("${cassandra.query.concurrent_limit}") int concurrencyLimit,
@Value("${cassandra.query.permit_max_wait_time}") long maxWaitTime,
@Value("${cassandra.query.dispatcher_threads:2}") int dispatcherThreads,
@Value("${cassandra.query.callback_threads:4}") int callbackThreads,
@Value("${cassandra.query.poll_ms:50}") long pollMs,
@Value("${cassandra.query.tenant_rate_limits.print_tenant_names}") boolean printTenantNames,
@Value("${cassandra.query.print_queries_freq:0}") int printQueriesFreq,
@Autowired StatsFactory statsFactory,
@Autowired EntityService entityService,
@Autowired RateLimitService rateLimitService,
@Autowired(required = false) TbServiceInfoProvider serviceInfoProvider) {
super(queueLimit, concurrencyLimit, maxWaitTime, dispatcherThreads, callbackThreads, pollMs, printQueriesFreq,
BufferedRateExecutorType.READ, serviceInfoProvider, rateLimitService, statsFactory, entityService, printTenantNames);
}
@Scheduled(fixedDelayString = "${cassandra.query.rate_limit_print_interval_ms}")
@Override
public void printStats() {
super.printStats();
}
@PreDestroy
public void stop() {
|
super.stop();
}
@Override
protected SettableFuture<TbResultSet> create() {
return SettableFuture.create();
}
@Override
protected TbResultSetFuture wrap(CassandraStatementTask task, SettableFuture<TbResultSet> future) {
return new TbResultSetFuture(future);
}
@Override
protected ListenableFuture<TbResultSet> execute(AsyncTaskContext<CassandraStatementTask, TbResultSet> taskCtx) {
CassandraStatementTask task = taskCtx.getTask();
return task.executeAsync(
statement ->
this.submit(new CassandraStatementTask(task.getTenantId(), task.getSession(), statement))
);
}
}
|
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\nosql\CassandraBufferedRateReadExecutor.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class CustomersInterfaceImpl implements CustomersInterface {
Logger logger= LoggerFactory.getLogger(this.getClass());
@Autowired
private CustomerRepository customerRepository;
@Override
public List<Customer> searchCity(Integer pageNumber, Integer pageSize, String searchContent) {
/* // 分页参数
Pageable pageable = new PageRequest(pageNumber, pageSize);
// Function Score Query
FunctionScoreQueryBuilder functionScoreQueryBuilder = QueryBuilders.functionScoreQuery()
.add(QueryBuilders.boolQuery().should(QueryBuilders.matchQuery("cityname", searchContent)),
ScoreFunctionBuilders.weightFactorFunction(1000))
.add(QueryBuilders.boolQuery().should(QueryBuilders.matchQuery("description", searchContent)),
|
ScoreFunctionBuilders.weightFactorFunction(100));
// 创建搜索 DSL 查询
SearchQuery searchQuery = new NativeSearchQueryBuilder()
.withPageable(pageable)
.withQuery(functionScoreQueryBuilder).build();
logger.info("\n searchCity(): searchContent [" + searchContent + "] \n DSL = \n " + searchQuery.getQuery().toString());
Page<Customer> searchPageResults = customerRepository.search(searchQuery);
return searchPageResults.getContent();
*/
return null;
}
}
|
repos\spring-boot-leaning-master\2.x_42_courses\第 4-8 课:Spring Boot 集成 ElasticSearch\spring-boot-elasticsearch\src\main\java\com\neo\service\impl\CustomersInterfaceImpl.java
| 2
|
请完成以下Java代码
|
public String getServerID()
{
return "WorkflowProcessor" + get_ID();
} // getServerID
/**
* Get Date Next Run
*
* @param requery requery
* @return date next run
*/
@Override
public Timestamp getDateNextRun(boolean requery)
{
if (requery)
load(get_TrxName());
return getDateNextRun();
} // getDateNextRun
/**
* Get Logs
*
* @return logs
*/
@Override
public AdempiereProcessorLog[] getLogs()
{
List<MWorkflowProcessorLog> list = new Query(getCtx(), MWorkflowProcessorLog.Table_Name, "AD_WorkflowProcessor_ID=?", get_TrxName())
.setParameters(new Object[] { getAD_WorkflowProcessor_ID() })
.setOrderBy("Created DESC")
.list(MWorkflowProcessorLog.class);
|
MWorkflowProcessorLog[] retValue = new MWorkflowProcessorLog[list.size()];
list.toArray(retValue);
return retValue;
} // getLogs
/**
* Delete old Request Log
*
* @return number of records
*/
public int deleteLog()
{
if (getKeepLogDays() < 1)
return 0;
String sql = "DELETE FROM AD_WorkflowProcessorLog "
+ "WHERE AD_WorkflowProcessor_ID=" + getAD_WorkflowProcessor_ID()
+ " AND (Created+" + getKeepLogDays() + ") < now()";
int no = DB.executeUpdateAndSaveErrorOnFail(sql, get_TrxName());
return no;
} // deleteLog
@Override
public boolean saveOutOfTrx()
{
return save(ITrx.TRXNAME_None);
}
} // MWorkflowProcessor
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\wf\MWorkflowProcessor.java
| 1
|
请完成以下Java代码
|
public void onR_StandardResponse_ID(final I_R_Request request, final ICalloutField calloutField)
{
final I_R_StandardResponse standardResponse = request.getR_StandardResponse();
if (standardResponse == null)
{
return;
}
String txt = standardResponse.getResponseText();
txt = Env.parseContext(calloutField.getCtx(), calloutField.getWindowNo(), txt, false, true);
request.setResult(txt);
}
@CalloutMethod(columnNames = I_R_Request.COLUMNNAME_R_RequestType_ID)
public void onR_RequestType_ID(final I_R_Request request)
{
request.setR_Status(null);
|
final int R_RequestType_ID = request.getR_RequestType_ID();
if (R_RequestType_ID <= 0)
{
return;
}
final Properties ctx = InterfaceWrapperHelper.getCtx(request);
final MRequestType requestType = MRequestType.get(ctx, R_RequestType_ID);
final int R_Status_ID = requestType.getDefaultR_Status_ID();
if (R_Status_ID > 0)
{
request.setR_Status_ID(R_Status_ID);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\request\callout\R_Request.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public @Nullable String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public List<PredicateProperties> getPredicates() {
return predicates;
}
public void setPredicates(List<PredicateProperties> predicates) {
this.predicates = predicates;
}
public List<FilterProperties> getFilters() {
return filters;
}
public void setFilters(List<FilterProperties> filters) {
this.filters = filters;
}
public @Nullable URI getUri() {
return uri;
}
public void setUri(URI uri) {
this.uri = uri;
}
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
public Map<String, Object> getMetadata() {
return metadata;
}
|
public void setMetadata(Map<String, Object> metadata) {
this.metadata = metadata;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RouteProperties that = (RouteProperties) o;
return this.order == that.order && Objects.equals(this.id, that.id)
&& Objects.equals(this.predicates, that.predicates) && Objects.equals(this.filters, that.filters)
&& Objects.equals(this.uri, that.uri) && Objects.equals(this.metadata, that.metadata);
}
@Override
public int hashCode() {
return Objects.hash(this.id, this.predicates, this.filters, this.uri, this.metadata, this.order);
}
@Override
public String toString() {
return "RouteDefinition{" + "id='" + id + '\'' + ", predicates=" + predicates + ", filters=" + filters
+ ", uri=" + uri + ", order=" + order + ", metadata=" + metadata + '}';
}
}
|
repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webmvc\src\main\java\org\springframework\cloud\gateway\server\mvc\config\RouteProperties.java
| 2
|
请完成以下Java代码
|
public boolean isMember(Long OrganizationId) {
final User user = ((MyUserPrincipal) this.getPrincipal()).getUser();
return user.getOrganization().getId().longValue() == OrganizationId.longValue();
}
@Override
public Object getFilterObject() {
return this.filterObject;
}
@Override
public Object getReturnObject() {
return this.returnObject;
}
|
@Override
public Object getThis() {
return this;
}
@Override
public void setFilterObject(Object obj) {
this.filterObject = obj;
}
@Override
public void setReturnObject(Object obj) {
this.returnObject = obj;
}
}
|
repos\tutorials-master\spring-security-modules\spring-security-web-boot-1\src\main\java\com\baeldung\roles\custom\security\CustomMethodSecurityExpressionRoot.java
| 1
|
请完成以下Java代码
|
protected String doIt()
{
log.info("From PP_Product_BOM_ID=" + fromProductBOMId + " to " + toProductBOMId);
if (toProductBOMId == 0)
{
throw new AdempiereException("Target PP_Product_BOM_ID == 0");
}
if (fromProductBOMId == 0)
{
throw new AdempiereException("Source PP_Product_BOM_ID == 0");
}
if (toProductBOMId == fromProductBOMId)
{
return MSG_OK;
}
final I_PP_Product_BOM fromBom = productBOMsRepo.getById(fromProductBOMId);
|
final I_PP_Product_BOM toBOM = productBOMsRepo.getById(toProductBOMId);
if (!productBOMsRepo.retrieveLines(toBOM).isEmpty())
{
throw new AdempiereException("@Error@ Existing BOM Line(s)");
}
for (final I_PP_Product_BOMLine fromBOMLine : productBOMsRepo.retrieveLines(fromBom))
{
final I_PP_Product_BOMLine toBOMLine = InterfaceWrapperHelper.copy()
.setFrom(fromBOMLine)
.copyToNew(I_PP_Product_BOMLine.class);
toBOMLine.setPP_Product_BOM_ID(toBOM.getPP_Product_BOM_ID());
InterfaceWrapperHelper.saveRecord(toBOMLine);
}
return MSG_OK;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\process\CopyFromBOM.java
| 1
|
请完成以下Java代码
|
public class C_Dunning_Candidate_MassWriteOff extends JavaProcess
{
final public static String MSG_DODISMISSAL = "StartMassDismissal";
@Override
protected void prepare()
{
// Nothing to do.
}
@Override
protected String doIt()
{
|
final boolean doWriteOff = Services.get(IClientUI.class).ask(0, MSG_DODISMISSAL);
if (!doWriteOff)
{
return "Canceled";
}
final Properties ctx = getCtx();
final String writeOffDescription = getProcessInfo().getTitle() + " #" + getPinstanceId().getRepoId();
final int writeOffCount = Services.get(IInvoiceSourceBL.class).writeOffDunningDocs(ctx, writeOffDescription);
return "@WriteOff@ #" + writeOffCount;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.dunning\src\main\java\de\metas\dunning\writeoff\invoice\process\C_Dunning_Candidate_MassWriteOff.java
| 1
|
请完成以下Java代码
|
public int getAD_DocType_BoilerPlate_ID()
{
return get_ValueAsInt(COLUMNNAME_AD_DocType_BoilerPlate_ID);
}
@Override
public void setC_DocType_ID (final int C_DocType_ID)
{
if (C_DocType_ID < 0)
set_Value (COLUMNNAME_C_DocType_ID, null);
else
set_Value (COLUMNNAME_C_DocType_ID, C_DocType_ID);
}
@Override
public int getC_DocType_ID()
|
{
return get_ValueAsInt(COLUMNNAME_C_DocType_ID);
}
@Override
public void setSeqNo (final int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, SeqNo);
}
@Override
public int getSeqNo()
{
return get_ValueAsInt(COLUMNNAME_SeqNo);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_DocType_BoilerPlate.java
| 1
|
请完成以下Spring Boot application配置
|
mybatis.config-location=classpath:mybatis/mybatis-config.xml
mybatis.mapper-locations=classpath:mybatis/mapper/*.xml
mybatis.type-aliases-package=com.neo.model
spring.datasource.url=jdbc:mysql://localhost:3306/test?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=true
spring.datasource.usernam
|
e=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
logging.level.com.neo.mapper=debug
|
repos\spring-boot-leaning-master\2.x_42_courses\第 3-2 课: 如何优雅的使用 MyBatis XML 配置版\spring-boot-mybatis-xml\src\main\resources\application.properties
| 2
|
请完成以下Java代码
|
public I_M_Product getM_Product()
{
return product;
}
@Override
public BigDecimal getQty()
{
return qty;
}
@Override
public I_C_UOM getC_UOM()
{
return uom;
}
@Override
public ProductionMaterialType getType()
{
return type;
}
@Override
public void setQM_QtyDeliveredPercOfRaw(final BigDecimal qtyDeliveredPercOfRaw)
{
Check.assumeNotNull(qtyDeliveredPercOfRaw, "qtyDeliveredPercOfRaw not null");
this.qtyDeliveredPercOfRaw = qtyDeliveredPercOfRaw;
}
@Override
public BigDecimal getQM_QtyDeliveredPercOfRaw()
{
return qtyDeliveredPercOfRaw;
}
@Override
|
public void setQM_QtyDeliveredAvg(final BigDecimal qtyDeliveredAvg)
{
Check.assumeNotNull(qtyDeliveredAvg, "qtyDeliveredAvg not null");
this.qtyDeliveredAvg = qtyDeliveredAvg;
}
@Override
public BigDecimal getQM_QtyDeliveredAvg()
{
return qtyDeliveredAvg;
}
@Override
public String getVariantGroup()
{
return null;
}
@Override
public BOMComponentType getComponentType()
{
return null;
}
@Override
public IHandlingUnitsInfo getHandlingUnitsInfo()
{
return handlingUnitsInfo;
}
@Override
public I_M_Product getMainComponentProduct()
{
return null;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java\de\metas\materialtracking\qualityBasedInvoicing\impl\PlainProductionMaterial.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public boolean isIgnoreWarnings() {
return this.ignoreWarnings;
}
public void setIgnoreWarnings(boolean ignoreWarnings) {
this.ignoreWarnings = ignoreWarnings;
}
public int getFetchSize() {
return this.fetchSize;
}
public void setFetchSize(int fetchSize) {
this.fetchSize = fetchSize;
}
public int getMaxRows() {
return this.maxRows;
}
public void setMaxRows(int maxRows) {
this.maxRows = maxRows;
}
public @Nullable Duration getQueryTimeout() {
return this.queryTimeout;
}
public void setQueryTimeout(@Nullable Duration queryTimeout) {
|
this.queryTimeout = queryTimeout;
}
public boolean isSkipResultsProcessing() {
return this.skipResultsProcessing;
}
public void setSkipResultsProcessing(boolean skipResultsProcessing) {
this.skipResultsProcessing = skipResultsProcessing;
}
public boolean isSkipUndeclaredResults() {
return this.skipUndeclaredResults;
}
public void setSkipUndeclaredResults(boolean skipUndeclaredResults) {
this.skipUndeclaredResults = skipUndeclaredResults;
}
public boolean isResultsMapCaseInsensitive() {
return this.resultsMapCaseInsensitive;
}
public void setResultsMapCaseInsensitive(boolean resultsMapCaseInsensitive) {
this.resultsMapCaseInsensitive = resultsMapCaseInsensitive;
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-jdbc\src\main\java\org\springframework\boot\jdbc\autoconfigure\JdbcProperties.java
| 2
|
请完成以下Spring Boot application配置
|
spring.datasource.url=jdbc:postgresql://localhost:5432/sample-baeldung-db
spring.datasource.username=postgres
spring.datasource.password=root
spring.datasource.driver-class-name=org.postgresq
|
l.Driver
spring.datasource.hikari.data-source-properties.reWriteBatchedInserts=true
|
repos\tutorials-master\persistence-modules\spring-jdbc\src\main\resources\com\baeldung\spring\jdbc\batch\application.properties
| 2
|
请完成以下Java代码
|
protected String[] nextWords(int n, String msg)
{
System.out.println(msg + " ('q' to break): ");
String[] words = new String[n];
for (int i = 0; i < n; i++)
{
String word = nextWord();
if (word == null) return null;
words[i] = word;
}
return words;
}
protected String nextWord()
{
String word = scanner.next();
return word == null || word.length() == 0 || word.equals("q") ? null : word;
}
protected abstract Result getTargetVector();
final protected void execute() throws IOException
{
vectorsReader.readVectorFile();
final int words = vectorsReader.getNumWords();
final int size = vectorsReader.getSize();
try
{
scanner = new Scanner(System.in);
Result result = null;
while ((result = getTargetVector()) != null)
{
double[] bestd = new double[N];
String[] bestw = new String[N];
next_word:
for (int i = 0; i < words; i++)
{
for (int bi : result.bi)
{
if (i == bi) continue next_word;
}
double dist = 0;
for (int j = 0; j < size; j++)
{
dist += result.vec[j] * vectorsReader.getMatrixElement(i, j);
}
for (int j = 0; j < N; j++)
{
|
if (dist > bestd[j])
{
for (int k = N - 1; k > j; k--)
{
bestd[k] = bestd[k - 1];
bestw[k] = bestw[k - 1];
}
bestd[j] = dist;
bestw[j] = vectorsReader.getWord(i);
break;
}
}
}
System.out.printf("\n Word Cosine cosine\n------------------------------------------------------------------------\n");
for (int j = 0; j < N; j++)
System.out.printf("%50s\t\t%f\n", bestw[j], bestd[j]);
}
}
finally
{
scanner.close();
}
}
protected static class Result
{
float[] vec;
int[] bi;
public Result(float[] vec, int[] bi)
{
this.vec = vec;
this.bi = bi;
}
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\mining\word2vec\AbstractClosestVectors.java
| 1
|
请完成以下Java代码
|
public CorrelationKey newInstance(ModelTypeInstanceContext instanceContext) {
return new CorrelationKeyImpl(instanceContext);
}
});
nameAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_NAME)
.build();
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
correlationPropertyRefCollection = sequenceBuilder.elementCollection(CorrelationPropertyRef.class)
.qNameElementReferenceCollection(CorrelationProperty.class)
.build();
typeBuilder.build();
}
|
public CorrelationKeyImpl(ModelTypeInstanceContext instanceContext) {
super(instanceContext);
}
public String getName() {
return nameAttribute.getValue(this);
}
public void setName(String name) {
nameAttribute.setValue(this, name);
}
public Collection<CorrelationProperty> getCorrelationProperties() {
return correlationPropertyRefCollection.getReferenceTargetElements(this);
}
}
|
repos\camunda-bpm-platform-master\model-api\bpmn-model\src\main\java\org\camunda\bpm\model\bpmn\impl\instance\CorrelationKeyImpl.java
| 1
|
请完成以下Java代码
|
private int computeToRealValueMultiplier()
{
int multiplier = 1;
// Adjust by SOTrx if needed
if (!isAPAdjusted)
{
final int multiplierAP = soTrx.isPurchase() ? -1 : +1;
multiplier *= multiplierAP;
}
// Adjust by Credit Memo if needed
if (!isCreditMemoAdjusted)
{
final int multiplierCM = isCreditMemo ? -1 : +1;
multiplier *= multiplierCM;
}
return multiplier;
}
private int getToRelativeValueMultiplier()
{
// NOTE: the relative->real and real->relative value multipliers are the same
return getToRealValueMultiplier();
}
public Money fromNotAdjustedAmount(@NonNull final Money money)
{
final int multiplier = computeFromNotAdjustedAmountMultiplier();
return multiplier > 0 ? money : money.negate();
}
private int computeFromNotAdjustedAmountMultiplier()
{
int multiplier = 1;
// Do we have to SO adjust?
if (isAPAdjusted)
{
final int multiplierAP = soTrx.isPurchase() ? -1 : +1;
multiplier *= multiplierAP;
}
|
// Do we have to adjust by Credit Memo?
if (isCreditMemoAdjusted)
{
final int multiplierCM = isCreditMemo ? -1 : +1;
multiplier *= multiplierCM;
}
return multiplier;
}
/**
* @return {@code true} for purchase-invoice and sales-creditmemo. {@code false} otherwise.
*/
public boolean isOutgoingMoney()
{
return isCreditMemo ^ soTrx.isPurchase();
}
public InvoiceAmtMultiplier withAPAdjusted(final boolean isAPAdjustedNew)
{
return isAPAdjusted == isAPAdjustedNew ? this : toBuilder().isAPAdjusted(isAPAdjustedNew).build().intern();
}
public InvoiceAmtMultiplier withCMAdjusted(final boolean isCreditMemoAdjustedNew)
{
return isCreditMemoAdjusted == isCreditMemoAdjustedNew ? this : toBuilder().isCreditMemoAdjusted(isCreditMemoAdjustedNew).build().intern();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\invoice\InvoiceAmtMultiplier.java
| 1
|
请完成以下Java代码
|
public static class ExistingWebApplicationScopes {
private static final Set<String> SCOPES;
static {
Set<String> scopes = new LinkedHashSet<>();
scopes.add(WebApplicationContext.SCOPE_REQUEST);
scopes.add(WebApplicationContext.SCOPE_SESSION);
SCOPES = Collections.unmodifiableSet(scopes);
}
private final ConfigurableListableBeanFactory beanFactory;
private final Map<String, Scope> scopes = new HashMap<>();
public ExistingWebApplicationScopes(ConfigurableListableBeanFactory beanFactory) {
this.beanFactory = beanFactory;
for (String scopeName : SCOPES) {
Scope scope = beanFactory.getRegisteredScope(scopeName);
|
if (scope != null) {
this.scopes.put(scopeName, scope);
}
}
}
public void restore() {
this.scopes.forEach((key, value) -> {
if (logger.isInfoEnabled()) {
logger.info("Restoring user defined scope " + key);
}
this.beanFactory.registerScope(key, value);
});
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-web-server\src\main\java\org\springframework\boot\web\server\servlet\context\ServletWebServerApplicationContext.java
| 1
|
请完成以下Java代码
|
public int getM_Product_ID()
{
return rs.getM_Product_ID();
}
@Override
public I_M_AttributeSetInstance getM_AttributeSetInstance()
{
return Services.get(IReceiptScheduleBL.class).getM_AttributeSetInstance_Effective(rs);
}
@Override
public int getM_AttributeSetInstance_ID()
{
return Services.get(IReceiptScheduleBL.class).getM_AttributeSetInstance_Effective_ID(rs);
}
|
@Override
public void setM_AttributeSetInstance(@Nullable final I_M_AttributeSetInstance asi)
{
AttributeSetInstanceId asiId = asi == null
? AttributeSetInstanceId.NONE
: AttributeSetInstanceId.ofRepoIdOrNone(asi.getM_AttributeSetInstance_ID());
receiptScheduleBL.setM_AttributeSetInstance_Effective(rs, asiId);
}
@Override
public void setM_AttributeSetInstance_ID(final int M_AttributeSetInstance_ID)
{
final AttributeSetInstanceId asiId = AttributeSetInstanceId.ofRepoIdOrNone(M_AttributeSetInstance_ID);
receiptScheduleBL.setM_AttributeSetInstance_Effective(rs, asiId);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\inoutcandidate\api\impl\ReceiptScheduleASIAware.java
| 1
|
请完成以下Java代码
|
public final class KotlinFunctionDeclaration implements Annotatable {
private final AnnotationContainer annotations = new AnnotationContainer();
private final String name;
private final String returnType;
private final List<KotlinModifier> modifiers;
private final List<Parameter> parameters;
private final CodeBlock code;
private KotlinFunctionDeclaration(Builder builder, CodeBlock code) {
this.name = builder.name;
this.returnType = builder.returnType;
this.modifiers = builder.modifiers;
this.parameters = List.copyOf(builder.parameters);
this.code = code;
}
/**
* Creates a new builder for the function with the given name.
* @param name the name
* @return the builder
*/
public static Builder function(String name) {
return new Builder(name);
}
String getName() {
return this.name;
}
String getReturnType() {
return this.returnType;
}
List<Parameter> getParameters() {
return this.parameters;
}
List<KotlinModifier> getModifiers() {
return this.modifiers;
}
CodeBlock getCode() {
return this.code;
}
@Override
public AnnotationContainer annotations() {
return this.annotations;
}
/**
* Builder for creating a {@link KotlinFunctionDeclaration}.
*/
public static final class Builder {
private final String name;
|
private List<Parameter> parameters = new ArrayList<>();
private List<KotlinModifier> modifiers = new ArrayList<>();
private String returnType;
private Builder(String name) {
this.name = name;
}
/**
* Sets the modifiers.
* @param modifiers the modifiers
* @return this for method chaining
*/
public Builder modifiers(KotlinModifier... modifiers) {
this.modifiers = Arrays.asList(modifiers);
return this;
}
/**
* Sets the return type.
* @param returnType the return type
* @return this for method chaining
*/
public Builder returning(String returnType) {
this.returnType = returnType;
return this;
}
/**
* Sets the parameters.
* @param parameters the parameters
* @return this for method chaining
*/
public Builder parameters(Parameter... parameters) {
this.parameters = Arrays.asList(parameters);
return this;
}
/**
* Sets the body.
* @param code the code for the body
* @return the function declaration containing the body
*/
public KotlinFunctionDeclaration body(CodeBlock code) {
return new KotlinFunctionDeclaration(this, code);
}
}
}
|
repos\initializr-main\initializr-generator\src\main\java\io\spring\initializr\generator\language\kotlin\KotlinFunctionDeclaration.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public static String toString(@NonNull final Document document) throws TransformerException
{
final TransformerFactory transformerFactory = TransformerFactory.newInstance();
final Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, XML_PROPERTY_VALUE_YES);
final StringWriter buffer = new StringWriter();
transformer.transform(new DOMSource(document.getDocumentElement()),
new StreamResult(buffer));
return buffer.toString();
}
@NonNull
public static String convertToXML(@NonNull final Object object, @NonNull final Class<?> clazz)
{
try
{
final JAXBContext jaxbContext = JAXBContext.newInstance(clazz);
final Marshaller marshaller = jaxbContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
marshaller.setProperty(Marshaller.JAXB_ENCODING, XML_PROPERTY_FILE_ENCODING_VALUE);
marshaller.setProperty("org.glassfish.jaxb.characterEscapeHandler", NoEscapeHandler.theInstance);
final StringWriter sw = new StringWriter();
marshaller.marshal(object, sw);
return sw.toString();
}
catch (final Exception e)
{
throw new RuntimeCamelException(e);
}
}
public static boolean hasAttribute(
@NonNull final Node node,
@NonNull final String attributeName,
@NonNull final String matchingValue)
{
final NamedNodeMap namedNodeMap = node.getAttributes();
final Node attributeNode = namedNodeMap.getNamedItem(attributeName);
if (attributeNode == null || attributeNode.getNodeValue() == null)
{
return false;
}
return matchingValue.equals(attributeNode.getNodeValue());
}
@Nullable
public static Element getElementByTag(@NonNull final Node node, @NonNull final String tagName)
{
|
final Element element = node instanceof Document
? ((Document)node).getDocumentElement()
: (Element)node;
final NodeList nodeList = element.getElementsByTagName(tagName);
if (nodeList.getLength() == 0)
{
return null;
}
final Node childNode = nodeList.item(0);
return (Element)childNode;
}
@NonNull
public static String addXMLDeclarationIfNeeded(@NonNull final String payload)
{
if (payload.trim().startsWith("<?xml")) {
// Payload already contains XML declaration
return payload;
}
final String xmlDeclaration = String.format(
"<?xml version=\"1.0\" encoding=\"%s\" standalone=\"%s\"?>\n",
XML_PROPERTY_FILE_ENCODING_VALUE,
XML_PROPERTY_VALUE_YES
);
return xmlDeclaration + payload;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-leichundmehl\src\main\java\de\metas\camel\externalsystems\leichundmehl\to_leichundmehl\util\XMLUtil.java
| 2
|
请完成以下Java代码
|
final class LdapEncoder {
private static final String[] FILTER_ESCAPE_TABLE = new String['\\' + 1];
static {
// fill with char itself
for (char c = 0; c < FILTER_ESCAPE_TABLE.length; c++) {
FILTER_ESCAPE_TABLE[c] = String.valueOf(c);
}
// escapes (RFC2254)
FILTER_ESCAPE_TABLE['*'] = "\\2a";
FILTER_ESCAPE_TABLE['('] = "\\28";
FILTER_ESCAPE_TABLE[')'] = "\\29";
FILTER_ESCAPE_TABLE['\\'] = "\\5c";
FILTER_ESCAPE_TABLE[0] = "\\00";
}
/**
* All static methods - not to be instantiated.
*/
private LdapEncoder() {
}
|
/**
* Escape a value for use in a filter.
* @param value the value to escape.
* @return a properly escaped representation of the supplied value.
*/
static String filterEncode(String value) {
if (value == null) {
return null;
}
StringBuilder encodedValue = new StringBuilder(value.length() * 2);
int length = value.length();
for (int i = 0; i < length; i++) {
char ch = value.charAt(i);
encodedValue.append((ch < FILTER_ESCAPE_TABLE.length) ? FILTER_ESCAPE_TABLE[ch] : ch);
}
return encodedValue.toString();
}
}
|
repos\spring-security-main\ldap\src\main\java\org\springframework\security\ldap\LdapEncoder.java
| 1
|
请完成以下Java代码
|
public HUMoveToDirectWarehouseService setHUView(final HUEditorView huView)
{
this.huView = huView;
return this;
}
private void notifyHUMoved(final I_M_HU hu)
{
final HuId huId = HuId.ofRepoId(hu.getM_HU_ID());
//
// Invalidate all documents which are about this HU.
if (documentsCollection != null)
{
try
{
documentsCollection.invalidateDocumentByRecordId(I_M_HU.Table_Name, huId.getRepoId());
}
catch (final Exception ex)
{
logger.warn("Failed invalidating documents for M_HU_ID={}. Ignored", huId, ex);
}
}
//
// Remove this HU from the view
// Don't invalidate. We will do it at the end of all processing.
//
// NOTE/Later edit: we decided to not remove it anymore
// because in some views it might make sense to keep it there.
// The right way would be to check if after moving it, the HU is still elgible for view's filters.
//
|
// if (huView != null) { huView.removeHUIds(ImmutableSet.of(huId)); }
}
/**
* @return target warehouse where the HUs will be moved to.
*/
@NonNull
private LocatorId getTargetLocatorId()
{
if (_targetLocatorId == null)
{
_targetLocatorId = huMovementBL.getDirectMoveLocatorId();
}
return _targetLocatorId;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\process\HUMoveToDirectWarehouseService.java
| 1
|
请完成以下Java代码
|
public void addGridTabRowBuilder(final IGridTabRowBuilder builder)
{
if (builder == null)
{
return;
}
if (builders.contains(builder))
{
return;
}
builders.add(builder);
}
@Override
public void apply(final Object model)
{
for (final IGridTabRowBuilder builder : builders)
{
if (!builder.isValid())
{
logger.debug("Skip builder because it's not valid: {}", builder);
continue;
}
builder.apply(model);
logger.debug("Applied {} to {}", new Object[] { builder, model });
}
}
@Override
public boolean isCreateNewRecord()
{
boolean createNewRecord = true;
for (final IGridTabRowBuilder builder : builders)
{
if (!builder.isValid())
{
createNewRecord = false;
continue;
|
}
if (!builder.isCreateNewRecord())
{
createNewRecord = false;
}
}
return createNewRecord;
}
/**
* @return true if at least one builder is valid
*/
@Override
public boolean isValid()
{
for (final IGridTabRowBuilder builder : builders)
{
if (builder.isValid())
{
return true;
}
}
return false;
}
@Override
public void setSource(Object model)
{
for (final IGridTabRowBuilder builder : builders)
{
builder.setSource(model);
}
}
@Override
public String toString()
{
return ObjectUtils.toString(this);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\compiere\apps\search\impl\CompositeGridTabRowBuilder.java
| 1
|
请完成以下Java代码
|
public void processDestinationTopicProperties(Consumer<DestinationTopic.Properties> destinationPropertiesProcessor,
Context context) {
context
.properties
.forEach(destinationPropertiesProcessor);
}
@Override
public void registerDestinationTopic(String mainTopicName, @Nullable String destinationTopicName,
DestinationTopic.Properties destinationTopicProperties, Context context) {
List<DestinationTopic> topicDestinations = context.destinationsByTopicMap
.computeIfAbsent(mainTopicName, newTopic -> new ArrayList<>());
topicDestinations.add(new DestinationTopic(destinationTopicName, destinationTopicProperties));
}
@Override
public void processRegisteredDestinations(Consumer<Collection<String>> topicsCallback, Context context) {
|
context
.destinationsByTopicMap
.values()
.forEach(topicDestinations -> this.destinationTopicResolver.addDestinationTopics(
context.listenerId, topicDestinations));
topicsCallback.accept(getAllTopicsNamesForThis(context));
}
private List<String> getAllTopicsNamesForThis(Context context) {
return context.destinationsByTopicMap
.values()
.stream()
.flatMap(Collection::stream)
.map(DestinationTopic::getDestinationName)
.collect(Collectors.toList());
}
}
|
repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\retrytopic\DefaultDestinationTopicProcessor.java
| 1
|
请完成以下Java代码
|
public String getFrontendURL()
{
final String url = StringUtils.trimBlankToNull(sysConfigBL.getValue(SYSCONFIG_FRONTEND_URL));
if (url == null || "-".equals(url))
{
logger.warn("{} is not configured. Features like CORS, document links in emails etc will not work", SYSCONFIG_FRONTEND_URL);
return null;
}
return url;
}
@Nullable
private String getFrontendURL(@NonNull final String pathSysConfigName, final Map<String, Object> params)
{
String url = getFrontendURL();
if (url == null)
{
return null;
}
final String path = StringUtils.trimBlankToNull(sysConfigBL.getValue(pathSysConfigName, defaultsBySysConfigName.get(pathSysConfigName)));
if (path == null || "-".equals(path))
{
return null;
}
url = url + path;
if (params != null && !params.isEmpty())
{
url = MapFormat.format(url, params);
}
return url;
}
@Nullable
public String getDocumentUrl(@NonNull final AdWindowId windowId, final int documentId)
{
return getDocumentUrl(String.valueOf(windowId.getRepoId()), String.valueOf(documentId));
}
@Nullable
public String getDocumentUrl(@NonNull final String windowId, @NonNull final String documentId)
{
return getFrontendURL(SYSCONFIG_DOCUMENT_PATH, ImmutableMap.<String, Object>builder()
.put(WebuiURLs.PARAM_windowId, windowId)
.put(WebuiURLs.PARAM_documentId, documentId)
.build());
}
@Nullable
public String getViewUrl(@NonNull final AdWindowId adWindowId, @NonNull final String viewId)
{
return getViewUrl(String.valueOf(adWindowId.getRepoId()), viewId);
}
|
@Nullable
public String getViewUrl(@NonNull final String windowId, @NonNull final String viewId)
{
return getFrontendURL(SYSCONFIG_VIEW_PATH, ImmutableMap.<String, Object>builder()
.put(PARAM_windowId, windowId)
.put(PARAM_viewId, viewId)
.build());
}
@Nullable
public String getResetPasswordUrl(final String token)
{
Check.assumeNotEmpty(token, "token is not empty");
return getFrontendURL(SYSCONFIG_RESET_PASSWORD_PATH, ImmutableMap.<String, Object>builder()
.put(PARAM_ResetPasswordToken, token)
.build());
}
public boolean isCrossSiteUsageAllowed()
{
return sysConfigBL.getBooleanValue(SYSCONFIG_IsCrossSiteUsageAllowed, false);
}
public String getAppApiUrl()
{
final String url = StringUtils.trimBlankToNull(sysConfigBL.getValue(SYSCONFIG_APP_API_URL));
if (url != null && !url.equals("-"))
{
return url;
}
final String frontendUrl = getFrontendURL();
if (frontendUrl != null)
{
return frontendUrl + "/app";
}
return null;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\ui\web\WebuiURLs.java
| 1
|
请完成以下Java代码
|
public class IntermediateCatchConditionalEventActivityBehavior extends IntermediateCatchEventActivityBehavior {
private static final long serialVersionUID = 1L;
protected ConditionalEventDefinition conditionalEventDefinition;
protected String conditionExpression;
protected String conditionLanguage;
public IntermediateCatchConditionalEventActivityBehavior(ConditionalEventDefinition conditionalEventDefinition, String conditionExpression, String conditionLanguage) {
this.conditionalEventDefinition = conditionalEventDefinition;
this.conditionExpression = conditionExpression;
this.conditionLanguage = conditionLanguage;
}
@Override
public void execute(DelegateExecution execution) {
ExecutionEntity executionEntity = (ExecutionEntity) execution;
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration();
FlowableEventDispatcher eventDispatcher = processEngineConfiguration.getEventDispatcher();
if (eventDispatcher != null && eventDispatcher.isEnabled()) {
eventDispatcher.dispatchEvent(FlowableEventBuilder.createConditionalEvent(FlowableEngineEventType.ACTIVITY_CONDITIONAL_WAITING,
executionEntity.getActivityId(), conditionExpression, conditionLanguage, executionEntity.getId(),
executionEntity.getProcessInstanceId(), executionEntity.getProcessDefinitionId()),
processEngineConfiguration.getEngineCfgKey());
}
}
@Override
public void trigger(DelegateExecution execution, String triggerName, Object triggerData) {
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration();
|
Expression expression = processEngineConfiguration.getExpressionManager().createExpression(conditionExpression);
Object result = expression.getValue(execution);
if (result instanceof Boolean && (Boolean) result) {
ExecutionEntity executionEntity = (ExecutionEntity) execution;
FlowableEventDispatcher eventDispatcher = processEngineConfiguration.getEventDispatcher();
if (eventDispatcher != null && eventDispatcher.isEnabled()) {
eventDispatcher.dispatchEvent(FlowableEventBuilder.createConditionalEvent(FlowableEngineEventType.ACTIVITY_CONDITIONAL_RECEIVED, executionEntity.getActivityId(),
conditionExpression, conditionLanguage, executionEntity.getId(), executionEntity.getProcessInstanceId(), executionEntity.getProcessDefinitionId()),
processEngineConfiguration.getEngineCfgKey());
}
leaveIntermediateCatchEvent(execution);
}
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\bpmn\behavior\IntermediateCatchConditionalEventActivityBehavior.java
| 1
|
请完成以下Java代码
|
public NamePair get (final IValidationContext evalCtx, Object key)
{
// linear search in m_data
final int size = getSize();
for (int i = 0; i < size; i++)
{
Object oo = getElementAt(i);
if (oo != null && oo instanceof NamePair)
{
NamePair pp = (NamePair)oo;
if (pp.getID().equals(key))
return pp;
}
}
return null;
} // get
/**
* Return data as sorted Array
* @param mandatory mandatory
* @param onlyValidated only validated
* @param onlyActive only active
* @param temporary force load for temporary display
* @return list of data
*/
@Override
public List<Object> getData (boolean mandatory,
boolean onlyValidated, boolean onlyActive, boolean temporary)
{
final int size = getSize();
final List<Object> list = new ArrayList<Object>(size);
for (int i = 0; i < size; i++)
{
final Object oo = getElementAt(i);
list.add(oo);
}
// Sort Data
if (m_keyColumn.endsWith("_ID"))
{
KeyNamePair p = KeyNamePair.EMPTY;
if (!mandatory)
list.add (p);
Collections.sort (list, p);
}
else
{
ValueNamePair p = ValueNamePair.EMPTY;
if (!mandatory)
list.add (p);
Collections.sort (list, p);
}
return list;
} // getArray
/**
* Refresh Values (nop)
* @return number of cache
*/
@Override
public int refresh()
{
return getSize();
} // refresh
|
@Override
public String getTableName()
{
if (Check.isEmpty(m_keyColumn, true))
{
return null;
}
return MQuery.getZoomTableName(m_keyColumn);
}
/**
* Get underlying fully qualified Table.Column Name
* @return column name
*/
@Override
public String getColumnName()
{
return m_keyColumn;
} // getColumnName
@Override
public String getColumnNameNotFQ()
{
return m_keyColumn;
}
} // XLookup
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\grid\XLookup.java
| 1
|
请完成以下Java代码
|
private JsonHUProduct toJsonProduct(@NonNull final ProductId productId)
{
final I_M_Product product = productBL.getById(productId);
final I_C_UOM uom = productBL.getStockUOM(product);
return JsonHUProduct.builder()
.productValue(product.getValue())
.productName(product.getName())
.qty("0")
.uom(uom.getX12DE355())
.build();
}
@PostMapping("/list/byQRCode")
public List<JsonHU> listByQRCode(@RequestBody @NonNull final JsonGetByQRCodeRequest request)
{
final String adLanguage = Env.getADLanguageOrBaseLanguage();
return handlingUnitsService.getHUsByQrCode(request, adLanguage);
}
private static @NonNull ResponseEntity<JsonGetSingleHUResponse> toBadRequestResponseEntity(final Exception e)
{
final String adLanguage = Env.getADLanguageOrBaseLanguage();
return ResponseEntity.badRequest().body(JsonGetSingleHUResponse.ofError(JsonErrors.ofThrowable(e, adLanguage)));
}
private JsonHUAttribute toJsonHUAttribute(final HUQRCodeAttribute huQRCodeAttribute)
{
|
final String adLanguage = Env.getADLanguageOrBaseLanguage();
final AttributeCode attributeCode = huQRCodeAttribute.getCode();
return JsonHUAttribute.builder()
.code(attributeCode.getCode())
.caption(attributeDAO.getAttributeByCode(attributeCode).getDisplayName().translate(adLanguage))
.value(huQRCodeAttribute.getValueRendered())
.build();
}
private static JsonHUType toJsonHUType(@NonNull final HUQRCodeUnitType huUnitType)
{
switch (huUnitType)
{
case LU:
return JsonHUType.LU;
case TU:
return JsonHUType.TU;
case VHU:
return JsonHUType.CU;
default:
throw new AdempiereException("Unknown HU Unit Type: " + huUnitType);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.mobileui\src\main\java\de\metas\handlingunits\rest_api\HandlingUnitsRestController.java
| 1
|
请完成以下Java代码
|
public String getReferenceId() {
return referenceId;
}
@Override
public String getReferenceType() {
return referenceType;
}
@Override
public boolean isCompletable() {
return completable;
}
@Override
public String getEntryCriterionId() {
return entryCriterionId;
}
@Override
public String getExitCriterionId() {
return exitCriterionId;
}
@Override
public String getFormKey() {
return formKey;
}
@Override
public String getExtraValue() {
return extraValue;
}
@Override
public boolean hasVariable(String variableName) {
return variables.containsKey(variableName);
}
|
@Override
public Object getVariable(String variableName) {
return variables.get(variableName);
}
@Override
public String getTenantId() {
return tenantId;
}
@Override
public Set<String> getVariableNames() {
return variables.keySet();
}
@Override
public Map<String, Object> getPlanItemInstanceLocalVariables() {
return localVariables;
}
@Override
public PlanItem getPlanItem() {
return planItem;
}
@Override
public String toString() {
return new StringJoiner(", ", getClass().getSimpleName() + "[", "]")
.add("id='" + id + "'")
.add("planItemDefinitionId='" + planItemDefinitionId + "'")
.add("elementId='" + elementId + "'")
.add("caseInstanceId='" + caseInstanceId + "'")
.add("caseDefinitionId='" + caseDefinitionId + "'")
.add("tenantId='" + tenantId + "'")
.toString();
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\delegate\ReadOnlyDelegatePlanItemInstanceImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public UserVO exception01() {
throw new NullPointerException("没有粗面鱼丸");
}
/**
* 测试抛出 ServiceException 异常
*/
@GetMapping("/exception-02")
public UserVO exception02() {
throw new ServiceException(ServiceExceptionEnum.USER_NOT_FOUND);
}
// @PostMapping(value = "/add",
// // ↓ 增加 "application/xml"、"application/json" ,针对 Content-Type 请求头
// consumes = {MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE},
|
// // ↓ 增加 "application/xml"、"application/json" ,针对 Accept 请求头
// produces = {MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE}
// )
@PostMapping(value = "/add",
// ↓ 增加 "application/xml"、"application/json" ,针对 Content-Type 请求头
consumes = {MediaType.APPLICATION_XML_VALUE},
// ↓ 增加 "application/xml"、"application/json" ,针对 Accept 请求头
produces = {MediaType.APPLICATION_XML_VALUE}
)
// @PostMapping(value = "/add")
public Mono<UserVO> add(@RequestBody Mono<UserVO> user) {
return user;
}
}
|
repos\SpringBoot-Labs-master\lab-27\lab-27-webflux-02\src\main\java\cn\iocoder\springboot\lab27\springwebflux\controller\UserController.java
| 2
|
请完成以下Java代码
|
public static StatusInfo ofUnknown() {
return valueOf(STATUS_UNKNOWN, null);
}
public static StatusInfo ofUp() {
return ofUp(null);
}
public static StatusInfo ofDown() {
return ofDown(null);
}
public static StatusInfo ofOffline() {
return ofOffline(null);
}
public static StatusInfo ofUp(@Nullable Map<String, Object> details) {
return valueOf(STATUS_UP, details);
}
public static StatusInfo ofDown(@Nullable Map<String, Object> details) {
return valueOf(STATUS_DOWN, details);
}
public static StatusInfo ofOffline(@Nullable Map<String, Object> details) {
return valueOf(STATUS_OFFLINE, details);
}
public Map<String, Object> getDetails() {
return Collections.unmodifiableMap(details);
}
public boolean isUp() {
return STATUS_UP.equals(status);
}
public boolean isOffline() {
return STATUS_OFFLINE.equals(status);
}
public boolean isDown() {
return STATUS_DOWN.equals(status);
}
public boolean isUnknown() {
return STATUS_UNKNOWN.equals(status);
}
|
public static Comparator<String> severity() {
return Comparator.comparingInt(STATUS_ORDER::indexOf);
}
@SuppressWarnings("unchecked")
public static StatusInfo from(Map<String, ?> body) {
Map<String, ?> details = Collections.emptyMap();
/*
* Key "details" is present when accessing Spring Boot Actuator Health using
* Accept-Header {@link org.springframework.boot.actuate.endpoint.ApiVersion#V2}.
*/
if (body.containsKey("details")) {
details = (Map<String, ?>) body.get("details");
}
else if (body.containsKey("components")) {
details = (Map<String, ?>) body.get("components");
}
return StatusInfo.valueOf((String) body.get("status"), details);
}
}
|
repos\spring-boot-admin-master\spring-boot-admin-server\src\main\java\de\codecentric\boot\admin\server\domain\values\StatusInfo.java
| 1
|
请完成以下Java代码
|
public void setJwtAssertionResolver(Function<OAuth2AuthorizationContext, Jwt> jwtAssertionResolver) {
Assert.notNull(jwtAssertionResolver, "jwtAssertionResolver cannot be null");
this.jwtAssertionResolver = jwtAssertionResolver;
}
/**
* Sets the maximum acceptable clock skew, which is used when checking the
* {@link OAuth2AuthorizedClient#getAccessToken() access token} expiry. The default is
* 60 seconds.
*
* <p>
* An access token is considered expired if
* {@code OAuth2AccessToken#getExpiresAt() - clockSkew} is before the current time
* {@code clock#instant()}.
* @param clockSkew the maximum acceptable clock skew
*/
public void setClockSkew(Duration clockSkew) {
Assert.notNull(clockSkew, "clockSkew cannot be null");
|
Assert.isTrue(clockSkew.getSeconds() >= 0, "clockSkew must be >= 0");
this.clockSkew = clockSkew;
}
/**
* Sets the {@link Clock} used in {@link Instant#now(Clock)} when checking the access
* token expiry.
* @param clock the clock
*/
public void setClock(Clock clock) {
Assert.notNull(clock, "clock cannot be null");
this.clock = clock;
}
}
|
repos\spring-security-main\oauth2\oauth2-client\src\main\java\org\springframework\security\oauth2\client\JwtBearerOAuth2AuthorizedClientProvider.java
| 1
|
请完成以下Java代码
|
public boolean inPeriod (Timestamp date)
{
if (date == null)
return false;
if (date.before(m_StartDate))
return false;
if (date.after(m_EndDate))
return false;
return true;
} // inPeriod
/**
* Get Name
* @return name
*/
public String getName()
{
return m_Name;
}
/**
* Get C_Period_ID
* @return period
*/
public int getC_Period_ID()
{
return m_C_Period_ID;
}
/**
* Get End Date
* @return end date
*/
public Timestamp getEndDate()
{
return m_EndDate;
}
/**
* Get Start Date
* @return start date
*/
|
public Timestamp getStartDate()
{
return m_StartDate;
}
/**
* Get Year Start Date
* @return year start date
*/
public Timestamp getYearStartDate()
{
return m_YearStartDate;
}
/**
* Get natural balance dateacct filter
* @param alias table name or alias name
* @return is balance sheet a/c and <= end or BETWEEN start AND end
*/
public String getNaturalWhere(String alias) {
String yearWhere = getYearWhere();
String totalWhere = getTotalWhere();
String bs = " EXISTS (SELECT C_ElementValue_ID FROM C_ElementValue WHERE C_ElementValue_ID = " + alias + ".Account_ID AND AccountType NOT IN ('R', 'E'))";
String full = totalWhere + " AND ( " + bs + " OR TRUNC(" + alias + ".DateAcct) " + yearWhere + " ) ";
return full;
}
} // FinReportPeriod
|
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java-legacy\org\compiere\report\FinReportPeriod.java
| 1
|
请完成以下Java代码
|
public byte[] getModulus() {
return modulus;
}
/**
* Sets the value of the modulus property.
*
* @param value
* allowed object is
* byte[]
*/
public void setModulus(byte[] value) {
this.modulus = value;
}
/**
* Gets the value of the exponent property.
*
* @return
* possible object is
|
* byte[]
*/
public byte[] getExponent() {
return exponent;
}
/**
* Sets the value of the exponent property.
*
* @param value
* allowed object is
* byte[]
*/
public void setExponent(byte[] value) {
this.exponent = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_request\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\request\RSAKeyValueType.java
| 1
|
请完成以下Java代码
|
public void migrateState() {
// update activity reference
String activityId = targetScope.getId();
jobEntity.setActivityId(activityId);
migrateJobHandlerConfiguration();
if (targetJobDefinitionEntity != null) {
jobEntity.setJobDefinition(targetJobDefinitionEntity);
}
// update process definition reference
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) targetScope.getProcessDefinition();
jobEntity.setProcessDefinitionId(processDefinition.getId());
jobEntity.setProcessDefinitionKey(processDefinition.getKey());
// update deployment reference
jobEntity.setDeploymentId(processDefinition.getDeploymentId());
}
public void migrateDependentEntities() {
for (MigratingInstance migratingDependentInstance : migratingDependentInstances) {
migratingDependentInstance.migrateState();
|
}
}
public void remove() {
jobEntity.delete();
}
public boolean migrates() {
return targetScope != null;
}
public ScopeImpl getTargetScope() {
return targetScope;
}
public JobDefinitionEntity getTargetJobDefinitionEntity() {
return targetJobDefinitionEntity;
}
protected abstract void migrateJobHandlerConfiguration();
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\migration\instance\MigratingJobInstance.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public JsonScannedBarcodeSuggestions getScannedBarcodeSuggestions(
@PathVariable("wfProcessId") final String wfProcessIdStr,
@PathVariable("wfActivityId") final String wfActivityIdStr)
{
final WFProcessId wfProcessId = WFProcessId.ofString(wfProcessIdStr);
assertAccess(wfProcessId.getApplicationId());
final WFActivityId wfActivityId = WFActivityId.ofString(wfActivityIdStr);
return workflowRestAPIService.getScannedBarcodeSuggestions(wfProcessId, wfActivityId);
}
@PostMapping("/wfProcess/{wfProcessId}/{wfActivityId}/userConfirmation")
public JsonWFProcess setUserConfirmation(
@PathVariable("wfProcessId") final String wfProcessIdStr,
@PathVariable("wfActivityId") final String wfActivityIdStr)
{
final UserId invokerId = Env.getLoggedUserId();
final WFProcessId wfProcessId = WFProcessId.ofString(wfProcessIdStr);
assertAccess(wfProcessId.getApplicationId());
final WFActivityId wfActivityId = WFActivityId.ofString(wfActivityIdStr);
final WFProcess wfProcess = workflowRestAPIService.setUserConfirmation(invokerId, wfProcessId, wfActivityId);
return toJson(wfProcess);
}
@GetMapping("/settings")
public JsonSettings getSettings()
{
final Map<String, String> map = sysConfigBL.getValuesForPrefix(SYSCONFIG_SETTINGS_PREFIX, true, Env.getClientAndOrgId());
return JsonSettings.ofMap(map);
}
@PostMapping("/errors")
public void logErrors(@RequestBody @NonNull final JsonError error)
{
error.getErrors().stream()
.map(WorkflowRestController::toInsertRemoteIssueRequest)
|
.forEach(errorManager::insertRemoteIssue);
}
private static InsertRemoteIssueRequest toInsertRemoteIssueRequest(final JsonErrorItem jsonErrorItem)
{
return InsertRemoteIssueRequest.builder()
.issueCategory(jsonErrorItem.getIssueCategory())
.issueSummary(StringUtils.trimBlankToOptional(jsonErrorItem.getMessage()).orElse("Error"))
.sourceClassName(jsonErrorItem.getSourceClassName())
.sourceMethodName(jsonErrorItem.getSourceMethodName())
.stacktrace(jsonErrorItem.getStackTrace())
.orgId(RestUtils.retrieveOrgIdOrDefault(jsonErrorItem.getOrgCode()))
.frontendUrl(jsonErrorItem.getFrontendUrl())
.build();
}
@GetMapping("/trolley")
public JsonGetCurrentTrolleyResponse getCurrentTrolley()
{
return trolleyService.getCurrent(Env.getLoggedUserId())
.map(JsonGetCurrentTrolleyResponse::ofQRCode)
.orElse(JsonGetCurrentTrolleyResponse.EMPTY);
}
@PostMapping("/trolley")
public JsonGetCurrentTrolleyResponse setCurrentTrolley(@NonNull @RequestBody JsonSetCurrentTrolley request)
{
final LocatorQRCode locatorQRCode = trolleyService.setCurrent(Env.getLoggedUserId(), request.getScannedCode());
return JsonGetCurrentTrolleyResponse.ofQRCode(locatorQRCode);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.workflow.rest-api\src\main\java\de\metas\workflow\rest_api\controller\v2\WorkflowRestController.java
| 2
|
请完成以下Java代码
|
public class X_ExternalSystem_Config_Shopware6_UOM extends org.compiere.model.PO implements I_ExternalSystem_Config_Shopware6_UOM, org.compiere.model.I_Persistent
{
private static final long serialVersionUID = 1127010332L;
/** Standard Constructor */
public X_ExternalSystem_Config_Shopware6_UOM (final Properties ctx, final int ExternalSystem_Config_Shopware6_UOM_ID, @Nullable final String trxName)
{
super (ctx, ExternalSystem_Config_Shopware6_UOM_ID, trxName);
}
/** Load Constructor */
public X_ExternalSystem_Config_Shopware6_UOM (final Properties ctx, final ResultSet rs, @Nullable final String trxName)
{
super (ctx, rs, trxName);
}
/** Load Meta Data */
@Override
protected org.compiere.model.POInfo initPO(final Properties ctx)
{
return org.compiere.model.POInfo.getPOInfo(Table_Name);
}
@Override
public void setC_UOM_ID (final int C_UOM_ID)
{
if (C_UOM_ID < 1)
set_Value (COLUMNNAME_C_UOM_ID, null);
else
set_Value (COLUMNNAME_C_UOM_ID, C_UOM_ID);
}
@Override
public int getC_UOM_ID()
{
return get_ValueAsInt(COLUMNNAME_C_UOM_ID);
}
@Override
public I_ExternalSystem_Config_Shopware6 getExternalSystem_Config_Shopware6()
{
return get_ValueAsPO(COLUMNNAME_ExternalSystem_Config_Shopware6_ID, I_ExternalSystem_Config_Shopware6.class);
}
@Override
public void setExternalSystem_Config_Shopware6(final I_ExternalSystem_Config_Shopware6 ExternalSystem_Config_Shopware6)
{
set_ValueFromPO(COLUMNNAME_ExternalSystem_Config_Shopware6_ID, I_ExternalSystem_Config_Shopware6.class, ExternalSystem_Config_Shopware6);
}
@Override
|
public void setExternalSystem_Config_Shopware6_ID (final int ExternalSystem_Config_Shopware6_ID)
{
if (ExternalSystem_Config_Shopware6_ID < 1)
set_Value (COLUMNNAME_ExternalSystem_Config_Shopware6_ID, null);
else
set_Value (COLUMNNAME_ExternalSystem_Config_Shopware6_ID, ExternalSystem_Config_Shopware6_ID);
}
@Override
public int getExternalSystem_Config_Shopware6_ID()
{
return get_ValueAsInt(COLUMNNAME_ExternalSystem_Config_Shopware6_ID);
}
@Override
public void setExternalSystem_Config_Shopware6_UOM_ID (final int ExternalSystem_Config_Shopware6_UOM_ID)
{
if (ExternalSystem_Config_Shopware6_UOM_ID < 1)
set_ValueNoCheck (COLUMNNAME_ExternalSystem_Config_Shopware6_UOM_ID, null);
else
set_ValueNoCheck (COLUMNNAME_ExternalSystem_Config_Shopware6_UOM_ID, ExternalSystem_Config_Shopware6_UOM_ID);
}
@Override
public int getExternalSystem_Config_Shopware6_UOM_ID()
{
return get_ValueAsInt(COLUMNNAME_ExternalSystem_Config_Shopware6_UOM_ID);
}
@Override
public void setShopwareCode (final String ShopwareCode)
{
set_Value (COLUMNNAME_ShopwareCode, ShopwareCode);
}
@Override
public String getShopwareCode()
{
return get_ValueAsString(COLUMNNAME_ShopwareCode);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java-gen\de\metas\externalsystem\model\X_ExternalSystem_Config_Shopware6_UOM.java
| 1
|
请完成以下Java代码
|
public void setPayPal_ClientId (final java.lang.String PayPal_ClientId)
{
set_Value (COLUMNNAME_PayPal_ClientId, PayPal_ClientId);
}
@Override
public java.lang.String getPayPal_ClientId()
{
return get_ValueAsString(COLUMNNAME_PayPal_ClientId);
}
@Override
public void setPayPal_ClientSecret (final java.lang.String PayPal_ClientSecret)
{
set_Value (COLUMNNAME_PayPal_ClientSecret, PayPal_ClientSecret);
}
@Override
public java.lang.String getPayPal_ClientSecret()
{
return get_ValueAsString(COLUMNNAME_PayPal_ClientSecret);
}
@Override
public void setPayPal_Config_ID (final int PayPal_Config_ID)
{
if (PayPal_Config_ID < 1)
set_ValueNoCheck (COLUMNNAME_PayPal_Config_ID, null);
else
set_ValueNoCheck (COLUMNNAME_PayPal_Config_ID, PayPal_Config_ID);
}
@Override
public int getPayPal_Config_ID()
{
return get_ValueAsInt(COLUMNNAME_PayPal_Config_ID);
}
@Override
public org.compiere.model.I_R_MailText getPayPal_PayerApprovalRequest_MailTemplate()
{
return get_ValueAsPO(COLUMNNAME_PayPal_PayerApprovalRequest_MailTemplate_ID, org.compiere.model.I_R_MailText.class);
}
@Override
public void setPayPal_PayerApprovalRequest_MailTemplate(final org.compiere.model.I_R_MailText PayPal_PayerApprovalRequest_MailTemplate)
{
set_ValueFromPO(COLUMNNAME_PayPal_PayerApprovalRequest_MailTemplate_ID, org.compiere.model.I_R_MailText.class, PayPal_PayerApprovalRequest_MailTemplate);
}
@Override
public void setPayPal_PayerApprovalRequest_MailTemplate_ID (final int PayPal_PayerApprovalRequest_MailTemplate_ID)
{
if (PayPal_PayerApprovalRequest_MailTemplate_ID < 1)
set_Value (COLUMNNAME_PayPal_PayerApprovalRequest_MailTemplate_ID, null);
else
set_Value (COLUMNNAME_PayPal_PayerApprovalRequest_MailTemplate_ID, PayPal_PayerApprovalRequest_MailTemplate_ID);
}
@Override
public int getPayPal_PayerApprovalRequest_MailTemplate_ID()
{
return get_ValueAsInt(COLUMNNAME_PayPal_PayerApprovalRequest_MailTemplate_ID);
|
}
@Override
public void setPayPal_PaymentApprovedCallbackUrl (final @Nullable java.lang.String PayPal_PaymentApprovedCallbackUrl)
{
set_Value (COLUMNNAME_PayPal_PaymentApprovedCallbackUrl, PayPal_PaymentApprovedCallbackUrl);
}
@Override
public java.lang.String getPayPal_PaymentApprovedCallbackUrl()
{
return get_ValueAsString(COLUMNNAME_PayPal_PaymentApprovedCallbackUrl);
}
@Override
public void setPayPal_Sandbox (final boolean PayPal_Sandbox)
{
set_Value (COLUMNNAME_PayPal_Sandbox, PayPal_Sandbox);
}
@Override
public boolean isPayPal_Sandbox()
{
return get_ValueAsBoolean(COLUMNNAME_PayPal_Sandbox);
}
@Override
public void setPayPal_WebUrl (final @Nullable java.lang.String PayPal_WebUrl)
{
set_Value (COLUMNNAME_PayPal_WebUrl, PayPal_WebUrl);
}
@Override
public java.lang.String getPayPal_WebUrl()
{
return get_ValueAsString(COLUMNNAME_PayPal_WebUrl);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.paypal\src\main\java-gen\de\metas\payment\paypal\model\X_PayPal_Config.java
| 1
|
请完成以下Java代码
|
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public Long getCreationTime() {
return this.creationTime;
}
public void setCreationTime(Long creationTime) {
this.creationTime = creationTime;
}
public String getCreatorId() {
return this.creatorId;
}
public void setCreatorId(String creatorId) {
this.creatorId = creatorId;
}
public String getCreator() {
return this.creator;
}
public void setCreator(String creator) {
this.creator = creator;
}
public int getTotalPlayers() {
return this.totalPlayers;
}
public void setTotalPlayers(int totalPlayers) {
this.totalPlayers = totalPlayers;
}
public GameMode getMode() {
return this.mode;
|
}
public void setMode(GameMode mode) {
this.mode = mode;
}
public int getMaxPlayers() {
return this.maxPlayers;
}
public void setMaxPlayers(int maxPlayers) {
this.maxPlayers = maxPlayers;
}
public List<PlayerDTO> getPlayers() {
return this.players;
}
public void setPlayers(List<PlayerDTO> players) {
this.players = players;
}
}
|
repos\tutorials-master\libraries-data\src\main\java\com\baeldung\modelmapper\dto\GameDTO.java
| 1
|
请完成以下Java代码
|
public static List<String> toSentenceList(String content)
{
return toSentenceList(content.toCharArray(), true);
}
/**
* 文本分句
*
* @param content 文本
* @param shortest 是否切割为最细的单位(将逗号也视作分隔符)
* @return
*/
public static List<String> toSentenceList(String content, boolean shortest)
{
return toSentenceList(content.toCharArray(), shortest);
}
public static List<String> toSentenceList(char[] chars)
{
return toSentenceList(chars, true);
}
public static List<String> toSentenceList(char[] chars, boolean shortest)
{
StringBuilder sb = new StringBuilder();
List<String> sentences = new LinkedList<String>();
for (int i = 0; i < chars.length; ++i)
{
if (sb.length() == 0 && (Character.isWhitespace(chars[i]) || chars[i] == ' '))
{
continue;
}
sb.append(chars[i]);
switch (chars[i])
{
case '.':
if (i < chars.length - 1 && chars[i + 1] > 128)
{
insertIntoList(sb, sentences);
sb = new StringBuilder();
}
break;
case '…':
{
if (i < chars.length - 1 && chars[i + 1] == '…')
{
sb.append('…');
++i;
insertIntoList(sb, sentences);
sb = new StringBuilder();
}
}
break;
case ',':
case ',':
case ';':
case ';':
if (!shortest)
{
continue;
}
case ' ':
case ' ':
case ' ':
case '。':
case '!':
case '!':
case '?':
case '?':
case '\n':
case '\r':
insertIntoList(sb, sentences);
|
sb = new StringBuilder();
break;
}
}
if (sb.length() > 0)
{
insertIntoList(sb, sentences);
}
return sentences;
}
private static void insertIntoList(StringBuilder sb, List<String> sentences)
{
String content = sb.toString().trim();
if (content.length() > 0)
{
sentences.add(content);
}
}
/**
* 句子中是否含有词性
*
* @param sentence
* @param nature
* @return
*/
public static boolean hasNature(List<Term> sentence, Nature nature)
{
for (Term term : sentence)
{
if (term.nature == nature)
{
return true;
}
}
return false;
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\utility\SentencesUtil.java
| 1
|
请完成以下Java代码
|
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 org.compiere.model.I_S_Resource getPP_Plant()
{
return get_ValueAsPO(COLUMNNAME_PP_Plant_ID, org.compiere.model.I_S_Resource.class);
}
@Override
public void setPP_Plant(final org.compiere.model.I_S_Resource PP_Plant)
{
set_ValueFromPO(COLUMNNAME_PP_Plant_ID, org.compiere.model.I_S_Resource.class, PP_Plant);
}
@Override
public void setPP_Plant_ID (final int PP_Plant_ID)
{
if (PP_Plant_ID < 1)
set_Value (COLUMNNAME_PP_Plant_ID, null);
else
set_Value (COLUMNNAME_PP_Plant_ID, PP_Plant_ID);
}
@Override
public int getPP_Plant_ID()
{
return get_ValueAsInt(COLUMNNAME_PP_Plant_ID);
}
@Override
public void setReplenishmentClass (final @Nullable java.lang.String ReplenishmentClass)
{
set_Value (COLUMNNAME_ReplenishmentClass, ReplenishmentClass);
}
@Override
public java.lang.String getReplenishmentClass()
{
return get_ValueAsString(COLUMNNAME_ReplenishmentClass);
}
@Override
public void setSeparator (final java.lang.String Separator)
{
|
set_Value (COLUMNNAME_Separator, Separator);
}
@Override
public java.lang.String getSeparator()
{
return get_ValueAsString(COLUMNNAME_Separator);
}
@Override
public void setValue (final java.lang.String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
@Override
public java.lang.String getValue()
{
return get_ValueAsString(COLUMNNAME_Value);
}
@Override
public void setAD_User_ID (final int AD_User_ID)
{
if (AD_User_ID < 0)
set_Value (COLUMNNAME_AD_User_ID, null);
else
set_Value (COLUMNNAME_AD_User_ID, AD_User_ID);
}
@Override
public int getAD_User_ID()
{
return get_ValueAsInt(COLUMNNAME_AD_User_ID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Warehouse.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class PostController {
private final PostDao postDao;
private final AuthorDao authorDao;
public PostController(PostDao postDao, AuthorDao authorDao) {
this.postDao = postDao;
this.authorDao = authorDao;
}
@QueryMapping
public List<Post> recentPosts(@Argument int count, @Argument int offset) {
return postDao.getRecentPosts(count, offset);
}
@SchemaMapping
public Author author(Post post) {
return authorDao.getAuthor(post.getAuthorId());
}
|
@SchemaMapping(typeName="Post", field="first_author")
public Author getFirstAuthor(Post post) {
return authorDao.getAuthor(post.getAuthorId());
}
@MutationMapping
public Post createPost(@Argument String title, @Argument String text,
@Argument String category, @Argument String authorId) {
Post post = new Post();
post.setId(UUID.randomUUID().toString());
post.setTitle(title);
post.setText(text);
post.setCategory(category);
post.setAuthorId(authorId);
postDao.savePost(post);
return post;
}
}
|
repos\tutorials-master\spring-boot-modules\spring-boot-graphql\src\main\java\com\baeldung\graphql\intro\PostController.java
| 2
|
请完成以下Java代码
|
public int getC_CompensationGroup_Schema_ID()
{
return get_ValueAsInt(COLUMNNAME_C_CompensationGroup_Schema_ID);
}
@Override
public void setC_Order_CompensationGroup_ID (final int C_Order_CompensationGroup_ID)
{
if (C_Order_CompensationGroup_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Order_CompensationGroup_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Order_CompensationGroup_ID, C_Order_CompensationGroup_ID);
}
@Override
public int getC_Order_CompensationGroup_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Order_CompensationGroup_ID);
}
@Override
public org.compiere.model.I_C_Order getC_Order()
{
return get_ValueAsPO(COLUMNNAME_C_Order_ID, org.compiere.model.I_C_Order.class);
}
@Override
public void setC_Order(final org.compiere.model.I_C_Order C_Order)
{
set_ValueFromPO(COLUMNNAME_C_Order_ID, org.compiere.model.I_C_Order.class, C_Order);
}
@Override
public void setC_Order_ID (final int C_Order_ID)
{
if (C_Order_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Order_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Order_ID, C_Order_ID);
}
@Override
public int getC_Order_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Order_ID);
}
@Override
public void setIsNamePrinted (final boolean IsNamePrinted)
{
set_Value (COLUMNNAME_IsNamePrinted, IsNamePrinted);
}
@Override
public boolean isNamePrinted()
{
return get_ValueAsBoolean(COLUMNNAME_IsNamePrinted);
}
@Override
public void setM_Product_Category_ID (final int M_Product_Category_ID)
{
if (M_Product_Category_ID < 1)
set_Value (COLUMNNAME_M_Product_Category_ID, null);
else
set_Value (COLUMNNAME_M_Product_Category_ID, M_Product_Category_ID);
}
|
@Override
public int getM_Product_Category_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_Category_ID);
}
@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 org.eevolution.model.I_PP_Product_BOM getPP_Product_BOM()
{
return get_ValueAsPO(COLUMNNAME_PP_Product_BOM_ID, org.eevolution.model.I_PP_Product_BOM.class);
}
@Override
public void setPP_Product_BOM(final org.eevolution.model.I_PP_Product_BOM PP_Product_BOM)
{
set_ValueFromPO(COLUMNNAME_PP_Product_BOM_ID, org.eevolution.model.I_PP_Product_BOM.class, PP_Product_BOM);
}
@Override
public void setPP_Product_BOM_ID (final int PP_Product_BOM_ID)
{
if (PP_Product_BOM_ID < 1)
set_Value (COLUMNNAME_PP_Product_BOM_ID, null);
else
set_Value (COLUMNNAME_PP_Product_BOM_ID, PP_Product_BOM_ID);
}
@Override
public int getPP_Product_BOM_ID()
{
return get_ValueAsInt(COLUMNNAME_PP_Product_BOM_ID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Order_CompensationGroup.java
| 1
|
请完成以下Java代码
|
public FlatrateUserNotificationsProducer notifyUser(
final I_C_Flatrate_Term contract,
final UserId recipientUserId,
@NonNull final AdMessageKey message)
{
if (contract == null)
{
return this;
}
try
{
postNotification(createFlatrateTermGeneratedEvent(contract, recipientUserId, message));
}
catch (final Exception ex)
{
logger.warn("Failed creating event for contract {}. Ignored.", contract, ex);
}
return this;
}
private final UserNotificationRequest createFlatrateTermGeneratedEvent(
@NonNull final I_C_Flatrate_Term contract,
final UserId recipientUserId,
@NonNull final AdMessageKey message)
{
if (recipientUserId == null)
{
// nothing to do
|
return null;
}
final TableRecordReference flatrateTermRef = TableRecordReference.of(contract);
return newUserNotificationRequest()
.recipientUserId(recipientUserId)
.contentADMessage(message)
.targetAction(TargetRecordAction.ofRecordAndWindow(flatrateTermRef, Contracts_Constants.CONTRACTS_WINDOW_ID))
.build();
}
private final UserNotificationRequest.UserNotificationRequestBuilder newUserNotificationRequest()
{
return UserNotificationRequest.builder()
.topic(EVENTBUS_TOPIC);
}
private void postNotification(final UserNotificationRequest notification)
{
Services.get(INotificationBL.class).sendAfterCommit(notification);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\event\FlatrateUserNotificationsProducer.java
| 1
|
请完成以下Java代码
|
public LUTUAssignBuilder setTUsToAssign(final Collection<I_M_HU> tusToAssign)
{
assertConfigurable();
_tusToAssign = new ArrayList<>(tusToAssign);
return this;
}
private List<I_M_HU> getTUsToAssign()
{
Check.assumeNotEmpty(_tusToAssign, "_tusToAssign not empty");
return _tusToAssign;
}
public final LUTUAssignBuilder setHUPlanningReceiptOwnerPM(final boolean isHUPlanningReceiptOwnerPM)
{
assertConfigurable();
_isHUPlanningReceiptOwnerPM = isHUPlanningReceiptOwnerPM;
return this;
}
private final boolean isHUPlanningReceiptOwnerPM()
{
return _isHUPlanningReceiptOwnerPM;
}
public LUTUAssignBuilder setDocumentLine(final IHUDocumentLine documentLine)
{
assertConfigurable();
_documentLine = documentLine;
return this;
}
private IHUDocumentLine getDocumentLine()
{
return _documentLine; // null is ok
}
public LUTUAssignBuilder setC_BPartner(final I_C_BPartner bpartner)
{
assertConfigurable();
this._bpartnerId = bpartner != null ? BPartnerId.ofRepoId(bpartner.getC_BPartner_ID()) : null;
return this;
}
private final BPartnerId getBPartnerId()
{
return _bpartnerId;
}
public LUTUAssignBuilder setC_BPartner_Location_ID(final int bpartnerLocationId)
{
assertConfigurable();
_bpLocationId = bpartnerLocationId;
return this;
}
private final int getC_BPartner_Location_ID()
|
{
return _bpLocationId;
}
public LUTUAssignBuilder setM_Locator(final I_M_Locator locator)
{
assertConfigurable();
_locatorId = LocatorId.ofRecordOrNull(locator);
return this;
}
private LocatorId getLocatorId()
{
Check.assumeNotNull(_locatorId, "_locatorId not null");
return _locatorId;
}
public LUTUAssignBuilder setHUStatus(final String huStatus)
{
assertConfigurable();
_huStatus = huStatus;
return this;
}
private String getHUStatus()
{
Check.assumeNotEmpty(_huStatus, "_huStatus not empty");
return _huStatus;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\allocation\transfer\impl\LUTUAssignBuilder.java
| 1
|
请完成以下Java代码
|
public class HandlerAdapter {
private final @Nullable InvocableHandlerMethod invokerHandlerMethod;
private final @Nullable DelegatingInvocableHandler delegatingHandler;
private final boolean asyncReplies;
/**
* Construct an instance with the provided method.
* @param invokerHandlerMethod the method.
*/
public HandlerAdapter(InvocableHandlerMethod invokerHandlerMethod) {
this.invokerHandlerMethod = invokerHandlerMethod;
this.delegatingHandler = null;
Method handlerMethod = invokerHandlerMethod.getMethod();
this.asyncReplies =
AdapterUtils.isAsyncReply(handlerMethod.getReturnType())
|| KotlinDetector.isSuspendingFunction(handlerMethod);
}
/**
* Construct an instance with the provided delegating handler.
* @param delegatingHandler the handler.
*/
public HandlerAdapter(DelegatingInvocableHandler delegatingHandler) {
this.invokerHandlerMethod = null;
this.delegatingHandler = delegatingHandler;
this.asyncReplies = delegatingHandler.isAsyncReplies();
}
/**
* Return true if any handler method has an async reply type.
* @return the asyncReply.
* @since 3.2
*/
public boolean isAsyncReplies() {
return this.asyncReplies;
}
@Nullable
public Object invoke(Message<?> message, @Nullable Object... providedArgs) throws Exception { //NOSONAR
if (this.invokerHandlerMethod != null) {
return this.invokerHandlerMethod.invoke(message, providedArgs); // NOSONAR
}
else if (Objects.requireNonNull(this.delegatingHandler).hasDefaultHandler()) {
// Needed to avoid returning raw Message which matches Object
Object[] args = new Object[providedArgs.length + 1];
args[0] = message.getPayload();
System.arraycopy(providedArgs, 0, args, 1, providedArgs.length);
return this.delegatingHandler.invoke(message, args);
}
else {
return this.delegatingHandler.invoke(message, providedArgs);
}
}
|
public String getMethodAsString(Object payload) {
if (this.invokerHandlerMethod != null) {
return this.invokerHandlerMethod.getMethod().toGenericString();
}
else {
return Objects.requireNonNull(this.delegatingHandler).getMethodNameFor(payload);
}
}
public Object getBean() {
if (this.invokerHandlerMethod != null) {
return this.invokerHandlerMethod.getBean();
}
else {
return Objects.requireNonNull(this.delegatingHandler).getBean();
}
}
@Nullable
public InvocationResult getInvocationResultFor(Object result, @Nullable Object inboundPayload) {
if (this.delegatingHandler != null && inboundPayload != null) {
return this.delegatingHandler.getInvocationResultFor(result, inboundPayload);
}
return null;
}
}
|
repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\listener\adapter\HandlerAdapter.java
| 1
|
请完成以下Java代码
|
private static final class ModelsScheduler<ModelType> extends WorkpackagesOnCommitSchedulerTemplate<ModelType>
{
private final Class<ModelType> modelType;
private final boolean collectModels;
public ModelsScheduler(final Class<? extends IWorkpackageProcessor> workpackageProcessorClass, final Class<ModelType> modelType, final boolean collectModels)
{
super(workpackageProcessorClass);
this.modelType = modelType;
this.collectModels = collectModels;
}
@Override
public String toString()
{
return MoreObjects.toStringHelper(this)
.add("collectModels", collectModels)
.add("workpackageProcessorClass", getWorkpackageProcessorClass())
.add("modelType", modelType)
.toString();
}
@Override
protected Properties extractCtxFromItem(final ModelType item)
{
return InterfaceWrapperHelper.getCtx(item);
}
|
@Override
protected String extractTrxNameFromItem(final ModelType item)
{
return InterfaceWrapperHelper.getTrxName(item);
}
@Nullable
@Override
protected Object extractModelToEnqueueFromItem(final Collector collector, final ModelType item)
{
return collectModels ? item : null;
}
@Override
protected boolean isEnqueueWorkpackageWhenNoModelsEnqueued()
{
return !collectModels;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java\de\metas\async\spi\WorkpackagesOnCommitSchedulerTemplate.java
| 1
|
请完成以下Java代码
|
private static String removeEmbeddedSlashDotDotSlash(String path) {
int index;
while ((index = path.indexOf("/../")) >= 0) {
int priorSlash = path.lastIndexOf('/', index - 1);
String after = path.substring(index + 3);
path = (priorSlash >= 0) ? path.substring(0, priorSlash) + after : after;
}
return path;
}
private static String removeEmbeddedSlashDotSlash(String path) {
int index;
while ((index = path.indexOf("/./")) >= 0) {
String before = path.substring(0, index);
String after = path.substring(index + 2);
path = before + after;
}
return path;
}
|
private static String removeTrailingSlashDot(String path) {
return (!path.endsWith("/.")) ? path : path.substring(0, path.length() - 1);
}
private static String removeTrailingSlashDotDot(String path) {
int index;
while (path.endsWith("/..")) {
index = path.indexOf("/..");
int priorSlash = path.lastIndexOf('/', index - 1);
path = (priorSlash >= 0) ? path.substring(0, priorSlash + 1) : path.substring(0, index);
}
return path;
}
}
|
repos\spring-boot-4.0.1\loader\spring-boot-loader\src\main\java\org\springframework\boot\loader\net\protocol\jar\Canonicalizer.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public JsonProductToAddResponse getProductsNotFavorite()
{
final User user = loginService.getLoggedInUser();
final List<Product> productsContracted = contractsService.getContracts(user.getBpartner()).getProducts();
final List<Product> productsFavorite = productSuppliesService.getUserFavoriteProducts(user);
final List<Product> productsShared = productSuppliesService.getAllSharedProducts();
final ArrayList<Product> productsNotSelected = new ArrayList<>(productsContracted);
productsNotSelected.removeAll(productsFavorite);
final ArrayList<Product> productsNotContracted = new ArrayList<>(productsShared);
productsNotContracted.removeAll(productsFavorite);
productsNotContracted.removeAll(productsContracted);
final Locale locale = loginService.getLocale();
return JsonProductToAddResponse.builder()
.products(toJsonProductOrderedList(productsNotSelected, locale))
.moreProducts(toJsonProductOrderedList(productsNotContracted, locale))
.build();
}
private static ArrayList<JsonProduct> toJsonProductOrderedList(@NonNull final List<Product> products, @NonNull final Locale locale)
|
{
return products.stream()
.map(product -> toJsonProduct(product, locale))
.sorted(Comparator.comparing(JsonProduct::getProductName))
.collect(Collectors.toCollection(ArrayList::new));
}
private static JsonProduct toJsonProduct(@NonNull final Product product, @NonNull final Locale locale)
{
return JsonProduct.builder()
.productId(product.getIdAsString())
.productName(product.getName(locale))
.packingInfo(product.getPackingInfo(locale))
.build();
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\procurement-webui\procurement-webui-backend\src\main\java\de\metas\procurement\webui\rest\products\ProductsRestController.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public String getDeploymentId() {
return deploymentId;
}
public void setDeploymentId(String deploymentId) {
this.deploymentId = deploymentId;
this.deploymentChanged = true;
}
public void setTenantId(String tenantId) {
tenantChanged = true;
this.tenantId = tenantId;
}
@ApiModelProperty(example = "null")
public String getTenantId() {
return tenantId;
}
@JsonIgnore
public boolean isCategoryChanged() {
return categoryChanged;
}
@JsonIgnore
public boolean isKeyChanged() {
return keyChanged;
}
@JsonIgnore
public boolean isMetaInfoChanged() {
return metaInfoChanged;
}
@JsonIgnore
|
public boolean isNameChanged() {
return nameChanged;
}
@JsonIgnore
public boolean isVersionChanged() {
return versionChanged;
}
@JsonIgnore
public boolean isDeploymentChanged() {
return deploymentChanged;
}
@JsonIgnore
public boolean isTenantIdChanged() {
return tenantChanged;
}
}
|
repos\flowable-engine-main\modules\flowable-rest\src\main\java\org\flowable\rest\service\api\repository\ModelRequest.java
| 2
|
请完成以下Java代码
|
private void close(final PickingCandidate pickingCandidate)
{
try
{
pickingCandidate.assertProcessed();
final PickingSlotId pickingSlotId = pickingCandidate.getPickingSlotId();
if (pickingSlotId != null)
{
huPickingSlotBL.addToPickingSlotQueue(pickingSlotId, pickingCandidate.getPackedToHuId());
}
changeStatusToProcessedAndSave(pickingCandidate);
}
catch (final Exception ex)
{
if (failOnError)
|
{
throw AdempiereException.wrapIfNeeded(ex).setParameter("pickingCandidate", pickingCandidate);
}
else
{
logger.warn("Failed closing {}. Skipped", pickingCandidate, ex);
}
}
}
private void changeStatusToProcessedAndSave(final PickingCandidate pickingCandidate)
{
pickingCandidate.changeStatusToClosed();
pickingCandidateRepository.save(pickingCandidate);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\candidate\commands\ClosePickingCandidateCommand.java
| 1
|
请完成以下Java代码
|
protected void executeParse(BpmnParse bpmnParse, BoundaryEvent boundaryEvent) {
if (boundaryEvent.getAttachedToRef() == null) {
logger.warn(
"Invalid reference in boundary event. Make sure that the referenced activity " +
"is defined in the same scope as the boundary event " +
boundaryEvent.getId()
);
return;
}
EventDefinition eventDefinition = null;
if (boundaryEvent.getEventDefinitions().size() > 0) {
eventDefinition = boundaryEvent.getEventDefinitions().get(0);
}
|
if (
eventDefinition instanceof TimerEventDefinition ||
eventDefinition instanceof ErrorEventDefinition ||
eventDefinition instanceof SignalEventDefinition ||
eventDefinition instanceof CancelEventDefinition ||
eventDefinition instanceof MessageEventDefinition ||
eventDefinition instanceof CompensateEventDefinition
) {
bpmnParse.getBpmnParserHandlers().parseElement(bpmnParse, eventDefinition);
} else {
// Should already be picked up by process validator on deploy, so this is just to be sure
logger.warn("Unsupported boundary event type for boundary event " + boundaryEvent.getId());
}
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\bpmn\parser\handler\BoundaryEventParseHandler.java
| 1
|
请完成以下Java代码
|
public StartupTimeline getTimeline() {
return this.timeline;
}
}
static class StartupEndpointRuntimeHints implements RuntimeHintsRegistrar {
private static final TypeReference DEFAULT_TAG = TypeReference
.of("org.springframework.boot.context.metrics.buffering.BufferedStartupStep$DefaultTag");
private static final TypeReference BUFFERED_STARTUP_STEP = TypeReference
.of("org.springframework.boot.context.metrics.buffering.BufferedStartupStep");
private static final TypeReference FLIGHT_RECORDER_TAG = TypeReference
.of("org.springframework.core.metrics.jfr.FlightRecorderStartupStep$FlightRecorderTag");
|
private static final TypeReference FLIGHT_RECORDER_STARTUP_STEP = TypeReference
.of("org.springframework.core.metrics.jfr.FlightRecorderStartupStep");
@Override
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
hints.reflection()
.registerType(DEFAULT_TAG, (typeHint) -> typeHint.onReachableType(BUFFERED_STARTUP_STEP)
.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS));
hints.reflection()
.registerType(FLIGHT_RECORDER_TAG, (typeHint) -> typeHint.onReachableType(FLIGHT_RECORDER_STARTUP_STEP)
.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS));
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-actuator\src\main\java\org\springframework\boot\actuate\startup\StartupEndpoint.java
| 1
|
请完成以下Java代码
|
public void setNameLikeIgnoreCase(String nameLikeIgnoreCase) {
this.nameLikeIgnoreCase = nameLikeIgnoreCase;
}
public String getDeploymentId() {
return deploymentId;
}
public void setDeploymentId(String deploymentId) {
this.deploymentId = deploymentId;
}
public List<String> getDeploymentIds() {
return deploymentIds;
}
public void setDeploymentIds(List<String> deploymentIds) {
this.deploymentIds = deploymentIds;
}
public String getActiveActivityId() {
return activeActivityId;
}
public void setActiveActivityId(String activeActivityId) {
this.activeActivityId = activeActivityId;
}
public Set<String> getActiveActivityIds() {
return activeActivityIds;
}
public void setActiveActivityIds(Set<String> activeActivityIds) {
this.activeActivityIds = activeActivityIds;
}
public Date getStartedBefore() {
return startedBefore;
}
public void setStartedBefore(Date startedBefore) {
this.startedBefore = startedBefore;
}
public Date getStartedAfter() {
return startedAfter;
}
public void setStartedAfter(Date startedAfter) {
this.startedAfter = startedAfter;
}
public String getStartedBy() {
return startedBy;
}
public void setStartedBy(String startedBy) {
this.startedBy = startedBy;
}
public String getLocale() {
return locale;
|
}
public boolean isWithLocalizationFallback() {
return withLocalizationFallback;
}
public String getCallbackId() {
return callbackId;
}
public Set<String> getCallBackIds() {
return callbackIds;
}
public String getCallbackType() {
return callbackType;
}
public String getParentCaseInstanceId() {
return parentCaseInstanceId;
}
public List<ExecutionQueryImpl> getOrQueryObjects() {
return orQueryObjects;
}
public List<List<String>> getSafeProcessInstanceIds() {
return safeProcessInstanceIds;
}
public void setSafeProcessInstanceIds(List<List<String>> safeProcessInstanceIds) {
this.safeProcessInstanceIds = safeProcessInstanceIds;
}
public List<List<String>> getSafeInvolvedGroups() {
return safeInvolvedGroups;
}
public void setSafeInvolvedGroups(List<List<String>> safeInvolvedGroups) {
this.safeInvolvedGroups = safeInvolvedGroups;
}
public String getRootScopeId() {
return null;
}
public String getParentScopeId() {
return null;
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\ExecutionQueryImpl.java
| 1
|
请完成以下Java代码
|
public JAXBElement<DeleteEmployee> createDeleteEmployee(DeleteEmployee value) {
return new JAXBElement<DeleteEmployee>(_DeleteEmployee_QNAME, DeleteEmployee.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link UpdateEmployeeResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://bottomup.server.jaxws.baeldung.com/", name = "updateEmployeeResponse")
public JAXBElement<UpdateEmployeeResponse> createUpdateEmployeeResponse(UpdateEmployeeResponse value) {
return new JAXBElement<UpdateEmployeeResponse>(_UpdateEmployeeResponse_QNAME, UpdateEmployeeResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link AddEmployee }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://bottomup.server.jaxws.baeldung.com/", name = "addEmployee")
public JAXBElement<AddEmployee> createAddEmployee(AddEmployee value) {
return new JAXBElement<AddEmployee>(_AddEmployee_QNAME, AddEmployee.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link GetAllEmployees }{@code >}}
*
|
*/
@XmlElementDecl(namespace = "http://bottomup.server.jaxws.baeldung.com/", name = "getAllEmployees")
public JAXBElement<GetAllEmployees> createGetAllEmployees(GetAllEmployees value) {
return new JAXBElement<GetAllEmployees>(_GetAllEmployees_QNAME, GetAllEmployees.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link CountEmployeesResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://bottomup.server.jaxws.baeldung.com/", name = "countEmployeesResponse")
public JAXBElement<CountEmployeesResponse> createCountEmployeesResponse(CountEmployeesResponse value) {
return new JAXBElement<CountEmployeesResponse>(_CountEmployeesResponse_QNAME, CountEmployeesResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link GetEmployee }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://bottomup.server.jaxws.baeldung.com/", name = "getEmployee")
public JAXBElement<GetEmployee> createGetEmployee(GetEmployee value) {
return new JAXBElement<GetEmployee>(_GetEmployee_QNAME, GetEmployee.class, null, value);
}
}
|
repos\tutorials-master\web-modules\jee-7\src\main\java\com\baeldung\jaxws\client\ObjectFactory.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Collection<Class<? extends DDOrderDeletedEvent>> getHandledEventType()
{
return ImmutableList.of(DDOrderDeletedEvent.class);
}
@Override
public void handleEvent(final DDOrderDeletedEvent event)
{
final OrgId orgId = event.getOrgId();
final ZoneId timeZone = orgDAO.getTimeZone(orgId);
for (final DDOrderLine ddOrderLine : event.getDdOrder().getLines())
{
final DDOrderMainDataHandler mainDataUpdater = DDOrderMainDataHandler.builder()
.ddOrderDetailRequestHandler(ddOrderDetailRequestHandler)
.mainDataRequestHandler(mainDataRequestHandler)
.abstractDDOrderEvent(event)
.ddOrderLine(ddOrderLine)
.orgZone(timeZone)
.build();
mainDataUpdater.handleDelete();
}
final int ddOrderId = event.getDdOrder().getDdOrderId();
event.getDdOrder().getLines().forEach(line -> deleteCandidates(ddOrderId, line));
}
|
private void deleteCandidates(final int ddOrderId, @NonNull final DDOrderLine ddOrderLine)
{
final CandidatesQuery query = CandidatesQuery
.builder()
.distributionDetailsQuery(DistributionDetailsQuery.builder()
.ddOrderId(ddOrderId)
.ddOrderLineId(ddOrderLine.getDdOrderLineId())
.build())
.build();
candidateRepositoryRetrieval.retrieveOrderedByDateAndSeqNo(query)
.forEach(candidateChangeService::onCandidateDelete);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.material\dispo-service\src\main\java\de\metas\material\dispo\service\event\handler\ddorder\DDOrderDeletedEventHandler.java
| 2
|
请完成以下Java代码
|
public boolean isAllowRetryOnError()
{
return false;
}
@Override
public Result processWorkPackage(final I_C_Queue_WorkPackage workpackage_NOTUSED, final String localTrxName_NOTUSED)
{
//
// Retrieve enqueued HUs
final List<I_M_HU> hus = retrieveItems(I_M_HU.class);
if (hus.isEmpty())
{
Loggables.addLog("No HUs found");
return Result.SUCCESS;
}
final IParams parameters = getParameters();
final int addToShipperTransportationId = parameters.getParameterAsInt(PARAMETERNAME_AddToShipperTransportationId, -1);
final boolean completeShipments = parameters.getParameterAsBool(PARAMETERNAME_IsCompleteShipments);
final BillAssociatedInvoiceCandidates invoiceMode = parameters.getParameterAsEnum(PARAMETERNAME_InvoiceMode, BillAssociatedInvoiceCandidates.class).orElse(BillAssociatedInvoiceCandidates.NO);
HUShippingFacade.builder()
.hus(hus)
.addToShipperTransportationId(addToShipperTransportationId)
.completeShipments(completeShipments)
.invoiceMode(invoiceMode)
.build()
.generateShippingDocuments();
return Result.SUCCESS;
}
/**
* Returns an instance of {@link CreateShipmentLatch}.
*
|
* task http://dewiki908/mediawiki/index.php/09216_Async_-_Need_SPI_to_decide_if_packets_can_be_processed_in_parallel_of_not_%28106397206117%29
*/
@Override
public ILatchStragegy getLatchStrategy()
{
return CreateShipmentLatch.INSTANCE;
}
/**
* Gets the {@link InOutGenerateResult} created by {@link #processWorkPackage(I_C_Queue_WorkPackage, String)}.
*
* @return shipment generation result; never return null
*/
@NonNull
public InOutGenerateResult getInOutGenerateResult()
{
Check.assumeNotNull(inoutGenerateResult, "workpackage shall be processed first");
return inoutGenerateResult;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\shipmentschedule\async\GenerateInOutFromHU.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public JwtResponse dynamicBuilderSpecific(@RequestBody Map<String, Object> claims) throws UnsupportedEncodingException {
JwtBuilder builder = Jwts.builder();
claims.forEach((key, value) -> {
switch (key) {
case "iss":
ensureType(key, value, String.class);
builder.setIssuer((String) value);
break;
case "sub":
ensureType(key, value, String.class);
builder.setSubject((String) value);
break;
case "aud":
ensureType(key, value, String.class);
builder.setAudience((String) value);
break;
case "exp":
ensureType(key, value, Long.class);
builder.setExpiration(Date.from(Instant.ofEpochSecond(Long.parseLong(value.toString()))));
break;
case "nbf":
ensureType(key, value, Long.class);
builder.setNotBefore(Date.from(Instant.ofEpochSecond(Long.parseLong(value.toString()))));
break;
case "iat":
ensureType(key, value, Long.class);
builder.setIssuedAt(Date.from(Instant.ofEpochSecond(Long.parseLong(value.toString()))));
break;
case "jti":
ensureType(key, value, String.class);
|
builder.setId((String) value);
break;
default:
builder.claim(key, value);
}
});
builder.signWith(SignatureAlgorithm.HS256, secretService.getHS256SecretBytes());
return new JwtResponse(builder.compact());
}
private void ensureType(String registeredClaim, Object value, Class expectedType) {
boolean isCorrectType = expectedType.isInstance(value) || expectedType == Long.class && value instanceof Integer;
if (!isCorrectType) {
String msg = "Expected type: " + expectedType.getCanonicalName() + " for registered claim: '" + registeredClaim + "', but got value: " + value + " of type: " + value.getClass()
.getCanonicalName();
throw new JwtException(msg);
}
}
}
|
repos\tutorials-master\security-modules\jjwt\src\main\java\io\jsonwebtoken\jjwtfun\controller\DynamicJWTController.java
| 2
|
请完成以下Java代码
|
private static InventoryValue retrieveInventoryValueRow(final ResultSet rs) throws SQLException
{
return InventoryValue.builder()
.combination(rs.getString("combination"))
.description(rs.getString("description"))
.activityName(rs.getString("ActivityName"))
.warehouseName(rs.getString("WarehouseName"))
.productValue(rs.getString("ProductValue"))
.productName(rs.getString("ProductName"))
.qty(rs.getBigDecimal("Qty"))
.uomSymbol(rs.getString("UOMSymbol"))
.accounted(retrieveAmounts(rs, "Acct"))
.costing(retrieveAmounts(rs, "Costing"))
.inventoryValueAcctAmt(retrieveBigDecimalOrZero(rs, "InventoryValueAcctAmt"))
.build();
}
|
private static InventoryValue.Amounts retrieveAmounts(@NonNull final ResultSet rs, @NonNull final String prefix) throws SQLException
{
return InventoryValue.Amounts.builder()
.costPrice(retrieveBigDecimalOrZero(rs, prefix + "_CostPrice"))
.expectedAmt(retrieveBigDecimalOrZero(rs, prefix + "_ExpectedAmt"))
.errorAmt(retrieveBigDecimalOrZero(rs, prefix + "_ErrorAmt"))
.build();
}
@NonNull
private static BigDecimal retrieveBigDecimalOrZero(final @NonNull ResultSet rs, final @NonNull String columnName) throws SQLException
{
return CoalesceUtil.coalesceNotNull(rs.getBigDecimal(columnName), BigDecimal.ZERO);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\inventory\InventoryValuationService.java
| 1
|
请完成以下Java代码
|
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);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
|
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Ratio.
@param PA_Ratio_ID
Performace Ratio
*/
public void setPA_Ratio_ID (int PA_Ratio_ID)
{
if (PA_Ratio_ID < 1)
set_ValueNoCheck (COLUMNNAME_PA_Ratio_ID, null);
else
set_ValueNoCheck (COLUMNNAME_PA_Ratio_ID, Integer.valueOf(PA_Ratio_ID));
}
/** Get Ratio.
@return Performace Ratio
*/
public int getPA_Ratio_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_PA_Ratio_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_PA_Ratio.java
| 1
|
请完成以下Java代码
|
public String getIpAddress() {
return ipAddress;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getLatitude() {
return latitude;
|
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
}
|
repos\tutorials-master\spring-web-modules\spring-mvc-xml-2\src\main\java\com\baeldung\spring\form\GeoIP.java
| 1
|
请完成以下Java代码
|
protected String getDefaultMessage() {
return DEFAULT_MESSAGE;
}
public void setRestTemplate(RestTemplate restTemplate) {
this.restTemplate = restTemplate;
}
@Nullable
public URI getUrl() {
return url;
}
public void setUrl(@Nullable URI url) {
this.url = url;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
|
this.username = username;
}
@Nullable
public String getRoom() {
return room;
}
public void setRoom(@Nullable String room) {
this.room = room;
}
@Nullable
public String getToken() {
return token;
}
public void setToken(@Nullable String token) {
this.token = token;
}
}
|
repos\spring-boot-admin-master\spring-boot-admin-server\src\main\java\de\codecentric\boot\admin\server\notify\LetsChatNotifier.java
| 1
|
请完成以下Java代码
|
void section(int nclusters)
{
if (size() < nclusters)
throw new IllegalArgumentException("簇数目小于文档数目");
sectioned_clusters_ = new ArrayList<Cluster<K>>(nclusters);
List<Document> centroids = new ArrayList<Document>(nclusters);
// choose_randomly(nclusters, centroids);
choose_smartly(nclusters, centroids);
for (int i = 0; i < centroids.size(); i++)
{
Cluster<K> cluster = new Cluster<K>();
sectioned_clusters_.add(cluster);
}
for (Document<K> d : documents_)
{
double max_similarity = -1.0;
int max_index = 0;
for (int j = 0; j < centroids.size(); j++)
{
|
double similarity = SparseVector.inner_product(d.feature(), centroids.get(j).feature());
if (max_similarity < similarity)
{
max_similarity = similarity;
max_index = j;
}
}
sectioned_clusters_.get(max_index).add_document(d);
}
}
@Override
public int compareTo(Cluster<K> o)
{
return Double.compare(o.sectioned_gain(), sectioned_gain());
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\mining\cluster\Cluster.java
| 1
|
请完成以下Java代码
|
public int getAD_Role_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Role_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_AD_User getAD_User() throws RuntimeException
{
return (I_AD_User)MTable.get(getCtx(), I_AD_User.Table_Name)
.getPO(getAD_User_ID(), get_TrxName()); }
/** Set User/Contact.
@param AD_User_ID
User within the system - Internal or Business Partner Contact
*/
public void setAD_User_ID (int AD_User_ID)
{
if (AD_User_ID < 1)
set_Value (COLUMNNAME_AD_User_ID, null);
else
set_Value (COLUMNNAME_AD_User_ID, Integer.valueOf(AD_User_ID));
}
|
/** Get User/Contact.
@return User within the system - Internal or Business Partner Contact
*/
public int getAD_User_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), String.valueOf(getAD_User_ID()));
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_AlertRecipient.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void deleteVariablesByTaskId(String taskId) {
DbSqlSession dbSqlSession = getDbSqlSession();
if (isEntityInserted(dbSqlSession, "task", taskId)) {
deleteCachedEntities(dbSqlSession, variableInstanceByTaskIdMatcher, taskId);
} else {
bulkDelete("deleteVariableInstancesByTaskId", variableInstanceByTaskIdMatcher, taskId);
}
}
@Override
public void deleteVariablesByExecutionId(String executionId) {
DbSqlSession dbSqlSession = getDbSqlSession();
if (isEntityInserted(dbSqlSession, "execution", executionId)) {
deleteCachedEntities(dbSqlSession, variableInstanceByExecutionIdMatcher, executionId);
} else {
bulkDelete("deleteVariableInstancesByExecutionId", variableInstanceByExecutionIdMatcher, executionId);
}
}
@Override
public void deleteByScopeIdAndScopeType(String scopeId, String scopeType) {
Map<String, Object> params = new HashMap<>(3);
params.put("scopeId", scopeId);
params.put("scopeType", scopeType);
bulkDelete("deleteVariablesByScopeIdAndScopeType", variableInstanceByScopeIdAndScopeTypeMatcher, params);
}
@Override
public void deleteByScopeIdAndScopeTypes(String scopeId, Collection<String> scopeTypes) {
if (scopeTypes.size() == 1) {
deleteByScopeIdAndScopeType(scopeId, scopeTypes.iterator().next());
return;
}
Map<String, Object> params = new HashMap<>(3);
params.put("scopeId", scopeId);
params.put("scopeTypes", scopeTypes);
|
bulkDelete("deleteVariablesByScopeIdAndScopeTypes", variableInstanceByScopeIdAndScopeTypesMatcher, params);
}
@Override
public void deleteBySubScopeIdAndScopeTypes(String subScopeId, Collection<String> scopeTypes) {
Map<String, Object> params = new HashMap<>(3);
params.put("subScopeId", subScopeId);
params.put("scopeTypes", scopeTypes);
bulkDelete("deleteVariablesBySubScopeIdAndScopeTypes", variableInstanceBySubScopeIdAndScopeTypesMatcher, params);
}
@Override
protected IdGenerator getIdGenerator() {
return variableServiceConfiguration.getIdGenerator();
}
}
|
repos\flowable-engine-main\modules\flowable-variable-service\src\main\java\org\flowable\variable\service\impl\persistence\entity\data\impl\MybatisVariableInstanceDataManager.java
| 2
|
请完成以下Java代码
|
public BigDecimal getLastDifference()
{
return m_lastDifference;
} // getLastDifference
/**
* Set Last Allocation Difference
* @param difference difference
*/
public void setLastDifference(BigDecimal difference)
{
m_lastDifference = difference;
} // setLastDifference
/**
* Get Max Allocation
* @return max allocation
*/
public BigDecimal getMaxAllocation()
{
return m_maxAllocation;
} // getMaxAllocation
/**
* Set Max Allocation if greater
* @param max allocation
* @param set set to max
*/
public void setMaxAllocation (BigDecimal max, boolean set)
{
if (set || max.compareTo(m_maxAllocation) > 0)
m_maxAllocation = max;
} // setMaxAllocation
/**
* Reset Calculations
*/
public void resetCalculations()
{
m_actualQty = Env.ZERO;
m_actualMin = Env.ZERO;
m_actualAllocation = Env.ZERO;
// m_lastDifference = Env.ZERO;
m_maxAllocation = Env.ZERO;
} // resetCalculations
/**************************************************************************
* Get Product
* @return product
*/
|
public MProduct getProduct()
{
if (m_product == null)
m_product = MProduct.get(getCtx(), getM_Product_ID());
return m_product;
} // getProduct
/**
* Get Product Standard Precision
* @return standard precision
*/
public int getUOMPrecision()
{
return getProduct().getUOMPrecision();
} // getUOMPrecision
/**************************************************************************
* String Representation
* @return info
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MDistributionRunLine[")
.append(get_ID()).append("-")
.append(getInfo())
.append ("]");
return sb.toString ();
} // toString
/**
* Get Info
* @return info
*/
public String getInfo()
{
StringBuffer sb = new StringBuffer ();
sb.append("Line=").append(getLine())
.append (",TotalQty=").append(getTotalQty())
.append(",SumMin=").append(getActualMin())
.append(",SumQty=").append(getActualQty())
.append(",SumAllocation=").append(getActualAllocation())
.append(",MaxAllocation=").append(getMaxAllocation())
.append(",LastDiff=").append(getLastDifference());
return sb.toString ();
} // getInfo
} // MDistributionRunLine
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MDistributionRunLine.java
| 1
|
请完成以下Java代码
|
public boolean isColumnPrinted(final int col)
{
MPrintFormatItem item = m_printFormat.getItem(col);
return item.isPrinted();
}
@Override
public boolean isPageBreak(final int row, final int col)
{
PrintDataElement pde = getPDE(row, col);
return pde != null ? pde.isPageBreak() : false;
}
@Override
public boolean isFunctionRow(final int row)
{
return m_printData.isFunctionRow(row);
}
@Override
protected void formatPage(final Sheet sheet)
{
super.formatPage(sheet);
MPrintPaper paper = MPrintPaper.get(this.m_printFormat.getAD_PrintPaper_ID());
//
// Set paper size:
short paperSize = -1;
MediaSizeName mediaSizeName = paper.getMediaSize().getMediaSizeName();
if (MediaSizeName.NA_LETTER.equals(mediaSizeName))
{
paperSize = PrintSetup.LETTER_PAPERSIZE;
}
else if (MediaSizeName.NA_LEGAL.equals(mediaSizeName))
{
paperSize = PrintSetup.LEGAL_PAPERSIZE;
}
else if (MediaSizeName.EXECUTIVE.equals(mediaSizeName))
{
paperSize = PrintSetup.EXECUTIVE_PAPERSIZE;
}
else if (MediaSizeName.ISO_A4.equals(mediaSizeName))
{
paperSize = PrintSetup.A4_PAPERSIZE;
}
else if (MediaSizeName.ISO_A5.equals(mediaSizeName))
{
paperSize = PrintSetup.A5_PAPERSIZE;
}
else if (MediaSizeName.NA_NUMBER_10_ENVELOPE.equals(mediaSizeName))
{
|
paperSize = PrintSetup.ENVELOPE_10_PAPERSIZE;
}
// else if (MediaSizeName..equals(mediaSizeName)) {
// paperSize = PrintSetup.ENVELOPE_DL_PAPERSIZE;
// }
// else if (MediaSizeName..equals(mediaSizeName)) {
// paperSize = PrintSetup.ENVELOPE_CS_PAPERSIZE;
// }
else if (MediaSizeName.MONARCH_ENVELOPE.equals(mediaSizeName))
{
paperSize = PrintSetup.ENVELOPE_MONARCH_PAPERSIZE;
}
if (paperSize != -1)
{
sheet.getPrintSetup().setPaperSize(paperSize);
}
//
// Set Landscape/Portrait:
sheet.getPrintSetup().setLandscape(paper.isLandscape());
//
// Set Paper Margin:
sheet.setMargin(Sheet.TopMargin, ((double)paper.getMarginTop()) / 72);
sheet.setMargin(Sheet.RightMargin, ((double)paper.getMarginRight()) / 72);
sheet.setMargin(Sheet.LeftMargin, ((double)paper.getMarginLeft()) / 72);
sheet.setMargin(Sheet.BottomMargin, ((double)paper.getMarginBottom()) / 72);
//
}
@Override
protected List<CellValue> getNextRow()
{
final ArrayList<CellValue> result = new ArrayList<>();
for (int i = 0; i < getColumnCount(); i++)
{
result.add(getValueAt(rowNumber, i));
}
rowNumber++;
return result;
}
@Override
protected boolean hasNextRow()
{
return rowNumber < getRowCount();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\adempiere\print\export\PrintDataExcelExporter.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
}
private String username;
private String password;
private Server server;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
|
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Server getServer() {
return server;
}
public void setServer(Server server) {
this.server = server;
}
}
|
repos\tutorials-master\spring-boot-modules\spring-boot-autoconfiguration\src\main\java\com\baeldung\autoconfiguration\annotationprocessor\DatabaseProperties.java
| 2
|
请完成以下Java代码
|
public ALayoutConstraint createNext()
{
return new ALayoutConstraint(m_row, m_col+1);
} // createNext
private int m_row;
private int m_col;
/**
* Get Row
* @return roe no
*/
public int getRow()
{
return m_row;
} // getRow
/**
* Get Column
* @return col no
*/
public int getCol()
{
return m_col;
} // getCol
/**
* Compares this object with the specified object for order. Returns a
* negative integer, zero, or a positive integer as this object is less
* than, equal to, or greater than the specified object.<p>
*
* @param o the Object to be compared.
* @return a negative integer if this object is less than the specified object,
* zero if equal,
* or a positive integer if this object is greater than the specified object.
*/
public int compareTo(Object o)
{
ALayoutConstraint comp = null;
if (o instanceof ALayoutConstraint)
|
comp = (ALayoutConstraint)o;
if (comp == null)
return +111;
// Row compare
int rowComp = m_row - comp.getRow();
if (rowComp != 0)
return rowComp;
// Column compare
return m_col - comp.getCol();
} // compareTo
/**
* Is Object Equal
* @param o
* @return true if equal
*/
public boolean equals(Object o)
{
if (o instanceof ALayoutConstraint)
return compareTo(o) == 0;
return false;
} // equal
/**
* To String
* @return info
*/
public String toString()
{
return "ALayoutConstraint [Row=" + m_row + ", Col=" + m_col + "]";
} // toString
} // ALayoutConstraint
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\apps\ALayoutConstraint.java
| 1
|
请完成以下Java代码
|
public void setAD_WF_Process_ID (final int AD_WF_Process_ID)
{
if (AD_WF_Process_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_WF_Process_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_WF_Process_ID, AD_WF_Process_ID);
}
@Override
public int getAD_WF_Process_ID()
{
return get_ValueAsInt(COLUMNNAME_AD_WF_Process_ID);
}
@Override
public void setAD_WF_ProcessData_ID (final int AD_WF_ProcessData_ID)
{
if (AD_WF_ProcessData_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_WF_ProcessData_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_WF_ProcessData_ID, AD_WF_ProcessData_ID);
}
@Override
public int getAD_WF_ProcessData_ID()
{
return get_ValueAsInt(COLUMNNAME_AD_WF_ProcessData_ID);
}
@Override
public void setAttributeName (final java.lang.String AttributeName)
{
set_Value (COLUMNNAME_AttributeName, AttributeName);
}
@Override
|
public java.lang.String getAttributeName()
{
return get_ValueAsString(COLUMNNAME_AttributeName);
}
@Override
public void setAttributeValue (final java.lang.String AttributeValue)
{
set_Value (COLUMNNAME_AttributeValue, AttributeValue);
}
@Override
public java.lang.String getAttributeValue()
{
return get_ValueAsString(COLUMNNAME_AttributeValue);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_WF_ProcessData.java
| 1
|
请完成以下Java代码
|
public static Long getCurrentUserId() {
return getCurrentUserId(getToken());
}
/**
* 获取用户ID
* @return 系统用户ID
*/
public static Long getCurrentUserId(String token) {
JWT jwt = JWTUtil.parseToken(token);
return Long.valueOf(jwt.getPayload("userId").toString());
}
/**
* 获取系统用户名称
*
* @return 系统用户名称
*/
public static String getCurrentUsername() {
return getCurrentUsername(getToken());
}
/**
* 获取系统用户名称
*
* @return 系统用户名称
*/
public static String getCurrentUsername(String token) {
JWT jwt = JWTUtil.parseToken(token);
return jwt.getPayload("sub").toString();
}
|
/**
* 获取Token
* @return /
*/
public static String getToken() {
HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder
.getRequestAttributes())).getRequest();
String bearerToken = request.getHeader(header);
if (bearerToken != null && bearerToken.startsWith(tokenStartWith)) {
// 去掉令牌前缀
return bearerToken.replace(tokenStartWith, "");
} else {
log.debug("非法Token:{}", bearerToken);
}
return null;
}
}
|
repos\eladmin-master\eladmin-common\src\main\java\me\zhengjie\utils\SecurityUtils.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class InvoiceReferenceNo
{
String bankAccount;
String org;
/** Last 8 digits of the C_BPArtner_ID; lpadded with 0 */
String bPartnerHint;
/** Last 8 digits of the C_Invoice_ID; lpadded with 0 */
String invoiceHint;
int checkDigit;
private InvoiceReferenceNo(
@NonNull final String bankAccount,
@NonNull final String org,
@NonNull final String bPartnerHint,
@NonNull final String invoiceHint,
|
final int checkDigit)
{
this.bankAccount = bankAccount;
this.org = org;
this.bPartnerHint = bPartnerHint;
this.invoiceHint = invoiceHint;
this.checkDigit = checkDigit;
}
public String asString()
{
return new StringBuilder()
.append(bankAccount)
.append(org)
.append(bPartnerHint)
.append(invoiceHint)
.append(checkDigit)
.toString();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.esr\src\main\java\de\metas\payment\esr\api\InvoiceReferenceNo.java
| 2
|
请完成以下Java代码
|
abstract class AbstractExpressionAttributeRegistry<T extends ExpressionAttribute> {
private final Map<MethodClassKey, T> cachedAttributes = new ConcurrentHashMap<>();
private MethodSecurityExpressionHandler expressionHandler = new DefaultMethodSecurityExpressionHandler();
/**
* Returns an {@link ExpressionAttribute} for the {@link MethodInvocation}.
* @param mi the {@link MethodInvocation} to use
* @return the {@link ExpressionAttribute} to use
*/
final T getAttribute(MethodInvocation mi) {
Method method = mi.getMethod();
Object target = mi.getThis();
Class<?> targetClass = (target != null) ? target.getClass() : null;
return getAttribute(method, targetClass);
}
/**
* Returns an {@link ExpressionAttribute} for the method and the target class.
* @param method the method
* @param targetClass the target class
* @return the {@link ExpressionAttribute} to use
*/
final T getAttribute(Method method, @Nullable Class<?> targetClass) {
MethodClassKey cacheKey = new MethodClassKey(method, targetClass);
return this.cachedAttributes.computeIfAbsent(cacheKey, (k) -> resolveAttribute(method, targetClass));
}
/**
* Returns the {@link MethodSecurityExpressionHandler}.
* @return the {@link MethodSecurityExpressionHandler} to use
*/
|
MethodSecurityExpressionHandler getExpressionHandler() {
return this.expressionHandler;
}
void setExpressionHandler(MethodSecurityExpressionHandler expressionHandler) {
Assert.notNull(expressionHandler, "expressionHandler cannot be null");
this.expressionHandler = expressionHandler;
}
abstract void setTemplateDefaults(AnnotationTemplateExpressionDefaults adapter);
/**
* Subclasses should implement this method to provide the non-null
* {@link ExpressionAttribute} for the method and the target class.
* @param method the method
* @param targetClass the target class
* @return {@link ExpressionAttribute} or null if not found.
*/
abstract @Nullable T resolveAttribute(Method method, @Nullable Class<?> targetClass);
Class<?> targetClass(Method method, @Nullable Class<?> targetClass) {
return (targetClass != null) ? targetClass : method.getDeclaringClass();
}
}
|
repos\spring-security-main\core\src\main\java\org\springframework\security\authorization\method\AbstractExpressionAttributeRegistry.java
| 1
|
请完成以下Java代码
|
public Iterator<Cookie> iterator() {
return cookieMap.values().iterator();
}
public Cookie[] toArray() {
Cookie[] cookies = new Cookie[cookieMap.size()];
return toArray(cookies);
}
@Override
public <T> T[] toArray(T[] ts) {
return cookieMap.values().toArray(ts);
}
@Override
public boolean add(Cookie cookie) {
if (cookie == null) {
return false;
}
cookieMap.put(cookie.getName(), cookie);
return true;
}
@Override
public boolean remove(Object o) {
if (o instanceof String) {
return cookieMap.remove((String)o) != null;
}
if (o instanceof Cookie) {
Cookie c = (Cookie)o;
return cookieMap.remove(c.getName()) != null;
}
return false;
}
public Cookie get(String name) {
return cookieMap.get(name);
}
@Override
public boolean containsAll(Collection<?> collection) {
for(Object o : collection) {
if (!contains(o)) {
return false;
}
}
|
return true;
}
@Override
public boolean addAll(Collection<? extends Cookie> collection) {
boolean result = false;
for(Cookie cookie : collection) {
result|= add(cookie);
}
return result;
}
@Override
public boolean removeAll(Collection<?> collection) {
boolean result = false;
for(Object cookie : collection) {
result|= remove(cookie);
}
return result;
}
@Override
public boolean retainAll(Collection<?> collection) {
boolean result = false;
Iterator<Map.Entry<String, Cookie>> it = cookieMap.entrySet().iterator();
while(it.hasNext()) {
Map.Entry<String, Cookie> e = it.next();
if (!collection.contains(e.getKey()) && !collection.contains(e.getValue())) {
it.remove();
result = true;
}
}
return result;
}
@Override
public void clear() {
cookieMap.clear();
}
}
|
repos\tutorials-master\jhipster-modules\jhipster-uaa\gateway\src\main\java\com\baeldung\jhipster\gateway\security\oauth2\CookieCollection.java
| 1
|
请完成以下Java代码
|
public class HistoryCleanupConfigurationDto {
protected Date batchWindowStartTime;
protected Date batchWindowEndTime;
protected boolean enabled;
public Date getBatchWindowStartTime() {
return batchWindowStartTime;
}
public void setBatchWindowStartTime(Date batchWindowStartTime) {
this.batchWindowStartTime = batchWindowStartTime;
}
public Date getBatchWindowEndTime() {
return batchWindowEndTime;
|
}
public void setBatchWindowEndTime(Date batchWindowEndTime) {
this.batchWindowEndTime = batchWindowEndTime;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\history\HistoryCleanupConfigurationDto.java
| 1
|
请完成以下Java代码
|
public void invokeLater(final int windowNo, final Runnable runnable)
{
getCurrentInstance().invokeLater(windowNo, runnable);
}
@Override
public Thread createUserThread(final Runnable runnable, final String threadName)
{
return getCurrentInstance().createUserThread(runnable, threadName);
}
@Override
public String getClientInfo()
{
return getCurrentInstance().getClientInfo();
}
/**
* This method does nothing.
*
* @deprecated please check out the deprecation notice in {@link IClientUIInstance#hideBusyDialog()}.
*/
@Deprecated
@Override
public void hideBusyDialog()
{
// nothing
}
@Override
public void showWindow(final Object model)
{
getCurrentInstance().showWindow(model);
}
|
@Override
public void executeLongOperation(final Object component, final Runnable runnable)
{
getCurrentInstance().executeLongOperation(component, runnable);
}
@Override
public IClientUIInvoker invoke()
{
return getCurrentInstance().invoke();
}
@Override
public IClientUIAsyncInvoker invokeAsync()
{
return getCurrentInstance().invokeAsync();
}
@Override
public void showURL(String url)
{
getCurrentInstance().showURL(url);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\adempiere\form\AbstractClientUI.java
| 1
|
请完成以下Java代码
|
public Set<LogLevel> getSupportedLogLevels() {
return EnumSet.allOf(LogLevel.class);
}
/**
* Sets the logging level for a given logger.
* @param loggerName the name of the logger to set ({@code null} can be used for the
* root logger).
* @param level the log level ({@code null} can be used to remove any custom level for
* the logger and use the default configuration instead)
*/
public void setLogLevel(@Nullable String loggerName, @Nullable LogLevel level) {
throw new UnsupportedOperationException("Unable to set log level");
}
/**
* Returns a collection of the current configuration for all a {@link LoggingSystem}'s
* loggers.
* @return the current configurations
* @since 1.5.0
*/
public List<LoggerConfiguration> getLoggerConfigurations() {
throw new UnsupportedOperationException("Unable to get logger configurations");
}
/**
* Returns the current configuration for a {@link LoggingSystem}'s logger.
* @param loggerName the name of the logger
* @return the current configuration
* @since 1.5.0
*/
public @Nullable LoggerConfiguration getLoggerConfiguration(String loggerName) {
throw new UnsupportedOperationException("Unable to get logger configuration");
}
/**
* Detect and return the logging system in use. Supports Logback and Java Logging.
* @param classLoader the classloader
* @return the logging system
*/
public static LoggingSystem get(ClassLoader classLoader) {
String loggingSystemClassName = System.getProperty(SYSTEM_PROPERTY);
if (StringUtils.hasLength(loggingSystemClassName)) {
if (NONE.equals(loggingSystemClassName)) {
return new NoOpLoggingSystem();
}
return get(classLoader, loggingSystemClassName);
}
LoggingSystem loggingSystem = SYSTEM_FACTORY.getLoggingSystem(classLoader);
Assert.state(loggingSystem != null, "No suitable logging system located");
return loggingSystem;
}
private static LoggingSystem get(ClassLoader classLoader, String loggingSystemClassName) {
try {
Class<?> systemClass = ClassUtils.forName(loggingSystemClassName, classLoader);
Constructor<?> constructor = systemClass.getDeclaredConstructor(ClassLoader.class);
constructor.setAccessible(true);
return (LoggingSystem) constructor.newInstance(classLoader);
|
}
catch (Exception ex) {
throw new IllegalStateException(ex);
}
}
/**
* {@link LoggingSystem} that does nothing.
*/
static class NoOpLoggingSystem extends LoggingSystem {
@Override
public void beforeInitialize() {
}
@Override
public void setLogLevel(@Nullable String loggerName, @Nullable LogLevel level) {
}
@Override
public List<LoggerConfiguration> getLoggerConfigurations() {
return Collections.emptyList();
}
@Override
public @Nullable LoggerConfiguration getLoggerConfiguration(String loggerName) {
return null;
}
}
}
|
repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\logging\LoggingSystem.java
| 1
|
请完成以下Java代码
|
public abstract class BPartnerException extends AdempiereException
{
BPartnerException(
@NonNull final AdMessageKey adMessage,
@Nullable final I_C_BPartner bpartner)
{
super(buildMsg(adMessage, extractBPartnerName(bpartner)), getErrorCode(adMessage));
}
BPartnerException(
@NonNull final AdMessageKey adMessage,
@Nullable final String bpartnerName)
{
super(buildMsg(adMessage, bpartnerName), getErrorCode(adMessage));
}
@Nullable
private static String getErrorCode(final @NonNull AdMessageKey adMessage)
{
return Services.get(IMsgBL.class).getErrorCode(adMessage);
}
private static String extractBPartnerName(final I_C_BPartner bpartner)
{
return bpartner != null
? bpartner.getValue() + "_" + bpartner.getName()
: null;
|
}
private static ITranslatableString buildMsg(
@NonNull final AdMessageKey adMessage,
@Nullable final String bpartnerName)
{
final TranslatableStringBuilder builder = TranslatableStrings.builder()
.appendADMessage(adMessage);
if (Check.isNotBlank(bpartnerName))
{
builder.append(": ").append(bpartnerName);
}
return builder.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\bpartner\exceptions\BPartnerException.java
| 1
|
请完成以下Java代码
|
public MenuType getType() {
return type;
}
public void setType(MenuType type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getUrl() {
return url;
}
|
public void setUrl(String url) {
this.url = url;
}
public String getMediaId() {
return mediaId;
}
public void setMediaId(String mediaId) {
this.mediaId = mediaId;
}
public List<MenuButton> getSubButton() {
return subButton;
}
public void setSubButton(List<MenuButton> subButton) {
if (null == subButton || subButton.size() > 5) {
throw new WeixinException("子菜单最多只有5个");
}
this.subButton = subButton;
}
}
|
repos\spring-boot-quick-master\quick-wx-public\src\main\java\com\wx\pn\api\model\MenuButton.java
| 1
|
请完成以下Java代码
|
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Valid from.
@param ValidFrom
Valid from including this date (first day)
*/
public void setValidFrom (String ValidFrom)
{
set_Value (COLUMNNAME_ValidFrom, ValidFrom);
}
/** Get Valid from.
@return Valid from including this date (first day)
*/
public String getValidFrom ()
{
return (String)get_Value(COLUMNNAME_ValidFrom);
}
/** Set Valid to.
@param ValidTo
Valid to including this date (last day)
*/
public void setValidTo (Timestamp ValidTo)
{
set_Value (COLUMNNAME_ValidTo, ValidTo);
}
/** Get Valid to.
@return Valid to including this date (last day)
*/
public Timestamp getValidTo ()
{
|
return (Timestamp)get_Value(COLUMNNAME_ValidTo);
}
/** 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\eevolution\model\X_QM_SpecificationLine.java
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.