instruction string | input string | output string | source_file string | priority int64 |
|---|---|---|---|---|
请在Spring Boot框架中完成以下Java代码 | public class JsonResponseBPartnerCreditLimit
{
public static final String METASFRESH_ID = "metasfreshId";
public static final String BPARTNER_ID = "bpartnerId";
public static final String AMOUNT = "amount";
public static final String DATE_FROM = "dateFrom";
public static final String CREDITLIMITTYPE = "creditLimitType";
@ApiModelProperty( //
required = true, //
dataType = "java.lang.Integer", //
value = "This translates to `C_BPartner_CreditLimit.C_BPartner_CreditLimit_ID`.")
@JsonProperty(METASFRESH_ID)
@JsonInclude(JsonInclude.Include.NON_NULL)
JsonMetasfreshId metasfreshId;
@ApiModelProperty(value = "This translates to `C_BPartner_CreditLimit.Amount`.")
@JsonProperty(AMOUNT)
BigDecimal amount;
@ApiModelProperty(value = "This translates to `C_BPartner_CreditLimit.C_BPartner_ID`.")
@JsonProperty(BPARTNER_ID)
@NonNull
JsonMetasfreshId metasfreshBPartnerId;
@ApiModelProperty(value = "This translates to `C_BPartner_CreditLimit.DateFrom`.")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
LocalDate dateFrom;
@ApiModelProperty(value = "This translates to `C_BPartner_CreditLimit.C_CreditLimit_Type_ID`.")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
JsonResponseCreditLimitType creditLimitType; | @JsonCreator
@Builder(toBuilder = true)
private JsonResponseBPartnerCreditLimit(
@JsonProperty(METASFRESH_ID) @NonNull final JsonMetasfreshId metasfreshId,
@JsonProperty(BPARTNER_ID) @NonNull final JsonMetasfreshId metasfreshBPartnerId,
@JsonProperty(AMOUNT) final BigDecimal amount,
@JsonProperty(DATE_FROM) @Nullable final LocalDate dateFrom,
@JsonProperty(CREDITLIMITTYPE) @Nullable final JsonResponseCreditLimitType creditLimitType)
{
this.metasfreshId = metasfreshId;
this.metasfreshBPartnerId = metasfreshBPartnerId;
this.amount = amount;
this.dateFrom = dateFrom;
this.creditLimitType = creditLimitType;
}
} | repos\metasfresh-new_dawn_uat\misc\de-metas-common\de-metas-common-bpartner\src\main\java\de\metas\common\bpartner\v2\response\JsonResponseBPartnerCreditLimit.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class Person {
@Id @GeneratedValue Long id;
String name;
@Version Long version;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() { | return name;
}
public void setName(String name) {
this.name = name;
}
public Long getVersion() {
return version;
}
public void setVersion(Long version) {
this.version = version;
}
} | repos\spring-data-examples-main\jpa\envers\src\main\java\example\springdata\jpa\envers\Person.java | 2 |
请完成以下Java代码 | public boolean isDirty()
{
return wasInterrupted;
}
private final String normalizeKey(final Object key)
{
return key == null ? null : key.toString();
}
@Override
public boolean containsKey(Object key)
{
final String keyStr = normalizeKey(key);
return values.containsKey(keyStr);
}
@Override
public NamePair getByKey(Object key)
{
final String keyStr = normalizeKey(key);
return values.get(keyStr); | }
@Override
public Collection<NamePair> getValues()
{
return values.values();
}
@Override
public int size()
{
return values.size();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\compiere\model\MLookupLoader.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public Integer getRetries() {
return retries;
}
public void setRetries(Integer retries) {
this.retries = retries;
}
@ApiModelProperty(example = "null")
public String getExceptionMessage() {
return exceptionMessage;
}
public void setExceptionMessage(String exceptionMessage) {
this.exceptionMessage = exceptionMessage;
}
@ApiModelProperty(example = "2023-06-04T22:05:05.474+0000")
public Date getDueDate() {
return dueDate;
}
public void setDueDate(Date dueDate) {
this.dueDate = dueDate;
}
@ApiModelProperty(example = "2023-06-03T22:05:05.474+0000")
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@ApiModelProperty(example = "node1")
public String getLockOwner() { | return lockOwner;
}
public void setLockOwner(String lockOwner) {
this.lockOwner = lockOwner;
}
@ApiModelProperty(example = "2023-06-03T22:05:05.474+0000")
public Date getLockExpirationTime() {
return lockExpirationTime;
}
public void setLockExpirationTime(Date lockExpirationTime) {
this.lockExpirationTime = lockExpirationTime;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
@ApiModelProperty(example = "null")
public String getTenantId() {
return tenantId;
}
} | repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\management\JobResponse.java | 2 |
请完成以下Spring Boot application配置 | spring:
application:
name: demo-consumer-application
cloud:
# Spring Cloud Stream 配置项,对应 BindingServiceProperties 类
stream:
# Binder 配置项,对应 BinderProperties Map
# binders:
# Binding 配置项,对应 BindingProperties Map
bindings:
demo01-input:
destination: DEMO-TOPIC-01 # 目的地。这里使用 Kafka Topic
content-type: application/json # 内容格式。这里使用 JSON
group: demo01-consumer-group # 消费者分组
# Spring Cloud Stream Kafka 配置项
kafka:
# Kafka Binder 配置项,对应 KafkaBinderConfigurationProperties 类
binder:
brokers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔
# Kafka Binding 配置项,对应 KafkaBindingProperties 类
bindings:
| demo01-input:
# Kafka Consumer 配置项,对应 KafkaConsumerProperties 类
consumer:
auto-commit-offset: false # 是否自动提交消费进度,默认为 true 自动提交。
ack-each-record: true # 是否每一条消息都进行提交消费进度,默认为 false 在每一批消费完成后一起提交。
server:
port: ${random.int[10000,19999]} # 随机端口,方便启动多个消费者 | repos\SpringBoot-Labs-master\labx-11-spring-cloud-stream-kafka\labx-11-sc-stream-kafka-consumer-ack\src\main\resources\application.yml | 2 |
请完成以下Java代码 | public String getText()
{
return CityName;
}
@Override
public String toString()
{
// needed for ListCellRenderer
final StringBuilder sb = new StringBuilder();
if (this.CityName != null)
{
sb.append(this.CityName);
}
if (this.RegionName != null)
{
sb.append(" (").append(this.RegionName).append(")");
}
return sb.toString();
}
public int getC_City_ID()
{ | return C_City_ID;
}
public String getCityName()
{
return CityName;
}
public int getC_Region_ID()
{
return C_Region_ID;
}
public String getRegionName()
{
return RegionName;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\org\compiere\grid\ed\CityVO.java | 1 |
请完成以下Java代码 | public Mother getMother() {
return mother;
}
public void setMother(Mother mother) {
this.mother = mother;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Child child = (Child) o;
return Objects.equals(childPK, child.childPK) &&
Objects.equals(father, child.father) &&
Objects.equals(mother, child.mother) &&
Objects.equals(name, child.name); | }
@Override
public int hashCode() {
return Objects.hash(childPK, father, mother, name);
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
} | repos\springboot-demo-master\olingo\src\main\java\com\et\olingo\entity\Child.java | 1 |
请完成以下Java代码 | public class MyDtoWithEnumJsonFormat {
private String stringValue;
private int intValue;
private boolean booleanValue;
private DistanceEnumWithJsonFormat distanceType;
public MyDtoWithEnumJsonFormat() {
super();
}
public MyDtoWithEnumJsonFormat(final String stringValue, final int intValue, final boolean booleanValue, final DistanceEnumWithJsonFormat type) {
super();
this.stringValue = stringValue;
this.intValue = intValue;
this.booleanValue = booleanValue;
this.distanceType = type;
}
// API
public String getStringValue() {
return stringValue;
}
public void setStringValue(final String stringValue) { | this.stringValue = stringValue;
}
public int getIntValue() {
return intValue;
}
public void setIntValue(final int intValue) {
this.intValue = intValue;
}
public boolean isBooleanValue() {
return booleanValue;
}
public void setBooleanValue(final boolean booleanValue) {
this.booleanValue = booleanValue;
}
public DistanceEnumWithJsonFormat getDistanceType() {
return distanceType;
}
public void setDistanceType(final DistanceEnumWithJsonFormat type) {
this.distanceType = type;
}
} | repos\tutorials-master\jackson-modules\jackson-conversions\src\main\java\com\baeldung\jackson\enums\withEnum\MyDtoWithEnumJsonFormat.java | 1 |
请完成以下Java代码 | public class CreateAndDeleteTag {
private static final Logger logger = LoggerFactory.getLogger(CreateAndDeleteTag.class);
public static void main(String[] args) throws IOException, GitAPIException {
// prepare test-repository
try (Repository repository = Helper.openJGitRepository()) {
try (Git git = new Git(repository)) {
// remove the tag before creating it
git.tagDelete().setTags("tag_for_testing").call();
// set it on the current HEAD
Ref tag = git.tag().setName("tag_for_testing").call();
logger.debug("Created/moved tag " + tag + " to repository at " + repository.getDirectory());
// remove the tag again
git.tagDelete().setTags("tag_for_testing").call();
// read some other commit and set the tag on it
ObjectId id = repository.resolve("HEAD^");
try (RevWalk walk = new RevWalk(repository)) { | RevCommit commit = walk.parseCommit(id);
tag = git.tag().setObjectId(commit).setName("tag_for_testing").call();
logger.debug("Created/moved tag " + tag + " to repository at " + repository.getDirectory());
// remove the tag again
git.tagDelete().setTags("tag_for_testing").call();
// create an annotated tag
tag = git.tag().setName("tag_for_testing").setAnnotated(true).call();
logger.debug("Created/moved tag " + tag + " to repository at " + repository.getDirectory());
// remove the tag again
git.tagDelete().setTags("tag_for_testing").call();
walk.dispose();
}
}
}
}
} | repos\tutorials-master\jgit\src\main\java\com\baeldung\jgit\porcelain\CreateAndDeleteTag.java | 1 |
请完成以下Java代码 | public class NotificationRequestStats {
private final Map<NotificationDeliveryMethod, AtomicInteger> sent;
@JsonIgnore
private final AtomicInteger totalSent;
private final Map<NotificationDeliveryMethod, Map<String, String>> errors;
private final AtomicInteger totalErrors;
private String error;
@JsonIgnore
private final Map<NotificationDeliveryMethod, Set<Object>> processedRecipients;
public NotificationRequestStats() {
this.sent = new ConcurrentHashMap<>();
this.totalSent = new AtomicInteger();
this.errors = new ConcurrentHashMap<>();
this.totalErrors = new AtomicInteger();
this.processedRecipients = new ConcurrentHashMap<>();
}
@JsonCreator
public NotificationRequestStats(@JsonProperty("sent") Map<NotificationDeliveryMethod, AtomicInteger> sent,
@JsonProperty("errors") Map<NotificationDeliveryMethod, Map<String, String>> errors,
@JsonProperty("totalErrors") Integer totalErrors,
@JsonProperty("error") String error) {
this.sent = sent;
this.totalSent = null;
this.errors = errors;
if (totalErrors == null) {
if (errors != null) {
totalErrors = errors.values().stream().mapToInt(Map::size).sum();
} else {
totalErrors = 0;
}
}
this.totalErrors = new AtomicInteger(totalErrors);
this.error = error;
this.processedRecipients = Collections.emptyMap();
}
public void reportSent(NotificationDeliveryMethod deliveryMethod, NotificationRecipient recipient) {
sent.computeIfAbsent(deliveryMethod, k -> new AtomicInteger()).incrementAndGet();
totalSent.incrementAndGet();
} | public void reportError(NotificationDeliveryMethod deliveryMethod, Throwable error, NotificationRecipient recipient) {
if (error instanceof AlreadySentException) {
return;
}
String errorMessage = error.getMessage();
if (errorMessage == null) {
errorMessage = error.getClass().getSimpleName();
}
Map<String, String> errors = this.errors.computeIfAbsent(deliveryMethod, k -> new ConcurrentHashMap<>());
if (errors.size() < 100) {
errors.put(recipient.getTitle(), errorMessage);
}
totalErrors.incrementAndGet();
}
public void reportProcessed(NotificationDeliveryMethod deliveryMethod, Object recipientId) {
processedRecipients.computeIfAbsent(deliveryMethod, k -> ConcurrentHashMap.newKeySet()).add(recipientId);
}
public boolean contains(NotificationDeliveryMethod deliveryMethod, Object recipientId) {
Set<Object> processedRecipients = this.processedRecipients.get(deliveryMethod);
return processedRecipients != null && processedRecipients.contains(recipientId);
}
} | repos\thingsboard-master\common\data\src\main\java\org\thingsboard\server\common\data\notification\NotificationRequestStats.java | 1 |
请完成以下Java代码 | private ResolveHUResponse.ResolveHUResponseBuilder newResponse()
{
return ResolveHUResponse.builder()
.scannedCode(scannedCode);
}
private ResolveHUResponse resolveByEAN13(@NonNull final EAN13 ean13)
{
for (final InventoryLine line : lines)
{
final ProductId lineProductId = line.getProductId();
if (!productService.isValidEAN13Product(ean13, lineProductId))
{
continue;
}
return newResponse()
.lineId(line.getIdNonNull())
.locatorId(line.getLocatorId())
.huId(null)
.productId(lineProductId)
.qtyBooked(Quantitys.zero(lineProductId))
.attributes(getDefaultAttributes())
.build();
}
throw new AdempiereException("No line found for the given HU QR code");
}
private Attributes getDefaultAttributes()
{ | return Attributes.ofList(
ATTRIBUTE_CODES.stream()
.map(this::getDefaultAttribute)
.filter(Objects::nonNull)
.collect(ImmutableList.toImmutableList())
);
}
@Nullable
private Attribute getDefaultAttribute(@NonNull AttributeCode attributeCode)
{
return Attribute.of(productService.getAttribute(attributeCode));
}
@NonNull
private InventoryLine findFirstMatchingLine(final Predicate<InventoryLine> predicate)
{
return lines.stream()
.filter(predicate)
.findFirst()
.orElseThrow(() -> new AdempiereException("No line found for the given HU QR code"));
}
private boolean isLineMatchingHU(final InventoryLine line, final I_M_HU hu)
{
return !line.isCounted()
&& LocatorId.equals(line.getLocatorId(), huCache.getLocatorId(hu))
&& huCache.getProductIds(hu).contains(line.getProductId());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.inventory.mobileui\src\main\java\de\metas\inventory\mobileui\job\qrcode\ResolveHUCommand.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public boolean canPay(@NonNull final PayableDocument payable)
{
// A purchase invoice can compensate only on a sales invoice
if (payable.getType() != PayableDocumentType.Invoice)
{
return false;
}
if (!payable.getSoTrx().isSales())
{
return false;
}
// if currency differs, do not allow payment
return CurrencyId.equals(payable.getCurrencyId(), purchaseInvoicePayableDoc.getCurrencyId());
}
@Override
public CurrencyId getCurrencyId()
{
return purchaseInvoicePayableDoc.getCurrencyId();
}
@Override
public LocalDate getDate()
{
return purchaseInvoicePayableDoc.getDate();
} | @Override
public PaymentCurrencyContext getPaymentCurrencyContext()
{
return PaymentCurrencyContext.builder()
.paymentCurrencyId(purchaseInvoicePayableDoc.getCurrencyId())
.currencyConversionTypeId(purchaseInvoicePayableDoc.getCurrencyConversionTypeId())
.build();
}
@Override
public Money getPaymentDiscountAmt()
{
return purchaseInvoicePayableDoc.getAmountsToAllocate().getDiscountAmt();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.base\src\main\java\de\metas\banking\payment\paymentallocation\service\PurchaseInvoiceAsInboundPaymentDocumentWrapper.java | 2 |
请完成以下Java代码 | public class DataQueue {
private final Queue<Message> queue = new LinkedList<>();
private final int maxSize;
private final Object IS_NOT_FULL = new Object();
private final Object IS_NOT_EMPTY = new Object();
DataQueue(int maxSize) {
this.maxSize = maxSize;
}
public boolean isFull() {
return queue.size() == maxSize;
}
public boolean isEmpty() {
return queue.isEmpty();
}
public void waitIsNotFull() throws InterruptedException {
synchronized (IS_NOT_FULL) {
IS_NOT_FULL.wait();
}
}
public void waitIsNotEmpty() throws InterruptedException {
synchronized (IS_NOT_EMPTY) {
IS_NOT_EMPTY.wait();
}
}
public void add(Message message) { | queue.add(message);
notifyIsNotEmpty();
}
public Message poll() {
Message mess = queue.poll();
notifyIsNotFull();
return mess;
}
public Integer getSize() {
return queue.size();
}
private void notifyIsNotFull() {
synchronized (IS_NOT_FULL) {
IS_NOT_FULL.notify();
}
}
private void notifyIsNotEmpty() {
synchronized (IS_NOT_EMPTY) {
IS_NOT_EMPTY.notify();
}
}
} | repos\tutorials-master\core-java-modules\core-java-concurrency-advanced-7\src\main\java\com\baeldung\producerconsumer\DataQueue.java | 1 |
请完成以下Java代码 | public List<I_M_Material_Balance_Detail> retrieveDetailsForConfigAndDate(final MaterialBalanceConfig config, final Timestamp resetDate)
{
final IQueryBL queryBL = Services.get(IQueryBL.class);
final IQueryBuilder<I_M_Material_Balance_Detail> queryBuilder = queryBL.createQueryBuilder(I_M_Material_Balance_Detail.class)
.filterByClientId()
.addOnlyActiveRecordsFilter();
if (config != null)
{
queryBuilder.addEqualsFilter(I_M_Material_Balance_Detail.COLUMNNAME_M_Material_Balance_Config_ID, config.getRepoId());
}
queryBuilder.addCompareFilter(I_M_Material_Balance_Detail.COLUMNNAME_MovementDate, Operator.LESS, resetDate);
return queryBuilder
.create() | .list();
}
@Override
public void deleteBalanceDetailsForInOut(final I_M_InOut inout)
{
final IQueryBuilder<I_M_Material_Balance_Detail> queryBuilder = createQueryBuilderForInout(inout);
// delete directly all the entries
queryBuilder
.create()
.deleteDirectly();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\inout\api\impl\MaterialBalanceDetailDAO.java | 1 |
请完成以下Java代码 | public String getPostingType ()
{
return (String)get_Value(COLUMNNAME_PostingType);
}
/** Set Serial No.
@param SerNo
Product Serial Number
*/
public void setSerNo (String SerNo)
{
set_ValueNoCheck (COLUMNNAME_SerNo, SerNo);
}
/** Get Serial No.
@return Product Serial Number
*/
public String getSerNo ()
{
return (String)get_Value(COLUMNNAME_SerNo);
}
/** Set Details.
@param TextDetails Details */
public void setTextDetails (String TextDetails)
{
set_ValueNoCheck (COLUMNNAME_TextDetails, TextDetails);
}
/** Get Details.
@return Details */
public String getTextDetails ()
{
return (String)get_Value(COLUMNNAME_TextDetails);
}
/** Set Usable Life - Months.
@param UseLifeMonths
Months of the usable life of the asset
*/
public void setUseLifeMonths (int UseLifeMonths)
{
set_ValueNoCheck (COLUMNNAME_UseLifeMonths, Integer.valueOf(UseLifeMonths));
}
/** Get Usable Life - Months.
@return Months of the usable life of the asset
*/
public int getUseLifeMonths ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_UseLifeMonths);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Usable Life - Years.
@param UseLifeYears
Years of the usable life of the asset
*/
public void setUseLifeYears (int UseLifeYears)
{
set_ValueNoCheck (COLUMNNAME_UseLifeYears, Integer.valueOf(UseLifeYears));
} | /** Get Usable Life - Years.
@return Years of the usable life of the asset
*/
public int getUseLifeYears ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_UseLifeYears);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Use units.
@param UseUnits
Currently used units of the assets
*/
public void setUseUnits (int UseUnits)
{
set_Value (COLUMNNAME_UseUnits, Integer.valueOf(UseUnits));
}
/** Get Use units.
@return Currently used units of the assets
*/
public int getUseUnits ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_UseUnits);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Version No.
@param VersionNo
Version Number
*/
public void setVersionNo (String VersionNo)
{
set_ValueNoCheck (COLUMNNAME_VersionNo, VersionNo);
}
/** Get Version No.
@return Version Number
*/
public String getVersionNo ()
{
return (String)get_Value(COLUMNNAME_VersionNo);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_A_Asset_Change.java | 1 |
请完成以下Java代码 | public void createCatchWeightUOMConversion(@NonNull final I_I_Product importRecord)
{
final UomId fromUomId = UomId.ofRepoIdOrNull(importRecord.getQtyCU_UOM_ID());
if (fromUomId == null)
{
throw new AdempiereException(I_I_Product.COLUMNNAME_QtyCU_UOM_ID + " is mandatory for catch weight products");
}
final UomId toUomId = UomId.ofRepoId(importRecord.getC_UOM_ID());
if (fromUomId.equals(toUomId))
{
return;
}
final ProductId productId = ProductId.ofRepoId(importRecord.getM_Product_ID());
final UOMConversionRate productRate = uomConversionDAO.getProductConversions(productId).getRateIfExists(fromUomId, toUomId).orElse(null);
if (productRate != null)
{
final BigDecimal multiplierRate = extractMultiplierRate(importRecord);
uomConversionDAO.updateUOMConversion(UpdateUOMConversionRequest.builder()
.productId(productId)
.fromUomId(fromUomId)
.toUomId(toUomId)
.fromToMultiplier(multiplierRate != null ? multiplierRate : productRate.getFromToMultiplier())
.catchUOMForProduct(true) // make sure it's the catch UOM
.build());
}
else
{
BigDecimal multiplierRate = extractMultiplierRate(importRecord);
if (multiplierRate == null)
{
multiplierRate = uomConversionDAO.getGenericConversions().getRateIfExists(fromUomId, toUomId)
.map(UOMConversionRate::getFromToMultiplier)
.orElseThrow(() -> new AdempiereException("UOM Conversion rate not set and no generic conversion found for " + fromUomId + " -> " + toUomId + "!")); | }
uomConversionDAO.createUOMConversion(CreateUOMConversionRequest.builder()
.productId(productId)
.fromUomId(fromUomId)
.toUomId(toUomId)
.fromToMultiplier(multiplierRate)
.catchUOMForProduct(true) // make sure it's the catch UOM
.build());
}
}
@Nullable
private static BigDecimal extractMultiplierRate(final @NonNull I_I_Product importRecord)
{
return !InterfaceWrapperHelper.isNull(importRecord, I_I_Product.COLUMNNAME_UOM_MultiplierRate)
? importRecord.getUOM_MultiplierRate()
: null;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\product\impexp\ProductImportHelper.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public boolean matches(CharSequence charSequence, String s) {
String encode = DigestUtils.md5DigestAsHex(charSequence.toString().getBytes());
boolean res = s.equals( encode );
return res;
}
} );
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
http.requestMatchers()
.antMatchers("/oauth/**","/login","/login-error")
.and()
.authorizeRequests()
.antMatchers("/oauth/**").authenticated()
.and()
.formLogin().loginPage( "/login" ).failureUrl( "/login-error" );
}
@Override
@Bean
public AuthenticationManager authenticationManagerBean() throws Exception{
return super.authenticationManager();
}
@Bean
public PasswordEncoder passwordEncoder() { | return new PasswordEncoder() {
@Override
public String encode(CharSequence charSequence) {
return charSequence.toString();
}
@Override
public boolean matches(CharSequence charSequence, String s) {
return Objects.equals(charSequence.toString(),s);
}
};
}
} | repos\SpringBootLearning-master (1)\springboot-security-oauth2\src\main\java\com\gf\config\SecurityConfig.java | 2 |
请完成以下Java代码 | 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 Send dunning letters.
@param SendDunningLetter
Indicates if dunning letters will be sent
*/
public void setSendDunningLetter (boolean SendDunningLetter) | {
set_Value (COLUMNNAME_SendDunningLetter, Boolean.valueOf(SendDunningLetter));
}
/** Get Send dunning letters.
@return Indicates if dunning letters will be sent
*/
public boolean isSendDunningLetter ()
{
Object oo = get_Value(COLUMNNAME_SendDunningLetter);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Dunning.java | 1 |
请完成以下Java代码 | public String toString()
{
return ObjectUtils.toString(this);
}
public IAttributeStorage getAttributes()
{
return huAttributes;
}
public I_M_Locator getM_Locator()
{
return IHandlingUnitsBL.extractLocatorOrNull(hu);
} | public I_C_BPartner getC_BPartner()
{
return IHandlingUnitsBL.extractBPartnerOrNull(hu);
}
public I_C_BPartner_Location getC_BPartner_Location()
{
return IHandlingUnitsBL.extractBPartnerLocationOrNull(hu);
}
public I_M_HU getM_HU()
{
return hu;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\storage\spi\hu\impl\HUStorageRecord_HUPart.java | 1 |
请完成以下Java代码 | public Optional<Account> getProductAccount(@NonNull final AcctSchemaId acctSchemaId, @Nullable final ProductId productId, @NonNull final ProductAcctType acctType)
{
return getProductAccount(acctSchemaId, acctType);
}
@Override
@NonNull
public Optional<Account> getProductCategoryAccount(@NonNull final AcctSchemaId acctSchemaId, @NonNull final ProductCategoryId productCategoryId, @NonNull final ProductAcctType acctType)
{
return getProductAccount(acctSchemaId, acctType);
}
@NonNull
private Optional<Account> getProductAccount(final @NonNull AcctSchemaId acctSchemaId, final @NonNull ProductAcctType acctType)
{
return invoiceAccounts.getElementValueId(acctSchemaId, acctType.getAccountConceptualName(), invoiceAndLineId)
.map(elementValueId -> getOrCreateAccount(elementValueId, acctSchemaId))
.map(id -> Account.of(id, acctType));
}
@Override
@NonNull
public Optional<Account> getBPartnerCustomerAccount(@NonNull final AcctSchemaId acctSchemaId, @NonNull final BPartnerId bpartnerId, @NonNull final BPartnerCustomerAccountType acctType)
{
return Optional.empty();
} | @Override
@NonNull
public Optional<Account> getBPartnerVendorAccount(@NonNull final AcctSchemaId acctSchemaId, @NonNull final BPartnerId bpartnerId, @NonNull final BPartnerVendorAccountType acctType)
{
return Optional.empty();
}
@Override
@NonNull
public Optional<Account> getBPGroupAccount(@NonNull final AcctSchemaId acctSchemaId, @NonNull final BPGroupId bpGroupId, @NonNull final BPartnerGroupAccountType acctType)
{
return Optional.empty();
}
@NonNull
private AccountId getOrCreateAccount(
@NonNull final ElementValueId elementValueId,
@NonNull final AcctSchemaId acctSchemaId)
{
return accountDAO.getOrCreateOutOfTrx(
AccountDimension.builder()
.setAcctSchemaId(acctSchemaId)
.setC_ElementValue_ID(elementValueId.getRepoId())
.setAD_Client_ID(clientId.getRepoId())
.setAD_Org_ID(OrgId.ANY.getRepoId())
.build());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\accounts\InvoiceAccountProviderExtension.java | 1 |
请完成以下Java代码 | public String getCategory() {
return activiti5Deployment.getCategory();
}
@Override
public String getKey() {
return null;
}
@Override
public String getTenantId() {
return activiti5Deployment.getTenantId();
}
@Override
public boolean isNew() {
return ((DeploymentEntity) activiti5Deployment).isNew();
}
@Override
public Map<String, EngineResource> getResources() {
return null;
}
@Override | public String getDerivedFrom() {
return null;
}
@Override
public String getDerivedFromRoot() {
return null;
}
@Override
public String getParentDeploymentId() {
return null;
}
@Override
public String getEngineVersion() {
return Flowable5Util.V5_ENGINE_TAG;
}
public org.activiti.engine.repository.Deployment getRawObject() {
return activiti5Deployment;
}
} | repos\flowable-engine-main\modules\flowable5-compatibility\src\main\java\org\flowable\compatibility\wrapper\Flowable5DeploymentWrapper.java | 1 |
请完成以下Java代码 | public void setPluFileLocalFolder (final @Nullable java.lang.String PluFileLocalFolder)
{
set_Value (COLUMNNAME_PluFileLocalFolder, PluFileLocalFolder);
}
@Override
public java.lang.String getPluFileLocalFolder()
{
return get_ValueAsString(COLUMNNAME_PluFileLocalFolder);
}
@Override
public void setProduct_BaseFolderName (final String Product_BaseFolderName)
{
set_Value (COLUMNNAME_Product_BaseFolderName, Product_BaseFolderName);
}
@Override
public String getProduct_BaseFolderName()
{
return get_ValueAsString(COLUMNNAME_Product_BaseFolderName);
}
@Override
public void setTCP_Host (final String TCP_Host)
{
set_Value (COLUMNNAME_TCP_Host, TCP_Host);
}
@Override | public String getTCP_Host()
{
return get_ValueAsString(COLUMNNAME_TCP_Host);
}
@Override
public void setTCP_PortNumber (final int TCP_PortNumber)
{
set_Value (COLUMNNAME_TCP_PortNumber, TCP_PortNumber);
}
@Override
public int getTCP_PortNumber()
{
return get_ValueAsInt(COLUMNNAME_TCP_PortNumber);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java-gen\de\metas\externalsystem\model\X_ExternalSystem_Config_LeichMehl.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class CanalProperties {
private String ip;
int port;
private String zkServers;//zookeeper 地址
private List<String> destination;//监听instance列表
private List<String> dropEnableTableList;
public CanalProperties() {
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getIp() {
return ip;
}
public void setIp(String ip) { | this.ip = ip;
}
public String getZkServers() {
return zkServers;
}
public void setZkServers(String zkServers) {
this.zkServers = zkServers;
}
public List<String> getDestination() {
return destination;
}
public void setDestination(List<String> destination) {
this.destination = destination;
}
} | repos\spring-boot-leaning-master\2.x_data\3-3 使用 canal 将业务数据从 Mysql 同步到 MongoDB\spring-boot-canal-mongodb\src\main\java\com\neo\canal\config\CanalProperties.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class JsonMoney
{
@NonNull BigDecimal amount;
@NonNull String currencyCode; // ISO 4217, e.g. "EUR"
@Override
public String toString() {return toJson();}
@JsonValue
public String toJson() {return amount + " " + currencyCode;}
@JsonCreator
public static JsonMoney fromJson(@NonNull final String json)
{
try
{
final List<String> parts = Splitter.on(" ") | .trimResults()
.omitEmptyStrings()
.splitToList(json);
return JsonMoney.builder()
.amount(new BigDecimal(parts.get(0)))
.currencyCode(parts.get(1))
.build();
}
catch (final Exception e)
{
throw new RuntimeException("Cannot convert string to JsonMoney: " + json, e);
}
}
} | repos\metasfresh-new_dawn_uat\misc\de-metas-common\de-metas-common-delivery\src\main\java\de\metas\common\delivery\v1\json\JsonMoney.java | 2 |
请完成以下Java代码 | public String getEventType() {
return eventType;
}
public void setEventType(String eventType) {
this.eventType = eventType;
}
public long getSequenceCounter() {
return sequenceCounter;
}
public void setSequenceCounter(long sequenceCounter) {
this.sequenceCounter = sequenceCounter;
}
public Date getRemovalTime() {
return removalTime;
}
public void setRemovalTime(Date removalTime) {
this.removalTime = removalTime;
}
// persistent object implementation ///////////////
public Object getPersistentState() {
// events are immutable
return HistoryEvent.class;
} | // state inspection
public boolean isEventOfType(HistoryEventType type) {
return type.getEventName().equals(eventType);
}
@Override
public String toString() {
return this.getClass().getSimpleName()
+ "[id=" + id
+ ", eventType=" + eventType
+ ", executionId=" + executionId
+ ", processDefinitionId=" + processDefinitionId
+ ", processInstanceId=" + processInstanceId
+ ", rootProcessInstanceId=" + rootProcessInstanceId
+ ", removalTime=" + removalTime
+ "]";
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\history\event\HistoryEvent.java | 1 |
请完成以下Java代码 | public void parsingInput() {
logDebug("004", "Parsing input into DOM document.");
}
public DataFormatException unableToCreateParser(Exception cause) {
return new DataFormatException(exceptionMessage("005", "Unable to create DocumentBuilder"), cause);
}
public DataFormatException unableToParseInput(Exception e) {
return new DataFormatException(exceptionMessage("006", "Unable to parse input into DOM document"), e);
}
public DataFormatException unableToCreateTransformer(Exception cause) {
return new DataFormatException(exceptionMessage("007", "Unable to create a transformer to write element"), cause);
}
public DataFormatException unableToTransformElement(Node element, Exception cause) {
return new DataFormatException(exceptionMessage("008", "Unable to transform element '{}:{}'", element.getNamespaceURI(), element.getNodeName()), cause);
}
public DataFormatException unableToWriteInput(Object parameter, Throwable cause) {
return new DataFormatException(exceptionMessage("009", "Unable to write object '{}' to xml element", parameter.toString()), cause);
} | public DataFormatException unableToDeserialize(Object node, String canonicalClassName, Throwable cause) {
return new DataFormatException(
exceptionMessage("010", "Cannot deserialize '{}...' to java class '{}'", node.toString(), canonicalClassName), cause);
}
public DataFormatException unableToCreateMarshaller(Throwable cause) {
return new DataFormatException(exceptionMessage("011", "Cannot create marshaller"), cause);
}
public DataFormatException unableToCreateContext(Throwable cause) {
return new DataFormatException(exceptionMessage("012", "Cannot create context"), cause);
}
public DataFormatException unableToCreateUnmarshaller(Throwable cause) {
return new DataFormatException(exceptionMessage("013", "Cannot create unmarshaller"), cause);
}
public DataFormatException classNotFound(String classname, ClassNotFoundException cause) {
return new DataFormatException(exceptionMessage("014", "Class {} not found ", classname), cause);
}
} | repos\camunda-bpm-platform-master\clients\java\client\src\main\java\org\camunda\bpm\client\variable\impl\format\xml\DomXmlLogger.java | 1 |
请完成以下Java代码 | public Object getWrappedModel()
{
return orderLine;
}
@Override
public Timestamp getDate()
{
return CoalesceUtil.coalesceSuppliers(
() -> orderLine.getDatePromised(),
() -> orderLine.getC_Order().getDatePromised());
}
@Override
public BigDecimal getQty()
{
return orderLine.getQtyOrdered();
}
@Override
public void setM_PricingSystem_ID(int M_PricingSystem_ID)
{
throw new NotImplementedException();
}
@Override
public void setM_PriceList_ID(int M_PriceList_ID)
{
throw new NotImplementedException();
}
/**
* Sets a private member variable to the given {@code price}.
*/
@Override | public void setPrice(BigDecimal price)
{
this.price = price;
}
/**
*
* @return the value that was set via {@link #setPrice(BigDecimal)}.
*/
public BigDecimal getPrice()
{
return price;
}
public I_M_AttributeSetInstance getM_AttributeSetInstance()
{
return orderLine.getM_AttributeSetInstance();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java\de\metas\procurement\base\order\impl\PMMPricingAware_C_OrderLine.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public HFINI1 getHFINI1() {
return hfini1;
}
/**
* Sets the value of the hfini1 property.
*
* @param value
* allowed object is
* {@link HFINI1 }
*
*/
public void setHFINI1(HFINI1 value) {
this.hfini1 = value;
}
/**
* Gets the value of the hrfad1 property.
*
* @return
* possible object is
* {@link HRFAD1 }
*
*/
public HRFAD1 getHRFAD1() {
return hrfad1;
}
/**
* Sets the value of the hrfad1 property.
*
* @param value
* allowed object is
* {@link HRFAD1 }
*
*/ | public void setHRFAD1(HRFAD1 value) {
this.hrfad1 = value;
}
/**
* Gets the value of the hctad1 property.
*
* @return
* possible object is
* {@link HCTAD1 }
*
*/
public HCTAD1 getHCTAD1() {
return hctad1;
}
/**
* Sets the value of the hctad1 property.
*
* @param value
* allowed object is
* {@link HCTAD1 }
*
*/
public void setHCTAD1(HCTAD1 value) {
this.hctad1 = value;
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_stepcom_desadv\de\metas\edi\esb\jaxb\stepcom\desadv\HADRE1.java | 2 |
请完成以下Java代码 | public static <T> List<List<T>> toChunkV4(List<T> list, int chunkSize) {
if (list == null || list.size() < 2) {
throw new IllegalArgumentException("The list must have at least 1 element");
}
if (chunkSize < 1) {
throw new IllegalArgumentException("Chunk size should be minimum 1");
}
List<List<T>> result = list.stream()
.collect(chunkIt(chunkSize));
return result;
}
public static <T> List<List<T>> toChunkV5(List<T> list, int chunkSize) {
if (list == null || list.size() < 2) {
throw new IllegalArgumentException("The list must have at least 1 element");
}
if (chunkSize < 1) {
throw new IllegalArgumentException("Chunk size should be minimum 1");
}
List<List<T>> result = list.parallelStream()
.collect(chunkIt(chunkSize));
return result;
}
public static <T> List<List<T>> toChunkV6(List<T> list, int chunkSize) { | if (list == null || list.size() < 2) {
throw new IllegalArgumentException("The list must have at least 1 element");
}
if (chunkSize < 1) {
throw new IllegalArgumentException("Chunk size should be minimum 1");
}
List<List<T>> result = Chunk.ofSize(list, chunkSize);
return result;
}
private static <T> Collector<T, List<T>, List<List<T>>> chunkIt(int chunkSize) {
return Collector.of(ArrayList::new, List::add, (x, y) -> {
x.addAll(y);
return x;
}, x -> Chunk.ofSize(x, chunkSize), Collector.Characteristics.UNORDERED
);
}
} | repos\Hibernate-SpringBoot-master\ChunkList\src\main\java\com\app\chunklist\Lists.java | 1 |
请完成以下Java代码 | public int getExternalSystem_Outbound_Endpoint_ID()
{
return get_ValueAsInt(COLUMNNAME_ExternalSystem_Outbound_Endpoint_ID);
}
@Override
public void setExternalSystemValue (final String ExternalSystemValue)
{
set_Value (COLUMNNAME_ExternalSystemValue, ExternalSystemValue);
}
@Override
public String getExternalSystemValue()
{
return get_ValueAsString(COLUMNNAME_ExternalSystemValue);
}
@Override
public void setScriptIdentifier (final String ScriptIdentifier)
{
set_Value (COLUMNNAME_ScriptIdentifier, ScriptIdentifier);
}
@Override
public String getScriptIdentifier()
{
return get_ValueAsString(COLUMNNAME_ScriptIdentifier);
}
@Override
public void setSeqNo (final int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, SeqNo);
}
@Override
public int getSeqNo() | {
return get_ValueAsInt(COLUMNNAME_SeqNo);
}
@Override
public void setWhereClause (final String WhereClause)
{
set_Value (COLUMNNAME_WhereClause, WhereClause);
}
@Override
public String getWhereClause()
{
return get_ValueAsString(COLUMNNAME_WhereClause);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java-gen\de\metas\externalsystem\model\X_ExternalSystem_Config_ScriptedExportConversion.java | 1 |
请完成以下Java代码 | private ImmutableList<SAPGLJournalLine> createTaxLines(
@NonNull final SAPGLJournalLine baseLine,
@NonNull final SAPGLJournalTaxProvider taxProvider,
@NonNull final SAPGLJournalCurrencyConverter currencyConverter)
{
final TaxId taxId = Check.assumeNotNull(baseLine.getTaxId(), "line shall have the tax set: {}", baseLine);
final PostingSign taxPostingSign = baseLine.getPostingSign();
final Account taxAccount = taxProvider.getTaxAccount(taxId, acctSchemaId, taxPostingSign);
final Money taxAmt = taxProvider.calculateTaxAmt(baseLine.getAmount(), taxId, baseLine.isTaxIncluded());
final Money taxAmtAcct = currencyConverter.convertToAcctCurrency(taxAmt, conversionCtx);
final SAPGLJournalLine line = SAPGLJournalLine.builder()
.parentId(baseLine.getIdNotNull())
.line(baseLine.getLine()) // will be updated later
.account(taxAccount)
.postingSign(taxPostingSign)
.amount(taxAmt)
.amountAcct(taxAmtAcct)
.taxId(taxId)
.orgId(baseLine.getOrgId())
.dimension(baseLine.getDimension())
.isTaxIncluded(false) // tax can't be included for generated tax lines
.build();
final ImmutableList.Builder<SAPGLJournalLine> resultBuilder = ImmutableList.builder();
resultBuilder.add(line);
line.getReverseChargeCounterPart(taxProvider, acctSchemaId).ifPresent(resultBuilder::add);
return resultBuilder.build();
}
public void removeLinesIf(final Predicate<SAPGLJournalLine> predicate)
{
lines.removeIf(predicate);
updateTotals();
}
@NonNull
public SAPGLJournalCreateRequest getReversal(@NonNull final Instant reversalDocDate)
{
return SAPGLJournalCreateRequest.builder()
.docTypeId(docTypeId)
.conversionCtx(conversionCtx)
.dateDoc(reversalDocDate)
.acctSchemaId(acctSchemaId)
.postingType(postingType)
.reversalId(id) | .totalAcctDR(getTotalAcctCR())
.totalAcctCR(getTotalAcctDR())
.orgId(orgId)
.dimension(dimension)
.description(description)
.glCategoryId(glCategoryId)
//
.lines(getLines()
.stream()
.map(line -> SAPGLJournalLineCreateRequest.builder()
.postingSign(line.getPostingSign())
.account(line.getAccount())
.postingSign(line.getPostingSign().reverse())
.amount(line.getAmount().toBigDecimal())
.dimension(line.getDimension())
.description(line.getDescription())
.taxId(line.getTaxId())
.determineTaxBaseSAP(line.isDetermineTaxBaseSAP())
.build())
.collect(ImmutableList.toImmutableList()))
.build();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\gljournal_sap\SAPGLJournal.java | 1 |
请完成以下Java代码 | public void setProcessDefinitionKey(String processDefinitionKey) {
this.processDefinitionKey = processDefinitionKey;
}
public void setProcessDefinitionName(String processDefinitionName) {
this.processDefinitionName = processDefinitionName;
}
public void setProcessDefinitionVersion(int processDefinitionVersion) {
this.processDefinitionVersion = processDefinitionVersion;
}
public void setHistoryTimeToLive(Integer historyTimeToLive) {
this.historyTimeToLive = historyTimeToLive;
}
public void setFinishedProcessInstanceCount(long finishedProcessInstanceCount) {
this.finishedProcessInstanceCount = finishedProcessInstanceCount;
}
public void setCleanableProcessInstanceCount(long cleanableProcessInstanceCount) {
this.cleanableProcessInstanceCount = cleanableProcessInstanceCount;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public String getProcessDefinitionKey() {
return processDefinitionKey;
}
public String getProcessDefinitionName() {
return processDefinitionName;
}
public int getProcessDefinitionVersion() {
return processDefinitionVersion;
}
public Integer getHistoryTimeToLive() {
return historyTimeToLive;
}
public Long getFinishedProcessInstanceCount() {
return finishedProcessInstanceCount;
}
public Long getCleanableProcessInstanceCount() {
return cleanableProcessInstanceCount;
}
public String getTenantId() { | return tenantId;
}
protected CleanableHistoricProcessInstanceReport createNewReportQuery(ProcessEngine engine) {
return engine.getHistoryService().createCleanableHistoricProcessInstanceReport();
}
public static List<CleanableHistoricProcessInstanceReportResultDto> convert(List<CleanableHistoricProcessInstanceReportResult> reportResult) {
List<CleanableHistoricProcessInstanceReportResultDto> dtos = new ArrayList<CleanableHistoricProcessInstanceReportResultDto>();
for (CleanableHistoricProcessInstanceReportResult current : reportResult) {
CleanableHistoricProcessInstanceReportResultDto dto = new CleanableHistoricProcessInstanceReportResultDto();
dto.setProcessDefinitionId(current.getProcessDefinitionId());
dto.setProcessDefinitionKey(current.getProcessDefinitionKey());
dto.setProcessDefinitionName(current.getProcessDefinitionName());
dto.setProcessDefinitionVersion(current.getProcessDefinitionVersion());
dto.setHistoryTimeToLive(current.getHistoryTimeToLive());
dto.setFinishedProcessInstanceCount(current.getFinishedProcessInstanceCount());
dto.setCleanableProcessInstanceCount(current.getCleanableProcessInstanceCount());
dto.setTenantId(current.getTenantId());
dtos.add(dto);
}
return dtos;
}
} | repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\history\CleanableHistoricProcessInstanceReportResultDto.java | 1 |
请完成以下Java代码 | public class LegoSet {
private @Id int id;
private String name;
private @Transient Period minimumAge, maximumAge;
/**
* Since Manuals are part of a {@link LegoSet} and only make sense inside a {@link LegoSet} it is considered part of
* the Aggregate.
*/
@Column("HANDBUCH_ID")
private Manual manual;
// You can build multiple models from one LegoSet
@MappedCollection(keyColumn = "NAME")
private final @AccessType(Type.FIELD) @With(AccessLevel.PACKAGE) Map<String, Model> models;
LegoSet() {
this.models = new HashMap<>();
}
// conversion for custom types currently has to be done through getters/setter + marking the underlying property with
// @Transient.
@Column("MIN_AGE")
public int getIntMinimumAge() {
return toInt(this.minimumAge);
}
public void setIntMinimumAge(int years) {
minimumAge = toPeriod(years);
}
@Column("MAX_AGE") | public int getIntMaximumAge() {
return toInt(this.maximumAge);
}
public void setIntMaximumAge(int years) {
maximumAge = toPeriod(years);
}
private static int toInt(Period period) {
return (int) (period == null ? 0 : period.get(ChronoUnit.YEARS));
}
private static Period toPeriod(int years) {
return Period.ofYears(years);
}
public void addModel(String name, String description) {
var model = new Model(name, description);
models.put(name, model);
}
} | repos\spring-data-examples-main\jdbc\basics\src\main\java\example\springdata\jdbc\basics\aggregate\LegoSet.java | 1 |
请完成以下Java代码 | public void setAD_ReportView_Col_ID (int AD_ReportView_Col_ID)
{
if (AD_ReportView_Col_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_ReportView_Col_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_ReportView_Col_ID, Integer.valueOf(AD_ReportView_Col_ID));
}
/** Get Report view Column.
@return Report view Column */
public int getAD_ReportView_Col_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_ReportView_Col_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_AD_ReportView getAD_ReportView() throws RuntimeException
{
return (I_AD_ReportView)MTable.get(getCtx(), I_AD_ReportView.Table_Name)
.getPO(getAD_ReportView_ID(), get_TrxName()); }
/** Set Report View.
@param AD_ReportView_ID
View used to generate this report
*/
public void setAD_ReportView_ID (int AD_ReportView_ID)
{
if (AD_ReportView_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_ReportView_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_ReportView_ID, Integer.valueOf(AD_ReportView_ID));
}
/** Get Report View.
@return View used to generate this report
*/
public int getAD_ReportView_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_ReportView_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_ReportView_ID()));
}
/** Set Function Column.
@param FunctionColumn
Overwrite Column with Function
*/
public void setFunctionColumn (String FunctionColumn)
{
set_Value (COLUMNNAME_FunctionColumn, FunctionColumn);
}
/** Get Function Column.
@return Overwrite Column with Function | */
public String getFunctionColumn ()
{
return (String)get_Value(COLUMNNAME_FunctionColumn);
}
/** Set SQL Group Function.
@param IsGroupFunction
This function will generate a Group By Clause
*/
public void setIsGroupFunction (boolean IsGroupFunction)
{
set_Value (COLUMNNAME_IsGroupFunction, Boolean.valueOf(IsGroupFunction));
}
/** Get SQL Group Function.
@return This function will generate a Group By Clause
*/
public boolean isGroupFunction ()
{
Object oo = get_Value(COLUMNNAME_IsGroupFunction);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_ReportView_Col.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public boolean isEmpty() {
return this.loaders.isEmpty();
}
@Override
public boolean containsKey(Object key) {
return this.loaders.containsKey(key);
}
@Override
public Set<K> keySet() {
return this.loaders.keySet();
}
@Override
public V get(Object key) {
if (!this.loaders.containsKey(key)) {
throw new IllegalArgumentException(
"This map only supports the following keys: " + this.loaders.keySet());
}
return this.loaded.computeIfAbsent((K) key, (k) -> this.loaders.get(k).get());
}
@Override
public V put(K key, V value) {
if (!this.loaders.containsKey(key)) {
throw new IllegalArgumentException(
"This map only supports the following keys: " + this.loaders.keySet());
}
return this.loaded.put(key, value);
}
@Override
public V remove(Object key) {
if (!this.loaders.containsKey(key)) {
throw new IllegalArgumentException(
"This map only supports the following keys: " + this.loaders.keySet());
}
return this.loaded.remove(key);
}
@Override
public void putAll(Map<? extends K, ? extends V> m) {
for (Map.Entry<? extends K, ? extends V> entry : m.entrySet()) {
put(entry.getKey(), entry.getValue());
}
}
@Override
public void clear() {
this.loaded.clear();
}
@Override
public boolean containsValue(Object value) {
return this.loaded.containsValue(value);
}
@Override
public Collection<V> values() { | return this.loaded.values();
}
@Override
public Set<Entry<K, V>> entrySet() {
return this.loaded.entrySet();
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
LoadingMap<?, ?> that = (LoadingMap<?, ?>) o;
return this.loaded.equals(that.loaded);
}
@Override
public int hashCode() {
return this.loaded.hashCode();
}
}
} | repos\spring-security-main\config\src\main\java\org\springframework\security\config\annotation\web\configuration\SecurityReactorContextConfiguration.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public void deleteByOperatorId(Long operatorId) {
super.getSessionTemplate().delete(getStatement("deleteByOperatorId"), operatorId);
}
/**
* 根据角色ID删除操作员与角色的关联关系.
*
* @param roleId
* .
*/
public void deleteByRoleId(Long roleId) {
super.getSessionTemplate().delete(getStatement("deleteByRoleId"), roleId);
}
/**
* 根据角色ID和操作员ID删除关联数据(用于更新操作员的角色). | *
* @param roleId
* 角色ID.
* @param operatorId
* 操作员ID.
*/
@Override
public void deleteByRoleIdAndOperatorId(Long roleId, Long operatorId) {
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("roleId", roleId);
paramMap.put("operatorId", operatorId);
super.getSessionTemplate().delete(getStatement("deleteByRoleIdAndOperatorId"), paramMap);
}
} | repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\permission\dao\impl\PmsOperatorRoleDaoImpl.java | 2 |
请完成以下Java代码 | public Integer getId() {
return id;
}
public Category setId(Integer id) {
this.id = id;
return this;
}
public String getName() {
return name;
}
public Category setName(String name) {
this.name = name; | return this;
}
}
public List<Category> getCategories() {
return categories;
}
public ProductConditionBO setCategories(List<Category> categories) {
this.categories = categories;
return this;
}
} | repos\SpringBoot-Labs-master\lab-15-spring-data-es\lab-15-spring-data-elasticsearch\src\main\java\cn\iocoder\springboot\lab15\springdataelasticsearch\bo\ProductConditionBO.java | 1 |
请完成以下Java代码 | public class OutputSetImpl extends BaseElementImpl implements OutputSet {
protected static Attribute<String> nameAttribute;
protected static ElementReferenceCollection<DataOutput, DataOutputRefs> dataOutputRefsCollection;
protected static ElementReferenceCollection<DataOutput, OptionalOutputRefs> optionalOutputRefsCollection;
protected static ElementReferenceCollection<DataOutput, WhileExecutingOutputRefs> whileExecutingOutputRefsCollection;
protected static ElementReferenceCollection<InputSet, InputSetRefs> inputSetInputSetRefsCollection;
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(OutputSet.class, BPMN_ELEMENT_OUTPUT_SET)
.namespaceUri(BPMN20_NS)
.extendsType(BaseElement.class)
.instanceProvider(new ModelTypeInstanceProvider<OutputSet>() {
public OutputSet newInstance(ModelTypeInstanceContext instanceContext) {
return new OutputSetImpl(instanceContext);
}
});
nameAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_NAME)
.build();
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
dataOutputRefsCollection = sequenceBuilder.elementCollection(DataOutputRefs.class)
.idElementReferenceCollection(DataOutput.class)
.build();
optionalOutputRefsCollection = sequenceBuilder.elementCollection(OptionalOutputRefs.class)
.idElementReferenceCollection(DataOutput.class)
.build();
whileExecutingOutputRefsCollection = sequenceBuilder.elementCollection(WhileExecutingOutputRefs.class)
.idElementReferenceCollection(DataOutput.class)
.build();
inputSetInputSetRefsCollection = sequenceBuilder.elementCollection(InputSetRefs.class)
.idElementReferenceCollection(InputSet.class)
.build();
typeBuilder.build();
} | public OutputSetImpl(ModelTypeInstanceContext instanceContext) {
super(instanceContext);
}
public String getName() {
return nameAttribute.getValue(this);
}
public void setName(String name) {
nameAttribute.setValue(this, name);
}
public Collection<DataOutput> getDataOutputRefs() {
return dataOutputRefsCollection.getReferenceTargetElements(this);
}
public Collection<DataOutput> getOptionalOutputRefs() {
return optionalOutputRefsCollection.getReferenceTargetElements(this);
}
public Collection<DataOutput> getWhileExecutingOutputRefs() {
return whileExecutingOutputRefsCollection.getReferenceTargetElements(this);
}
public Collection<InputSet> getInputSetRefs() {
return inputSetInputSetRefsCollection.getReferenceTargetElements(this);
}
} | repos\camunda-bpm-platform-master\model-api\bpmn-model\src\main\java\org\camunda\bpm\model\bpmn\impl\instance\OutputSetImpl.java | 1 |
请完成以下Java代码 | public int hashCode() {
return this.lowerCaseAlphaNumeric.hashCode();
}
/**
* Return a lower-case version of the endpoint ID.
* @return the lower-case endpoint ID
*/
public String toLowerCaseString() {
return this.lowerCaseValue;
}
@Override
public String toString() {
return this.value;
}
/**
* Factory method to create a new {@link EndpointId} of the specified value.
* @param value the endpoint ID value
* @return an {@link EndpointId} instance
*/
public static EndpointId of(String value) {
return new EndpointId(value);
}
/**
* Factory method to create a new {@link EndpointId} of the specified value. This
* variant will respect the {@code management.endpoints.migrate-legacy-names} property
* if it has been set in the {@link Environment}.
* @param environment the Spring environment
* @param value the endpoint ID value
* @return an {@link EndpointId} instance
* @since 2.2.0 | */
public static EndpointId of(Environment environment, String value) {
Assert.notNull(environment, "'environment' must not be null");
return new EndpointId(migrateLegacyId(environment, value));
}
private static String migrateLegacyId(Environment environment, String value) {
if (environment.getProperty(MIGRATE_LEGACY_NAMES_PROPERTY, Boolean.class, false)) {
return value.replaceAll("[-.]+", "");
}
return value;
}
/**
* Factory method to create a new {@link EndpointId} from a property value. More
* lenient than {@link #of(String)} to allow for common "relaxed" property variants.
* @param value the property value to convert
* @return an {@link EndpointId} instance
*/
public static EndpointId fromPropertyValue(String value) {
return new EndpointId(value.replace("-", ""));
}
static void resetLoggedWarnings() {
loggedWarnings.clear();
}
private static void logWarning(String value) {
if (logger.isWarnEnabled() && loggedWarnings.add(value)) {
logger.warn("Endpoint ID '" + value + "' contains invalid characters, please migrate to a valid format.");
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-actuator\src\main\java\org\springframework\boot\actuate\endpoint\EndpointId.java | 1 |
请完成以下Java代码 | public final void bindFieldAndLabel(final JPanel panel,
final JComponent field, final String fieldConstraints,
final JLabel label, final String labelConstraints,
final String columnName)
{
final Properties ctx = Env.getCtx();
final String labelText = Services.get(IMsgBL.class).translate(ctx, columnName);
label.setText(labelText);
label.setHorizontalAlignment(SwingConstants.RIGHT);
panel.add(label, labelConstraints);
panel.add(field, fieldConstraints);
}
@Override
public final VLookup getVLookup(final int windowNo,
final int tabNo,
final int displayType,
final String tableName,
final String columnName,
final boolean mandatory,
final boolean autocomplete)
{
final Properties ctx = Env.getCtx();
final I_AD_Column column = Services.get(IADTableDAO.class).retrieveColumn(tableName, columnName);
final Lookup lookup = MLookupFactory.newInstance().get(ctx, windowNo, tabNo, column.getAD_Column_ID(), displayType);
lookup.setMandatory(mandatory);
final VLookup lookupField = new VLookup(columnName,
mandatory, // mandatory
false, // isReadOnly
true, // isUpdateable
lookup);
if (autocomplete)
{
lookupField.enableLookupAutocomplete();
}
//
// For firing validation rules
lookupField.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(final ActionEvent e)
{
final Object value = lookupField.getValue();
Env.setContext(ctx, windowNo, columnName, value == null ? "" : value.toString());
}
});
return lookupField;
}
@Override
public final VNumber getVNumber(final String columnName, final boolean mandatory)
{
final Properties ctx = Env.getCtx();
final String title = Services.get(IMsgBL.class).translate(ctx, columnName);
return new VNumber(columnName,
mandatory,
false, // isReadOnly
true, // isUpdateable
DisplayType.Number, // displayType
title); | }
@Override
public final void disposeDialogForColumnData(final int windowNo, final JDialog dialog, final List<String> columnNames)
{
if (columnNames == null || columnNames.isEmpty())
{
return;
}
final StringBuilder missingColumnsBuilder = new StringBuilder();
final Iterator<String> columnNamesIt = columnNames.iterator();
while (columnNamesIt.hasNext())
{
final String columnName = columnNamesIt.next();
missingColumnsBuilder.append("@").append(columnName).append("@");
if (columnNamesIt.hasNext())
{
missingColumnsBuilder.append(", ");
}
}
final Exception ex = new AdempiereException("@NotFound@ " + missingColumnsBuilder.toString());
ADialog.error(windowNo, dialog.getContentPane(), ex.getLocalizedMessage());
dialog.dispose();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\org\compiere\grid\ed\api\impl\SwingEditorFactory.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public final void registerStompEndpoints(StompEndpointRegistry registry) {
if (registry instanceof WebMvcStompEndpointRegistry) {
WebMvcStompEndpointRegistry mvcRegistry = (WebMvcStompEndpointRegistry) registry;
configureStompEndpoints(new SessionStompEndpointRegistry(mvcRegistry, sessionRepositoryInterceptor()));
}
}
/**
* Register STOMP endpoints mapping each to a specific URL and (optionally) enabling
* and configuring SockJS fallback options with a
* {@link SessionRepositoryMessageInterceptor} automatically added as an interceptor.
* @param registry the {@link StompEndpointRegistry} which automatically has a
* {@link SessionRepositoryMessageInterceptor} added to it.
*/
protected abstract void configureStompEndpoints(StompEndpointRegistry registry);
@Override
public void configureWebSocketTransport(WebSocketTransportRegistration registration) {
registration.addDecoratorFactory(wsConnectHandlerDecoratorFactory());
}
@Bean
public static WebSocketRegistryListener webSocketRegistryListener() {
return new WebSocketRegistryListener();
}
@Bean
public WebSocketConnectHandlerDecoratorFactory wsConnectHandlerDecoratorFactory() {
return new WebSocketConnectHandlerDecoratorFactory(this.eventPublisher);
}
@Bean
@SuppressWarnings("unchecked")
public SessionRepositoryMessageInterceptor<S> sessionRepositoryInterceptor() {
return new SessionRepositoryMessageInterceptor<>(this.sessionRepository);
}
/**
* A {@link StompEndpointRegistry} that applies {@link HandshakeInterceptor}.
*/
static class SessionStompEndpointRegistry implements StompEndpointRegistry {
private final WebMvcStompEndpointRegistry registry;
private final HandshakeInterceptor interceptor;
SessionStompEndpointRegistry(WebMvcStompEndpointRegistry registry, HandshakeInterceptor interceptor) {
this.registry = registry;
this.interceptor = interceptor;
}
@Override
public StompWebSocketEndpointRegistration addEndpoint(String... paths) {
StompWebSocketEndpointRegistration endpoints = this.registry.addEndpoint(paths);
endpoints.addInterceptors(this.interceptor); | return endpoints;
}
@Override
public void setOrder(int order) {
this.registry.setOrder(order);
}
@Override
public void setUrlPathHelper(UrlPathHelper urlPathHelper) {
this.registry.setUrlPathHelper(urlPathHelper);
}
@Override
public WebMvcStompEndpointRegistry setErrorHandler(StompSubProtocolErrorHandler errorHandler) {
return this.registry.setErrorHandler(errorHandler);
}
@Override
public WebMvcStompEndpointRegistry setPreserveReceiveOrder(boolean preserveReceiveOrder) {
return this.registry.setPreserveReceiveOrder(preserveReceiveOrder);
}
}
} | repos\spring-session-main\spring-session-core\src\main\java\org\springframework\session\web\socket\config\annotation\AbstractSessionWebSocketMessageBrokerConfigurer.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class SqlDataSource implements ReportDataSource
{
@Override
public Map<String, Object> createJRParameters(@NonNull final ReportContext reportContext)
{
return ImmutableMap.of();
}
@Override
public Optional<Connection> createDBConnection(
@NonNull final ReportContext reportContext,
@Nullable final String troubleshooting_reportPath)
{
Connection conn = null;
try
{
final String sqlQueryInfo = buildSqlQueryInfo(reportContext, troubleshooting_reportPath);
final String securityWhereClause = getSecurityWhereClause(reportContext);
conn = DB.getConnectionRW();
return Optional.of(new JasperJdbcConnection(conn, sqlQueryInfo, securityWhereClause));
}
catch (final Error | RuntimeException ex)
{
DB.close(conn);
throw ex;
}
} | @NonNull
private static String buildSqlQueryInfo(final @NonNull ReportContext reportContext, final @Nullable String troubleshooting_reportPath)
{
return "jasper main report=" + troubleshooting_reportPath
+ ", AD_PInstance_ID=" + reportContext.getPinstanceId();
}
@Nullable
private static String getSecurityWhereClause(final @NonNull ReportContext reportContext)
{
final String securityWhereClause;
if (reportContext.isApplySecuritySettings())
{
final IUserRolePermissions userRolePermissions = reportContext.getUserRolePermissions();
final String tableName = reportContext.getTableNameOrNull();
securityWhereClause = userRolePermissions.getOrgWhere(tableName, Access.READ).orElse(null);
}
else
{
securityWhereClause = null;
}
return securityWhereClause;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.report\metasfresh-report-service\src\main\java\de\metas\report\jasper\data_source\SqlDataSource.java | 2 |
请完成以下Java代码 | public ErrorItemBuilder adIssueId(final AdIssueId adIssueId)
{
innerBuilder.adIssueId(adIssueId);
return this;
}
public PurchaseErrorItem buildAndAdd()
{
final PurchaseErrorItem newItem = innerBuilder.build();
parent.purchaseErrorItems.add(newItem);
return newItem;
}
}
public ErrorItemBuilder createErrorItem()
{
return new ErrorItemBuilder(this);
}
public static final class OrderItemBuilder
{
private final PurchaseCandidate parent;
private final PurchaseOrderItemBuilder innerBuilder;
private OrderItemBuilder(@NonNull final PurchaseCandidate parent)
{
this.parent = parent;
innerBuilder = PurchaseOrderItem.builder().purchaseCandidate(parent);
}
public OrderItemBuilder datePromised(@NonNull final ZonedDateTime datePromised)
{
innerBuilder.datePromised(datePromised);
return this;
}
public OrderItemBuilder dateOrdered(@Nullable final ZonedDateTime dateOrdered)
{
innerBuilder.dateOrdered(dateOrdered);
return this;
}
public OrderItemBuilder purchasedQty(@NonNull final Quantity purchasedQty)
{
innerBuilder.purchasedQty(purchasedQty);
return this;
}
public OrderItemBuilder remotePurchaseOrderId(final String remotePurchaseOrderId)
{
innerBuilder.remotePurchaseOrderId(remotePurchaseOrderId);
return this;
}
public OrderItemBuilder transactionReference(final ITableRecordReference transactionReference)
{
innerBuilder.transactionReference(transactionReference);
return this;
}
public OrderItemBuilder dimension(final Dimension dimension)
{
innerBuilder.dimension(dimension);
return this;
}
public PurchaseOrderItem buildAndAddToParent()
{ | final PurchaseOrderItem newItem = innerBuilder.build();
parent.purchaseOrderItems.add(newItem);
return newItem;
}
}
public OrderItemBuilder createOrderItem()
{
return new OrderItemBuilder(this);
}
/**
* Intended to be used by the persistence layer
*/
public void addLoadedPurchaseOrderItem(@NonNull final PurchaseOrderItem purchaseOrderItem)
{
final PurchaseCandidateId id = getId();
Check.assumeNotNull(id, "purchase candidate shall be saved: {}", this);
Check.assumeEquals(id, purchaseOrderItem.getPurchaseCandidateId(),
"The given purchaseOrderItem's purchaseCandidateId needs to be equal to this instance's id; purchaseOrderItem={}; this={}",
purchaseOrderItem, this);
purchaseOrderItems.add(purchaseOrderItem);
}
public Quantity getPurchasedQty()
{
return purchaseOrderItems.stream()
.map(PurchaseOrderItem::getPurchasedQty)
.reduce(Quantity::add)
.orElseGet(() -> getQtyToPurchase().toZero());
}
public List<PurchaseOrderItem> getPurchaseOrderItems()
{
return ImmutableList.copyOf(purchaseOrderItems);
}
public List<PurchaseErrorItem> getPurchaseErrorItems()
{
return ImmutableList.copyOf(purchaseErrorItems);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.purchasecandidate.base\src\main\java\de\metas\purchasecandidate\PurchaseCandidate.java | 1 |
请完成以下Java代码 | protected void postProcess(final boolean success)
{
invalidateView();
}
private PricingConditionsRowChangeRequest createChangeRequest(@NonNull final PricingConditionsRow templateRow)
{
final PricingConditionsBreak templatePricingConditionsBreak = templateRow.getPricingConditionsBreak();
PriceSpecification price = templatePricingConditionsBreak.getPriceSpecification();
if (price.isNoPrice())
{
// In case row does not have a price then use BPartner's pricing system
final BPartnerId bpartnerId = templateRow.getBpartnerId();
final SOTrx soTrx = SOTrx.ofBoolean(templateRow.isCustomer());
price = createBasePricingSystemPrice(bpartnerId, soTrx);
}
final Percent discount = templatePricingConditionsBreak.getDiscount();
final PaymentTermId paymentTermIdOrNull = templatePricingConditionsBreak.getPaymentTermIdOrNull();
final Percent paymentDiscountOverrideOrNull = templatePricingConditionsBreak.getPaymentDiscountOverrideOrNull();
return PricingConditionsRowChangeRequest.builder()
.priceChange(CompletePriceChange.of(price))
.discount(discount)
.paymentTermId(Optional.ofNullable(paymentTermIdOrNull)) | .paymentDiscount(Optional.ofNullable(paymentDiscountOverrideOrNull))
.sourcePricingConditionsBreakId(templatePricingConditionsBreak.getId())
.build();
}
private PriceSpecification createBasePricingSystemPrice(final BPartnerId bpartnerId, final SOTrx soTrx)
{
final PricingSystemId pricingSystemId = bpartnersRepo.retrievePricingSystemIdOrNull(bpartnerId, soTrx);
if (pricingSystemId == null)
{
return PriceSpecification.none();
}
return PriceSpecification.basePricingSystem(pricingSystemId);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\order\pricingconditions\process\PricingConditionsView_CopyRowToEditable.java | 1 |
请完成以下Java代码 | private String addPaginationModel(int page, Model model, Page<Owner> paginated) {
List<Owner> listOwners = paginated.getContent();
model.addAttribute("currentPage", page);
model.addAttribute("totalPages", paginated.getTotalPages());
model.addAttribute("totalItems", paginated.getTotalElements());
model.addAttribute("listOwners", listOwners);
return "owners/ownersList";
}
private Page<Owner> findPaginatedForOwnersLastName(int page, String lastname) {
int pageSize = 5;
Pageable pageable = PageRequest.of(page - 1, pageSize);
return owners.findByLastNameStartingWith(lastname, pageable);
}
@GetMapping("/owners/{ownerId}/edit")
public String initUpdateOwnerForm() {
return VIEWS_OWNER_CREATE_OR_UPDATE_FORM;
}
@PostMapping("/owners/{ownerId}/edit")
public String processUpdateOwnerForm(@Valid Owner owner, BindingResult result, @PathVariable("ownerId") int ownerId,
RedirectAttributes redirectAttributes) {
if (result.hasErrors()) {
redirectAttributes.addFlashAttribute("error", "There was an error in updating the owner.");
return VIEWS_OWNER_CREATE_OR_UPDATE_FORM;
} | if (!Objects.equals(owner.getId(), ownerId)) {
result.rejectValue("id", "mismatch", "The owner ID in the form does not match the URL.");
redirectAttributes.addFlashAttribute("error", "Owner ID mismatch. Please try again.");
return "redirect:/owners/{ownerId}/edit";
}
owner.setId(ownerId);
this.owners.save(owner);
redirectAttributes.addFlashAttribute("message", "Owner Values Updated");
return "redirect:/owners/{ownerId}";
}
/**
* Custom handler for displaying an owner.
* @param ownerId the ID of the owner to display
* @return a ModelMap with the model attributes for the view
*/
@GetMapping("/owners/{ownerId}")
public ModelAndView showOwner(@PathVariable("ownerId") int ownerId) {
ModelAndView mav = new ModelAndView("owners/ownerDetails");
Optional<Owner> optionalOwner = this.owners.findById(ownerId);
Owner owner = optionalOwner.orElseThrow(() -> new IllegalArgumentException(
"Owner not found with id: " + ownerId + ". Please ensure the ID is correct "));
mav.addObject(owner);
return mav;
}
} | repos\spring-petclinic-main\src\main\java\org\springframework\samples\petclinic\owner\OwnerController.java | 1 |
请完成以下Java代码 | public String getAuthUserId() {
return authUserId;
}
public void setAuthUserId(String authUserId) {
this.authUserId = authUserId;
}
public List<String> getAuthGroupIds() {
return authGroupIds;
}
public void setAuthGroupIds(List<String> authGroupIds) {
this.authGroupIds = authGroupIds;
}
public int getAuthDefaultPerm() {
return authDefaultPerm;
}
public void setAuthDefaultPerm(int authDefaultPerm) {
this.authDefaultPerm = authDefaultPerm;
}
// authorization check parameters
public CompositePermissionCheck getPermissionChecks() {
return permissionChecks;
}
public void setAtomicPermissionChecks(List<PermissionCheck> permissionChecks) {
this.permissionChecks.setAtomicChecks(permissionChecks);
}
public void addAtomicPermissionCheck(PermissionCheck permissionCheck) {
permissionChecks.addAtomicCheck(permissionCheck);
}
public void setPermissionChecks(CompositePermissionCheck permissionChecks) {
this.permissionChecks = permissionChecks; | }
public boolean isRevokeAuthorizationCheckEnabled() {
return isRevokeAuthorizationCheckEnabled;
}
public void setRevokeAuthorizationCheckEnabled(boolean isRevokeAuthorizationCheckEnabled) {
this.isRevokeAuthorizationCheckEnabled = isRevokeAuthorizationCheckEnabled;
}
public void setHistoricInstancePermissionsEnabled(boolean historicInstancePermissionsEnabled) {
this.historicInstancePermissionsEnabled = historicInstancePermissionsEnabled;
}
/**
* Used in SQL mapping
*/
public boolean isHistoricInstancePermissionsEnabled() {
return historicInstancePermissionsEnabled;
}
public boolean isUseLeftJoin() {
return useLeftJoin;
}
public void setUseLeftJoin(boolean useLeftJoin) {
this.useLeftJoin = useLeftJoin;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\db\AuthorizationCheck.java | 1 |
请完成以下Java代码 | public static AppsAction createAppsAction(final APanel parent, final boolean small)
{
AGridColumnsToggle app = new AGridColumnsToggle(parent, small);
return app.action;
}
private AGridColumnsToggle(final APanel parent, final boolean small)
{
super();
Check.assumeNotNull(parent, "parent not null");
this.parent = parent;
initAction(small);
}
private void initAction(final boolean small)
{
this.action = AppsAction.builder()
.setAction(ACTION_Name)
.setSmallSize(small)
.build();
action.setDelegate(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
showPopup();
}
});
}
private CColumnControlButton getCColumnControlButton()
{ | final GridController currentGridController = this.parent.getCurrentGridController();
if (currentGridController == null)
{
return null;
}
final VTable table = currentGridController.getVTable();
if (table == null)
{
return null;
}
final CColumnControlButton columnControlButton = table.getColumnControl();
return columnControlButton;
}
public void showPopup()
{
final CColumnControlButton columnControlButton = getCColumnControlButton();
if (columnControlButton == null)
{
return;
}
final AbstractButton button = action.getButton();
columnControlButton.togglePopup(button);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\org\compiere\apps\AGridColumnsToggle.java | 1 |
请完成以下Java代码 | public String getHelp ()
{
return (String)get_Value(COLUMNNAME_Help);
}
/** Set Knowledge Category.
@param K_Category_ID
Knowledge Category
*/
public void setK_Category_ID (int K_Category_ID)
{
if (K_Category_ID < 1)
set_ValueNoCheck (COLUMNNAME_K_Category_ID, null);
else
set_ValueNoCheck (COLUMNNAME_K_Category_ID, Integer.valueOf(K_Category_ID));
}
/** Get Knowledge Category.
@return Knowledge Category
*/
public int getK_Category_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_K_Category_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Name. | @param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_K_Category.java | 1 |
请完成以下Java代码 | public class RetourenavisAnfragen {
@XmlElement(namespace = "")
protected String clientSoftwareKennung;
@XmlElement(namespace = "")
protected RetourenavisAnfrageType retourenavisAnfrageType;
/**
* Gets the value of the clientSoftwareKennung property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getClientSoftwareKennung() {
return clientSoftwareKennung;
}
/**
* Sets the value of the clientSoftwareKennung property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setClientSoftwareKennung(String value) {
this.clientSoftwareKennung = value;
}
/**
* Gets the value of the retourenavisAnfrageType property.
*
* @return
* possible object is
* {@link RetourenavisAnfrageType }
* | */
public RetourenavisAnfrageType getRetourenavisAnfrageType() {
return retourenavisAnfrageType;
}
/**
* Sets the value of the retourenavisAnfrageType property.
*
* @param value
* allowed object is
* {@link RetourenavisAnfrageType }
*
*/
public void setRetourenavisAnfrageType(RetourenavisAnfrageType value) {
this.retourenavisAnfrageType = value;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.msv3.schema.v2\src\main\java-xjc\de\metas\vertical\pharma\vendor\gateway\msv3\schema\v2\RetourenavisAnfragen.java | 1 |
请完成以下Java代码 | protected String doIt()
{
assertDraftPaySelection();
final BPartnerId bpartnerId = getBPartnerIdFromSelectedLines();
openViewForBPartner(bpartnerId);
return MSG_OK;
}
private void assertDraftPaySelection()
{
final PaySelectionId paySelectionId = getPaySelectionId();
final DocStatus docStatus = getDocStatus(paySelectionId);
if (!docStatus.isDraftedOrInProgress())
{
throw new AdempiereException("Invalid doc status");
}
}
@NonNull
private PaySelectionId getPaySelectionId()
{
return PaySelectionId.ofRepoId(getRecord_ID());
}
private BPartnerId getBPartnerIdFromSelectedLines()
{
final PaySelectionId paySelectionId = getPaySelectionId();
final ImmutableSet<PaySelectionLineId> paySelectionLineIds = getSelectedIncludedRecordIds(I_C_PaySelectionLine.class, repoId -> PaySelectionLineId.ofRepoId(paySelectionId, repoId));
final ImmutableSet<BPartnerId> bpartnerIds = paySelectionBL.getBPartnerIdsFromPaySelectionLineIds(paySelectionLineIds);
if (bpartnerIds.isEmpty())
{
throw new AdempiereException("No BPartners");
}
else if (bpartnerIds.size() != 1)
{
throw new AdempiereException("More than one BPartner selected"); | }
else
{
return bpartnerIds.iterator().next();
}
}
private void openViewForBPartner(final BPartnerId bpartnerId)
{
final ViewId viewId = viewsFactory.createView(
CreateViewRequest.builder(PaymentsViewFactory.WINDOW_ID)
.setParameter(PaymentsViewFactory.PARAMETER_TYPE_BPARTNER_ID, bpartnerId)
.build())
.getViewId();
getResult().setWebuiViewToOpen(WebuiViewToOpen.modalOverlay(viewId.getViewId()));
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\payment_allocation\process\PaymentView_Launcher_From_PaySelection.java | 1 |
请完成以下Java代码 | public final IModelMethodInfo getMethodInfo(final Method method)
{
modelMethodInfosLock.lock();
try
{
final Map<Method, IModelMethodInfo> methodInfos = getMethodInfos0();
IModelMethodInfo methodInfo = methodInfos.get(method);
//
// If methodInfo was not found, try to create it now
if (methodInfo == null)
{
methodInfo = introspector.createModelMethodInfo(method);
if (methodInfo == null)
{
throw new IllegalStateException("No method info was found for " + method + " in " + this);
}
methodInfos.put(method, methodInfo);
}
return methodInfo;
}
finally
{
modelMethodInfosLock.unlock();
}
}
/**
* Gets the inner map of {@link Method} to {@link IModelMethodInfo}.
*
* NOTE: this method is not thread safe
*
* @return
*/
private final Map<Method, IModelMethodInfo> getMethodInfos0()
{
if (_modelMethodInfos == null)
{
_modelMethodInfos = introspector.createModelMethodInfos(getModelClass());
}
return _modelMethodInfos;
}
@Override
public synchronized final Set<String> getDefinedColumnNames()
{
if (_definedColumnNames == null)
{
_definedColumnNames = findDefinedColumnNames();
}
return _definedColumnNames;
} | @SuppressWarnings("unchecked")
private final Set<String> findDefinedColumnNames()
{
//
// Collect all columnnames
final ImmutableSet.Builder<String> columnNamesBuilder = ImmutableSet.builder();
ReflectionUtils.getAllFields(modelClass, new Predicate<Field>()
{
@Override
public boolean apply(final Field field)
{
final String fieldName = field.getName();
if (fieldName.startsWith("COLUMNNAME_"))
{
final String columnName = fieldName.substring("COLUMNNAME_".length());
columnNamesBuilder.add(columnName);
}
return false;
}
});
return columnNamesBuilder.build();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\persistence\ModelClassInfo.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public Saml2ResponseValidatorResult concat(Saml2ResponseValidatorResult result) {
Assert.notNull(result, "result cannot be null");
Collection<Saml2Error> errors = new ArrayList<>(this.errors);
errors.addAll(result.getErrors());
return failure(errors);
}
/**
* Construct a successful {@link Saml2ResponseValidatorResult}
* @return an {@link Saml2ResponseValidatorResult} with no errors
*/
public static Saml2ResponseValidatorResult success() {
return NO_ERRORS;
}
/**
* Construct a failure {@link Saml2ResponseValidatorResult} with the provided detail
* @param errors the list of errors
* @return an {@link Saml2ResponseValidatorResult} with the errors specified | */
public static Saml2ResponseValidatorResult failure(Saml2Error... errors) {
return failure(Arrays.asList(errors));
}
/**
* Construct a failure {@link Saml2ResponseValidatorResult} with the provided detail
* @param errors the list of errors
* @return an {@link Saml2ResponseValidatorResult} with the errors specified
*/
public static Saml2ResponseValidatorResult failure(Collection<Saml2Error> errors) {
if (errors.isEmpty()) {
return NO_ERRORS;
}
return new Saml2ResponseValidatorResult(errors);
}
} | repos\spring-security-main\saml2\saml2-service-provider\src\main\java\org\springframework\security\saml2\core\Saml2ResponseValidatorResult.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
}
/**
* Gets the value of the code property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCode() {
return code;
}
/**
* Sets the value of the code property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCode(String value) {
this.code = value;
}
/**
* Gets the value of the description property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDescription() {
return description;
}
/**
* Sets the value of the description property.
* | * @param value
* allowed object is
* {@link String }
*
*/
public void setDescription(String value) {
this.description = value;
}
/**
* Gets the value of the unit property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUnit() {
return unit;
}
/**
* Sets the value of the unit property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUnit(String value) {
this.unit = value;
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\FeatureType.java | 2 |
请完成以下Java代码 | public boolean isAll()
{
return this == All;
}
/**
* @return true if it has System flag set
*/
public boolean isSystem()
{
return (accesses & SystemOnly.accesses) > 0;
}
/**
* @return true if it has only the System flag set (i.e. it's {@value #SystemOnly})
*/
public boolean isSystemOnly()
{
return this == SystemOnly;
}
/**
* @return true if it has Client flag set
*/
public boolean isClient()
{
return (accesses & ClientOnly.accesses) > 0;
}
/**
* @return true if it has only the Client flag set (i.e. it's {@value #ClientOnly})
*/
public boolean isClientOnly()
{
return this == ClientOnly;
}
/**
* @return true if it has Organization flag set
*/
public boolean isOrganization()
{
return (accesses & Organization.accesses) > 0;
}
/**
* @return true if it has only the Organization flag set (i.e. it's {@value #Organization})
*/
public boolean isOrganizationOnly()
{
return this == Organization;
}
/** | * @return user friendly AD_Message of this access level.
*/
public String getAD_Message()
{
return adMessage;
}
/**
* Gets user friendly description of enabled flags.
*
* e.g. "3 - Client - Org"
*
* @return user friendly description of enabled flags
*/
public String getDescription()
{
final StringBuilder accessLevelInfo = new StringBuilder();
accessLevelInfo.append(getAccessLevelString());
if (isSystem())
{
accessLevelInfo.append(" - System");
}
if (isClient())
{
accessLevelInfo.append(" - Client");
}
if (isOrganization())
{
accessLevelInfo.append(" - Org");
}
return accessLevelInfo.toString();
}
// --------------------------------------
// Pre-indexed values for optimization
private static ImmutableMap<Integer, TableAccessLevel> accessLevelInt2accessLevel;
static
{
final ImmutableMap.Builder<Integer, TableAccessLevel> builder = new ImmutableMap.Builder<Integer, TableAccessLevel>();
for (final TableAccessLevel l : values())
{
builder.put(l.getAccessLevelInt(), l);
}
accessLevelInt2accessLevel = builder.build();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\security\TableAccessLevel.java | 1 |
请完成以下Java代码 | public Integer getPicCount() {
return picCount;
}
public void setPicCount(Integer picCount) {
this.picCount = picCount;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
} | @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", name=").append(name);
sb.append(", coverPic=").append(coverPic);
sb.append(", picCount=").append(picCount);
sb.append(", sort=").append(sort);
sb.append(", description=").append(description);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\PmsAlbum.java | 1 |
请完成以下Java代码 | public class LaneSetImpl extends BaseElementImpl implements LaneSet {
protected static Attribute<String> nameAttribute;
protected static ChildElementCollection<Lane> laneCollection;
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(LaneSet.class, BPMN_ELEMENT_LANE_SET)
.namespaceUri(BPMN20_NS)
.extendsType(BaseElement.class)
.instanceProvider(new ModelTypeInstanceProvider<LaneSet>() {
public LaneSet newInstance(ModelTypeInstanceContext instanceContext) {
return new LaneSetImpl(instanceContext);
}
});
nameAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_NAME)
.build();
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
laneCollection = sequenceBuilder.elementCollection(Lane.class) | .build();
typeBuilder.build();
}
public LaneSetImpl(ModelTypeInstanceContext instanceContext) {
super(instanceContext);
}
public String getName() {
return nameAttribute.getValue(this);
}
public void setName(String name) {
nameAttribute.setValue(this, name);
}
public Collection<Lane> getLanes() {
return laneCollection.get(this);
}
} | repos\camunda-bpm-platform-master\model-api\bpmn-model\src\main\java\org\camunda\bpm\model\bpmn\impl\instance\LaneSetImpl.java | 1 |
请完成以下Java代码 | public class ResourceEntityManagerImpl extends AbstractEntityManager<ResourceEntity> implements ResourceEntityManager {
protected ResourceDataManager resourceDataManager;
public ResourceEntityManagerImpl(
ProcessEngineConfigurationImpl processEngineConfiguration,
ResourceDataManager resourceDataManager
) {
super(processEngineConfiguration);
this.resourceDataManager = resourceDataManager;
}
@Override
protected DataManager<ResourceEntity> getDataManager() {
return resourceDataManager;
}
@Override
public void deleteResourcesByDeploymentId(String deploymentId) {
resourceDataManager.deleteResourcesByDeploymentId(deploymentId);
}
@Override
public ResourceEntity findResourceByDeploymentIdAndResourceName(String deploymentId, String resourceName) { | return resourceDataManager.findResourceByDeploymentIdAndResourceName(deploymentId, resourceName);
}
@Override
public List<ResourceEntity> findResourcesByDeploymentId(String deploymentId) {
return resourceDataManager.findResourcesByDeploymentId(deploymentId);
}
public ResourceDataManager getResourceDataManager() {
return resourceDataManager;
}
public void setResourceDataManager(ResourceDataManager resourceDataManager) {
this.resourceDataManager = resourceDataManager;
}
} | repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\persistence\entity\ResourceEntityManagerImpl.java | 1 |
请完成以下Java代码 | public final class NullStatelessTicketCache implements StatelessTicketCache {
/**
* @return null since we are not storing any tickets.
*/
@Override
public @Nullable CasAuthenticationToken getByTicketId(final String serviceTicket) {
return null;
}
/**
* This is a no-op since we are not storing tickets.
*/
@Override
public void putTicketInCache(final CasAuthenticationToken token) {
// nothing to do
}
/**
* This is a no-op since we are not storing tickets. | */
@Override
public void removeTicketFromCache(final CasAuthenticationToken token) {
// nothing to do
}
/**
* This is a no-op since we are not storing tickets.
*/
@Override
public void removeTicketFromCache(final String serviceTicket) {
// nothing to do
}
} | repos\spring-security-main\cas\src\main\java\org\springframework\security\cas\authentication\NullStatelessTicketCache.java | 1 |
请完成以下Java代码 | public void setAuthor(String author) {
this.author = author;
}
public String getBlurb() {
return blurb;
}
public void setBlurb(String blurb) {
this.blurb = blurb;
}
public int getPages() {
return pages;
} | public void setPages(int pages) {
this.pages = pages;
}
@Override
public String toString() {
return "Book{" +
"id=" + id +
", title='" + title + '\'' +
", author='" + author + '\'' +
", blurb='" + blurb + '\'' +
", pages=" + pages +
'}';
}
} | repos\tutorials-master\persistence-modules\spring-data-rest-2\src\main\java\com\baeldung\halbrowser\model\Book.java | 1 |
请完成以下Java代码 | protected CmmnElement convert(XMLStreamReader xtr, ConversionHelper conversionHelper) {
Stage stage = new Stage();
stage.setName(xtr.getAttributeValue(null, CmmnXmlConstants.ATTRIBUTE_NAME));
stage.setAutoComplete(Boolean.valueOf(xtr.getAttributeValue(null, CmmnXmlConstants.ATTRIBUTE_IS_AUTO_COMPLETE)));
stage.setAutoCompleteCondition(xtr.getAttributeValue(CmmnXmlConstants.FLOWABLE_EXTENSIONS_NAMESPACE, CmmnXmlConstants.ATTRIBUTE_AUTO_COMPLETE_CONDITION));
String displayOrderString = xtr.getAttributeValue(CmmnXmlConstants.FLOWABLE_EXTENSIONS_NAMESPACE, CmmnXmlConstants.ATTRIBUTE_DISPLAY_ORDER);
if (StringUtils.isNotEmpty(displayOrderString)) {
stage.setDisplayOrder(Integer.valueOf(displayOrderString));
}
String includeInStageOverviewString = xtr.getAttributeValue(CmmnXmlConstants.FLOWABLE_EXTENSIONS_NAMESPACE, CmmnXmlConstants.ATTRIBUTE_INCLUDE_IN_STAGE_OVERVIEW);
if (StringUtils.isNotEmpty(includeInStageOverviewString)) {
stage.setIncludeInStageOverview(includeInStageOverviewString);
} else {
stage.setIncludeInStageOverview("true"); // True by default
}
stage.setCase(conversionHelper.getCurrentCase());
stage.setParent(conversionHelper.getCurrentPlanFragment()); | conversionHelper.setCurrentStage(stage);
conversionHelper.addStage(stage);
String businessStatus = xtr.getAttributeValue(CmmnXmlConstants.FLOWABLE_EXTENSIONS_NAMESPACE, CmmnXmlConstants.ATTRIBUTE_BUSINESS_STATUS);
if (StringUtils.isNotEmpty(businessStatus)) {
stage.setBusinessStatus(businessStatus);
}
return stage;
}
@Override
protected void elementEnd(XMLStreamReader xtr, ConversionHelper conversionHelper) {
super.elementEnd(xtr, conversionHelper);
conversionHelper.removeCurrentStage();
}
} | repos\flowable-engine-main\modules\flowable-cmmn-converter\src\main\java\org\flowable\cmmn\converter\StageXmlConverter.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public List<User> getAllUsers() {
logger.info("获取所有用户列表");
return userMapper.selectList(null);
}
/**
* 创建用户,同时使用新的返回值的替换缓存中的值
* 创建用户后会将allUsersCache缓存全部清空
*/
@Caching(
put = {@CachePut(value = "userCache", key = "#user.id")},
evict = {@CacheEvict(value = "allUsersCache", allEntries = true)}
)
public User createUser(User user) {
logger.info("创建用户start..., user.id=" + user.getId());
userMapper.insert(user);
return user;
}
/**
* 更新用户,同时使用新的返回值的替换缓存中的值
* 更新用户后会将allUsersCache缓存全部清空
*/
@Caching(
put = {@CachePut(value = "userCache", key = "#user.id")},
evict = {@CacheEvict(value = "allUsersCache", allEntries = true)}
)
public User updateUser(User user) {
logger.info("更新用户start..."); | userMapper.updateById(user);
return user;
}
/**
* 对符合key条件的记录从缓存中移除
* 删除用户后会将allUsersCache缓存全部清空
*/
@Caching(
evict = {
@CacheEvict(value = "userCache", key = "#id"),
@CacheEvict(value = "allUsersCache", allEntries = true)
}
)
public void deleteById(int id) {
logger.info("删除用户start...");
userMapper.deleteById(id);
}
} | repos\SpringBootBucket-master\springboot-cache\src\main\java\com\xncoding\trans\service\UserService.java | 2 |
请完成以下Java代码 | public int getShiroRetryExpireTimeRedis() {
return shiroRetryExpireTimeRedis;
}
public void setShiroRetryExpireTimeRedis(int shiroRetryExpireTimeRedis) {
this.shiroRetryExpireTimeRedis = shiroRetryExpireTimeRedis;
}
public int getShiroAuthorizationExpireTimeRedis() {
return shiroAuthorizationExpireTimeRedis;
}
public void setShiroAuthorizationExpireTimeRedis(int shiroAuthorizationExpireTimeRedis) {
this.shiroAuthorizationExpireTimeRedis = shiroAuthorizationExpireTimeRedis;
}
public int getShiroRetryMax() { | return shiroRetryMax;
}
public void setShiroRetryMax(int shiroRetryMax) {
this.shiroRetryMax = shiroRetryMax;
}
public Integer getShiroSessionExpireTimeRedis() {
return shiroSessionExpireTimeRedis;
}
public void setShiroSessionExpireTimeRedis(Integer shiroSessionExpireTimeRedis) {
this.shiroSessionExpireTimeRedis = shiroSessionExpireTimeRedis;
}
} | repos\springBoot-master\springboot-shiro2\src\main\java\cn\abel\rest\shiro\ShiroProperty.java | 1 |
请完成以下Java代码 | public DirContext run() {
try {
return KerberosLdapContextSource.super.getDirContextInstance(environment);
}
catch (NamingException ex) {
suppressedException[0] = ex;
return null;
}
}
});
if (suppressedException[0] != null) {
throw suppressedException[0];
}
return dirContext;
}
/**
* The login configuration to get the serviceSubject from LoginContext
* @param loginConfig the login config
*/
public void setLoginConfig(Configuration loginConfig) { | this.loginConfig = loginConfig;
}
private Subject login() throws AuthenticationException {
try {
LoginContext lc = new LoginContext(KerberosLdapContextSource.class.getSimpleName(), null, null,
this.loginConfig);
lc.login();
return lc.getSubject();
}
catch (LoginException ex) {
AuthenticationException ae = new AuthenticationException(ex.getMessage());
ae.initCause(ex);
throw ae;
}
}
} | repos\spring-security-main\kerberos\kerberos-client\src\main\java\org\springframework\security\kerberos\client\ldap\KerberosLdapContextSource.java | 1 |
请完成以下Java代码 | public abstract class NamedElementImpl extends DmnElementImpl implements NamedElement {
protected static Attribute<String> nameAttribute;
public NamedElementImpl(ModelTypeInstanceContext instanceContext) {
super(instanceContext);
}
public String getName() {
return nameAttribute.getValue(this);
}
public void setName(String name) {
nameAttribute.setValue(this, name);
} | public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(NamedElement.class, DMN_ELEMENT_NAMED_ELEMENT)
.namespaceUri(LATEST_DMN_NS)
.extendsType(DmnElement.class)
.abstractType();
nameAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_NAME)
.required()
.build();
typeBuilder.build();
}
} | repos\camunda-bpm-platform-master\model-api\dmn-model\src\main\java\org\camunda\bpm\model\dmn\impl\instance\NamedElementImpl.java | 1 |
请完成以下Java代码 | private void berEncode(byte type, byte[] src, ByteArrayOutputStream dest) {
int length = src.length;
dest.write(type);
if (length < 128) {
dest.write(length);
}
else if ((length & 0x0000_00FF) == length) {
dest.write((byte) 0x81);
dest.write((byte) (length & 0xFF));
}
else if ((length & 0x0000_FFFF) == length) {
dest.write((byte) 0x82);
dest.write((byte) ((length >> 8) & 0xFF));
dest.write((byte) (length & 0xFF));
}
else if ((length & 0x00FF_FFFF) == length) {
dest.write((byte) 0x83);
dest.write((byte) ((length >> 16) & 0xFF));
dest.write((byte) ((length >> 8) & 0xFF)); | dest.write((byte) (length & 0xFF));
}
else {
dest.write((byte) 0x84);
dest.write((byte) ((length >> 24) & 0xFF));
dest.write((byte) ((length >> 16) & 0xFF));
dest.write((byte) ((length >> 8) & 0xFF));
dest.write((byte) (length & 0xFF));
}
try {
dest.write(src);
}
catch (IOException ex) {
throw new IllegalArgumentException("Failed to BER encode provided value of type: " + type);
}
}
}
} | repos\spring-security-main\ldap\src\main\java\org\springframework\security\ldap\userdetails\LdapUserDetailsManager.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public Map<String, String> getPDFCache() {
return redissonClient.getMapCache(FILE_PREVIEW_PDF_KEY);
}
@Override
public String getPDFCache(String key) {
RMapCache<String, String> convertedList = redissonClient.getMapCache(FILE_PREVIEW_PDF_KEY);
return convertedList.get(key);
}
@Override
public Map<String, List<String>> getImgCache() {
return redissonClient.getMapCache(FILE_PREVIEW_IMGS_KEY);
}
@Override
public List<String> getImgCache(String key) {
RMapCache<String, List<String>> convertedList = redissonClient.getMapCache(FILE_PREVIEW_IMGS_KEY);
return convertedList.get(key);
}
@Override
public Integer getPdfImageCache(String key) {
RMapCache<String, Integer> convertedList = redissonClient.getMapCache(FILE_PREVIEW_PDF_IMGS_KEY);
return convertedList.get(key);
}
@Override
public void putPdfImageCache(String pdfFilePath, int num) {
RMapCache<String, Integer> convertedList = redissonClient.getMapCache(FILE_PREVIEW_PDF_IMGS_KEY);
convertedList.fastPut(pdfFilePath, num);
}
@Override
public Map<String, String> getMediaConvertCache() {
return redissonClient.getMapCache(FILE_PREVIEW_MEDIA_CONVERT_KEY);
}
@Override
public void putMediaConvertCache(String key, String value) {
RMapCache<String, String> convertedList = redissonClient.getMapCache(FILE_PREVIEW_MEDIA_CONVERT_KEY);
convertedList.fastPut(key, value);
}
@Override
public String getMediaConvertCache(String key) { | RMapCache<String, String> convertedList = redissonClient.getMapCache(FILE_PREVIEW_MEDIA_CONVERT_KEY);
return convertedList.get(key);
}
@Override
public void cleanCache() {
cleanPdfCache();
cleanImgCache();
cleanPdfImgCache();
cleanMediaConvertCache();
}
@Override
public void addQueueTask(String url) {
RBlockingQueue<String> queue = redissonClient.getBlockingQueue(TASK_QUEUE_NAME);
queue.addAsync(url);
}
@Override
public String takeQueueTask() throws InterruptedException {
RBlockingQueue<String> queue = redissonClient.getBlockingQueue(TASK_QUEUE_NAME);
return queue.take();
}
private void cleanPdfCache() {
RMapCache<String, String> pdfCache = redissonClient.getMapCache(FILE_PREVIEW_PDF_KEY);
pdfCache.clear();
}
private void cleanImgCache() {
RMapCache<String, List<String>> imgCache = redissonClient.getMapCache(FILE_PREVIEW_IMGS_KEY);
imgCache.clear();
}
private void cleanPdfImgCache() {
RMapCache<String, Integer> pdfImg = redissonClient.getMapCache(FILE_PREVIEW_PDF_IMGS_KEY);
pdfImg.clear();
}
private void cleanMediaConvertCache() {
RMapCache<String, Integer> mediaConvertCache = redissonClient.getMapCache(FILE_PREVIEW_MEDIA_CONVERT_KEY);
mediaConvertCache.clear();
}
} | repos\kkFileView-master\server\src\main\java\cn\keking\service\cache\impl\CacheServiceRedisImpl.java | 2 |
请完成以下Java代码 | private final boolean forwardEventToParentScrollPane(final MouseWheelEvent e)
{
final JScrollPane parent = getParentScrollPane(scrollpane);
if (parent == null)
{
return false;
}
parent.dispatchEvent(cloneEvent(parent, e));
return true;
}
/** @return The parent scroll pane, or null if there is no parent. */
private JScrollPane getParentScrollPane(final JScrollPane scrollPane)
{
if (scrollPane == null)
{
return null;
}
Component parent = scrollPane.getParent();
while (parent != null)
{
if (parent instanceof JScrollPane)
{
return (JScrollPane)parent; | }
parent = parent.getParent();
}
return null;
}
/** @return cloned event */
private final MouseWheelEvent cloneEvent(final JScrollPane scrollPane, final MouseWheelEvent event)
{
return new MouseWheelEvent(scrollPane
, event.getID()
, event.getWhen()
, event.getModifiers()
, event.getX()
, event.getY()
, event.getClickCount()
, event.isPopupTrigger()
, event.getScrollType()
, event.getScrollAmount()
, event.getWheelRotation());
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\plaf\AdempiereScrollPaneUI.java | 1 |
请完成以下Java代码 | private void collectFrom(final DocumentChanges fromDocumentChanges)
{
final DocumentPath documentPath = fromDocumentChanges.getDocumentPath();
documentChanges(documentPath).collectFrom(fromDocumentChanges);
}
@Override
public Set<String> collectFrom(@NonNull final Document document, final ReasonSupplier reason)
{
final DocumentPath documentPath = document.getDocumentPath();
return documentChanges(documentPath)
.collectFrom(document, reason);
}
@Override
public void collectDocumentValidStatusChanged(final DocumentPath documentPath, final DocumentValidStatus documentValidStatus)
{
documentChanges(documentPath)
.collectDocumentValidStatusChanged(documentValidStatus);
}
@Override
public void collectValidStatus(final IDocumentFieldView documentField)
{
documentChanges(documentField)
.collectValidStatusChanged(documentField);
}
@Override
public void collectDocumentSaveStatusChanged(final DocumentPath documentPath, final DocumentSaveStatus documentSaveStatus)
{
documentChanges(documentPath)
.collectDocumentSaveStatusChanged(documentSaveStatus);
}
@Override
public void collectDeleted(final DocumentPath documentPath)
{
documentChanges(documentPath)
.collectDeleted();
}
@Override
public void collectStaleDetailId(final DocumentPath rootDocumentPath, final DetailId detailId)
{
rootDocumentChanges(rootDocumentPath)
.includedDetailInfo(detailId)
.setStale(); | }
@Override
public void collectAllowNew(final DocumentPath rootDocumentPath, final DetailId detailId, final LogicExpressionResult allowNew)
{
rootDocumentChanges(rootDocumentPath)
.includedDetailInfo(detailId)
.setAllowNew(allowNew);
}
@Override
public void collectAllowDelete(final DocumentPath rootDocumentPath, final DetailId detailId, final LogicExpressionResult allowDelete)
{
rootDocumentChanges(rootDocumentPath)
.includedDetailInfo(detailId)
.setAllowDelete(allowDelete);
}
private boolean isStaleDocumentChanges(final DocumentChanges documentChanges)
{
final DocumentPath documentPath = documentChanges.getDocumentPath();
if (!documentPath.isSingleIncludedDocument())
{
return false;
}
final DocumentPath rootDocumentPath = documentPath.getRootDocumentPath();
final DetailId detailId = documentPath.getDetailId();
return documentChangesIfExists(rootDocumentPath)
.flatMap(rootDocumentChanges -> rootDocumentChanges.includedDetailInfoIfExists(detailId))
.map(IncludedDetailInfo::isStale)
.orElse(false);
}
@Override
public void collectEvent(final IDocumentFieldChangedEvent event)
{
documentChanges(event.getDocumentPath())
.collectEvent(event);
}
@Override
public void collectFieldWarning(final IDocumentFieldView documentField, final DocumentFieldWarning fieldWarning)
{
documentChanges(documentField)
.collectFieldWarning(documentField, fieldWarning);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\model\DocumentChangesCollector.java | 1 |
请完成以下Java代码 | public Category id(Long id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
**/
@ApiModelProperty(value = "")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Category name(String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
**/
@ApiModelProperty(value = "")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Category category = (Category) o;
return Objects.equals(this.id, category.id) &&
Objects.equals(this.name, category.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
} | @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Category {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
} | repos\tutorials-master\spring-swagger-codegen-modules\spring-swagger-codegen-api-client\src\main\java\com\baeldung\petstore\client\model\Category.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class IbatisVariableTypeHandler implements TypeHandler<VariableType> {
protected VariableTypes variableTypes;
public IbatisVariableTypeHandler(VariableTypes variableTypes) {
this.variableTypes = variableTypes;
}
@Override
public VariableType getResult(ResultSet rs, String columnName) throws SQLException {
String typeName = rs.getString(columnName);
VariableType type = variableTypes.getVariableType(typeName);
if (type == null && typeName != null) {
throw new FlowableException("unknown variable type name " + typeName);
}
return type;
}
@Override
public VariableType getResult(CallableStatement cs, int columnIndex) throws SQLException {
String typeName = cs.getString(columnIndex);
VariableType type = variableTypes.getVariableType(typeName); | if (type == null) {
throw new FlowableException("unknown variable type name " + typeName);
}
return type;
}
@Override
public void setParameter(PreparedStatement ps, int i, VariableType parameter, JdbcType jdbcType) throws SQLException {
String typeName = parameter.getTypeName();
ps.setString(i, typeName);
}
@Override
public VariableType getResult(ResultSet resultSet, int columnIndex) throws SQLException {
String typeName = resultSet.getString(columnIndex);
VariableType type = variableTypes.getVariableType(typeName);
if (type == null) {
throw new FlowableException("unknown variable type name " + typeName);
}
return type;
}
} | repos\flowable-engine-main\modules\flowable-variable-service\src\main\java\org\flowable\variable\service\impl\db\IbatisVariableTypeHandler.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public void setBIC(String value) {
this.bic = value;
}
/**
*
* International bank account number
*
*
* @return
* possible object is
* {@link String }
*
*/
public String getIBAN() {
return iban;
}
/**
* Sets the value of the iban property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIBAN(String value) {
this.iban = value;
}
/**
*
* Owner of the bank account.
*
*
* @return
* possible object is
* {@link String }
*
*/
public String getBankAccountOwner() {
return bankAccountOwner;
}
/**
* Sets the value of the bankAccountOwner property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBankAccountOwner(String value) {
this.bankAccountOwner = value;
}
/**
*
* The creditor ID of the SEPA direct debit.
*
*
* @return
* possible object is
* {@link String }
*
*/
public String getCreditorID() {
return creditorID;
}
/**
* Sets the value of the creditorID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCreditorID(String value) {
this.creditorID = value;
}
/**
*
* The mandate reference of the SEPA direct debit.
*
*
* @return
* possible object is
* {@link String }
*
*/
public String getMandateReference() {
return mandateReference; | }
/**
* Sets the value of the mandateReference property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMandateReference(String value) {
this.mandateReference = value;
}
/**
*
* The debit collection date.
*
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getDebitCollectionDate() {
return debitCollectionDate;
}
/**
* Sets the value of the debitCollectionDate property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setDebitCollectionDate(XMLGregorianCalendar value) {
this.debitCollectionDate = value;
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\SEPADirectDebitType.java | 2 |
请完成以下Java代码 | protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_M_InOutLineMA[")
.append(get_ID()).append("]");
return sb.toString();
}
public I_M_AttributeSetInstance getM_AttributeSetInstance() throws RuntimeException
{
return (I_M_AttributeSetInstance)MTable.get(getCtx(), I_M_AttributeSetInstance.Table_Name)
.getPO(getM_AttributeSetInstance_ID(), get_TrxName()); }
/** Set Attribute Set Instance.
@param M_AttributeSetInstance_ID
Product Attribute Set Instance
*/
public void setM_AttributeSetInstance_ID (int M_AttributeSetInstance_ID)
{
if (M_AttributeSetInstance_ID < 0)
set_ValueNoCheck (COLUMNNAME_M_AttributeSetInstance_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_AttributeSetInstance_ID, Integer.valueOf(M_AttributeSetInstance_ID));
}
/** Get Attribute Set Instance.
@return Product Attribute Set Instance
*/
public int getM_AttributeSetInstance_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_AttributeSetInstance_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_M_InOutLine getM_InOutLine() throws RuntimeException
{
return (I_M_InOutLine)MTable.get(getCtx(), I_M_InOutLine.Table_Name)
.getPO(getM_InOutLine_ID(), get_TrxName()); }
/** Set Shipment/Receipt Line.
@param M_InOutLine_ID
Line on Shipment or Receipt document
*/
public void setM_InOutLine_ID (int M_InOutLine_ID)
{
if (M_InOutLine_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_InOutLine_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_InOutLine_ID, Integer.valueOf(M_InOutLine_ID));
}
/** Get Shipment/Receipt Line.
@return Line on Shipment or Receipt document
*/
public int getM_InOutLine_ID ()
{ | Integer ii = (Integer)get_Value(COLUMNNAME_M_InOutLine_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(getM_InOutLine_ID()));
}
/** Set Movement Quantity.
@param MovementQty
Quantity of a product moved.
*/
public void setMovementQty (BigDecimal MovementQty)
{
set_Value (COLUMNNAME_MovementQty, MovementQty);
}
/** Get Movement Quantity.
@return Quantity of a product moved.
*/
public BigDecimal getMovementQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_MovementQty);
if (bd == null)
return Env.ZERO;
return bd;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_InOutLineMA.java | 1 |
请完成以下Java代码 | public class AD_EventLog_RepostEvent extends JavaProcess
{
@Override
protected String doIt() throws Exception
{
final I_AD_EventLog eventLogRecord = getRecord(I_AD_EventLog.class);
Check.assumeNotNull(eventLogRecord.getEventTopicName(), "EventTopicName is null");
Check.assumeNotNull(eventLogRecord.getEventTypeName(), "EventTypeName is null");
final Topic topic = Topic.builder()
.name(eventLogRecord.getEventTopicName())
.type(Type.valueOf(eventLogRecord.getEventTypeName()))
.build();
final boolean typeMismatchBetweenTopicAndBus = !Type.valueOf(eventLogRecord.getEventTypeName()).equals(topic.getType());
if (typeMismatchBetweenTopicAndBus) | {
addLog("The given event log record has a different topic than the event bus!");
}
final EventLogId eventLogId = EventLogId.ofRepoId(eventLogRecord.getAD_EventLog_ID());
final EventLogService eventLogService = SpringContextHolder.instance.getBean(EventLogService.class);
final Event event = eventLogService.loadEventForReposting(eventLogId);
final IEventBus eventBus = Services.get(IEventBusFactory.class).getEventBus(topic);
eventBus.enqueueEvent(event);
return MSG_OK;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\event\log\process\AD_EventLog_RepostEvent.java | 1 |
请完成以下Java代码 | public PageData<RuleNodeId> findAllRuleNodeIdsByTypeAndVersionLessThan(String type, int version, PageLink pageLink) {
return DaoUtil.pageToPageData(ruleNodeRepository
.findAllRuleNodeIdsByTypeAndVersionLessThan(
type,
version,
DaoUtil.toPageable(pageLink)))
.mapData(RuleNodeId::new);
}
@Override
public List<RuleNode> findAllRuleNodeByIds(List<RuleNodeId> ruleNodeIds) {
return DaoUtil.convertDataList(ruleNodeRepository.findAllById(
ruleNodeIds.stream().map(RuleNodeId::getId).collect(Collectors.toList())));
}
@Override
public List<RuleNode> findByExternalIds(RuleChainId ruleChainId, List<RuleNodeId> externalIds) { | return DaoUtil.convertDataList(ruleNodeRepository.findRuleNodesByRuleChainIdAndExternalIdIn(ruleChainId.getId(),
externalIds.stream().map(RuleNodeId::getId).collect(Collectors.toList())));
}
@Override
public void deleteByIdIn(List<RuleNodeId> ruleNodeIds) {
ruleNodeRepository.deleteAllById(ruleNodeIds.stream().map(RuleNodeId::getId).collect(Collectors.toList()));
}
@Override
public EntityType getEntityType() {
return EntityType.RULE_NODE;
}
} | repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\sql\rule\JpaRuleNodeDao.java | 1 |
请完成以下Java代码 | public abstract class ReceiptScheduleListenerAdapter implements IReceiptScheduleListener
{
@Override
public void onBeforeClose(final I_M_ReceiptSchedule receiptSchedule)
{
// nothing, this is an adapter; please add any implementation in subclasses!
}
@Override
public void onAfterClose(final I_M_ReceiptSchedule receiptSchedule)
{
// nothing, this is an adapter; please add any implementation in subclasses!
}
@Override
public void onReceiptScheduleAllocReversed(final I_M_ReceiptSchedule_Alloc rsa, final I_M_ReceiptSchedule_Alloc rsaReversal) | {
// nothing, this is an adapter; please add any implementation in subclasses!
}
@Override
public void onBeforeReopen(final I_M_ReceiptSchedule receiptSchedule)
{
// nothing, this is an adapter; please add any implementation in subclasses!
}
@Override
public void onAfterReopen(final I_M_ReceiptSchedule receiptSchedule)
{
// nothing, this is an adapter; please add any implementation in subclasses!
};
} | repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\inoutcandidate\spi\ReceiptScheduleListenerAdapter.java | 1 |
请完成以下Java代码 | public boolean isUseLocalScopeForOutParameters() {
return useLocalScopeForOutParameters;
}
public void setUseLocalScopeForOutParameters(boolean useLocalScopeForOutParameters) {
this.useLocalScopeForOutParameters = useLocalScopeForOutParameters;
}
public boolean isCompleteAsync() {
return completeAsync;
}
public void setCompleteAsync(boolean completeAsync) {
this.completeAsync = completeAsync;
}
public Boolean getFallbackToDefaultTenant() {
return fallbackToDefaultTenant;
}
public void setFallbackToDefaultTenant(Boolean fallbackToDefaultTenant) {
this.fallbackToDefaultTenant = fallbackToDefaultTenant;
}
public void setCalledElementType(String calledElementType) {
this.calledElementType = calledElementType;
}
public String getCalledElementType() {
return calledElementType;
}
public String getProcessInstanceIdVariableName() {
return processInstanceIdVariableName;
}
public void setProcessInstanceIdVariableName(String processInstanceIdVariableName) {
this.processInstanceIdVariableName = processInstanceIdVariableName;
}
@Override
public CallActivity clone() {
CallActivity clone = new CallActivity(); | clone.setValues(this);
return clone;
}
public void setValues(CallActivity otherElement) {
super.setValues(otherElement);
setCalledElement(otherElement.getCalledElement());
setCalledElementType(otherElement.getCalledElementType());
setBusinessKey(otherElement.getBusinessKey());
setInheritBusinessKey(otherElement.isInheritBusinessKey());
setInheritVariables(otherElement.isInheritVariables());
setSameDeployment(otherElement.isSameDeployment());
setUseLocalScopeForOutParameters(otherElement.isUseLocalScopeForOutParameters());
setCompleteAsync(otherElement.isCompleteAsync());
setFallbackToDefaultTenant(otherElement.getFallbackToDefaultTenant());
inParameters = new ArrayList<>();
if (otherElement.getInParameters() != null && !otherElement.getInParameters().isEmpty()) {
for (IOParameter parameter : otherElement.getInParameters()) {
inParameters.add(parameter.clone());
}
}
outParameters = new ArrayList<>();
if (otherElement.getOutParameters() != null && !otherElement.getOutParameters().isEmpty()) {
for (IOParameter parameter : otherElement.getOutParameters()) {
outParameters.add(parameter.clone());
}
}
}
} | repos\flowable-engine-main\modules\flowable-bpmn-model\src\main\java\org\flowable\bpmn\model\CallActivity.java | 1 |
请在Spring Boot框架中完成以下Java代码 | protected boolean isTransactionActive() {
if (handleTransactions && entityManager.getTransaction() != null) {
return entityManager.getTransaction().isActive();
}
return false;
}
@Override
public void close() {
if (closeEntityManager && entityManager != null && entityManager.isOpen()) {
try {
entityManager.close();
} catch (IllegalStateException ise) {
throw new FlowableException("Error while closing EntityManager, may have already been closed or it is container-managed", ise);
}
}
}
@Override
public EntityManager getEntityManager() {
if (entityManager == null) {
entityManager = getEntityManagerFactory().createEntityManager();
if (handleTransactions) {
// Add transaction listeners, if transactions should be handled
TransactionListener jpaTransactionCommitListener = new TransactionListener() {
@Override
public void execute(CommandContext commandContext) {
if (isTransactionActive()) {
entityManager.getTransaction().commit();
}
}
};
TransactionListener jpaTransactionRollbackListener = new TransactionListener() {
@Override | public void execute(CommandContext commandContext) {
if (isTransactionActive()) {
entityManager.getTransaction().rollback();
}
}
};
TransactionContext transactionContext = Context.getTransactionContext();
transactionContext.addTransactionListener(TransactionState.COMMITTED, jpaTransactionCommitListener);
transactionContext.addTransactionListener(TransactionState.ROLLED_BACK, jpaTransactionRollbackListener);
// Also, start a transaction, if one isn't started already
if (!isTransactionActive()) {
entityManager.getTransaction().begin();
}
}
}
return entityManager;
}
private EntityManagerFactory getEntityManagerFactory() {
return entityManagerFactory;
}
} | repos\flowable-engine-main\modules\flowable-variable-service\src\main\java\org\flowable\variable\service\impl\types\EntityManagerSessionImpl.java | 2 |
请完成以下Java代码 | public List<OtherIdentification1> getOthrId() {
if (othrId == null) {
othrId = new ArrayList<OtherIdentification1>();
}
return this.othrId;
}
/**
* Gets the value of the desc property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDesc() { | return desc;
}
/**
* Sets the value of the desc property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDesc(String value) {
this.desc = value;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_04\SecurityIdentification14.java | 1 |
请完成以下Java代码 | public class Lesson {
@PlanningId
private String id;
private String subject;
private String teacher;
private String studentGroup;
@JsonIdentityReference
@PlanningVariable
private Timeslot timeslot;
@JsonIdentityReference
@PlanningVariable
private Room room;
public Lesson() {
}
public Lesson(String id, String subject, String teacher, String studentGroup) {
this.id = id;
this.subject = subject;
this.teacher = teacher;
this.studentGroup = studentGroup;
}
public Lesson(String id, String subject, String teacher, String studentGroup, Timeslot timeslot, Room room) {
this(id, subject, teacher, studentGroup);
this.timeslot = timeslot;
this.room = room;
}
@Override
public String toString() {
return subject + "(" + id + ")";
}
// ************************************************************************ | // Getters and setters
// ************************************************************************
public String getId() {
return id;
}
public String getSubject() {
return subject;
}
public String getTeacher() {
return teacher;
}
public String getStudentGroup() {
return studentGroup;
}
public Timeslot getTimeslot() {
return timeslot;
}
public void setTimeslot(Timeslot timeslot) {
this.timeslot = timeslot;
}
public Room getRoom() {
return room;
}
public void setRoom(Room room) {
this.room = room;
}
} | repos\springboot-demo-master\Timefold Solver\src\main\java\org\acme\schooltimetabling\domain\Lesson.java | 1 |
请完成以下Java代码 | public boolean init(MBankStatementLoader controller)
{
boolean result = false;
FileInputStream m_stream = null;
try
{
// Try to open the file specified as a process parameter
if (controller.getLocalFileName() != null)
{
m_stream = new FileInputStream(controller.getLocalFileName());
}
// Try to open the file specified as part of the loader configuration
else if (controller.getFileName() != null)
{
m_stream = new FileInputStream(controller.getFileName());
}
else
{
return result;
}
if (!super.init(controller))
{
return result;
}
if (m_stream == null)
{
return result;
}
result = attachInput(m_stream);
}
catch(Exception e)
{
m_errorMessage = "ErrorReadingData";
m_errorDescription = "";
}
return result;
} // init
/** | * Method characters
* @param ch char[]
* @param start int
* @param length int
* @throws SAXException
* @see org.xml.sax.ContentHandler#characters(char[], int, int)
*/
public void characters (char ch[], int start, int length)
throws SAXException
{
/*
* There are no additional things to do when importing from file.
* All data is handled by OFXBankStatementHandler
*/
super.characters(ch, start, length);
} // characterS
} // OFXFileBankStatementLoader | repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.base\src\main\java-legacy\org\compiere\impexp\OFXFileBankStatementLoader.java | 1 |
请完成以下Java代码 | public TransactionActivityBehavior createTransactionActivityBehavior(Transaction transaction) {
return new TransactionActivityBehavior();
}
// Intermediate Events
@Override
public IntermediateCatchEventActivityBehavior createIntermediateCatchEventActivityBehavior(IntermediateCatchEvent intermediateCatchEvent) {
return new IntermediateCatchEventActivityBehavior();
}
@Override
public IntermediateThrowNoneEventActivityBehavior createIntermediateThrowNoneEventActivityBehavior(ThrowEvent throwEvent) {
return new IntermediateThrowNoneEventActivityBehavior();
}
@Override
public IntermediateThrowSignalEventActivityBehavior createIntermediateThrowSignalEventActivityBehavior(ThrowEvent throwEvent,
Signal signal, EventSubscriptionDeclaration eventSubscriptionDeclaration) {
return new IntermediateThrowSignalEventActivityBehavior(throwEvent, signal, eventSubscriptionDeclaration);
}
@Override
public IntermediateThrowCompensationEventActivityBehavior createIntermediateThrowCompensationEventActivityBehavior(ThrowEvent throwEvent,
CompensateEventDefinition compensateEventDefinition) {
return new IntermediateThrowCompensationEventActivityBehavior(compensateEventDefinition);
}
// End events
@Override
public NoneEndEventActivityBehavior createNoneEndEventActivityBehavior(EndEvent endEvent) {
return new NoneEndEventActivityBehavior();
}
@Override
public ErrorEndEventActivityBehavior createErrorEndEventActivityBehavior(EndEvent endEvent, ErrorEventDefinition errorEventDefinition) { | return new ErrorEndEventActivityBehavior(errorEventDefinition.getErrorCode());
}
@Override
public CancelEndEventActivityBehavior createCancelEndEventActivityBehavior(EndEvent endEvent) {
return new CancelEndEventActivityBehavior();
}
@Override
public TerminateEndEventActivityBehavior createTerminateEndEventActivityBehavior(EndEvent endEvent) {
return new TerminateEndEventActivityBehavior(endEvent);
}
// Boundary Events
@Override
public BoundaryEventActivityBehavior createBoundaryEventActivityBehavior(BoundaryEvent boundaryEvent, boolean interrupting, ActivityImpl activity) {
return new BoundaryEventActivityBehavior(interrupting, activity.getId());
}
@Override
public CancelBoundaryEventActivityBehavior createCancelBoundaryEventActivityBehavior(CancelEventDefinition cancelEventDefinition) {
return new CancelBoundaryEventActivityBehavior();
}
} | repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\bpmn\parser\factory\DefaultActivityBehaviorFactory.java | 1 |
请完成以下Java代码 | public void actionPerformed(final ActionEvent e)
{
if (e.getActionCommand().equals(ConfirmPanel.A_OK))
{
try
{
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
confirmPanel.getOKButton().setEnabled(false);
//
if (m_isPrintOnOK)
{
m_isPrinted = fMessage.print();
}
}
finally
{
confirmPanel.getOKButton().setEnabled(true);
setCursor(Cursor.getDefaultCursor());
}
// m_isPrinted = true;
m_isPressedOK = true;
dispose();
}
else if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL))
{
dispose();
}
} // actionPerformed
public void setPrintOnOK(final boolean value)
{
m_isPrintOnOK = value;
}
public boolean isPressedOK()
{
return m_isPressedOK; | }
public boolean isPrinted()
{
return m_isPrinted;
}
public File getPDF()
{
return fMessage.getPDF(getTitle());
}
public RichTextEditor getRichTextEditor()
{
return fMessage;
}
} // Letter | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\org\compiere\apps\LetterDialog.java | 1 |
请完成以下Java代码 | public <T extends org.compiere.model.I_AD_User> T getByIdInTrx(final UserId userId, final Class<T> modelClass)
{
return load(userId, modelClass);
}
@Override
@Nullable
public UserId retrieveUserIdByLogin(@NonNull final String login)
{
return queryBL
.createQueryBuilderOutOfTrx(I_AD_User.class)
.addEqualsFilter(org.compiere.model.I_AD_User.COLUMNNAME_Login, login)
.create()
.firstId(UserId::ofRepoIdOrNull);
}
@Override
public void save(@NonNull final org.compiere.model.I_AD_User user)
{
InterfaceWrapperHelper.save(user);
}
@Override
public Optional<I_AD_User> getCounterpartUser(
@NonNull final UserId sourceUserId,
@NonNull final OrgId targetOrgId)
{
final OrgMappingId orgMappingId = getOrgMappingId(sourceUserId).orElse(null);
if (orgMappingId == null)
{
return Optional.empty();
}
final UserId targetUserId = queryBL.createQueryBuilder(I_AD_User.class)
.addEqualsFilter(I_AD_User.COLUMNNAME_AD_Org_Mapping_ID, orgMappingId)
.addEqualsFilter(I_AD_User.COLUMNNAME_AD_Org_ID, targetOrgId)
.orderByDescending(I_AD_User.COLUMNNAME_AD_User_ID) | .create()
.firstId(UserId::ofRepoIdOrNull);
if (targetUserId == null)
{
return Optional.empty();
}
return Optional.of(getById(targetUserId));
}
@Override
public ImmutableSet<UserId> retrieveUsersByJobId(@NonNull final JobId jobId)
{
return queryBL.createQueryBuilder(I_AD_User.class)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_AD_User.COLUMNNAME_C_Job_ID, jobId)
.create()
.idsAsSet(UserId::ofRepoId);
}
private Optional<OrgMappingId> getOrgMappingId(@NonNull final UserId sourceUserId)
{
final I_AD_User sourceUserRecord = getById(sourceUserId);
return OrgMappingId.optionalOfRepoId(sourceUserRecord.getAD_Org_Mapping_ID());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\user\api\impl\UserDAO.java | 1 |
请完成以下Java代码 | public static MetricVo parse(String line) {
String[] strs = line.split("\\|");
long timestamp = Long.parseLong(strs[0]);
String identity = strs[1];
long passQps = Long.parseLong(strs[2]);
long blockQps = Long.parseLong(strs[3]);
long exception = Long.parseLong(strs[4]);
double rt = Double.parseDouble(strs[5]);
long successQps = Long.parseLong(strs[6]);
MetricVo vo = new MetricVo();
vo.timestamp = timestamp;
vo.resource = identity;
vo.passQps = passQps;
vo.blockQps = blockQps;
vo.successQps = successQps;
vo.exceptionQps = exception;
vo.rt = rt;
vo.count = 1;
return vo;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getApp() {
return app;
}
public void setApp(String app) {
this.app = app;
}
public Long getTimestamp() {
return timestamp;
}
public void setTimestamp(Long timestamp) {
this.timestamp = timestamp;
}
public Long getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(Long gmtCreate) {
this.gmtCreate = gmtCreate;
}
public String getResource() {
return resource;
}
public void setResource(String resource) {
this.resource = resource;
}
public Long getPassQps() {
return passQps;
}
public void setPassQps(Long passQps) {
this.passQps = passQps;
}
public Long getBlockQps() {
return blockQps; | }
public void setBlockQps(Long blockQps) {
this.blockQps = blockQps;
}
public Long getSuccessQps() {
return successQps;
}
public void setSuccessQps(Long successQps) {
this.successQps = successQps;
}
public Long getExceptionQps() {
return exceptionQps;
}
public void setExceptionQps(Long exceptionQps) {
this.exceptionQps = exceptionQps;
}
public Double getRt() {
return rt;
}
public void setRt(Double rt) {
this.rt = rt;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
@Override
public int compareTo(MetricVo o) {
return Long.compare(this.timestamp, o.timestamp);
}
} | repos\spring-boot-student-master\spring-boot-student-sentinel-dashboard\src\main\java\com\alibaba\csp\sentinel\dashboard\domain\vo\MetricVo.java | 1 |
请完成以下Java代码 | public void setHelp (String Help)
{
set_Value (COLUMNNAME_Help, Help);
}
/** Get Comment/Help.
@return Comment or Hint
*/
public String getHelp ()
{
return (String)get_Value(COLUMNNAME_Help);
}
public I_M_LotCtl getM_LotCtl() throws RuntimeException
{
return (I_M_LotCtl)MTable.get(getCtx(), I_M_LotCtl.Table_Name)
.getPO(getM_LotCtl_ID(), get_TrxName()); }
/** Set Lot Control.
@param M_LotCtl_ID
Product Lot Control
*/
public void setM_LotCtl_ID (int M_LotCtl_ID)
{
if (M_LotCtl_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_LotCtl_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_LotCtl_ID, Integer.valueOf(M_LotCtl_ID));
}
/** Get Lot Control.
@return Product Lot Control
*/
public int getM_LotCtl_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_LotCtl_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Lot.
@param M_Lot_ID
Product Lot Definition
*/
public void setM_Lot_ID (int M_Lot_ID)
{
if (M_Lot_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Lot_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Lot_ID, Integer.valueOf(M_Lot_ID));
}
/** Get Lot.
@return Product Lot Definition
*/
public int getM_Lot_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Lot_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_M_Product getM_Product() throws RuntimeException
{
return (I_M_Product)MTable.get(getCtx(), I_M_Product.Table_Name)
.getPO(getM_Product_ID(), get_TrxName()); }
/** Set Product.
@param M_Product_ID
Product, Service, Item
*/ | public void setM_Product_ID (int M_Product_ID)
{
if (M_Product_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Product_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID));
}
/** Get Product.
@return Product, Service, Item
*/
public int getM_Product_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), String.valueOf(getM_Product_ID()));
}
/** 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);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Lot.java | 1 |
请完成以下Java代码 | public ResultType createMenu(Menu menu) {
BeanUtil.requireNonNull(menu, "menu is null");
String url = BASE_API_URL;
if (BeanUtil.isNull(menu.getMatchrule())) {
//普通菜单
logger.info("创建普通菜单.....");
url += "cgi-bin/menu/create?access_token=" + apiConfig.getAccessToken();
} else {
//个性化菜单
logger.info("创建个性化菜单.....");
url += "cgi-bin/menu/addconditional?access_token=" + apiConfig.getAccessToken();
}
BaseResponse baseResponse = executePost(url, menu.toJsonString());
return ResultType.get(baseResponse.getErrcode());
} | /**
* 删除所有菜单,包括个性化菜单
*
* @return 调用结果
*/
public ResultType deleteMenu() {
logger.debug("删除菜单.....");
String url = BASE_API_URL + "cgi-bin/menu/delete?access_token=" + apiConfig.getAccessToken();
BaseResponse response = executeGet(url);
return ResultType.get(response.getErrcode());
}
} | repos\spring-boot-quick-master\quick-wx-public\src\main\java\com\wx\pn\api\MenuApi.java | 1 |
请完成以下Spring Boot application配置 | # elasticsearch.yml \u6587\u4EF6\u4E2D\u7684 cluster.name
spring.data.elasticsearch.cluster-name=docker-cluster
# elasticsearch \u8C03\u7528\u5730\u5740\uFF0C\u591A\u4E2A\u4F7F\u7528\u201C,\u201D\u9694\u5F00
spring.data.elasticsearch.cluster-nodes=127.0.0.1:9300
#spring.data.elasticsearch.repositories.enabled=true |
#spring.data.elasticsearch.username=elastic
#spring.data.elasticsearch.password=123456
#spring.data.elasticsearch.network.host=0.0.0.0 | repos\springboot-demo-master\elasticsearch\src\main\resources\application.properties | 2 |
请完成以下Java代码 | protected void registerInterceptors(final IModelValidationEngine engine)
{
//
// Master data
engine.addModelValidator(new org.eevolution.model.validator.PP_Product_BOM(bomVersionsDAO, productBOMService));
engine.addModelValidator(new org.eevolution.model.validator.PP_Product_BOMLine());
engine.addModelValidator(new org.eevolution.model.validator.PP_Product_Planning(bomVersionsDAO, productBOMService));
// PP_Order related
engine.addModelValidator(new org.eevolution.model.validator.PP_Order(
ppOrderConverter,
materialEventService,
documentNoBuilderFactory,
ppOrderBOMBL,
bomVersionsDAO));
engine.addModelValidator(new org.eevolution.model.validator.PP_Order_PostMaterialEvent(ppOrderConverter, materialEventService)); // gh #523
engine.addModelValidator(new org.eevolution.model.validator.PP_Order_BOM());
engine.addModelValidator(new org.eevolution.model.validator.PP_Order_BOMLine(ddOrderCandidateRepository));
engine.addModelValidator(new org.eevolution.model.validator.PP_Order_Node_Product());
engine.addModelValidator(new org.eevolution.model.validator.PP_Cost_Collector());
//
// DRP
engine.addModelValidator(new DDOrderLowLevelInterceptors(ddOrderLowLevelService,
documentNoBuilderFactory,
ddOrderCandidateAllocRepository,
distributionNetworkRepository, | replenishInfoRepository,
materialEventService));
//
// Forecast
engine.addModelValidator(new org.eevolution.model.validator.M_Forecast(ddOrderLowLevelService));
}
@Override
protected void setupCaching(final IModelCacheService cachingService)
{
cachingService.addTableCacheConfigIfAbsent(I_S_Resource.class);
cachingService.addTableCacheConfigIfAbsent(I_S_ResourceType.class);
CacheMgt.get().enableRemoteCacheInvalidationForTableName(I_PP_Order.Table_Name);
}
@Override
public void onUserLogin(
final int AD_Org_ID,
final int AD_Role_ID,
final int AD_User_ID)
{
Env.setContext(Env.getCtx(), CTX_IsLiberoEnabled, true);
}
} // LiberoValidator | repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\model\LiberoValidator.java | 1 |
请完成以下Java代码 | public void delete(final T entity) {
entityManager.remove(entity);
}
public void deleteById(final long entityId) {
final T entity = findOne(entityId);
delete(entity);
}
public long countAllRowsUsingHibernateCriteria() {
Session session = entityManager.unwrap(Session.class);
Criteria criteria = session.createCriteria(clazz);
criteria.setProjection(Projections.rowCount());
Long count = (Long) criteria.uniqueResult();
return count != null ? count : 0L;
}
public long getFooCountByBarNameUsingHibernateCriteria(String barName) {
Session session = entityManager.unwrap(Session.class); | Criteria criteria = session.createCriteria(clazz);
criteria.createAlias("bar", "b");
criteria.add(Restrictions.eq("b.name", barName));
criteria.setProjection(Projections.rowCount());
return (Long) criteria.uniqueResult();
}
public long getFooCountByBarNameAndFooNameUsingHibernateCriteria(String barName, String fooName) {
Session session = entityManager.unwrap(Session.class);
Criteria criteria = session.createCriteria(clazz);
criteria.createAlias("bar", "b");
criteria.add(Restrictions.eq("b.name", barName));
criteria.add(Restrictions.eq("name", fooName));
criteria.setProjection(Projections.rowCount());
return (Long) criteria.uniqueResult();
}
} | repos\tutorials-master\persistence-modules\spring-hibernate-5\src\main\java\com\baeldung\hibernate\cache\dao\AbstractJpaDAO.java | 1 |
请完成以下Java代码 | public void setBalance (BigDecimal Balance)
{
set_ValueNoCheck (COLUMNNAME_Balance, Balance);
}
/** Get Balance.
@return Balance */
public BigDecimal getBalance ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Balance);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Account Date.
@param DateAcct
Accounting Date
*/
public void setDateAcct (Timestamp DateAcct)
{
set_ValueNoCheck (COLUMNNAME_DateAcct, DateAcct);
}
/** Get Account Date.
@return Accounting Date
*/
public Timestamp getDateAcct ()
{
return (Timestamp)get_Value(COLUMNNAME_DateAcct);
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_ValueNoCheck (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
public I_Fact_Acct getFact_Acct() throws RuntimeException
{
return (I_Fact_Acct)MTable.get(getCtx(), I_Fact_Acct.Table_Name)
.getPO(getFact_Acct_ID(), get_TrxName()); }
/** Set Accounting Fact.
@param Fact_Acct_ID Accounting Fact */
public void setFact_Acct_ID (int Fact_Acct_ID)
{
if (Fact_Acct_ID < 1)
set_ValueNoCheck (COLUMNNAME_Fact_Acct_ID, null);
else
set_ValueNoCheck (COLUMNNAME_Fact_Acct_ID, Integer.valueOf(Fact_Acct_ID));
}
/** Get Accounting Fact.
@return Accounting Fact */
public int getFact_Acct_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Fact_Acct_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Level no.
@param LevelNo Level no */
public void setLevelNo (int LevelNo)
{
set_ValueNoCheck (COLUMNNAME_LevelNo, Integer.valueOf(LevelNo));
}
/** Get Level no.
@return Level no */
public int getLevelNo () | {
Integer ii = (Integer)get_Value(COLUMNNAME_LevelNo);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_ValueNoCheck (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 Quantity.
@param Qty
Quantity
*/
public void setQty (BigDecimal Qty)
{
set_ValueNoCheck (COLUMNNAME_Qty, Qty);
}
/** Get Quantity.
@return Quantity
*/
public BigDecimal getQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty);
if (bd == null)
return Env.ZERO;
return bd;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_T_ReportStatement.java | 1 |
请完成以下Java代码 | public CurrencyConversionContext getCurrencyConversionContext(@NonNull final InOutId inoutId)
{
final I_M_InOut inout = inOutDAO.getById(inoutId);
return getCurrencyConversionContext(inout);
}
@Override
public CurrencyConversionContext getCurrencyConversionContext(@NonNull final I_M_InOut inout)
{
final CurrencyConversionContext conversionCtx = currencyBL.createCurrencyConversionContext(
inout.getDateAcct().toInstant(),
(CurrencyConversionTypeId)null,
ClientId.ofRepoId(inout.getAD_Client_ID()),
OrgId.ofRepoId(inout.getAD_Org_ID()));
return conversionCtx;
}
@Override
public Money getCOGSBySalesOrderId(
@NonNull final OrderLineId salesOrderLineId,
@NonNull final AcctSchemaId acctSchemaId)
{
final List<FactAcctQuery> factAcctQueries = getLineIdsByOrderLineIds(ImmutableSet.of(salesOrderLineId))
.stream()
.map(inoutAndLineId -> FactAcctQuery.builder()
.acctSchemaId(acctSchemaId)
.accountConceptualName(AccountConceptualName.ofString(I_M_Product_Acct.COLUMNNAME_P_COGS_Acct))
.tableName(I_M_InOut.Table_Name)
.recordId(inoutAndLineId.getInOutId().getRepoId())
.lineId(inoutAndLineId.getInOutLineId().getRepoId())
.build())
.collect(Collectors.toList());
return factAcctBL.getAcctBalance(factAcctQueries)
.orElseGet(() -> Money.zero(acctSchemaBL.getAcctCurrencyId(acctSchemaId)));
} | @Override
public ImmutableSet<I_M_InOut> getNotVoidedNotReversedForOrderId(@NonNull final OrderId orderId)
{
final InOutQuery query = InOutQuery.builder()
.orderId(orderId)
.excludeDocStatuses(ImmutableSet.of(DocStatus.Voided, DocStatus.Reversed))
.build();
return inOutDAO.retrieveByQuery(query).collect(ImmutableSet.toImmutableSet());
}
@Override
public void setShipperId(@NonNull final I_M_InOut inout)
{
inout.setM_Shipper_ID(ShipperId.toRepoId(findShipperId(inout)));
}
private ShipperId findShipperId(@NonNull final I_M_InOut inout)
{
if (inout.getDropShip_BPartner_ID() > 0 && inout.getDropShip_Location_ID() > 0)
{
final Optional<ShipperId> deliveryAddressShipperId = bpartnerDAO.getShipperIdByBPLocationId(BPartnerLocationId.ofRepoId(inout.getDropShip_BPartner_ID(), inout.getDropShip_Location_ID()));
if (deliveryAddressShipperId.isPresent())
{
return deliveryAddressShipperId.get(); // we are done
}
}
return bpartnerDAO.getShipperId(CoalesceUtil.coalesceSuppliersNotNull(
() -> BPartnerId.ofRepoIdOrNull(inout.getDropShip_BPartner_ID()),
() -> BPartnerId.ofRepoIdOrNull(inout.getC_BPartner_ID())));
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\inout\impl\InOutBL.java | 1 |
请完成以下Java代码 | public String toString()
{
return ObjectUtils.toString(this);
}
@Override
public final boolean isAccountSignDR()
{
return _accountSignDR;
}
@Override
public final boolean isAccountSignCR()
{
return !_accountSignDR;
}
@Override
public int getC_Tax_ID()
{
return isAccountSignDR() ? glJournalLine.getDR_Tax_ID() : glJournalLine.getCR_Tax_ID();
}
@Override
public void setC_Tax(final I_C_Tax tax)
{
final int taxId = tax != null ? tax.getC_Tax_ID() : -1;
if (isAccountSignDR())
{
glJournalLine.setDR_Tax_ID(taxId);
}
else
{
glJournalLine.setCR_Tax_ID(taxId);
}
}
@Override
public I_C_ValidCombination getTax_Acct()
{
return isAccountSignDR() ? glJournalLine.getDR_Tax_Acct() : glJournalLine.getCR_Tax_Acct();
}
@Override
public void setTax_Acct(final I_C_ValidCombination taxAcct)
{
if (isAccountSignDR())
{
glJournalLine.setDR_Tax_Acct(taxAcct);
}
else
{
glJournalLine.setCR_Tax_Acct(taxAcct);
}
}
@Override
public BigDecimal getTaxAmt()
{
return isAccountSignDR() ? glJournalLine.getDR_TaxAmt() : glJournalLine.getCR_TaxAmt();
}
@Override
public void setTaxAmt(final BigDecimal taxAmt)
{
if (isAccountSignDR())
{
glJournalLine.setDR_TaxAmt(taxAmt);
}
else
{
glJournalLine.setCR_TaxAmt(taxAmt);
}
}
@Override
public BigDecimal getTaxBaseAmt()
{ | return isAccountSignDR() ? glJournalLine.getDR_TaxBaseAmt() : glJournalLine.getCR_TaxBaseAmt();
}
@Override
public void setTaxBaseAmt(final BigDecimal taxBaseAmt)
{
if (isAccountSignDR())
{
glJournalLine.setDR_TaxBaseAmt(taxBaseAmt);
}
else
{
glJournalLine.setCR_TaxBaseAmt(taxBaseAmt);
}
}
@Override
public BigDecimal getTaxTotalAmt()
{
return isAccountSignDR() ? glJournalLine.getDR_TaxTotalAmt() : glJournalLine.getCR_TaxTotalAmt();
}
@Override
public void setTaxTotalAmt(final BigDecimal totalAmt)
{
if (isAccountSignDR())
{
glJournalLine.setDR_TaxTotalAmt(totalAmt);
}
else
{
glJournalLine.setCR_TaxTotalAmt(totalAmt);
}
//
// Update AmtSourceDr/Cr
// NOTE: we are updating both sides because they shall be the SAME
glJournalLine.setAmtSourceDr(totalAmt);
glJournalLine.setAmtSourceCr(totalAmt);
}
@Override
public I_C_ValidCombination getTaxBase_Acct()
{
return isAccountSignDR() ? glJournalLine.getAccount_DR() : glJournalLine.getAccount_CR();
}
@Override
public I_C_ValidCombination getTaxTotal_Acct()
{
return isAccountSignDR() ? glJournalLine.getAccount_CR() : glJournalLine.getAccount_DR();
}
@Override
public CurrencyPrecision getPrecision()
{
final CurrencyId currencyId = CurrencyId.ofRepoIdOrNull(glJournalLine.getC_Currency_ID());
return currencyId != null
? Services.get(ICurrencyDAO.class).getStdPrecision(currencyId)
: CurrencyPrecision.TWO;
}
@Override
public AcctSchemaId getAcctSchemaId()
{
return AcctSchemaId.ofRepoId(glJournalLine.getGL_Journal().getC_AcctSchema_ID());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\gljournal\impl\GLJournalLineTaxAccountable.java | 1 |
请完成以下Java代码 | public Mono<ServerHttpRequest> removeMatchingRequest(ServerWebExchange exchange) {
return Mono.just(exchange.getResponse())
.map(ServerHttpResponse::getCookies)
.doOnNext((cookies) -> cookies.add(REDIRECT_URI_COOKIE_NAME,
invalidateRedirectUriCookie(exchange.getRequest())))
.thenReturn(exchange.getRequest());
}
/**
* Sets the {@link Consumer}, allowing customization of cookie.
* @param cookieCustomizer customize for cookie
* @since 6.4
*/
public void setCookieCustomizer(Consumer<ResponseCookie.ResponseCookieBuilder> cookieCustomizer) {
Assert.notNull(cookieCustomizer, "cookieCustomizer cannot be null");
this.cookieCustomizer = cookieCustomizer;
}
private static ResponseCookie.ResponseCookieBuilder createRedirectUriCookieBuilder(ServerHttpRequest request) {
String path = request.getPath().pathWithinApplication().value();
String query = request.getURI().getRawQuery();
String redirectUri = path + ((query != null) ? "?" + query : "");
return createResponseCookieBuilder(request, encodeCookie(redirectUri), COOKIE_MAX_AGE);
}
private static ResponseCookie invalidateRedirectUriCookie(ServerHttpRequest request) {
return createResponseCookieBuilder(request, null, Duration.ZERO).build();
}
private static ResponseCookie.ResponseCookieBuilder createResponseCookieBuilder(ServerHttpRequest request, | @Nullable String cookieValue, Duration age) {
return ResponseCookie.from(REDIRECT_URI_COOKIE_NAME)
.value(cookieValue)
.path(request.getPath().contextPath().value() + "/")
.maxAge(age)
.httpOnly(true)
.secure("https".equalsIgnoreCase(request.getURI().getScheme()))
.sameSite("Lax");
}
private static String encodeCookie(String cookieValue) {
return new String(Base64.getEncoder().encode(cookieValue.getBytes()));
}
private static String decodeCookie(String encodedCookieValue) {
return new String(Base64.getDecoder().decode(encodedCookieValue.getBytes()));
}
private static ServerWebExchangeMatcher createDefaultRequestMatcher() {
ServerWebExchangeMatcher get = ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET, "/**");
ServerWebExchangeMatcher notFavicon = new NegatedServerWebExchangeMatcher(
ServerWebExchangeMatchers.pathMatchers("/favicon.*"));
MediaTypeServerWebExchangeMatcher html = new MediaTypeServerWebExchangeMatcher(MediaType.TEXT_HTML);
html.setIgnoredMediaTypes(Collections.singleton(MediaType.ALL));
return new AndServerWebExchangeMatcher(get, notFavicon, html);
}
} | repos\spring-security-main\web\src\main\java\org\springframework\security\web\server\savedrequest\CookieServerRequestCache.java | 1 |
请完成以下Java代码 | public abstract class AbstractMessageConverter implements MessageConverter {
private boolean createMessageIds = false;
/**
* Flag to indicate that new messages should have unique identifiers added to their properties before sending.
* Default false.
* @param createMessageIds the flag value to set
*/
public void setCreateMessageIds(boolean createMessageIds) {
this.createMessageIds = createMessageIds;
}
/**
* Flag to indicate that new messages should have unique identifiers added to their properties before sending.
* @return the flag value
*/
protected boolean isCreateMessageIds() {
return this.createMessageIds;
}
@Override
public final Message toMessage(Object object, MessageProperties messageProperties)
throws MessageConversionException {
return toMessage(object, messageProperties, null);
}
@Override
public final Message toMessage(Object object, @Nullable MessageProperties messagePropertiesArg,
@Nullable Type genericType)
throws MessageConversionException {
MessageProperties messageProperties = messagePropertiesArg;
if (messageProperties == null) {
messageProperties = new MessageProperties();
}
Message message = createMessage(object, messageProperties, genericType);
messageProperties = message.getMessageProperties();
if (this.createMessageIds && messageProperties.getMessageId() == null) {
messageProperties.setMessageId(UUID.randomUUID().toString()); | }
return message;
}
/**
* Crate a message from the payload object and message properties provided. The message id will be added to the
* properties if necessary later.
* @param object the payload
* @param messageProperties the message properties (headers)
* @param genericType the type to convert from - used to populate type headers.
* @return a message
* @since 2.1
*/
protected Message createMessage(Object object, MessageProperties messageProperties, @Nullable Type genericType) {
return createMessage(object, messageProperties);
}
/**
* Crate a message from the payload object and message properties provided. The message id will be added to the
* properties if necessary later.
* @param object the payload.
* @param messageProperties the message properties (headers).
* @return a message.
*/
protected abstract Message createMessage(Object object, MessageProperties messageProperties);
} | repos\spring-amqp-main\spring-amqp\src\main\java\org\springframework\amqp\support\converter\AbstractMessageConverter.java | 1 |
请完成以下Java代码 | public String getSql()
{
final IValidationRuleFactory validationRuleFactory = Services.get(IValidationRuleFactory.class);
final IValidationContext evalCtx = validationRuleFactory.createValidationContext(evaluatee);
final IValidationRule valRule = validationRuleFactory.create(
tableName,
adValRuleId,
null, // ctx table name
null // ctx column name
);
final IStringExpression prefilterWhereClauseExpr = valRule.getPrefilterWhereClause();
final String prefilterWhereClause = prefilterWhereClauseExpr.evaluate(evalCtx, OnVariableNotFound.ReturnNoResult);
if (prefilterWhereClauseExpr.isNoResult(prefilterWhereClause)) | {
final String prefilterWhereClauseDefault = "1=0";
logger.warn("Cannot evaluate {} using {}. Returning {}.", prefilterWhereClauseExpr, evalCtx, prefilterWhereClauseDefault);
return prefilterWhereClauseDefault;
}
return prefilterWhereClause;
}
@Override
public List<Object> getSqlParams(final Properties ctx)
{
return Collections.emptyList();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\dao\impl\ValidationRuleQueryFilter.java | 1 |
请完成以下Java代码 | public class SupportedActivityValidator implements MigrationActivityValidator {
public static SupportedActivityValidator INSTANCE = new SupportedActivityValidator();
public static List<Class<? extends ActivityBehavior>> SUPPORTED_ACTIVITY_BEHAVIORS = new ArrayList<Class<? extends ActivityBehavior>>();
static {
SUPPORTED_ACTIVITY_BEHAVIORS.add(SubProcessActivityBehavior.class);
SUPPORTED_ACTIVITY_BEHAVIORS.add(UserTaskActivityBehavior.class);
SUPPORTED_ACTIVITY_BEHAVIORS.add(BoundaryEventActivityBehavior.class);
SUPPORTED_ACTIVITY_BEHAVIORS.add(ParallelMultiInstanceActivityBehavior.class);
SUPPORTED_ACTIVITY_BEHAVIORS.add(SequentialMultiInstanceActivityBehavior.class);
SUPPORTED_ACTIVITY_BEHAVIORS.add(ReceiveTaskActivityBehavior.class);
SUPPORTED_ACTIVITY_BEHAVIORS.add(CallActivityBehavior.class);
SUPPORTED_ACTIVITY_BEHAVIORS.add(CaseCallActivityBehavior.class);
SUPPORTED_ACTIVITY_BEHAVIORS.add(IntermediateCatchEventActivityBehavior.class);
SUPPORTED_ACTIVITY_BEHAVIORS.add(EventBasedGatewayActivityBehavior.class);
SUPPORTED_ACTIVITY_BEHAVIORS.add(EventSubProcessActivityBehavior.class);
SUPPORTED_ACTIVITY_BEHAVIORS.add(EventSubProcessStartEventActivityBehavior.class);
SUPPORTED_ACTIVITY_BEHAVIORS.add(ExternalTaskActivityBehavior.class);
SUPPORTED_ACTIVITY_BEHAVIORS.add(ParallelGatewayActivityBehavior.class); | SUPPORTED_ACTIVITY_BEHAVIORS.add(InclusiveGatewayActivityBehavior.class);;
SUPPORTED_ACTIVITY_BEHAVIORS.add(IntermediateConditionalEventBehavior.class);
SUPPORTED_ACTIVITY_BEHAVIORS.add(BoundaryConditionalEventActivityBehavior.class);
SUPPORTED_ACTIVITY_BEHAVIORS.add(EventSubProcessStartConditionalEventActivityBehavior.class);
}
public boolean valid(ActivityImpl activity) {
return activity != null && (isSupportedActivity(activity) || isAsync(activity));
}
public boolean isSupportedActivity(ActivityImpl activity) {
return SUPPORTED_ACTIVITY_BEHAVIORS.contains(activity.getActivityBehavior().getClass());
}
protected boolean isAsync(ActivityImpl activity) {
return activity.isAsyncBefore() || activity.isAsyncAfter();
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\migration\validation\activity\SupportedActivityValidator.java | 1 |
请完成以下Java代码 | public Version safeParse(String text) {
try {
return parse(text);
}
catch (InvalidVersionException ex) {
return null;
}
}
/**
* Parse the string representation of a {@link VersionRange}. Throws an
* {@link InvalidVersionException} if the range could not be parsed.
* @param text the range text
* @return a VersionRange instance for the specified range text
* @throws InvalidVersionException if the range text could not be parsed
*/
public VersionRange parseRange(String text) {
Assert.notNull(text, "Text must not be null");
Matcher matcher = RANGE_REGEX.matcher(text.trim());
if (!matcher.matches()) {
// Try to read it as simple string
Version version = parse(text);
return new VersionRange(version, true, null, true);
}
boolean lowerInclusive = matcher.group(1).equals("[");
Version lowerVersion = parse(matcher.group(2));
Version higherVersion = parse(matcher.group(3));
boolean higherInclusive = matcher.group(4).equals("]");
return new VersionRange(lowerVersion, lowerInclusive, higherVersion, higherInclusive);
} | private Version findLatestVersion(Integer major, Integer minor, Version.Qualifier qualifier) {
List<Version> matches = this.latestVersions.stream().filter((it) -> {
if (major != null && !major.equals(it.getMajor())) {
return false;
}
if (minor != null && !minor.equals(it.getMinor())) {
return false;
}
if (qualifier != null && !qualifier.equals(it.getQualifier())) {
return false;
}
return true;
}).toList();
return (matches.size() != 1) ? null : matches.get(0);
}
} | repos\initializr-main\initializr-generator\src\main\java\io\spring\initializr\generator\version\VersionParser.java | 1 |
请完成以下Java代码 | public int getC_BPartner_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_BPartner_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Exclusion From Sale Reason.
@param ExclusionFromSaleReason Exclusion From Sale Reason */
@Override
public void setExclusionFromSaleReason (java.lang.String ExclusionFromSaleReason)
{
set_Value (COLUMNNAME_ExclusionFromSaleReason, ExclusionFromSaleReason);
}
/** Get Exclusion From Sale Reason.
@return Exclusion From Sale Reason */
@Override
public java.lang.String getExclusionFromSaleReason ()
{
return (java.lang.String)get_Value(COLUMNNAME_ExclusionFromSaleReason);
}
/** Set Banned Manufacturer .
@param M_BannedManufacturer_ID Banned Manufacturer */
@Override
public void setM_BannedManufacturer_ID (int M_BannedManufacturer_ID)
{
if (M_BannedManufacturer_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_BannedManufacturer_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_BannedManufacturer_ID, Integer.valueOf(M_BannedManufacturer_ID));
}
/** Get Banned Manufacturer .
@return Banned Manufacturer */
@Override
public int getM_BannedManufacturer_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_BannedManufacturer_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public org.compiere.model.I_C_BPartner getManufacturer() throws RuntimeException | {
return get_ValueAsPO(COLUMNNAME_Manufacturer_ID, org.compiere.model.I_C_BPartner.class);
}
@Override
public void setManufacturer(org.compiere.model.I_C_BPartner Manufacturer)
{
set_ValueFromPO(COLUMNNAME_Manufacturer_ID, org.compiere.model.I_C_BPartner.class, Manufacturer);
}
/** Set Hersteller.
@param Manufacturer_ID
Hersteller des Produktes
*/
@Override
public void setManufacturer_ID (int Manufacturer_ID)
{
if (Manufacturer_ID < 1)
set_Value (COLUMNNAME_Manufacturer_ID, null);
else
set_Value (COLUMNNAME_Manufacturer_ID, Integer.valueOf(Manufacturer_ID));
}
/** Get Hersteller.
@return Hersteller des Produktes
*/
@Override
public int getManufacturer_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Manufacturer_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_M_BannedManufacturer.java | 1 |
请完成以下Java代码 | public class CallbackData {
protected String callbackId;
protected String callbackType;
protected String instanceId;
protected String oldState;
protected String newState;
protected Map<String, Object> additionalData = null;
public CallbackData(String callbackId, String callbackType, String instanceId, String oldState, String newState, Map<String, Object> additionalData) {
this.callbackId = callbackId;
this.callbackType = callbackType;
this.instanceId = instanceId;
this.oldState = oldState;
this.newState = newState;
}
public CallbackData(String callbackId, String callbackType, String instanceId, String oldState, String newState) {
this(callbackId, callbackType, instanceId, oldState, newState, null);
}
public String getCallbackId() {
return callbackId;
}
public void setCallbackId(String callbackId) {
this.callbackId = callbackId;
}
public String getCallbackType() {
return callbackType;
}
public void setCallbackType(String callbackType) {
this.callbackType = callbackType;
}
public String getInstanceId() {
return instanceId; | }
public void setInstanceId(String instanceId) {
this.instanceId = instanceId;
}
public String getOldState() {
return oldState;
}
public void setOldState(String oldState) {
this.oldState = oldState;
}
public String getNewState() {
return newState;
}
public void setNewState(String newState) {
this.newState = newState;
}
public Map<String, Object> getAdditionalData() {
return additionalData;
}
public void setAdditionalData(Map<String, Object> additionalData) {
this.additionalData = additionalData;
}
} | repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\callback\CallbackData.java | 1 |
请完成以下Java代码 | public class BankAccountInvoiceAutoAllocRules
{
static final BankAccountInvoiceAutoAllocRules NO_RESTRICTIONS = new BankAccountInvoiceAutoAllocRules(ImmutableList.of());
private final ImmutableListMultimap<DocTypeId, BankAccountInvoiceAutoAllocRule> rulesByInvoiceDocTypeId;
private final ImmutableListMultimap<BankAccountId, BankAccountInvoiceAutoAllocRule> rulesByBankAccountId;
private BankAccountInvoiceAutoAllocRules(@NonNull final List<BankAccountInvoiceAutoAllocRule> rules)
{
rulesByInvoiceDocTypeId = Multimaps.index(rules, BankAccountInvoiceAutoAllocRule::getInvoiceDocTypeId);
rulesByBankAccountId = Multimaps.index(rules, BankAccountInvoiceAutoAllocRule::getBankAccountId);
}
public static BankAccountInvoiceAutoAllocRules ofRulesList(@NonNull final List<BankAccountInvoiceAutoAllocRule> rules)
{
return !rules.isEmpty()
? new BankAccountInvoiceAutoAllocRules(rules)
: NO_RESTRICTIONS; | }
public boolean isAutoAllocate(
@NonNull final BankAccountId bankAccountId,
@NonNull final DocTypeId invoiceDocTypeId)
{
final ImmutableList<BankAccountInvoiceAutoAllocRule> rulesForInvoiceDocTypeId = rulesByInvoiceDocTypeId.get(invoiceDocTypeId);
if (rulesForInvoiceDocTypeId.isEmpty())
{
final ImmutableList<BankAccountInvoiceAutoAllocRule> rulesForBankAccountId = rulesByBankAccountId.get(bankAccountId);
return rulesForBankAccountId.isEmpty();
}
else
{
return rulesForInvoiceDocTypeId.stream().anyMatch(rule -> BankAccountId.equals(rule.getBankAccountId(), bankAccountId));
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\banking\invoice_auto_allocation\BankAccountInvoiceAutoAllocRules.java | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.