instruction string | input string | output string | source_file string | priority int64 |
|---|---|---|---|---|
请完成以下Java代码 | public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
} | @Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
User book = (User) o;
return Objects.equals(id, book.id);
}
@Override
public int hashCode() {
return Objects.hash(id);
}
} | repos\tutorials-master\persistence-modules\spring-boot-persistence-mongodb\src\main\java\com\baeldung\multipledb\model\User.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class DocumentExtensionType {
@XmlElement(name = "DocumentExtension", namespace = "http://erpel.at/schemas/1p0/documents/extensions/edifact")
protected at.erpel.schemas._1p0.documents.extensions.edifact.DocumentExtensionType documentExtension;
@XmlElement(name = "ErpelDocumentExtension")
protected ErpelDocumentExtensionType erpelDocumentExtension;
/**
* Gets the value of the documentExtension property.
*
* @return
* possible object is
* {@link at.erpel.schemas._1p0.documents.extensions.edifact.DocumentExtensionType }
*
*/
public at.erpel.schemas._1p0.documents.extensions.edifact.DocumentExtensionType getDocumentExtension() {
return documentExtension;
}
/**
* Sets the value of the documentExtension property.
*
* @param value
* allowed object is
* {@link at.erpel.schemas._1p0.documents.extensions.edifact.DocumentExtensionType }
*
*/
public void setDocumentExtension(at.erpel.schemas._1p0.documents.extensions.edifact.DocumentExtensionType value) {
this.documentExtension = value;
}
/**
* Gets the value of the erpelDocumentExtension property.
*
* @return
* possible object is | * {@link ErpelDocumentExtensionType }
*
*/
public ErpelDocumentExtensionType getErpelDocumentExtension() {
return erpelDocumentExtension;
}
/**
* Sets the value of the erpelDocumentExtension property.
*
* @param value
* allowed object is
* {@link ErpelDocumentExtensionType }
*
*/
public void setErpelDocumentExtension(ErpelDocumentExtensionType value) {
this.erpelDocumentExtension = value;
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\ext\DocumentExtensionType.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public String getQuantityTypeCodeQualifier() {
return quantityTypeCodeQualifier;
}
/**
* Sets the value of the quantityTypeCodeQualifier property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setQuantityTypeCodeQualifier(String value) {
this.quantityTypeCodeQualifier = value;
}
/**
* Gets the value of the quantity property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getQuantity() {
return quantity;
}
/**
* Sets the value of the quantity property.
*
* @param value
* allowed object is
* {@link BigDecimal }
* | */
public void setQuantity(BigDecimal value) {
this.quantity = value;
}
/**
* Gets the value of the measurementUnitCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMeasurementUnitCode() {
return measurementUnitCode;
}
/**
* Sets the value of the measurementUnitCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMeasurementUnitCode(String value) {
this.measurementUnitCode = value;
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\extensions\edifact\ExtendedQuantityType.java | 2 |
请完成以下Spring Boot application配置 | spring:
application:
name: publisher-demo
# Kafka 配置项,对应 KafkaProperties 配置类
kafka:
bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔
management:
endpoints:
# Actuator HTTP 配置项,对应 WebEndpointProperties | 配置类
web:
exposure:
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。 | repos\SpringBoot-Labs-master\labx-19\labx-19-sc-bus-kafka-demo-publisher-actuator\src\main\resources\application.yml | 2 |
请完成以下Java代码 | public int getC_Order_CompensationGroup_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Order_CompensationGroup_ID);
}
@Override
public org.compiere.model.I_C_Order getC_Order()
{
return get_ValueAsPO(COLUMNNAME_C_Order_ID, org.compiere.model.I_C_Order.class);
}
@Override
public void setC_Order(final org.compiere.model.I_C_Order C_Order)
{
set_ValueFromPO(COLUMNNAME_C_Order_ID, org.compiere.model.I_C_Order.class, C_Order);
}
@Override
public void setC_Order_ID (final int C_Order_ID)
{
if (C_Order_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Order_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Order_ID, C_Order_ID);
}
@Override
public int getC_Order_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Order_ID);
}
@Override
public void setIsNamePrinted (final boolean IsNamePrinted)
{
set_Value (COLUMNNAME_IsNamePrinted, IsNamePrinted);
}
@Override
public boolean isNamePrinted()
{
return get_ValueAsBoolean(COLUMNNAME_IsNamePrinted);
}
@Override
public void setM_Product_Category_ID (final int M_Product_Category_ID)
{
if (M_Product_Category_ID < 1)
set_Value (COLUMNNAME_M_Product_Category_ID, null);
else
set_Value (COLUMNNAME_M_Product_Category_ID, M_Product_Category_ID);
}
@Override
public int getM_Product_Category_ID() | {
return get_ValueAsInt(COLUMNNAME_M_Product_Category_ID);
}
@Override
public void setName (final java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
@Override
public org.eevolution.model.I_PP_Product_BOM getPP_Product_BOM()
{
return get_ValueAsPO(COLUMNNAME_PP_Product_BOM_ID, org.eevolution.model.I_PP_Product_BOM.class);
}
@Override
public void setPP_Product_BOM(final org.eevolution.model.I_PP_Product_BOM PP_Product_BOM)
{
set_ValueFromPO(COLUMNNAME_PP_Product_BOM_ID, org.eevolution.model.I_PP_Product_BOM.class, PP_Product_BOM);
}
@Override
public void setPP_Product_BOM_ID (final int PP_Product_BOM_ID)
{
if (PP_Product_BOM_ID < 1)
set_Value (COLUMNNAME_PP_Product_BOM_ID, null);
else
set_Value (COLUMNNAME_PP_Product_BOM_ID, PP_Product_BOM_ID);
}
@Override
public int getPP_Product_BOM_ID()
{
return get_ValueAsInt(COLUMNNAME_PP_Product_BOM_ID);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Order_CompensationGroup.java | 1 |
请完成以下Java代码 | public void setSourceCaseExecution(CmmnExecution sourceCaseExecution) {
this.sourceCaseExecution = (CaseExecutionEntity) sourceCaseExecution;
if (sourceCaseExecution != null) {
sourceCaseExecutionId = sourceCaseExecution.getId();
} else {
sourceCaseExecutionId = null;
}
}
// persistence /////////////////////////////////////////////////////////
public int getRevision() {
return revision;
}
public void setRevision(int revision) {
this.revision = revision;
}
public int getRevisionNext() {
return revision + 1;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public void forceUpdate() {
this.forcedUpdate = true;
}
public Object getPersistentState() {
Map<String, Object> persistentState = new HashMap<String, Object>();
persistentState.put("satisfied", isSatisfied());
if (forcedUpdate) {
persistentState.put("forcedUpdate", Boolean.TRUE);
}
return persistentState;
} | // helper ////////////////////////////////////////////////////////////////////
protected CaseExecutionEntity findCaseExecutionById(String caseExecutionId) {
return Context
.getCommandContext()
.getCaseExecutionManager()
.findCaseExecutionById(caseExecutionId);
}
@Override
public Set<String> getReferencedEntityIds() {
Set<String> referencedEntityIds = new HashSet<String>();
return referencedEntityIds;
}
@Override
public Map<String, Class> getReferencedEntitiesIdAndClass() {
Map<String, Class> referenceIdAndClass = new HashMap<String, Class>();
if (caseExecutionId != null) {
referenceIdAndClass.put(caseExecutionId, CaseExecutionEntity.class);
}
if (caseInstanceId != null) {
referenceIdAndClass.put(caseInstanceId, CaseExecutionEntity.class);
}
return referenceIdAndClass;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmmn\entity\runtime\CaseSentryPartEntity.java | 1 |
请完成以下Java代码 | public void setMeta_Publisher (String Meta_Publisher)
{
set_Value (COLUMNNAME_Meta_Publisher, Meta_Publisher);
}
/** Get Meta Publisher.
@return Meta Publisher defines the publisher of the content
*/
public String getMeta_Publisher ()
{
return (String)get_Value(COLUMNNAME_Meta_Publisher);
}
/** Set Meta RobotsTag.
@param Meta_RobotsTag
RobotsTag defines how search robots should handle this content
*/
public void setMeta_RobotsTag (String Meta_RobotsTag)
{
set_Value (COLUMNNAME_Meta_RobotsTag, Meta_RobotsTag);
}
/** Get Meta RobotsTag.
@return RobotsTag defines how search robots should handle this content
*/
public String getMeta_RobotsTag ()
{
return (String)get_Value(COLUMNNAME_Meta_RobotsTag);
}
/** 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_CM_WebProject.java | 1 |
请完成以下Java代码 | public BigDecimal getQtyDeliveredInUOM_Nominal()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyDeliveredInUOM_Nominal);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyDeliveredInUOM_Override (final @Nullable BigDecimal QtyDeliveredInUOM_Override)
{
set_ValueNoCheck (COLUMNNAME_QtyDeliveredInUOM_Override, QtyDeliveredInUOM_Override);
}
@Override
public BigDecimal getQtyDeliveredInUOM_Override()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyDeliveredInUOM_Override); | return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyInvoiced (final BigDecimal QtyInvoiced)
{
set_Value (COLUMNNAME_QtyInvoiced, QtyInvoiced);
}
@Override
public BigDecimal getQtyInvoiced()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyInvoiced);
return bd != null ? bd : BigDecimal.ZERO;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\de\metas\invoicecandidate\model\X_C_InvoiceCandidate_InOutLine.java | 1 |
请完成以下Java代码 | public class Address {
private String city;
private Country country;
public Address() {
// default constructor needed for Jackson deserialization
}
public Address(String city, Country country) {
this.city = city;
this.country = country;
}
public Country getCountry() {
return country;
}
public void setCountry(Country country) {
this.country = country;
} | public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Address address = (Address) o;
if (!city.equals(address.city)) return false;
return country.getName().equals(address.country.getName());
}
} | repos\tutorials-master\core-java-modules\core-java-collections-maps-8\src\main\java\com\baeldung\map\castingmaptoobject\Address.java | 1 |
请完成以下Java代码 | public void start() {
log.info("Creating Store Procedures and Function...");
jdbcTemplate.execute(SQL_STORED_PROC_REF);
/* Test Stored Procedure RefCursor */
List<Book> books = findBookByName("Java");
// Book{id=1, name='Thinking in Java', price=46.32}
// Book{id=2, name='Mkyong in Java', price=1.99}
books.forEach(x -> System.out.println(x));
}
List<Book> findBookByName(String name) { | SqlParameterSource paramaters = new MapSqlParameterSource()
.addValue("p_name", name);
Map out = simpleJdbcCallRefCursor.execute(paramaters);
if (out == null) {
return Collections.emptyList();
} else {
return (List) out.get("o_c_book");
}
}
} | repos\spring-boot-master\spring-jdbc\src\main\java\com\mkyong\sp\StoredProcedure2.java | 1 |
请完成以下Java代码 | public Optional<MAccount> getAccountIfExists(final TaxId taxId, final AcctSchemaId acctSchemaId, final TaxAcctType acctType)
{
return getAccountId(taxId, acctSchemaId, acctType)
.map(accountsRepo::getById);
}
@Override
public Optional<AccountId> getAccountId(@NonNull final TaxId taxId, @NonNull final AcctSchemaId acctSchemaId, final TaxAcctType acctType)
{
final I_C_Tax_Acct taxAcct = getTaxAcctRecord(acctSchemaId, taxId);
if (TaxAcctType.TaxDue == acctType)
{
final Optional<AccountId> accountId = AccountId.optionalOfRepoId(taxAcct.getT_Due_Acct());
return accountId;
}
else if (TaxAcctType.TaxLiability == acctType)
{
final Optional<AccountId> accountId = AccountId.optionalOfRepoId(taxAcct.getT_Liability_Acct());
return accountId;
}
else if (TaxAcctType.TaxCredit == acctType)
{
final Optional<AccountId> accountId = AccountId.optionalOfRepoId(taxAcct.getT_Credit_Acct());
return accountId;
}
else if (TaxAcctType.TaxReceivables == acctType)
{
final Optional<AccountId> accountId = AccountId.optionalOfRepoId(taxAcct.getT_Receivables_Acct());
return accountId;
}
else if (TaxAcctType.TaxExpense == acctType)
{
final Optional<AccountId> accountId = AccountId.optionalOfRepoId(taxAcct.getT_Expense_Acct());
return accountId;
}
else if (TaxAcctType.ProductRevenue_Override == acctType)
{
// might be not set
return AccountId.optionalOfRepoId(taxAcct.getT_Revenue_Acct());
}
else
{
throw new AdempiereException("Unknown tax account type: " + acctType);
}
} | private I_C_Tax_Acct getTaxAcctRecord(final AcctSchemaId acctSchemaId, final TaxId taxId)
{
return taxAcctRecords.getOrLoad(
TaxIdAndAcctSchemaId.of(taxId, acctSchemaId),
this::retrieveTaxAcctRecord);
}
private I_C_Tax_Acct retrieveTaxAcctRecord(@NonNull final TaxIdAndAcctSchemaId key)
{
return Services.get(IQueryBL.class)
.createQueryBuilderOutOfTrx(I_C_Tax_Acct.class)
.addEqualsFilter(I_C_Tax_Acct.COLUMNNAME_C_Tax_ID, key.getTaxId())
.addEqualsFilter(I_C_Tax_Acct.COLUMNNAME_C_AcctSchema_ID, key.getAcctSchemaId())
.addOnlyActiveRecordsFilter()
.create()
.firstOnlyNotNull(I_C_Tax_Acct.class);
}
@Value(staticConstructor = "of")
private static class TaxIdAndAcctSchemaId
{
@NonNull
TaxId taxId;
@NonNull
AcctSchemaId acctSchemaId;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\tax\impl\TaxAcctBL.java | 1 |
请完成以下Java代码 | public void unlock(final I_M_HU hu, final LockOwner lockOwner)
{
Preconditions.checkNotNull(hu, "hu is null");
Preconditions.checkNotNull(lockOwner, "lockOwner is null");
Preconditions.checkArgument(!lockOwner.isAnyOwner(), "%s not allowed", lockOwner);
final int huId = hu.getM_HU_ID();
unlock0(huId, lockOwner);
if (isUseVirtualColumn())
{
InterfaceWrapperHelper.refresh(hu);
}
}
@Override
public void unlockOnAfterCommit(
final int huId,
@NonNull final LockOwner lockOwner)
{
Preconditions.checkArgument(huId > 0, "huId shall be > 0");
Preconditions.checkArgument(!lockOwner.isAnyOwner(), "{} not allowed", lockOwner);
Services.get(ITrxManager.class)
.getCurrentTrxListenerManagerOrAutoCommit()
.newEventListener(TrxEventTiming.AFTER_COMMIT)
.registerWeakly(false) // register "hard", because that's how it was before
.invokeMethodJustOnce(false) // invoke the handling method on *every* commit, because that's how it was and I can't check now if it's really needed
.registerHandlingMethod(transaction -> unlock0(huId, lockOwner));
}
private void unlock0(final int huId, final LockOwner lockOwner)
{
Services.get(ILockManager.class)
.unlock()
.setOwner(lockOwner)
.setRecordByTableRecordId(I_M_HU.Table_Name, huId)
.release();
}
@Override
public void unlockAll(final Collection<I_M_HU> hus, final LockOwner lockOwner)
{
if (hus.isEmpty())
{
return;
}
Preconditions.checkNotNull(lockOwner, "lockOwner is null");
Preconditions.checkArgument(!lockOwner.isAnyOwner(), "{} not allowed", lockOwner); | Services.get(ILockManager.class)
.unlock()
.setOwner(lockOwner)
.setRecordsByModels(hus)
.release();
if (isUseVirtualColumn())
{
InterfaceWrapperHelper.refresh(hus);
}
}
@Override
public IQueryFilter<I_M_HU> isLockedFilter()
{
return Services.get(ILockManager.class).getLockedByFilter(I_M_HU.class, LockOwner.ANY);
}
@Override
public IQueryFilter<I_M_HU> isNotLockedFilter()
{
return Services.get(ILockManager.class).getNotLockedFilter(I_M_HU.class);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\impl\HULockBL.java | 1 |
请完成以下Java代码 | public class HUPackingAwareCopy
{
public static HUPackingAwareCopy from(final IHUPackingAware from)
{
return new HUPackingAwareCopy(from);
}
private final IHUPackingAware from;
private boolean overridePartner = true;
public enum ASICopyMode
{
Clone, CopyID
}
private ASICopyMode asiCopyMode = ASICopyMode.Clone;
private HUPackingAwareCopy(@NonNull final IHUPackingAware from)
{
this.from = from;
}
public void copyTo(@NonNull final IHUPackingAware to)
{
to.setM_Product_ID(from.getM_Product_ID());
copyASI(to);
to.setC_UOM_ID(from.getC_UOM_ID());
to.setQty(from.getQty());
to.setM_HU_PI_Item_Product_ID(from.getM_HU_PI_Item_Product_ID());
to.setQtyTU(from.getQtyTU());
to.setLuId(from.getLuId());
to.setQtyLU(CoalesceUtil.coalesceNotNull(from.getQtyLU(), BigDecimal.ZERO));
from.getQtyCUsPerTU().ifPresent(to::setQtyCUsPerTU);
copyBPartner(to);
}
private void copyASI(final IHUPackingAware to)
{
final AttributeSetInstanceId asiId = AttributeSetInstanceId.ofRepoIdOrNone(from.getM_AttributeSetInstance_ID());
if (asiId.isNone())
{
return;
}
if (asiCopyMode == ASICopyMode.Clone)
{
final IAttributeSetInstanceBL asiBL = Services.get(IAttributeSetInstanceBL.class);
final AttributeSetInstanceId asiIdCopy = asiBL.copy(asiId);
to.setM_AttributeSetInstance_ID(asiIdCopy.getRepoId()); | }
else if (asiCopyMode == ASICopyMode.CopyID)
{
to.setM_AttributeSetInstance_ID(asiId.getRepoId());
}
else
{
throw new IllegalStateException("Unknown asiCopyMode: " + asiCopyMode);
}
}
private void copyBPartner(final IHUPackingAware to)
{
// 08276
// do not modify the partner in the orderline if it was already set
if (to.getC_BPartner_ID() <= 0 || overridePartner)
{
to.setC_BPartner_ID(from.getC_BPartner_ID());
}
}
/**
* @param overridePartner if true, the BPartner will be copied, even if "to" record already has a partner set
*/
public HUPackingAwareCopy overridePartner(final boolean overridePartner)
{
this.overridePartner = overridePartner;
return this;
}
public HUPackingAwareCopy asiCopyMode(@NonNull final ASICopyMode asiCopyMode)
{
this.asiCopyMode = asiCopyMode;
return this;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\adempiere\gui\search\HUPackingAwareCopy.java | 1 |
请完成以下Java代码 | public void setPassword(String password) {
this.password = password;
}
public List<Role> getRoles() {
return roles;
}
public void setRoles(List<Role> roles) {
this.roles = roles;
}
// 下面为实现UserDetails而需要的重写方法!
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return true;
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public boolean isEnabled() {
return true;
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities() { | List<GrantedAuthority> authorities = new ArrayList<>();
for (Role role : roles) {
authorities.add( new SimpleGrantedAuthority( role.getName() ) );
}
return authorities;
}
@Override
public String getUsername() {
return username;
}
@Override
public String getPassword() {
return password;
}
} | repos\Spring-Boot-In-Action-master\springbt_security_jwt\src\main\java\cn\codesheep\springbt_security_jwt\model\entity\User.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void setFilename(@Nullable String filename) {
this.filename = filename;
}
public @Nullable String getFileDateFormat() {
return this.fileDateFormat;
}
public void setFileDateFormat(@Nullable String fileDateFormat) {
this.fileDateFormat = fileDateFormat;
}
public int getRetentionPeriod() {
return this.retentionPeriod;
}
public void setRetentionPeriod(int retentionPeriod) {
this.retentionPeriod = retentionPeriod;
}
public boolean isAppend() {
return this.append;
}
public void setAppend(boolean append) {
this.append = append;
}
public @Nullable List<String> getIgnorePaths() {
return this.ignorePaths;
}
public void setIgnorePaths(@Nullable List<String> ignorePaths) {
this.ignorePaths = ignorePaths;
}
/**
* Log format for Jetty access logs.
*/
public enum Format {
/**
* NCSA format, as defined in CustomRequestLog#NCSA_FORMAT.
*/
NCSA,
/**
* Extended NCSA format, as defined in CustomRequestLog#EXTENDED_NCSA_FORMAT.
*/
EXTENDED_NCSA
}
}
/**
* Jetty thread properties.
*/
public static class Threads {
/**
* Number of acceptor threads to use. When the value is -1, the default, the
* number of acceptors is derived from the operating environment.
*/
private Integer acceptors = -1;
/**
* Number of selector threads to use. When the value is -1, the default, the
* number of selectors is derived from the operating environment.
*/
private Integer selectors = -1;
/**
* Maximum number of threads. Doesn't have an effect if virtual threads are | * enabled.
*/
private Integer max = 200;
/**
* Minimum number of threads. Doesn't have an effect if virtual threads are
* enabled.
*/
private Integer min = 8;
/**
* Maximum capacity of the thread pool's backing queue. A default is computed
* based on the threading configuration.
*/
private @Nullable Integer maxQueueCapacity;
/**
* Maximum thread idle time.
*/
private Duration idleTimeout = Duration.ofMillis(60000);
public Integer getAcceptors() {
return this.acceptors;
}
public void setAcceptors(Integer acceptors) {
this.acceptors = acceptors;
}
public Integer getSelectors() {
return this.selectors;
}
public void setSelectors(Integer selectors) {
this.selectors = selectors;
}
public void setMin(Integer min) {
this.min = min;
}
public Integer getMin() {
return this.min;
}
public void setMax(Integer max) {
this.max = max;
}
public Integer getMax() {
return this.max;
}
public @Nullable Integer getMaxQueueCapacity() {
return this.maxQueueCapacity;
}
public void setMaxQueueCapacity(@Nullable Integer maxQueueCapacity) {
this.maxQueueCapacity = maxQueueCapacity;
}
public void setIdleTimeout(Duration idleTimeout) {
this.idleTimeout = idleTimeout;
}
public Duration getIdleTimeout() {
return this.idleTimeout;
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-jetty\src\main\java\org\springframework\boot\jetty\autoconfigure\JettyServerProperties.java | 2 |
请完成以下Java代码 | private void extractFromStream(ZipInputStream zipStream, boolean overwrite, File outputDirectory)
throws IOException {
ZipEntry entry = zipStream.getNextEntry();
String canonicalOutputPath = outputDirectory.getCanonicalPath() + File.separator;
while (entry != null) {
File file = new File(outputDirectory, entry.getName());
String canonicalEntryPath = file.getCanonicalPath();
if (!canonicalEntryPath.startsWith(canonicalOutputPath)) {
throw new ReportableException("Entry '" + entry.getName() + "' would be written to '"
+ canonicalEntryPath + "'. This is outside the output location of '" + canonicalOutputPath
+ "'. Verify your target server configuration.");
}
if (file.exists() && !overwrite) {
throw new ReportableException((file.isDirectory() ? "Directory" : "File") + " '" + file.getName()
+ "' already exists. Use --force if you want to overwrite or "
+ "specify an alternate location.");
}
if (!entry.isDirectory()) {
FileCopyUtils.copy(StreamUtils.nonClosing(zipStream), new FileOutputStream(file));
}
else {
file.mkdir();
}
zipStream.closeEntry();
entry = zipStream.getNextEntry();
}
}
private void writeProject(ProjectGenerationResponse entity, String output, boolean overwrite) throws IOException { | File outputFile = new File(output);
if (outputFile.exists()) {
if (!overwrite) {
throw new ReportableException(
"File '" + outputFile.getName() + "' already exists. Use --force if you want to "
+ "overwrite or specify an alternate location.");
}
if (!outputFile.delete()) {
throw new ReportableException("Failed to delete existing file " + outputFile.getPath());
}
}
byte[] content = entity.getContent();
Assert.state(content != null, "'content' must not be null");
FileCopyUtils.copy(content, outputFile);
Log.info("Content saved to '" + output + "'");
}
private void fixExecutableFlag(File dir, String fileName) {
File f = new File(dir, fileName);
if (f.exists()) {
f.setExecutable(true, false);
}
}
} | repos\spring-boot-4.0.1\cli\spring-boot-cli\src\main\java\org\springframework\boot\cli\command\init\ProjectGenerator.java | 1 |
请完成以下Java代码 | public Object invoke(MethodInvocation invocation) throws Throwable {
if (isRefreshCall(invocation)) {
refresh();
return null;
}
if (isGetDelegateCall(invocation)) {
return getDelegate();
}
if (isGetPropertyCall(invocation)) {
return getProperty(getNameArgument(invocation));
}
return invocation.proceed();
}
private String getNameArgument(MethodInvocation invocation) {
return (String) invocation.getArguments()[0]; | }
private boolean isGetDelegateCall(MethodInvocation invocation) {
return invocation.getMethod().getName().equals("getDelegate");
}
private boolean isRefreshCall(MethodInvocation invocation) {
return invocation.getMethod().getName().equals("refresh");
}
private boolean isGetPropertyCall(MethodInvocation invocation) {
return invocation.getMethod().getName().equals("getProperty")
&& invocation.getMethod().getParameters().length == 1
&& invocation.getMethod().getParameters()[0].getType() == String.class;
}
} | repos\jasypt-spring-boot-master\jasypt-spring-boot\src\main\java\com\ulisesbocchio\jasyptspringboot\aop\EncryptablePropertySourceMethodInterceptor.java | 1 |
请完成以下Java代码 | public int getHR_Revenue_Acct ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_HR_Revenue_Acct);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Balancing.
@param IsBalancing
All transactions within an element value must balance (e.g. cost centers)
*/
public void setIsBalancing (boolean IsBalancing)
{
set_Value (COLUMNNAME_IsBalancing, Boolean.valueOf(IsBalancing));
}
/** Get Balancing.
@return All transactions within an element value must balance (e.g. cost centers)
*/
public boolean isBalancing ()
{
Object oo = get_Value(COLUMNNAME_IsBalancing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
public I_C_ElementValue getUser1() throws RuntimeException
{
return (I_C_ElementValue)MTable.get(getCtx(), I_C_ElementValue.Table_Name)
.getPO(getUser1_ID(), get_TrxName()); }
/** Set User List 1.
@param User1_ID
User defined list element #1
*/
public void setUser1_ID (int User1_ID)
{
if (User1_ID < 1)
set_Value (COLUMNNAME_User1_ID, null);
else
set_Value (COLUMNNAME_User1_ID, Integer.valueOf(User1_ID));
} | /** Get User List 1.
@return User defined list element #1
*/
public int getUser1_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_User1_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_C_ValidCombination getUser2() throws RuntimeException
{
return (I_C_ValidCombination)MTable.get(getCtx(), I_C_ValidCombination.Table_Name)
.getPO(getUser2_ID(), get_TrxName()); }
/** Set User List 2.
@param User2_ID
User defined list element #2
*/
public void setUser2_ID (int User2_ID)
{
if (User2_ID < 1)
set_Value (COLUMNNAME_User2_ID, null);
else
set_Value (COLUMNNAME_User2_ID, Integer.valueOf(User2_ID));
}
/** Get User List 2.
@return User defined list element #2
*/
public int getUser2_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_User2_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\eevolution\model\X_HR_Concept_Acct.java | 1 |
请完成以下Java代码 | protected boolean afterSave(boolean newRecord, boolean success)
{
// Set Instance Attribute
if (!isInstanceAttribute())
{
String sql = "UPDATE M_AttributeSet mas"
+ " SET IsInstanceAttribute='Y' "
+ "WHERE M_AttributeSet_ID=" + getM_AttributeSet_ID()
+ " AND IsInstanceAttribute='N'"
+ " AND (EXISTS (SELECT * FROM M_AttributeUse mau"
+ " INNER JOIN M_Attribute ma ON (mau.M_Attribute_ID=ma.M_Attribute_ID) "
+ "WHERE mau.M_AttributeSet_ID=mas.M_AttributeSet_ID"
+ " AND mau.IsActive='Y' AND ma.IsActive='Y'"
+ " AND ma.IsInstanceAttribute='Y')"
+ ")";
int no = DB.executeUpdateAndThrowExceptionOnFail(sql, get_TrxName());
if (no != 0)
{
log.warn("Set Instance Attribute");
setIsInstanceAttribute(true);
}
}
// Reset Instance Attribute | if (isInstanceAttribute())
{
String sql = "UPDATE M_AttributeSet mas"
+ " SET IsInstanceAttribute='N' "
+ "WHERE M_AttributeSet_ID=" + getM_AttributeSet_ID()
+ " AND IsInstanceAttribute='Y'"
+ " AND NOT EXISTS (SELECT * FROM M_AttributeUse mau"
+ " INNER JOIN M_Attribute ma ON (mau.M_Attribute_ID=ma.M_Attribute_ID) "
+ "WHERE mau.M_AttributeSet_ID=mas.M_AttributeSet_ID"
+ " AND mau.IsActive='Y' AND ma.IsActive='Y'"
+ " AND ma.IsInstanceAttribute='Y')";
int no = DB.executeUpdateAndThrowExceptionOnFail(sql, get_TrxName());
if (no != 0)
{
log.warn("Reset Instance Attribute");
setIsInstanceAttribute(false);
}
}
return success;
} // afterSave
} // MAttributeSet | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MAttributeSet.java | 1 |
请完成以下Java代码 | public AgentId getId() {
return this.id;
}
public String getVersion() {
return this.version;
}
/**
* Create an {@link Agent} based on the specified {@code User-Agent} header.
* @param userAgent the user agent
* @return an {@link Agent} instance or {@code null}
*/
public static Agent fromUserAgent(String userAgent) {
return UserAgentHandler.parse(userAgent);
}
/**
* Defines the various known agents.
*/
public enum AgentId {
/**
* CURL.
*/
CURL("curl", "curl"),
/**
* HTTPie.
*/
HTTPIE("httpie", "HTTPie"),
/**
* JBoss Forge.
*/
JBOSS_FORGE("jbossforge", "SpringBootForgeCli"),
/**
* The Spring Boot CLI.
*/
SPRING_BOOT_CLI("spring", "SpringBootCli"),
/**
* Spring Tools Suite.
*/
STS("sts", "STS"),
/**
* IntelliJ IDEA.
*/
INTELLIJ_IDEA("intellijidea", "IntelliJ IDEA"),
/**
* Netbeans.
*/
NETBEANS("netbeans", "NetBeans"),
/**
* Visual Studio Code.
*/
VSCODE("vscode", "vscode"),
/**
* Jenkins X.
*/
JENKINSX("jenkinsx", "jx"),
/**
* NX.
*/
NX("nx", "@nxrocks_nx-spring-boot"),
/**
* A generic browser.
*/
BROWSER("browser", "Browser");
final String id;
final String name;
public String getId() {
return this.id;
}
public String getName() {
return this.name;
}
AgentId(String id, String name) {
this.id = id;
this.name = name;
} | }
private static final class UserAgentHandler {
private static final Pattern TOOL_REGEX = Pattern.compile("([^\\/]*)\\/([^ ]*).*");
private static final Pattern STS_REGEX = Pattern.compile("STS (.*)");
private static final Pattern NETBEANS_REGEX = Pattern.compile("nb-springboot-plugin\\/(.*)");
static Agent parse(String userAgent) {
Matcher matcher = TOOL_REGEX.matcher(userAgent);
if (matcher.matches()) {
String name = matcher.group(1);
for (AgentId id : AgentId.values()) {
if (name.equals(id.name)) {
String version = matcher.group(2);
return new Agent(id, version);
}
}
}
matcher = STS_REGEX.matcher(userAgent);
if (matcher.matches()) {
return new Agent(AgentId.STS, matcher.group(1));
}
matcher = NETBEANS_REGEX.matcher(userAgent);
if (matcher.matches()) {
return new Agent(AgentId.NETBEANS, matcher.group(1));
}
if (userAgent.equals(AgentId.INTELLIJ_IDEA.name)) {
return new Agent(AgentId.INTELLIJ_IDEA, null);
}
if (userAgent.contains("Mozilla/5.0")) { // Super heuristics
return new Agent(AgentId.BROWSER, null);
}
return null;
}
}
} | repos\initializr-main\initializr-web\src\main\java\io\spring\initializr\web\support\Agent.java | 1 |
请完成以下Java代码 | public void onExit(CmmnActivityExecution execution) {
throw createIllegalStateTransitionException("exit", execution);
}
// occur /////////////////////////////////////////////////////////////////
public void onOccur(CmmnActivityExecution execution) {
ensureTransitionAllowed(execution, AVAILABLE, COMPLETED, "occur");
}
// suspension ////////////////////////////////////////////////////////////
public void onSuspension(CmmnActivityExecution execution) {
ensureTransitionAllowed(execution, AVAILABLE, SUSPENDED, "suspend");
performSuspension(execution);
}
public void onParentSuspension(CmmnActivityExecution execution) {
throw createIllegalStateTransitionException("parentSuspend", execution);
}
// resume ////////////////////////////////////////////////////////////////
public void onResume(CmmnActivityExecution execution) {
ensureTransitionAllowed(execution, SUSPENDED, AVAILABLE, "resume");
CmmnActivityExecution parent = execution.getParent();
if (parent != null) {
if (!parent.isActive()) {
String id = execution.getId();
throw LOG.resumeInactiveCaseException("resume", id);
}
} | resuming(execution);
}
public void onParentResume(CmmnActivityExecution execution) {
throw createIllegalStateTransitionException("parentResume", execution);
}
// re-activation ////////////////////////////////////////////////////////
public void onReactivation(CmmnActivityExecution execution) {
throw createIllegalStateTransitionException("reactivate", execution);
}
// sentry ///////////////////////////////////////////////////////////////
protected boolean isAtLeastOneExitCriterionSatisfied(CmmnActivityExecution execution) {
return false;
}
public void fireExitCriteria(CmmnActivityExecution execution) {
throw LOG.criteriaNotAllowedForEventListenerOrMilestonesException("exit", execution.getId());
}
// helper ////////////////////////////////////////////////////////////////
protected CaseIllegalStateTransitionException createIllegalStateTransitionException(String transition, CmmnActivityExecution execution) {
String id = execution.getId();
return LOG.illegalStateTransitionException(transition, id, getTypeName());
}
protected abstract String getTypeName();
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmmn\behavior\EventListenerOrMilestoneActivityBehavior.java | 1 |
请完成以下Java代码 | public class DataResponse<T> {
List<T> data;
long total;
int start;
String sort;
String order;
int size;
public List<T> getData() {
return data;
}
public DataResponse<T> setData(List<T> data) {
this.data = data;
return this;
}
public long getTotal() {
return total;
}
public void setTotal(long total) {
this.total = total;
}
public int getStart() {
return start;
}
public void setStart(int start) {
this.start = start;
}
public String getSort() {
return sort;
} | public void setSort(String sort) {
this.sort = sort;
}
public String getOrder() {
return order;
}
public void setOrder(String order) {
this.order = order;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
} | repos\flowable-engine-main\modules\flowable-common-rest\src\main\java\org\flowable\common\rest\api\DataResponse.java | 1 |
请完成以下Java代码 | public void composeDecisionResults(final ELExecutionContext executionContext) {
List<Map<String, Object>> ruleResults = new ArrayList<>(executionContext.getRuleResults().values());
boolean outputValuesPresent = false;
for (Map.Entry<String, List<Object>> entry : executionContext.getOutputValues().entrySet()) {
List<Object> outputValues = entry.getValue();
if (outputValues != null && !outputValues.isEmpty()) {
outputValuesPresent = true;
break;
}
}
if (!outputValuesPresent) {
String hitPolicyViolatedMessage = String.format("HitPolicy: %s violated; no output values present", getHitPolicyName());
if (CommandContextUtil.getDmnEngineConfiguration().isStrictMode()) {
throw new FlowableException(hitPolicyViolatedMessage);
} else {
executionContext.getAuditContainer().setValidationMessage(hitPolicyViolatedMessage);
}
} | // sort on predefined list(s) of output values
ruleResults.sort((o1, o2) -> {
CompareToBuilder compareToBuilder = new CompareToBuilder();
for (Map.Entry<String, List<Object>> entry : executionContext.getOutputValues().entrySet()) {
List<Object> outputValues = entry.getValue();
if (outputValues != null && !outputValues.isEmpty()) {
compareToBuilder.append(o1.get(entry.getKey()), o2.get(entry.getKey()),
new OutputOrderComparator<>(outputValues.toArray(new Comparable[outputValues.size()])));
compareToBuilder.toComparison();
}
}
return compareToBuilder.toComparison();
});
updateStackWithDecisionResults(ruleResults, executionContext);
DecisionExecutionAuditContainer auditContainer = executionContext.getAuditContainer();
auditContainer.setDecisionResult(ruleResults);
auditContainer.setMultipleResults(true);
}
} | repos\flowable-engine-main\modules\flowable-dmn-engine\src\main\java\org\flowable\dmn\engine\impl\hitpolicy\HitPolicyOutputOrder.java | 1 |
请完成以下Java代码 | class CollectionFilterer<T> implements Filterer<T> {
protected static final Log logger = LogFactory.getLog(CollectionFilterer.class);
private final Collection<T> collection;
private final Set<T> removeList;
CollectionFilterer(Collection<T> collection) {
this.collection = collection;
// We create a Set of objects to be removed from the Collection,
// as ConcurrentModificationException prevents removal during
// iteration, and making a new Collection to be returned is
// problematic as the original Collection implementation passed
// to the method may not necessarily be re-constructable (as
// the Collection(collection) constructor is not guaranteed and
// manually adding may lose sort order or other capabilities)
this.removeList = new HashSet<>();
}
@Override
public Object getFilteredObject() {
// Now the Iterator has ended, remove Objects from Collection
Iterator<T> removeIter = this.removeList.iterator();
int originalSize = this.collection.size();
while (removeIter.hasNext()) { | this.collection.remove(removeIter.next());
}
logger.debug(LogMessage.of(() -> "Original collection contained " + originalSize + " elements; now contains "
+ this.collection.size() + " elements"));
return this.collection;
}
@Override
public Iterator<T> iterator() {
return this.collection.iterator();
}
@Override
public void remove(T object) {
this.removeList.add(object);
}
} | repos\spring-security-main\access\src\main\java\org\springframework\security\acls\afterinvocation\CollectionFilterer.java | 1 |
请完成以下Java代码 | public void setAD_JavaClass_ID (final int AD_JavaClass_ID)
{
if (AD_JavaClass_ID < 1)
set_Value (COLUMNNAME_AD_JavaClass_ID, null);
else
set_Value (COLUMNNAME_AD_JavaClass_ID, AD_JavaClass_ID);
}
@Override
public int getAD_JavaClass_ID()
{
return get_ValueAsInt(COLUMNNAME_AD_JavaClass_ID);
}
@Override
public org.compiere.model.I_AD_Sequence getAD_Sequence()
{
return get_ValueAsPO(COLUMNNAME_AD_Sequence_ID, org.compiere.model.I_AD_Sequence.class);
}
@Override
public void setAD_Sequence(final org.compiere.model.I_AD_Sequence AD_Sequence)
{
set_ValueFromPO(COLUMNNAME_AD_Sequence_ID, org.compiere.model.I_AD_Sequence.class, AD_Sequence);
}
@Override
public void setAD_Sequence_ID (final int AD_Sequence_ID)
{
if (AD_Sequence_ID < 1)
set_Value (COLUMNNAME_AD_Sequence_ID, null);
else
set_Value (COLUMNNAME_AD_Sequence_ID, AD_Sequence_ID);
}
@Override | public int getAD_Sequence_ID()
{
return get_ValueAsInt(COLUMNNAME_AD_Sequence_ID);
}
@Override
public void setM_Product_ID (final int M_Product_ID)
{
if (M_Product_ID < 1)
set_Value (COLUMNNAME_M_Product_ID, null);
else
set_Value (COLUMNNAME_M_Product_ID, M_Product_ID);
}
@Override
public int getM_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
@Override
public void setPP_ComponentGenerator_ID (final int PP_ComponentGenerator_ID)
{
if (PP_ComponentGenerator_ID < 1)
set_ValueNoCheck (COLUMNNAME_PP_ComponentGenerator_ID, null);
else
set_ValueNoCheck (COLUMNNAME_PP_ComponentGenerator_ID, PP_ComponentGenerator_ID);
}
@Override
public int getPP_ComponentGenerator_ID()
{
return get_ValueAsInt(COLUMNNAME_PP_ComponentGenerator_ID);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_PP_ComponentGenerator.java | 1 |
请完成以下Java代码 | public void setC_CompensationGroup_Schema_TemplateLine_ID (final int C_CompensationGroup_Schema_TemplateLine_ID)
{
if (C_CompensationGroup_Schema_TemplateLine_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_CompensationGroup_Schema_TemplateLine_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_CompensationGroup_Schema_TemplateLine_ID, C_CompensationGroup_Schema_TemplateLine_ID);
}
@Override
public int getC_CompensationGroup_Schema_TemplateLine_ID()
{
return get_ValueAsInt(COLUMNNAME_C_CompensationGroup_Schema_TemplateLine_ID);
}
@Override
public void setC_Flatrate_Conditions_ID (final int C_Flatrate_Conditions_ID)
{
if (C_Flatrate_Conditions_ID < 1)
set_Value (COLUMNNAME_C_Flatrate_Conditions_ID, null);
else
set_Value (COLUMNNAME_C_Flatrate_Conditions_ID, C_Flatrate_Conditions_ID);
}
@Override
public int getC_Flatrate_Conditions_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Flatrate_Conditions_ID);
}
@Override
public void setC_UOM_ID (final int C_UOM_ID)
{
if (C_UOM_ID < 1)
set_Value (COLUMNNAME_C_UOM_ID, null);
else
set_Value (COLUMNNAME_C_UOM_ID, C_UOM_ID);
}
@Override
public int getC_UOM_ID()
{
return get_ValueAsInt(COLUMNNAME_C_UOM_ID);
}
@Override
public void setIsAllowSeparateInvoicing (final boolean IsAllowSeparateInvoicing)
{
set_Value (COLUMNNAME_IsAllowSeparateInvoicing, IsAllowSeparateInvoicing);
}
@Override
public boolean isAllowSeparateInvoicing()
{
return get_ValueAsBoolean(COLUMNNAME_IsAllowSeparateInvoicing);
} | @Override
public void setIsHideWhenPrinting (final boolean IsHideWhenPrinting)
{
set_Value (COLUMNNAME_IsHideWhenPrinting, IsHideWhenPrinting);
}
@Override
public boolean isHideWhenPrinting()
{
return get_ValueAsBoolean(COLUMNNAME_IsHideWhenPrinting);
}
@Override
public void setM_Product_ID (final int M_Product_ID)
{
if (M_Product_ID < 1)
set_Value (COLUMNNAME_M_Product_ID, null);
else
set_Value (COLUMNNAME_M_Product_ID, M_Product_ID);
}
@Override
public int getM_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
@Override
public void setQty (final BigDecimal Qty)
{
set_Value (COLUMNNAME_Qty, Qty);
}
@Override
public BigDecimal getQty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setSeqNo (final int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, SeqNo);
}
@Override
public int getSeqNo()
{
return get_ValueAsInt(COLUMNNAME_SeqNo);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\de\metas\order\model\X_C_CompensationGroup_Schema_TemplateLine.java | 1 |
请完成以下Java代码 | public void setSeqNo (int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
}
/** Get Sequence.
@return Method of ordering records; lowest number comes first
*/
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Column span.
@param SpanX
Number of columns spanned
*/
public void setSpanX (int SpanX)
{
set_Value (COLUMNNAME_SpanX, Integer.valueOf(SpanX));
}
/** Get Column span.
@return Number of columns spanned
*/
public int getSpanX ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SpanX);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Row Span.
@param SpanY
Number of rows spanned
*/
public void setSpanY (int SpanY)
{
set_Value (COLUMNNAME_SpanY, Integer.valueOf(SpanY));
}
/** Get Row Span.
@return Number of rows spanned
*/
public int getSpanY ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SpanY);
if (ii == null)
return 0;
return ii.intValue();
}
public I_C_POSKeyLayout getSubKeyLayout() throws RuntimeException
{
return (I_C_POSKeyLayout)MTable.get(getCtx(), I_C_POSKeyLayout.Table_Name)
.getPO(getSubKeyLayout_ID(), get_TrxName()); }
/** Set Key Layout.
@param SubKeyLayout_ID
Key Layout to be displayed when this key is pressed
*/
public void setSubKeyLayout_ID (int SubKeyLayout_ID)
{
if (SubKeyLayout_ID < 1)
set_Value (COLUMNNAME_SubKeyLayout_ID, null);
else
set_Value (COLUMNNAME_SubKeyLayout_ID, Integer.valueOf(SubKeyLayout_ID));
} | /** Get Key Layout.
@return Key Layout to be displayed when this key is pressed
*/
public int getSubKeyLayout_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SubKeyLayout_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Text.
@param Text Text */
public void setText (String Text)
{
set_Value (COLUMNNAME_Text, Text);
}
/** Get Text.
@return Text */
public String getText ()
{
return (String)get_Value(COLUMNNAME_Text);
}
@Override
public I_AD_Reference getAD_Reference() throws RuntimeException
{
return (I_AD_Reference)MTable.get(getCtx(), I_AD_Reference.Table_Name)
.getPO(getAD_Reference_ID(), get_TrxName());
}
@Override
public int getAD_Reference_ID()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Reference_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public void setAD_Reference_ID(int AD_Reference_ID)
{
if (AD_Reference_ID < 1)
set_Value (COLUMNNAME_AD_Reference_ID, null);
else
set_Value (COLUMNNAME_AD_Reference_ID, Integer.valueOf(AD_Reference_ID));
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_POSKey.java | 1 |
请完成以下Java代码 | public boolean getBoolean(final String name, final boolean defaultValue)
{
Object value = UIManager.getDefaults().get(buildUIDefaultsKey(name));
if (value instanceof Boolean)
{
return (boolean)value;
}
if (uiSubClassID != null)
{
value = UIManager.getDefaults().get(name);
if (value instanceof Boolean)
{
return (boolean)value;
}
}
return defaultValue;
}
/**
* Convert all keys from given UI defaults key-value list by applying the <code>uiSubClassID</code> prefix to them.
*
* @param uiSubClassID
* @param keyValueList
* @return converted <code>keyValueList</code>
*/
public static final Object[] applyUISubClassID(final String uiSubClassID, final Object[] keyValueList)
{
if (keyValueList == null || keyValueList.length <= 0)
{
return keyValueList;
}
Check.assumeNotEmpty(uiSubClassID, "uiSubClassID not empty");
final Object[] keyValueListConverted = new Object[keyValueList.length];
for (int i = 0, max = keyValueList.length; i < max; i += 2)
{ | final Object keyOrig = keyValueList[i];
final Object value = keyValueList[i + 1];
final Object key;
if (keyOrig instanceof String)
{
key = buildUIDefaultsKey(uiSubClassID, (String)keyOrig);
}
else
{
key = keyOrig;
}
keyValueListConverted[i] = key;
keyValueListConverted[i + 1] = value;
}
return keyValueListConverted;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\plaf\UISubClassIDHelper.java | 1 |
请完成以下Java代码 | public org.compiere.model.I_C_ValidCombination getT_PayDiscount_Rev_A()
{
return get_ValueAsPO(COLUMNNAME_T_PayDiscount_Rev_Acct, org.compiere.model.I_C_ValidCombination.class);
}
@Override
public void setT_PayDiscount_Rev_A(org.compiere.model.I_C_ValidCombination T_PayDiscount_Rev_A)
{
set_ValueFromPO(COLUMNNAME_T_PayDiscount_Rev_Acct, org.compiere.model.I_C_ValidCombination.class, T_PayDiscount_Rev_A);
}
/** Set Steuerkorrektur erhaltene Skonti.
@param T_PayDiscount_Rev_Acct
Steuerabhängiges Konto zur Verbuchung erhaltener Skonti
*/
@Override
public void setT_PayDiscount_Rev_Acct (int T_PayDiscount_Rev_Acct)
{
set_Value (COLUMNNAME_T_PayDiscount_Rev_Acct, Integer.valueOf(T_PayDiscount_Rev_Acct));
}
/** Get Steuerkorrektur erhaltene Skonti.
@return Steuerabhängiges Konto zur Verbuchung erhaltener Skonti
*/
@Override
public int getT_PayDiscount_Rev_Acct ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_T_PayDiscount_Rev_Acct);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public org.compiere.model.I_C_ValidCombination getT_Receivables_A()
{
return get_ValueAsPO(COLUMNNAME_T_Receivables_Acct, org.compiere.model.I_C_ValidCombination.class);
}
@Override
public void setT_Receivables_A(org.compiere.model.I_C_ValidCombination T_Receivables_A)
{
set_ValueFromPO(COLUMNNAME_T_Receivables_Acct, org.compiere.model.I_C_ValidCombination.class, T_Receivables_A);
}
/** Set Steuerüberzahlungen.
@param T_Receivables_Acct
Konto für Steuerüberzahlungen
*/
@Override
public void setT_Receivables_Acct (int T_Receivables_Acct)
{
set_Value (COLUMNNAME_T_Receivables_Acct, Integer.valueOf(T_Receivables_Acct));
}
/** Get Steuerüberzahlungen.
@return Konto für Steuerüberzahlungen
*/ | @Override
public int getT_Receivables_Acct ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_T_Receivables_Acct);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public org.compiere.model.I_C_ValidCombination getT_Revenue_A()
{
return get_ValueAsPO(COLUMNNAME_T_Revenue_Acct, org.compiere.model.I_C_ValidCombination.class);
}
@Override
public void setT_Revenue_A(org.compiere.model.I_C_ValidCombination T_Revenue_A)
{
set_ValueFromPO(COLUMNNAME_T_Revenue_Acct, org.compiere.model.I_C_ValidCombination.class, T_Revenue_A);
}
/** Set Erlös Konto.
@param T_Revenue_Acct
Steuerabhängiges Konto zur Verbuchung Erlöse
*/
@Override
public void setT_Revenue_Acct (int T_Revenue_Acct)
{
set_Value (COLUMNNAME_T_Revenue_Acct, Integer.valueOf(T_Revenue_Acct));
}
/** Get Erlös Konto.
@return Steuerabhängiges Konto zur Verbuchung Erlöse
*/
@Override
public int getT_Revenue_Acct ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_T_Revenue_Acct);
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_C_Tax_Acct.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class UserController {
@RequestMapping("/saveUser")
public void saveUser(@Valid User user, BindingResult result) {
System.out.println("user:"+user);
if(result.hasErrors()) {
List<ObjectError> list = result.getAllErrors();
for (ObjectError error : list) {
System.out.println(error.getCode() + " - " + error.getDefaultMessage());
}
}
}
@RequestMapping("/getUser")
public User getUser() {
User user=new User();
user.setName("小明");
user.setAge(12);
user.setPass("123456");
return user;
} | @RequestMapping("/getUsers")
public List<User> getUsers() {
List<User> users=new ArrayList<User>();
User user1=new User();
user1.setName("neo");
user1.setAge(30);
user1.setPass("neo123");
users.add(user1);
User user2=new User();
user2.setName("小明");
user2.setAge(12);
user2.setPass("123456");
users.add(user2);
return users;
}
} | repos\spring-boot-leaning-master\2.x_data\1-2 Spring Boot 对 Web 开发的支持\spring-boot-web\src\main\java\com\neo\controller\UserController.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public void setCompleteTime(Date completeTime) {
this.completeTime = completeTime;
}
@Override
public String getBatchSearchKey() {
return batchSearchKey;
}
@Override
public void setBatchSearchKey(String batchSearchKey) {
this.batchSearchKey = batchSearchKey;
}
@Override
public String getBatchSearchKey2() {
return batchSearchKey2;
}
@Override
public void setBatchSearchKey2(String batchSearchKey2) {
this.batchSearchKey2 = batchSearchKey2;
}
@Override
public String getStatus() {
return status;
}
@Override
public void setStatus(String status) {
this.status = status;
}
@Override
public ByteArrayRef getBatchDocRefId() {
return batchDocRefId;
}
public void setBatchDocRefId(ByteArrayRef batchDocRefId) {
this.batchDocRefId = batchDocRefId;
}
@Override
public String getBatchDocumentJson(String engineType) {
if (batchDocRefId != null) {
byte[] bytes = batchDocRefId.getBytes(engineType);
if (bytes != null) {
return new String(bytes, StandardCharsets.UTF_8);
}
} | return null;
}
@Override
public void setBatchDocumentJson(String batchDocumentJson, String engineType) {
this.batchDocRefId = setByteArrayRef(this.batchDocRefId, BATCH_DOCUMENT_JSON_LABEL, batchDocumentJson, engineType);
}
@Override
public String getTenantId() {
return tenantId;
}
@Override
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
protected static ByteArrayRef setByteArrayRef(ByteArrayRef byteArrayRef, String name, String value, String engineType) {
if (byteArrayRef == null) {
byteArrayRef = new ByteArrayRef();
}
byte[] bytes = null;
if (value != null) {
bytes = value.getBytes(StandardCharsets.UTF_8);
}
byteArrayRef.setValue(name, bytes, engineType);
return byteArrayRef;
}
} | repos\flowable-engine-main\modules\flowable-batch-service\src\main\java\org\flowable\batch\service\impl\persistence\entity\BatchEntityImpl.java | 2 |
请完成以下Java代码 | public String getTextValue() {
return textValue;
}
public void setTextValue(String textValue) {
this.textValue = textValue;
}
public String getTextValue2() {
return textValue2;
}
public void setTextValue2(String textValue2) {
this.textValue2 = textValue2;
}
public byte[] getByteValue() {
return byteValue;
}
public void setByteValue(byte[] byteValue) {
this.byteValue = byteValue;
}
public int getRevision() {
return revision;
}
public void setRevision(int revision) {
this.revision = revision;
}
public void setByteArrayId(String id) {
byteArrayId = id;
}
public String getByteArrayId() {
return byteArrayId;
}
public String getVariableInstanceId() {
return variableInstanceId;
}
public void setVariableInstanceId(String variableInstanceId) {
this.variableInstanceId = variableInstanceId;
}
public String getScopeActivityInstanceId() {
return scopeActivityInstanceId;
}
public void setScopeActivityInstanceId(String scopeActivityInstanceId) { | this.scopeActivityInstanceId = scopeActivityInstanceId;
}
public void setInitial(Boolean isInitial) {
this.isInitial = isInitial;
}
public Boolean isInitial() {
return isInitial;
}
@Override
public String toString() {
return this.getClass().getSimpleName()
+ "[variableName=" + variableName
+ ", variableInstanceId=" + variableInstanceId
+ ", revision=" + revision
+ ", serializerName=" + serializerName
+ ", longValue=" + longValue
+ ", doubleValue=" + doubleValue
+ ", textValue=" + textValue
+ ", textValue2=" + textValue2
+ ", byteArrayId=" + byteArrayId
+ ", activityInstanceId=" + activityInstanceId
+ ", scopeActivityInstanceId=" + scopeActivityInstanceId
+ ", eventType=" + eventType
+ ", executionId=" + executionId
+ ", id=" + id
+ ", processDefinitionId=" + processDefinitionId
+ ", processInstanceId=" + processInstanceId
+ ", taskId=" + taskId
+ ", timestamp=" + timestamp
+ ", tenantId=" + tenantId
+ ", isInitial=" + isInitial
+ "]";
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\history\event\HistoricVariableUpdateEventEntity.java | 1 |
请完成以下Java代码 | public String getGroupTypeAttribute() {
return groupTypeAttribute;
}
public void setGroupTypeAttribute(String groupTypeAttribute) {
this.groupTypeAttribute = groupTypeAttribute;
}
public boolean isAllowAnonymousLogin() {
return allowAnonymousLogin;
}
public void setAllowAnonymousLogin(boolean allowAnonymousLogin) {
this.allowAnonymousLogin = allowAnonymousLogin;
}
public boolean isAuthorizationCheckEnabled() {
return authorizationCheckEnabled;
} | public void setAuthorizationCheckEnabled(boolean authorizationCheckEnabled) {
this.authorizationCheckEnabled = authorizationCheckEnabled;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public boolean isPasswordCheckCatchAuthenticationException() {
return passwordCheckCatchAuthenticationException;
}
public void setPasswordCheckCatchAuthenticationException(boolean passwordCheckCatchAuthenticationException) {
this.passwordCheckCatchAuthenticationException = passwordCheckCatchAuthenticationException;
}
} | repos\camunda-bpm-platform-master\engine-plugins\identity-ldap\src\main\java\org\camunda\bpm\identity\impl\ldap\LdapConfiguration.java | 1 |
请完成以下Java代码 | public class ProcessDefinitionStatisticsQueryImpl extends AbstractQuery<ProcessDefinitionStatisticsQuery, ProcessDefinitionStatistics>
implements ProcessDefinitionStatisticsQuery {
protected static final long serialVersionUID = 1L;
protected boolean includeFailedJobs = false;
protected boolean includeIncidents = false;
protected boolean includeRootIncidents = false;
protected String includeIncidentsForType;
public ProcessDefinitionStatisticsQueryImpl(CommandExecutor commandExecutor) {
super(commandExecutor);
}
@Override
public long executeCount(CommandContext commandContext) {
checkQueryOk();
return
commandContext
.getStatisticsManager()
.getStatisticsCountGroupedByProcessDefinitionVersion(this);
}
@Override
public List<ProcessDefinitionStatistics> executeList(CommandContext commandContext,
Page page) {
checkQueryOk();
return
commandContext
.getStatisticsManager()
.getStatisticsGroupedByProcessDefinitionVersion(this, page);
}
public ProcessDefinitionStatisticsQuery includeFailedJobs() {
includeFailedJobs = true;
return this;
}
public ProcessDefinitionStatisticsQuery includeIncidents() {
includeIncidents = true;
return this;
}
public ProcessDefinitionStatisticsQuery includeIncidentsForType(String incidentType) {
this.includeIncidentsForType = incidentType;
return this;
} | public boolean isFailedJobsToInclude() {
return includeFailedJobs;
}
public boolean isIncidentsToInclude() {
return includeIncidents || includeRootIncidents || includeIncidentsForType != null;
}
protected void checkQueryOk() {
super.checkQueryOk();
if (includeIncidents && includeIncidentsForType != null) {
throw new ProcessEngineException("Invalid query: It is not possible to use includeIncident() and includeIncidentForType() to execute one query.");
}
if (includeRootIncidents && includeIncidentsForType != null) {
throw new ProcessEngineException("Invalid query: It is not possible to use includeRootIncident() and includeIncidentForType() to execute one query.");
}
if (includeIncidents && includeRootIncidents) {
throw new ProcessEngineException("Invalid query: It is not possible to use includeIncident() and includeRootIncidents() to execute one query.");
}
}
@Override
public ProcessDefinitionStatisticsQuery includeRootIncidents() {
this.includeRootIncidents = true;
return this;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\ProcessDefinitionStatisticsQueryImpl.java | 1 |
请完成以下Java代码 | public boolean isSupportZoomInto() {return allowZoomInfo && widgetType.isSupportZoomInto();}
}
@Getter
private enum DisplayMode
{
DISPLAYED(true, false),
HIDDEN(false, false),
DISPLAYED_BY_SYSCONFIG(true, true),
HIDDEN_BY_SYSCONFIG(false, true),
;
private final boolean displayed;
private final boolean configuredBySysConfig;
DisplayMode(final boolean displayed, final boolean configuredBySysConfig) | {
this.displayed = displayed;
this.configuredBySysConfig = configuredBySysConfig;
}
}
@Value
@Builder
private static class ClassViewColumnLayoutDescriptor
{
@NonNull JSONViewDataType viewType;
DisplayMode displayMode;
int seqNo;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\view\descriptor\annotation\ViewColumnHelper.java | 1 |
请完成以下Java代码 | public int hashCode() {
return Objects.hash(modelKey, tenantId);
}
}
protected static class CacheValue {
protected final String json;
protected final int version;
protected final String definitionId;
public CacheValue(String json, ChannelDefinition definition) {
this.json = json;
this.version = definition.getVersion();
this.definitionId = definition.getId();
}
}
protected static class CacheRegisteredChannel implements RegisteredChannel {
protected final CacheValue value;
protected CacheRegisteredChannel(CacheValue value) {
this.value = value;
}
@Override
public int getChannelDefinitionVersion() {
return value.version;
}
@Override
public String getChannelDefinitionId() {
return value.definitionId;
}
}
protected class ChannelRegistrationImpl implements ChannelRegistration {
protected final boolean registered;
protected final CacheRegisteredChannel previousChannel; | protected final CacheKey cacheKey;
public ChannelRegistrationImpl(boolean registered, CacheRegisteredChannel previousChannel, CacheKey cacheKey) {
this.registered = registered;
this.previousChannel = previousChannel;
this.cacheKey = cacheKey;
}
@Override
public boolean registered() {
return registered;
}
@Override
public RegisteredChannel previousChannel() {
return previousChannel;
}
@Override
public void rollback() {
CacheValue cacheValue = previousChannel != null ? previousChannel.value : null;
if (cacheValue == null) {
cache.remove(cacheKey);
} else {
cache.put(cacheKey, cacheValue);
}
}
}
} | repos\flowable-engine-main\modules\flowable-event-registry\src\main\java\org\flowable\eventregistry\impl\deployer\DefaultInboundChannelModelCacheManager.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public String getExcelPath() {
return excelPath;
}
public void setExcelPath(String excelPath) {
this.excelPath = excelPath;
}
public String getPicsUrlPrefix() {
return picsUrlPrefix;
}
public void setPicsUrlPrefix(String picsUrlPrefix) {
this.picsUrlPrefix = picsUrlPrefix;
}
public Boolean getKaptchaOpen() {
return kaptchaOpen;
}
public void setKaptchaOpen(Boolean kaptchaOpen) {
this.kaptchaOpen = kaptchaOpen;
}
public Boolean getSwaggerOpen() {
return swaggerOpen;
}
public void setSwaggerOpen(Boolean swaggerOpen) {
this.swaggerOpen = swaggerOpen;
}
public Integer getSessionInvalidateTime() {
return sessionInvalidateTime;
}
public void setSessionInvalidateTime(Integer sessionInvalidateTime) {
this.sessionInvalidateTime = sessionInvalidateTime;
}
public Integer getSessionValidationInterval() {
return sessionValidationInterval;
}
public void setSessionValidationInterval(Integer sessionValidationInterval) {
this.sessionValidationInterval = sessionValidationInterval;
}
public String getFilesUrlPrefix() {
return filesUrlPrefix;
}
public void setFilesUrlPrefix(String filesUrlPrefix) {
this.filesUrlPrefix = filesUrlPrefix; | }
public String getFilesPath() {
return filesPath;
}
public void setFilesPath(String filesPath) {
this.filesPath = filesPath;
}
public Integer getHeartbeatTimeout() {
return heartbeatTimeout;
}
public void setHeartbeatTimeout(Integer heartbeatTimeout) {
this.heartbeatTimeout = heartbeatTimeout;
}
public String getPicsPath() {
return picsPath;
}
public void setPicsPath(String picsPath) {
this.picsPath = picsPath;
}
public String getPosapiUrlPrefix() {
return posapiUrlPrefix;
}
public void setPosapiUrlPrefix(String posapiUrlPrefix) {
this.posapiUrlPrefix = posapiUrlPrefix;
}
} | repos\SpringBootBucket-master\springboot-shiro\src\main\java\com\xncoding\pos\config\properties\MyProperties.java | 2 |
请完成以下Java代码 | public BigDecimal getPriceList ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PriceList);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set PO Price.
@param PricePO
Price based on a purchase order
*/
public void setPricePO (BigDecimal PricePO)
{
set_Value (COLUMNNAME_PricePO, PricePO);
}
/** Get PO Price.
@return Price based on a purchase order
*/
public BigDecimal getPricePO ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PricePO);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Quality Rating.
@param QualityRating
Method for rating vendors
*/
public void setQualityRating (int QualityRating)
{
set_Value (COLUMNNAME_QualityRating, Integer.valueOf(QualityRating));
}
/** Get Quality Rating.
@return Method for rating vendors
*/
public int getQualityRating ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_QualityRating);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Royalty Amount.
@param RoyaltyAmt
(Included) Amount for copyright, etc.
*/
public void setRoyaltyAmt (BigDecimal RoyaltyAmt)
{
set_Value (COLUMNNAME_RoyaltyAmt, RoyaltyAmt);
}
/** Get Royalty Amount.
@return (Included) Amount for copyright, etc.
*/
public BigDecimal getRoyaltyAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_RoyaltyAmt);
if (bd == null)
return Env.ZERO;
return bd;
} | /** Set UPC/EAN.
@param UPC
Bar Code (Universal Product Code or its superset European Article Number)
*/
public void setUPC (String UPC)
{
set_Value (COLUMNNAME_UPC, UPC);
}
/** Get UPC/EAN.
@return Bar Code (Universal Product Code or its superset European Article Number)
*/
public String getUPC ()
{
return (String)get_Value(COLUMNNAME_UPC);
}
/** Set Partner Category.
@param VendorCategory
Product Category of the Business Partner
*/
public void setVendorCategory (String VendorCategory)
{
set_Value (COLUMNNAME_VendorCategory, VendorCategory);
}
/** Get Partner Category.
@return Product Category of the Business Partner
*/
public String getVendorCategory ()
{
return (String)get_Value(COLUMNNAME_VendorCategory);
}
/** Set Partner Product Key.
@param VendorProductNo
Product Key of the Business Partner
*/
public void setVendorProductNo (String VendorProductNo)
{
set_Value (COLUMNNAME_VendorProductNo, VendorProductNo);
}
/** Get Partner Product Key.
@return Product Key of the Business Partner
*/
public String getVendorProductNo ()
{
return (String)get_Value(COLUMNNAME_VendorProductNo);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Product_PO.java | 1 |
请完成以下Java代码 | public abstract class AbstractSetJobsRetriesBatchCmd implements Command<Batch> {
protected int retries;
protected Date dueDate;
protected boolean isDueDateSet;
@Override
public Batch execute(CommandContext commandContext) {
BatchElementConfiguration elementConfiguration = collectJobIds(commandContext);
EnsureUtil.ensureNotEmpty(BadUserRequestException.class, "jobIds", elementConfiguration.getIds());
EnsureUtil.ensureGreaterThanOrEqual("Retries count", retries, 0);
if(dueDate == null && commandContext.getProcessEngineConfiguration().isEnsureJobDueDateNotNull()) {
dueDate = ClockUtil.getCurrentTime();
}
return new BatchBuilder(commandContext)
.config(getConfiguration(elementConfiguration))
.type(Batch.TYPE_SET_JOB_RETRIES)
.permission(BatchPermissions.CREATE_BATCH_SET_JOB_RETRIES)
.operationLogHandler(this::writeUserOperationLog)
.build();
}
protected void writeUserOperationLog(CommandContext commandContext, int numInstances) {
List<PropertyChange> propertyChanges = new ArrayList<>();
propertyChanges.add(new PropertyChange("nrOfInstances",
null,
numInstances));
propertyChanges.add(new PropertyChange("async", null, true)); | propertyChanges.add(new PropertyChange("retries", null, retries));
commandContext.getOperationLogManager()
.logJobOperation(UserOperationLogEntry.OPERATION_TYPE_SET_JOB_RETRIES,
null,
null,
null,
null,
null,
propertyChanges);
}
protected abstract BatchElementConfiguration collectJobIds(CommandContext commandContext);
public BatchConfiguration getConfiguration(BatchElementConfiguration elementConfiguration) {
return new SetJobRetriesBatchConfiguration(elementConfiguration.getIds(), elementConfiguration.getMappings(), retries, dueDate, isDueDateSet);
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmd\AbstractSetJobsRetriesBatchCmd.java | 1 |
请完成以下Java代码 | public static class Builder
{
private IUserRolePermissions userRolePermissions;
private GridTab gridTab;
private Integer maxQueryRecordsPerTab = null;
private Builder()
{
super();
}
public final GridTabMaxRowsRestrictionChecker build()
{
return new GridTabMaxRowsRestrictionChecker(this);
}
public Builder setUserRolePermissions(final IUserRolePermissions userRolePermissions)
{
this.userRolePermissions = userRolePermissions;
return this;
}
private WindowMaxQueryRecordsConstraint getConstraint()
{
return getUserRolePermissions()
.getConstraint(WindowMaxQueryRecordsConstraint.class)
.orElse(WindowMaxQueryRecordsConstraint.DEFAULT);
}
private IUserRolePermissions getUserRolePermissions()
{
if (userRolePermissions != null)
{
return userRolePermissions;
}
return Env.getUserRolePermissions();
}
public Builder setAD_Tab(final GridTab gridTab)
{
this.gridTab = gridTab;
return this;
} | public Builder setMaxQueryRecordsPerTab(final int maxQueryRecordsPerTab)
{
this.maxQueryRecordsPerTab = maxQueryRecordsPerTab;
return this;
}
private int getMaxQueryRecordsPerTab()
{
if (maxQueryRecordsPerTab != null)
{
return maxQueryRecordsPerTab;
}
else if (gridTab != null)
{
return gridTab.getMaxQueryRecords();
}
return 0;
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\compiere\model\GridTabMaxRowsRestrictionChecker.java | 1 |
请完成以下Java代码 | public void setPayAmt (final BigDecimal PayAmt)
{
set_Value (COLUMNNAME_PayAmt, PayAmt);
}
@Override
public BigDecimal getPayAmt()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PayAmt);
return bd != null ? bd : BigDecimal.ZERO;
}
/**
* PaymentRule AD_Reference_ID=195
* Reference name: _Payment Rule
*/
public static final int PAYMENTRULE_AD_Reference_ID=195;
/** Cash = B */
public static final String PAYMENTRULE_Cash = "B";
/** CreditCard = K */
public static final String PAYMENTRULE_CreditCard = "K";
/** DirectDeposit = T */
public static final String PAYMENTRULE_DirectDeposit = "T";
/** Check = S */
public static final String PAYMENTRULE_Check = "S";
/** OnCredit = P */
public static final String PAYMENTRULE_OnCredit = "P";
/** DirectDebit = D */
public static final String PAYMENTRULE_DirectDebit = "D";
/** Mixed = M */
public static final String PAYMENTRULE_Mixed = "M";
/** PayPal = L */
public static final String PAYMENTRULE_PayPal = "L";
/** PayPal Extern = V */
public static final String PAYMENTRULE_PayPalExtern = "V";
/** Kreditkarte Extern = U */
public static final String PAYMENTRULE_KreditkarteExtern = "U";
/** Sofortüberweisung = R */
public static final String PAYMENTRULE_Sofortueberweisung = "R";
/** Rückerstattung = E */
public static final String PAYMENTRULE_Rueckerstattung = "E";
/** Verrechnung = F */
public static final String PAYMENTRULE_Verrechnung = "F"; | @Override
public void setPaymentRule (final java.lang.String PaymentRule)
{
set_Value (COLUMNNAME_PaymentRule, PaymentRule);
}
@Override
public java.lang.String getPaymentRule()
{
return get_ValueAsString(COLUMNNAME_PaymentRule);
}
@Override
public void setReference (final @Nullable java.lang.String Reference)
{
set_Value (COLUMNNAME_Reference, Reference);
}
@Override
public java.lang.String getReference()
{
return get_ValueAsString(COLUMNNAME_Reference);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_PaySelectionLine.java | 1 |
请完成以下Java代码 | public CurrencyId getCurrencyId() {return amt.getCurrencyId();}
public UomId getUomId() {return qty.getUomId();}
public boolean isZero() {return amt.isZero() && qty.isZero();}
public CostAmountAndQty toZero() {return isZero() ? this : of(amt.toZero(), qty.toZero());}
public CostAmountAndQty negate() {return isZero() ? this : of(amt.negate(), qty.negate());}
public CostAmountAndQty mapQty(@NonNull final UnaryOperator<Quantity> qtyMapper)
{
if (qty.isZero())
{
return this;
}
final Quantity newQty = qtyMapper.apply(qty);
if (Objects.equals(qty, newQty))
{
return this;
}
return of(amt, newQty);
} | public CostAmountAndQty add(@NonNull final CostAmountAndQty other)
{
if (other.isZero())
{
return this;
}
else if (this.isZero())
{
return other;
}
else
{
return of(this.amt.add(other.amt), this.qty.add(other.qty));
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\costing\CostAmountAndQty.java | 1 |
请完成以下Java代码 | public class Addition implements CalculatorOperation {
private double left;
private double right;
private double result = 0.0;
public Addition(double left, double right) {
this.left = left;
this.right = right;
}
public double getLeft() {
return left;
}
public void setLeft(double left) {
this.left = left;
}
public double getRight() {
return right;
}
public void setRight(double right) { | this.right = right;
}
public double getResult() {
return result;
}
public void setResult(double result) {
this.result = result;
}
@Override
public void perform() {
result = left + right;
}
} | repos\tutorials-master\patterns-modules\solid\src\main\java\com\baeldung\o\Addition.java | 1 |
请完成以下Java代码 | public LocalDate getDocumentDate()
{
return TimeUtil.asLocalDate(getStatementDate());
}
/**
* Get Process Message
*
* @return clear text error message
*/
@Override
public String getProcessMsg()
{
return m_processMsg;
} // getProcessMsg
/**
* Get Document Owner (Responsible)
*
* @return AD_User_ID
*/
@Override
public int getDoc_User_ID()
{
return getCreatedBy();
} // getDoc_User_ID
/**
* Get Document Approval Amount
*
* @return amount difference
*/ | @Override
public BigDecimal getApprovalAmt()
{
return getStatementDifference();
} // getApprovalAmt
/**
* Get Currency
*
* @return Currency
*/
@Override
public int getC_Currency_ID()
{
return getCashBook().getC_Currency_ID();
} // getC_Currency_ID
/**
* Document Status is Complete or Closed
*
* @return true if CO, CL or RE
*/
public boolean isComplete()
{
String ds = getDocStatus();
return DOCSTATUS_Completed.equals(ds)
|| DOCSTATUS_Closed.equals(ds)
|| DOCSTATUS_Reversed.equals(ds);
} // isComplete
} // MCash | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MCash.java | 1 |
请完成以下Java代码 | public List<I_M_Source_HU> retrieveMatchingSourceHuMarkers(@NonNull final MatchingSourceHusQuery query)
{
return sourceHuDAO.retrieveActiveSourceHuMarkers(query);
}
@NonNull
public ImmutableList<I_M_Source_HU> retrieveSourceHuMarkers(@NonNull final Collection<HuId> huIds)
{
return sourceHuDAO.retrieveSourceHuMarkers(huIds);
}
public Set<HuId> retrieveMatchingSourceHUIds(@NonNull final MatchingSourceHusQuery query)
{
return sourceHuDAO.retrieveActiveSourceHUIds(query);
}
public boolean isSourceHu(final HuId huId)
{
return sourceHuDAO.isSourceHu(huId);
}
public void addSourceHUMarkerIfCarringComponents(@NonNull final HuId huId, @NonNull final ProductId productId, @NonNull final WarehouseId warehouseId)
{
addSourceHUMarkerIfCarringComponents(ImmutableSet.of(huId), productId, warehouseId);
}
/**
* Creates an M_Source_HU record for the given HU, if it carries component products and the target warehouse has
* the org.compiere.model.I_M_Warehouse#isReceiveAsSourceHU() flag.
*/
public void addSourceHUMarkerIfCarringComponents(@NonNull final Set<HuId> huIds, @NonNull final ProductId productId, @NonNull final WarehouseId warehouseId)
{
if (huIds.isEmpty()) {return;}
final I_M_Warehouse warehouse = warehousesRepo.getById(warehouseId);
if (!warehouse.isReceiveAsSourceHU())
{
return;
}
final boolean referencedInComponentOrVariant = productBOMDAO.isComponent(productId);
if (!referencedInComponentOrVariant)
{
return;
}
huIds.forEach(this::addSourceHuMarker);
}
/**
* Specifies which source HUs (products and warehouse) to retrieve in particular
*/
@lombok.Value
@lombok.Builder | @Immutable
public static class MatchingSourceHusQuery
{
/**
* Query for HUs that have any of the given product IDs. Empty means that no HUs will be found.
*/
@Singular
ImmutableSet<ProductId> productIds;
@Singular
ImmutableSet<WarehouseId> warehouseIds;
public static MatchingSourceHusQuery fromHuId(final HuId huId)
{
final IHandlingUnitsBL handlingUnitsBL = Services.get(IHandlingUnitsBL.class);
final I_M_HU hu = handlingUnitsBL.getById(huId);
final IHUStorageFactory storageFactory = handlingUnitsBL.getStorageFactory();
final IHUStorage storage = storageFactory.getStorage(hu);
final ImmutableSet<ProductId> productIds = storage.getProductStorages().stream()
.filter(productStorage -> !productStorage.isEmpty())
.map(IProductStorage::getProductId)
.collect(ImmutableSet.toImmutableSet());
final WarehouseId warehouseId = IHandlingUnitsBL.extractWarehouseId(hu);
return new MatchingSourceHusQuery(productIds, ImmutableSet.of(warehouseId));
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\sourcehu\SourceHUsService.java | 1 |
请完成以下Java代码 | public final String getTableName() {return po.get_TableName();}
@Override
public final int getId() {return po.get_ID();}
@Override
public TableRecordReference getRecordRef() {return TableRecordReference.of(po.get_TableName(), po.get_ID());}
@Override
public ClientId getClientId()
{
return ClientId.ofRepoId(po.getAD_Client_ID());
}
@Override
public OrgId getOrgId() {return OrgId.ofRepoId(po.getAD_Org_ID());}
@Override
public UserId getUpdatedBy() {return UserId.ofRepoIdOrSystem(po.getUpdatedBy());}
@Override
@Nullable
public DocStatus getDocStatus()
{
final int index = po.get_ColumnIndex("DocStatus");
return index >= 0
? DocStatus.ofNullableCodeOrUnknown((String)po.get_Value(index))
: null;
}
@Override
public boolean isProcessing() {return po.get_ValueAsBoolean("Processing");}
@Override
public boolean isProcessed() {return po.get_ValueAsBoolean("Processed");}
@Override
public boolean isActive() {return po.isActive();}
@Override
public PostingStatus getPostingStatus() {return PostingStatus.ofNullableCode(po.get_ValueAsString("Posted"));}
@Override
public boolean hasColumnName(final String columnName) {return po.getPOInfo().hasColumnName(columnName);}
@Override
public int getValueAsIntOrZero(final String columnName)
{
final int index = po.get_ColumnIndex(columnName);
if (index != -1)
{
final Integer ii = (Integer)po.get_Value(index);
if (ii != null)
{
return ii;
}
}
return 0;
}
@Override
@Nullable
public <T extends RepoIdAware> T getValueAsIdOrNull(final String columnName, final IntFunction<T> idOrNullMapper)
{
final int index = po.get_ColumnIndex(columnName);
if (index < 0) | {
return null;
}
final Object valueObj = po.get_Value(index);
final Integer valueInt = NumberUtils.asInteger(valueObj, null);
if (valueInt == null)
{
return null;
}
return idOrNullMapper.apply(valueInt);
}
@Override
@Nullable
public LocalDateAndOrgId getValueAsLocalDateOrNull(@NonNull final String columnName, @NonNull final Function<OrgId, ZoneId> timeZoneMapper)
{
final int index = po.get_ColumnIndex(columnName);
if (index != -1)
{
final Timestamp ts = po.get_ValueAsTimestamp(index);
if (ts != null)
{
final OrgId orgId = OrgId.ofRepoId(po.getAD_Org_ID());
return LocalDateAndOrgId.ofTimestamp(ts, orgId, timeZoneMapper);
}
}
return null;
}
@Override
@Nullable
public Boolean getValueAsBooleanOrNull(@NonNull final String columnName)
{
final int index = po.get_ColumnIndex(columnName);
if (index != -1)
{
final Object valueObj = po.get_Value(index);
return DisplayType.toBoolean(valueObj, null);
}
return null;
}
@Override
@Nullable
public String getValueAsString(@NonNull final String columnName)
{
final int index = po.get_ColumnIndex(columnName);
if (index != -1)
{
final Object valueObj = po.get_Value(index);
return valueObj != null ? valueObj.toString() : null;
}
return null;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\doc\POAcctDocModel.java | 1 |
请完成以下Java代码 | public T readConfiguration(byte[] serializedConfiguration) {
return getJsonConverterInstance().toObject(JsonUtil.asObject(serializedConfiguration));
}
protected abstract AbstractBatchConfigurationObjectConverter<T> getJsonConverterInstance();
@Override
public Class<? extends DbEntity> getEntityType() {
return BatchEntity.class;
}
@Override
public OptimisticLockingResult failedOperation(final DbOperation operation) {
if (operation instanceof DbEntityOperation) {
return OptimisticLockingResult.IGNORE;
} | return OptimisticLockingResult.THROW;
}
@Override
public int calculateInvocationsPerBatchJob(String batchType, T configuration) {
ProcessEngineConfigurationImpl engineConfig = Context.getProcessEngineConfiguration();
Map<String, Integer> invocationsPerBatchJobByBatchType = engineConfig.getInvocationsPerBatchJobByBatchType();
Integer invocationCount = invocationsPerBatchJobByBatchType.get(batchType);
if (invocationCount != null) {
return invocationCount;
} else {
return engineConfig.getInvocationsPerBatchJob();
}
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\batch\AbstractBatchJobHandler.java | 1 |
请完成以下Java代码 | public org.compiere.model.I_M_Allergen getM_Allergen()
{
return get_ValueAsPO(COLUMNNAME_M_Allergen_ID, org.compiere.model.I_M_Allergen.class);
}
@Override
public void setM_Allergen(final org.compiere.model.I_M_Allergen M_Allergen)
{
set_ValueFromPO(COLUMNNAME_M_Allergen_ID, org.compiere.model.I_M_Allergen.class, M_Allergen);
}
@Override
public void setM_Allergen_ID (final int M_Allergen_ID)
{
if (M_Allergen_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Allergen_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Allergen_ID, M_Allergen_ID);
}
@Override
public int getM_Allergen_ID()
{ | return get_ValueAsInt(COLUMNNAME_M_Allergen_ID);
}
@Override
public void setName (final java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Allergen_Trl.java | 1 |
请完成以下Java代码 | public void recalculateDuedate(boolean creationDateBased) {
try {
ManagementService managementService = engine.getManagementService();
managementService.recalculateJobDuedate(jobId, creationDateBased);
} catch (AuthorizationException e) {
throw e;
} catch(NotFoundException e) {// rewrite status code from bad request (400) to not found (404)
throw new InvalidRequestException(Status.NOT_FOUND, e, e.getMessage());
} catch (ProcessEngineException e) {
throw new InvalidRequestException(Status.INTERNAL_SERVER_ERROR, e.getMessage());
}
}
public void updateSuspensionState(JobSuspensionStateDto dto) {
dto.setJobId(jobId);
dto.updateSuspensionState(engine);
}
@Override
public void setJobPriority(PriorityDto dto) {
if (dto.getPriority() == null) {
throw new RestException(Status.BAD_REQUEST, "Priority for job '" + jobId + "' cannot be null.");
}
try { | ManagementService managementService = engine.getManagementService();
managementService.setJobPriority(jobId, dto.getPriority());
} catch (AuthorizationException e) {
throw e;
} catch (NotFoundException e) {
throw new InvalidRequestException(Status.NOT_FOUND, e.getMessage());
} catch (ProcessEngineException e) {
throw new RestException(Status.INTERNAL_SERVER_ERROR, e.getMessage());
}
}
public void deleteJob() {
try {
engine.getManagementService()
.deleteJob(jobId);
} catch (AuthorizationException e) {
throw e;
} catch (NullValueException e) {
throw new InvalidRequestException(Status.NOT_FOUND, e.getMessage());
} catch (ProcessEngineException e) {
throw new RestException(Status.INTERNAL_SERVER_ERROR, e.getMessage());
}
}
} | repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\sub\runtime\impl\JobResourceImpl.java | 1 |
请完成以下Java代码 | public class ImagePreview extends JComponent
implements PropertyChangeListener {
ImageIcon thumbnail = null;
File file = null;
public ImagePreview(JFileChooser fc) {
setPreferredSize(new Dimension(100, 50));
setBorder(new TitledBorder(BorderFactory.createEtchedBorder(),
Local.getString("Preview"), TitledBorder.CENTER, TitledBorder.ABOVE_TOP));
fc.addPropertyChangeListener(this);
}
public void loadImage() {
if (file == null) {
return;
}
ImageIcon tmpIcon = new ImageIcon(file.getPath());
if (tmpIcon.getIconWidth() > 90) {
thumbnail = new ImageIcon(tmpIcon.getImage().
getScaledInstance(90, -1,
Image.SCALE_DEFAULT));
} else {
thumbnail = tmpIcon;
}
}
public void propertyChange(PropertyChangeEvent e) {
String prop = e.getPropertyName();
if (prop.equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) {
file = (File) e.getNewValue();
if (isShowing()) { | loadImage();
repaint();
}
}
}
public void paintComponent(Graphics g) {
if (thumbnail == null) {
loadImage();
}
if (thumbnail != null) {
int x = getWidth()/2 - thumbnail.getIconWidth()/2;
int y = getHeight()/2 - thumbnail.getIconHeight()/2;
if (y < 0) {
y = 0;
}
if (x < 5) {
x = 5;
}
thumbnail.paintIcon(this, g, x, y);
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\net\sf\memoranda\ui\htmleditor\filechooser\ImagePreview.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class BookService {
@Autowired
private BookRepository bookRepository;
public List<Book> findAllBooks() {
return bookRepository.findAll();
}
public Book findBookById(Long bookId) {
return bookRepository.findById(bookId)
.orElseThrow(() -> new BookNotFoundException(String.format("Book not found. ID: %s", bookId)));
}
@Transactional(propagation = Propagation.REQUIRED)
public Book createBook(Book book) {
final Book newBook = new Book();
newBook.setTitle(book.getTitle());
newBook.setAuthor(book.getAuthor());
return bookRepository.save(newBook);
}
@Transactional(propagation = Propagation.REQUIRED)
public void deleteBook(Long bookId) {
bookRepository.deleteById(bookId);
}
@Transactional(propagation = Propagation.REQUIRED)
public Book updateBook(Map<String, String> updates, Long bookId) {
final Book book = findBookById(bookId);
updates.keySet()
.forEach(key -> {
switch (key) {
case "author": | book.setAuthor(updates.get(key));
break;
case "title":
book.setTitle(updates.get(key));
}
});
return bookRepository.save(book);
}
@Transactional(propagation = Propagation.REQUIRED)
public Book updateBook(Book book, Long bookId) {
Preconditions.checkNotNull(book);
Preconditions.checkState(book.getId() == bookId);
Preconditions.checkArgument(bookRepository.findById(bookId)
.isPresent());
return bookRepository.save(book);
}
} | repos\tutorials-master\spring-cloud-modules\spring-cloud-bootstrap\zipkin-log-svc-book\src\main\java\com\baeldung\spring\cloud\bootstrap\svcbook\book\BookService.java | 2 |
请完成以下Java代码 | protected void afterInOutProcessed(final org.compiere.model.I_M_InOut inout)
{
huInOutBL.setAssignedHandlingUnits(inout, getHUsReturned());
}
@Override
public boolean isEmpty()
{
// only empty if there are no product lines.
return inoutLinesBuilder.isEmpty();
}
@Override
public IReturnsInOutProducer addPackingMaterial(final I_M_HU_PackingMaterial packingMaterial, final int qty)
{
packingMaterialInoutLinesBuilder.addSource(packingMaterial, qty);
return this;
}
private Set<HUToReturn> getHUsToReturn()
{
Check.assumeNotEmpty(_husToReturn, "husToReturn is not empty");
return _husToReturn;
}
public List<I_M_HU> getHUsReturned()
{
return _husToReturn.stream()
.map(HUToReturn::getHu)
.collect(Collectors.toList());
} | public void addHUToReturn(@NonNull final I_M_HU hu, @NonNull final InOutLineId originalShipmentLineId)
{
_husToReturn.add(new HUToReturn(hu, originalShipmentLineId));
}
@Value
private static class HUToReturn
{
@NonNull I_M_HU hu;
@NonNull InOutLineId originalShipmentLineId;
private int getM_HU_ID()
{
return hu.getM_HU_ID();
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\inout\returns\customer\CustomerReturnsInOutProducer.java | 1 |
请完成以下Java代码 | public String login(int arg0, int arg1, int arg2)
{
return null;
}
@Override
public String modelChange(PO arg0, int arg1) throws Exception
{
return null;
}
private String sendEMail(final MADBoilerPlate text, final MInOut io, final I_AD_User orderUser)
{
final Properties ctx = Env.getCtx();
MADBoilerPlate.sendEMail(new IEMailEditor()
{
@Override
public Object getBaseObject()
{
return io;
}
@Override
public int getAD_Table_ID()
{
return io.get_Table_ID();
}
@Override
public int getRecord_ID()
{
return io.get_ID();
}
@Override
public EMail sendEMail(I_AD_User from, String toEmail, String subject, final BoilerPlateContext attributes)
{
final BoilerPlateContext attributesEffective = attributes.toBuilder()
.setSourceDocumentFromObject(io)
.build();
//
String message = text.getTextSnippetParsed(attributesEffective);
//
if (Check.isEmpty(message, true))
{
return null;
}
//
final StringTokenizer st = new StringTokenizer(toEmail, " ,;", false);
EMailAddress to = EMailAddress.ofString(st.nextToken());
MClient client = MClient.get(ctx, Env.getAD_Client_ID(ctx));
if (orderUser != null)
{
to = EMailAddress.ofString(orderUser.getEMail()); | }
EMail email = client.createEMail(
to,
text.getName(),
message,
true);
if (email == null)
{
throw new AdempiereException("Cannot create email. Check log.");
}
while (st.hasMoreTokens())
{
email.addTo(EMailAddress.ofString(st.nextToken()));
}
send(email);
return email;
}
}, false);
return "";
}
private void send(EMail email)
{
int maxRetries = p_SMTPRetriesNo > 0 ? p_SMTPRetriesNo : 0;
int count = 0;
do
{
final EMailSentStatus emailSentStatus = email.send();
count++;
if (emailSentStatus.isSentOK())
{
return;
}
// Timeout => retry
if (emailSentStatus.isSentConnectionError() && count < maxRetries)
{
log.warn("SMTP error: {} [ Retry {}/{} ]", emailSentStatus, count, maxRetries);
}
else
{
throw new EMailSendException(emailSentStatus);
}
}
while (true);
}
private void setNotified(I_M_PackageLine packageLine)
{
InterfaceWrapperHelper.getPO(packageLine).set_ValueOfColumn("IsSentMailNotification", true);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\shipping\model\validator\ShipperTransportationMailNotification.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class ExternalSystemConfigQRCode
{
@NonNull IExternalSystemChildConfigId childConfigId;
public static boolean equals(@Nullable final ExternalSystemConfigQRCode o1, @Nullable final ExternalSystemConfigQRCode o2)
{
return Objects.equals(o1, o2);
}
public String toGlobalQRCodeJsonString() {return ExternalSystemConfigQRCodeJsonConverter.toGlobalQRCodeJsonString(this);}
public static ExternalSystemConfigQRCode ofGlobalQRCode(@NonNull final GlobalQRCode globalQRCode) {return ExternalSystemConfigQRCodeJsonConverter.fromGlobalQRCode(globalQRCode);}
public PrintableQRCode toPrintableQRCode()
{
return PrintableQRCode.builder()
.qrCode(toGlobalQRCodeJsonString()) | .bottomText(getCaption())
.build();
}
@NonNull
public String getCaption()
{
return childConfigId.getType() + "-" + childConfigId.getRepoId();
}
public static boolean isTypeMatching(@NonNull final GlobalQRCode globalQRCode)
{
return ExternalSystemConfigQRCodeJsonConverter.isTypeMatching(globalQRCode);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java\de\metas\externalsystem\config\qrcode\ExternalSystemConfigQRCode.java | 2 |
请完成以下Java代码 | public Collection<ConfigAttribute> getAllConfigAttributes() {
Set<ConfigAttribute> set = new HashSet<>();
for (MethodSecurityMetadataSource s : this.methodSecurityMetadataSources) {
Collection<ConfigAttribute> attrs = s.getAllConfigAttributes();
if (attrs != null) {
set.addAll(attrs);
}
}
return set;
}
public List<MethodSecurityMetadataSource> getMethodSecurityMetadataSources() {
return this.methodSecurityMetadataSources;
}
private static class DefaultCacheKey {
private final Method method;
private final @Nullable Class<?> targetClass;
DefaultCacheKey(Method method, @Nullable Class<?> targetClass) {
this.method = method;
this.targetClass = targetClass;
}
@Override | public boolean equals(Object other) {
DefaultCacheKey otherKey = (DefaultCacheKey) other;
return (this.method.equals(otherKey.method)
&& ObjectUtils.nullSafeEquals(this.targetClass, otherKey.targetClass));
}
@Override
public int hashCode() {
return this.method.hashCode() * 21 + ((this.targetClass != null) ? this.targetClass.hashCode() : 0);
}
@Override
public String toString() {
String targetClassName = (this.targetClass != null) ? this.targetClass.getName() : "-";
return "CacheKey[" + targetClassName + "; " + this.method + "]";
}
}
} | repos\spring-security-main\access\src\main\java\org\springframework\security\access\method\DelegatingMethodSecurityMetadataSource.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class JpaApiUsageStateDao extends JpaAbstractDao<ApiUsageStateEntity, ApiUsageState> implements ApiUsageStateDao {
private final ApiUsageStateRepository apiUsageStateRepository;
public JpaApiUsageStateDao(ApiUsageStateRepository apiUsageStateRepository) {
this.apiUsageStateRepository = apiUsageStateRepository;
}
@Override
protected Class<ApiUsageStateEntity> getEntityClass() {
return ApiUsageStateEntity.class;
}
@Override
protected JpaRepository<ApiUsageStateEntity, UUID> getRepository() {
return apiUsageStateRepository;
}
@Override
public ApiUsageState findTenantApiUsageState(UUID tenantId) {
return DaoUtil.getData(apiUsageStateRepository.findByTenantId(tenantId));
}
@Override
public ApiUsageState findApiUsageStateByEntityId(EntityId entityId) {
return DaoUtil.getData(apiUsageStateRepository.findByEntityIdAndEntityType(entityId.getId(), entityId.getEntityType().name()));
}
@Override
public void deleteApiUsageStateByTenantId(TenantId tenantId) {
apiUsageStateRepository.deleteApiUsageStateByTenantId(tenantId.getId());
}
@Override | public void deleteApiUsageStateByEntityId(EntityId entityId) {
apiUsageStateRepository.deleteByEntityIdAndEntityType(entityId.getId(), entityId.getEntityType().name());
}
@Override
public PageData<ApiUsageState> findAllByTenantId(TenantId tenantId, PageLink pageLink) {
return DaoUtil.toPageData(apiUsageStateRepository.findAllByTenantId(tenantId.getId(), DaoUtil.toPageable(pageLink)));
}
@Override
public List<ApiUsageStateFields> findNextBatch(UUID id, int batchSize) {
return apiUsageStateRepository.findNextBatch(id, Limit.of(batchSize));
}
@Override
public EntityType getEntityType() {
return EntityType.API_USAGE_STATE;
}
} | repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\sql\usagerecord\JpaApiUsageStateDao.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class ArrayOfPatients extends ArrayList<Patient> {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() { | StringBuilder sb = new StringBuilder();
sb.append("class ArrayOfPatients {\n");
sb.append(" ").append(toIndentedString(super.toString())).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\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\alberta\alberta-patient-api\src\main\java\io\swagger\client\model\ArrayOfPatients.java | 2 |
请完成以下Java代码 | public class ParamFlowRuleEntity extends AbstractRuleEntity<ParamFlowRule> {
public ParamFlowRuleEntity() {
}
public ParamFlowRuleEntity(ParamFlowRule rule) {
AssertUtil.notNull(rule, "Authority rule should not be null");
this.rule = rule;
}
public static ParamFlowRuleEntity fromAuthorityRule(String app, String ip, Integer port, ParamFlowRule rule) {
ParamFlowRuleEntity entity = new ParamFlowRuleEntity(rule);
entity.setApp(app);
entity.setIp(ip);
entity.setPort(port);
return entity;
}
@JsonIgnore
@JSONField(serialize = false)
public String getLimitApp() {
return rule.getLimitApp();
}
@JsonIgnore
@JSONField(serialize = false)
public String getResource() {
return rule.getResource();
}
@JsonIgnore
@JSONField(serialize = false)
public int getGrade() {
return rule.getGrade();
}
@JsonIgnore
@JSONField(serialize = false)
public Integer getParamIdx() {
return rule.getParamIdx();
}
@JsonIgnore
@JSONField(serialize = false)
public double getCount() {
return rule.getCount();
}
@JsonIgnore
@JSONField(serialize = false)
public List<ParamFlowItem> getParamFlowItemList() {
return rule.getParamFlowItemList();
}
@JsonIgnore
@JSONField(serialize = false)
public int getControlBehavior() {
return rule.getControlBehavior(); | }
@JsonIgnore
@JSONField(serialize = false)
public int getMaxQueueingTimeMs() {
return rule.getMaxQueueingTimeMs();
}
@JsonIgnore
@JSONField(serialize = false)
public int getBurstCount() {
return rule.getBurstCount();
}
@JsonIgnore
@JSONField(serialize = false)
public long getDurationInSec() {
return rule.getDurationInSec();
}
@JsonIgnore
@JSONField(serialize = false)
public boolean isClusterMode() {
return rule.isClusterMode();
}
@JsonIgnore
@JSONField(serialize = false)
public ParamFlowClusterConfig getClusterConfig() {
return rule.getClusterConfig();
}
} | repos\spring-boot-student-master\spring-boot-student-sentinel-dashboard\src\main\java\com\alibaba\csp\sentinel\dashboard\datasource\entity\rule\ParamFlowRuleEntity.java | 1 |
请在Spring Boot框架中完成以下Java代码 | protected GenericEventSubscriptionEntity insertGenericEvent(EventSubscriptionBuilder eventSubscriptionBuilder) {
GenericEventSubscriptionEntity eventSubscription = createGenericEventSubscription();
eventSubscription.setEventType(eventSubscriptionBuilder.getEventType());
eventSubscription.setEventName(eventSubscriptionBuilder.getEventName());
eventSubscription.setExecutionId(eventSubscriptionBuilder.getExecutionId());
eventSubscription.setProcessInstanceId(eventSubscriptionBuilder.getProcessInstanceId());
eventSubscription.setActivityId(eventSubscriptionBuilder.getActivityId());
eventSubscription.setProcessDefinitionId(eventSubscriptionBuilder.getProcessDefinitionId());
eventSubscription.setSubScopeId(eventSubscriptionBuilder.getSubScopeId());
eventSubscription.setScopeId(eventSubscriptionBuilder.getScopeId());
eventSubscription.setScopeDefinitionId(eventSubscriptionBuilder.getScopeDefinitionId());
eventSubscription.setScopeDefinitionKey(eventSubscriptionBuilder.getScopeDefinitionKey());
eventSubscription.setScopeType(eventSubscriptionBuilder.getScopeType());
if (eventSubscriptionBuilder.getTenantId() != null) {
eventSubscription.setTenantId(eventSubscriptionBuilder.getTenantId());
}
eventSubscription.setConfiguration(eventSubscriptionBuilder.getConfiguration());
insert(eventSubscription); | return eventSubscription;
}
protected List<SignalEventSubscriptionEntity> toSignalEventSubscriptionEntityList(List<EventSubscriptionEntity> result) {
List<SignalEventSubscriptionEntity> signalEventSubscriptionEntities = new ArrayList<>(result.size());
for (EventSubscriptionEntity eventSubscriptionEntity : result) {
signalEventSubscriptionEntities.add((SignalEventSubscriptionEntity) eventSubscriptionEntity);
}
return signalEventSubscriptionEntities;
}
protected List<MessageEventSubscriptionEntity> toMessageEventSubscriptionEntityList(List<EventSubscriptionEntity> result) {
List<MessageEventSubscriptionEntity> messageEventSubscriptionEntities = new ArrayList<>(result.size());
for (EventSubscriptionEntity eventSubscriptionEntity : result) {
messageEventSubscriptionEntities.add((MessageEventSubscriptionEntity) eventSubscriptionEntity);
}
return messageEventSubscriptionEntities;
}
} | repos\flowable-engine-main\modules\flowable-eventsubscription-service\src\main\java\org\flowable\eventsubscription\service\impl\persistence\entity\EventSubscriptionEntityManagerImpl.java | 2 |
请完成以下Java代码 | public class ColorConverter extends CompositeConverter<ILoggingEvent> {
private static final Map<String, AnsiElement> ELEMENTS;
static {
Map<String, AnsiElement> ansiElements = new HashMap<>();
Arrays.stream(AnsiColor.values())
.filter((color) -> color != AnsiColor.DEFAULT)
.forEach((color) -> ansiElements.put(color.name().toLowerCase(Locale.ROOT), color));
ansiElements.put("faint", AnsiStyle.FAINT);
ELEMENTS = Collections.unmodifiableMap(ansiElements);
}
private static final Map<Integer, AnsiElement> LEVELS;
static {
Map<Integer, AnsiElement> ansiLevels = new HashMap<>();
ansiLevels.put(Level.ERROR_INTEGER, AnsiColor.RED);
ansiLevels.put(Level.WARN_INTEGER, AnsiColor.YELLOW);
LEVELS = Collections.unmodifiableMap(ansiLevels);
}
@Override
protected String transform(ILoggingEvent event, String in) { | AnsiElement color = ELEMENTS.get(getFirstOption());
if (color == null) {
// Assume highlighting
color = LEVELS.get(event.getLevel().toInteger());
color = (color != null) ? color : AnsiColor.GREEN;
}
return toAnsiString(in, color);
}
protected String toAnsiString(String in, AnsiElement element) {
return AnsiOutput.toString(element, in);
}
static String getName(AnsiElement element) {
return ELEMENTS.entrySet()
.stream()
.filter((entry) -> entry.getValue().equals(element))
.map(Map.Entry::getKey)
.findFirst()
.orElseThrow();
}
} | repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\logging\logback\ColorConverter.java | 1 |
请完成以下Java代码 | public boolean isWarnEnabled() {
return delegateLogger.isWarnEnabled();
}
/**
* @return true if the logger will log 'ERROR' messages
*/
public boolean isErrorEnabled() {
return delegateLogger.isErrorEnabled();
}
/**
* Formats a message template
*
* @param id the id of the message
* @param messageTemplate the message template to use
*
* @return the formatted template
*/
protected String formatMessageTemplate(String id, String messageTemplate) {
return projectCode + "-" + componentId + id + " " + messageTemplate;
}
/**
* Prepares an exception message
*
* @param id the id of the message
* @param messageTemplate the message template to use
* @param parameters the parameters for the message (optional) | *
* @return the prepared exception message
*/
protected String exceptionMessage(String id, String messageTemplate, Object... parameters) {
String formattedTemplate = formatMessageTemplate(id, messageTemplate);
if(parameters == null || parameters.length == 0) {
return formattedTemplate;
} else {
return MessageFormatter.arrayFormat(formattedTemplate, parameters).getMessage();
}
}
} | repos\camunda-bpm-platform-master\commons\logging\src\main\java\org\camunda\commons\logging\BaseLogger.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class Location {
private String city;
private String country;
@Id
private Long id;
@OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name = "LOCATION_ID")
private List<Store> stores = new ArrayList<>();
public String getCity() {
return city;
}
public String getCountry() {
return country;
}
public Long getId() {
return id;
} | public List<Store> getStores() {
return stores;
}
public void setCity(String city) {
this.city = city;
}
public void setCountry(String country) {
this.country = country;
}
public void setId(Long id) {
this.id = id;
}
public void setStores(List<Store> stores) {
this.stores = stores;
}
} | repos\tutorials-master\persistence-modules\spring-data-jpa-repo-2\src\main\java\com\baeldung\boot\domain\Location.java | 2 |
请完成以下Java代码 | public class CacheReloadIfTrueParamDescriptor implements ICachedMethodPartDescriptor
{
private final int parameterIndex;
public CacheReloadIfTrueParamDescriptor(final Class<?> parameterType, final int parameterIndex, final Annotation annotation)
{
super();
this.parameterIndex = parameterIndex;
if (Boolean.class == parameterType)
{
// OK, nothing to do
}
else if (boolean.class == parameterType)
{
// OK, nothing to do
}
else
{ | throw new CacheIntrospectionException("Parameter has unsupported type")
.setParameter(parameterIndex, parameterType);
}
}
@Override
public void extractKeyParts(final CacheKeyBuilder keyBuilder, final Object targetObject, final Object[] params)
{
final Boolean cacheReloadFlagObj = (Boolean)params[parameterIndex];
final boolean cacheReloadFlag = cacheReloadFlagObj == null ? false : cacheReloadFlagObj;
if (cacheReloadFlag)
{
keyBuilder.setCacheReload();
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\cache\interceptor\CacheReloadIfTrueParamDescriptor.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public IAutoCloseable newContext()
{
return HUContextHolder.temporarySet(handlingUnitsBL.createMutableHUContextForProcessing());
}
public ProductId getSingleProductId(@NonNull final HUQRCode huQRCode)
{
final HuId huId = huQRCodesService.getHuIdByQRCode(huQRCode);
return getSingleHUProductStorage(huId).getProductId();
}
public IHUProductStorage getSingleHUProductStorage(@NonNull final HuId huId)
{
return handlingUnitsBL.getSingleHUProductStorage(huId);
}
public Quantity getProductQuantity(@NonNull final HuId huId, @NonNull ProductId productId)
{
return getHUProductStorage(huId, productId)
.map(IHUProductStorage::getQty)
.filter(Quantity::isPositive)
.orElseThrow(() -> new AdempiereException(PRODUCT_DOES_NOT_MATCH));
}
private Optional<IHUProductStorage> getHUProductStorage(final @NotNull HuId huId, final @NotNull ProductId productId)
{
final I_M_HU hu = handlingUnitsBL.getById(huId); | final IHUStorageFactory storageFactory = handlingUnitsBL.getStorageFactory();
return Optional.ofNullable(storageFactory.getStorage(hu).getProductStorageOrNull(productId));
}
public void assetHUContainsProduct(@NonNull final HUQRCode huQRCode, @NonNull final ProductId productId)
{
final HuId huId = huQRCodesService.getHuIdByQRCode(huQRCode);
getProductQuantity(huId, productId); // shall throw exception if no qty found
}
public void deleteReservationsByDocumentRefs(final ImmutableSet<HUReservationDocRef> huReservationDocRefs)
{
huReservationService.deleteReservationsByDocumentRefs(huReservationDocRefs);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.distribution.rest-api\src\main\java\de\metas\distribution\mobileui\external_services\hu\DistributionHUService.java | 2 |
请完成以下Java代码 | public void setFrom_Product_ID (final int From_Product_ID)
{
if (From_Product_ID < 1)
set_Value (COLUMNNAME_From_Product_ID, null);
else
set_Value (COLUMNNAME_From_Product_ID, From_Product_ID);
}
@Override
public int getFrom_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_From_Product_ID);
}
@Override
public void setMatured_Product_ID (final int Matured_Product_ID)
{
if (Matured_Product_ID < 1)
set_Value (COLUMNNAME_Matured_Product_ID, null);
else
set_Value (COLUMNNAME_Matured_Product_ID, Matured_Product_ID);
}
@Override
public int getMatured_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_Matured_Product_ID);
}
@Override
public void setMaturityAge (final int MaturityAge)
{
set_Value (COLUMNNAME_MaturityAge, MaturityAge);
}
@Override
public int getMaturityAge()
{
return get_ValueAsInt(COLUMNNAME_MaturityAge);
}
@Override
public org.compiere.model.I_M_Maturing_Configuration getM_Maturing_Configuration()
{
return get_ValueAsPO(COLUMNNAME_M_Maturing_Configuration_ID, org.compiere.model.I_M_Maturing_Configuration.class);
} | @Override
public void setM_Maturing_Configuration(final org.compiere.model.I_M_Maturing_Configuration M_Maturing_Configuration)
{
set_ValueFromPO(COLUMNNAME_M_Maturing_Configuration_ID, org.compiere.model.I_M_Maturing_Configuration.class, M_Maturing_Configuration);
}
@Override
public void setM_Maturing_Configuration_ID (final int M_Maturing_Configuration_ID)
{
if (M_Maturing_Configuration_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Maturing_Configuration_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Maturing_Configuration_ID, M_Maturing_Configuration_ID);
}
@Override
public int getM_Maturing_Configuration_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Maturing_Configuration_ID);
}
@Override
public void setM_Maturing_Configuration_Line_ID (final int M_Maturing_Configuration_Line_ID)
{
if (M_Maturing_Configuration_Line_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Maturing_Configuration_Line_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Maturing_Configuration_Line_ID, M_Maturing_Configuration_Line_ID);
}
@Override
public int getM_Maturing_Configuration_Line_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Maturing_Configuration_Line_ID);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Maturing_Configuration_Line.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public String getContractNumber() {
return contractNumber;
}
/**
* Sets the value of the contractNumber property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setContractNumber(String value) {
this.contractNumber = value;
}
/**
* Gets the value of the thm property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isTHM() {
return thm;
}
/**
* Sets the value of the thm property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setTHM(Boolean value) {
this.thm = value;
}
/**
* Gets the value of the nonReturnableContainer property.
*
* @return
* possible object is
* {@link Boolean }
*
*/ | public Boolean isNonReturnableContainer() {
return nonReturnableContainer;
}
/**
* Sets the value of the nonReturnableContainer property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setNonReturnableContainer(Boolean value) {
this.nonReturnableContainer = value;
}
/**
* Gets the value of the specialConditionCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSpecialConditionCode() {
return specialConditionCode;
}
/**
* Sets the value of the specialConditionCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSpecialConditionCode(String value) {
this.specialConditionCode = value;
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\extensions\edifact\INVOICListLineItemExtensionType.java | 2 |
请完成以下Java代码 | public Function<RateLimitConfig, BucketConfiguration> getConfigurationBuilder() {
return configurationBuilder;
}
public void setConfigurationBuilder(Function<RateLimitConfig, BucketConfiguration> configurationBuilder) {
Objects.requireNonNull(configurationBuilder, "configurationBuilder may not be null");
this.configurationBuilder = configurationBuilder;
}
public long getCapacity() {
return capacity;
}
public RateLimitConfig setCapacity(long capacity) {
this.capacity = capacity;
return this;
}
public @Nullable Duration getPeriod() {
return period;
}
public RateLimitConfig setPeriod(Duration period) {
this.period = period;
return this;
}
public @Nullable Function<ServerRequest, String> getKeyResolver() {
return keyResolver;
}
public RateLimitConfig setKeyResolver(Function<ServerRequest, String> keyResolver) {
Objects.requireNonNull(keyResolver, "keyResolver may not be null");
this.keyResolver = keyResolver;
return this;
}
public HttpStatusCode getStatusCode() {
return statusCode;
}
public RateLimitConfig setStatusCode(HttpStatusCode statusCode) {
this.statusCode = statusCode;
return this;
}
public @Nullable Duration getTimeout() {
return timeout;
}
public RateLimitConfig setTimeout(Duration timeout) {
this.timeout = timeout; | return this;
}
public int getTokens() {
return tokens;
}
public RateLimitConfig setTokens(int tokens) {
Assert.isTrue(tokens > 0, "tokens must be greater than zero");
this.tokens = tokens;
return this;
}
public String getHeaderName() {
return headerName;
}
public RateLimitConfig setHeaderName(String headerName) {
Objects.requireNonNull(headerName, "headerName may not be null");
this.headerName = headerName;
return this;
}
}
public static class FilterSupplier extends SimpleFilterSupplier {
public FilterSupplier() {
super(Bucket4jFilterFunctions.class);
}
}
} | repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webmvc\src\main\java\org\springframework\cloud\gateway\server\mvc\filter\Bucket4jFilterFunctions.java | 1 |
请完成以下Java代码 | public static BPGroupId ofRepoIdOrNull(final int repoId)
{
if (repoId == STANDARD.repoId)
{
return STANDARD;
}
else if (repoId <= 0)
{
return null;
}
else
{
return new BPGroupId(repoId);
}
}
public static Optional<BPGroupId> optionalOfRepoId(final int repoId) {return Optional.ofNullable(ofRepoIdOrNull(repoId));} | public static int toRepoId(@Nullable final BPGroupId bpGroupId)
{
return bpGroupId != null ? bpGroupId.getRepoId() : -1;
}
@JsonValue
public int toJson()
{
return getRepoId();
}
public static boolean equals(@Nullable final BPGroupId o1, @Nullable final BPGroupId o2)
{
return Objects.equals(o1, o2);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\bpartner\BPGroupId.java | 1 |
请完成以下Java代码 | private void checkProductById(@NonNull final I_M_Product product)
{
if (!product.isBOM())
{
log.info("Product is not a BOM");
// No BOM - should not happen, but no problem
return;
}
// Check this level
checkProductBOMCyclesAndMarkAsVerified(product);
// Get Default BOM from this product
final I_PP_Product_BOM bom = productBOMDAO.getDefaultBOMByProductId(ProductId.ofRepoId(product.getM_Product_ID()))
.orElseThrow(() ->
new AdempiereException(NO_DEFAULT_PP_PRODUCT_BOM_FOR_PRODUCT_MESSAGE_KEY,
product.getValue() + "_" + product.getName()));
// Check All BOM Lines
for (final I_PP_Product_BOMLine tbomline : productBOMDAO.retrieveLines(bom)) | {
final ProductId productId = ProductId.ofRepoId(tbomline.getM_Product_ID());
final I_M_Product bomLineProduct = productBL.getById(productId);
checkProductBOMCyclesAndMarkAsVerified(bomLineProduct);
}
}
private void checkProductBOMCyclesAndMarkAsVerified(final I_M_Product product)
{
final ProductId productId = ProductId.ofRepoId(product.getM_Product_ID());
productBOMBL.checkCycles(productId);
product.setIsVerified(true);
InterfaceWrapperHelper.save(product);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\process\PP_Product_BOM_Check.java | 1 |
请完成以下Java代码 | public final class ALoginRes_zh extends ListResourceBundle
{
/** Translation Content */
static final Object[][] contents = new String[][]
{
{ "Connection", "\u9023\u7dda" },
{ "Defaults", "\u9810\u8a2d\u503c" },
{ "Login", "ADempiere \u767b\u5165" },
{ "File", "\u6a94\u6848" },
{ "Exit", "\u96e2\u958b" },
{ "Help", "\u8aaa\u660e" },
{ "About", "\u95dc\u65bc" },
{ "Host", "\u4e3b\u6a5f" },
{ "Database", "\u8cc7\u6599\u5eab" },
{ "User", "\u5e33\u865f" },
{ "EnterUser", "\u8acb\u9375\u5165\u5e33\u865f" },
{ "Password", "\u5bc6\u78bc" },
{ "EnterPassword", "\u8acb\u9375\u5165\u5bc6\u78bc" },
{ "Language", "\u8a9e\u8a00" },
{ "SelectLanguage", "\u9078\u64c7\u8a9e\u8a00" },
{ "Role", "\u89d2\u8272" },
{ "Client", "\u5BE6\u9AD4" }, // \u5ba2\u6236\u7aef
{ "Organization", "\u7d44\u7e54" },
{ "Date", "\u65e5\u671f" },
{ "Warehouse", "\u5009\u5eab" },
{ "Printer", "\u5370\u8868\u6a5f" },
{ "Connected", "\u5df2\u9023\u7dda" },
{ "NotConnected", "\u672a\u9023\u7dda" },
{ "DatabaseNotFound", "\u627e\u4e0d\u5230\u8cc7\u6599\u5eab" }, | { "UserPwdError", "\u5e33\u865f\u5bc6\u78bc\u4e0d\u6b63\u78ba" },
{ "RoleNotFound", "\u6c92\u6709\u9019\u89d2\u8272" },
{ "Authorized", "\u5df2\u6388\u6b0a" },
{ "Ok", "\u78ba\u5b9a" },
{ "Cancel", "\u53d6\u6d88" },
{ "VersionConflict", "\u7248\u672c\u885d\u7a81:" },
{ "VersionInfo", "\u4f3a\u670d\u7aef <> \u5ba2\u6236\u7aef" },
{ "PleaseUpgrade", "\u8acb\u57f7\u884c\u5347\u7d1a\u7a0b\u5f0f" }
};
/**
* Get Contents
* @return context
*/
public Object[][] getContents()
{
return contents;
} // getContents
} // ALoginRes | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\apps\ALoginRes_zh.java | 1 |
请完成以下Java代码 | public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getSalt() {
return salt;
}
public void setSalt(String salt) {
this.salt = salt;
} | public byte getState() {
return state;
}
public void setState(byte state) {
this.state = state;
}
public List<SysRole> getRoleList() {
return roleList;
}
public void setRoleList(List<SysRole> roleList) {
this.roleList = roleList;
}
/**
* Salt
* @return
*/
public String getCredentialsSalt(){
return this.username+this.salt;
}
} | repos\springboot-demo-master\shiro\src\main\java\com\et\shiro\entity\UserInfo.java | 1 |
请完成以下Java代码 | public static String concatenateUsingStringConcat(String[] values) {
String result = "";
for (String value : values) {
result = result.concat(getNonNullString(value));
}
return result;
}
public static String concatenateUsingCollectorsJoining(String[] values) {
String result = Stream.of(values).filter(value -> null != value).collect(Collectors.joining(""));
return result;
}
public static String concatenateUsingStringJoiner(String[] values) {
StringJoiner result = new StringJoiner("");
for (String value : values) {
result = result.add(getNonNullString(value));
}
return result.toString();
}
public static String concatenateUsingJoin(String[] values) {
String result = String.join("", values);
return result;
}
public static String concatenateUsingStringBuilder(String[] values) {
StringBuilder result = new StringBuilder();
for (String value : values) {
result = result.append(getNonNullString(value));
}
return result.toString();
} | public static String concatenateUsingHelperMethod(String[] values) {
String result = "";
for (String value : values) {
result = result + getNonNullString(value);
}
return result;
}
public static String concatenateUsingPlusOperator(String[] values) {
String result = "";
for (String value : values) {
result = result + (value == null ? "" : value);
}
return result;
}
private static String getNonNullString(String value) {
return value == null ? "" : value;
}
} | repos\tutorials-master\core-java-modules\core-java-string-operations-4\src\main\java\com\baeldung\concatenation\ConcatenatingNull.java | 1 |
请在Spring Boot框架中完成以下Java代码 | class DefaultGraphQlSchemaCondition extends SpringBootCondition implements ConfigurationCondition {
@Override
public ConfigurationCondition.ConfigurationPhase getConfigurationPhase() {
return ConfigurationCondition.ConfigurationPhase.REGISTER_BEAN;
}
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
boolean match = false;
List<ConditionMessage> messages = new ArrayList<>(2);
ConditionMessage.Builder message = ConditionMessage.forCondition(ConditionalOnGraphQlSchema.class);
Binder binder = Binder.get(context.getEnvironment());
GraphQlProperties.Schema schema = binder.bind("spring.graphql.schema", GraphQlProperties.Schema.class)
.orElse(new GraphQlProperties.Schema());
ResourcePatternResolver resourcePatternResolver = ResourcePatternUtils
.getResourcePatternResolver(context.getResourceLoader());
List<Resource> schemaResources = resolveSchemaResources(resourcePatternResolver, schema.getLocations(),
schema.getFileExtensions());
if (!schemaResources.isEmpty()) {
match = true;
messages.add(message.found("schema", "schemas").items(ConditionMessage.Style.QUOTE, schemaResources));
}
else {
messages.add(message.didNotFind("schema files in locations")
.items(ConditionMessage.Style.QUOTE, Arrays.asList(schema.getLocations())));
}
ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
Assert.state(beanFactory != null, "'beanFactory' must not be null");
String[] customizerBeans = beanFactory.getBeanNamesForType(GraphQlSourceBuilderCustomizer.class, false, false);
if (customizerBeans.length != 0) {
match = true;
messages.add(message.found("customizer", "customizers").items(Arrays.asList(customizerBeans)));
}
else {
messages.add((message.didNotFind("GraphQlSourceBuilderCustomizer").atAll()));
}
String[] graphQlSourceBeanNames = beanFactory.getBeanNamesForType(GraphQlSource.class, false, false);
if (graphQlSourceBeanNames.length != 0) { | match = true;
messages.add(message.found("GraphQlSource").items(Arrays.asList(graphQlSourceBeanNames)));
}
else {
messages.add((message.didNotFind("GraphQlSource").atAll()));
}
return new ConditionOutcome(match, ConditionMessage.of(messages));
}
private List<Resource> resolveSchemaResources(ResourcePatternResolver resolver, String[] locations,
String[] extensions) {
List<Resource> resources = new ArrayList<>();
for (String location : locations) {
for (String extension : extensions) {
resources.addAll(resolveSchemaResources(resolver, location + "*" + extension));
}
}
return resources;
}
private List<Resource> resolveSchemaResources(ResourcePatternResolver resolver, String pattern) {
try {
return Arrays.asList(resolver.getResources(pattern));
}
catch (IOException ex) {
return Collections.emptyList();
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-graphql\src\main\java\org\springframework\boot\graphql\autoconfigure\DefaultGraphQlSchemaCondition.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public DmnDeploymentBuilder tenantId(String tenantId) {
deployment.setTenantId(tenantId);
return this;
}
@Override
public DmnDeploymentBuilder parentDeploymentId(String parentDeploymentId) {
deployment.setParentDeploymentId(parentDeploymentId);
return this;
}
@Override
public DmnDeploymentBuilder enableDuplicateFiltering() {
isDuplicateFilterEnabled = true;
return this;
}
@Override
public DmnDeployment deploy() {
return repositoryService.deploy(this); | }
// getters and setters
// //////////////////////////////////////////////////////
public DmnDeploymentEntity getDeployment() {
return deployment;
}
public boolean isDmnXsdValidationEnabled() {
return isDmn20XsdValidationEnabled;
}
public boolean isDuplicateFilterEnabled() {
return isDuplicateFilterEnabled;
}
} | repos\flowable-engine-main\modules\flowable-dmn-engine\src\main\java\org\flowable\dmn\engine\impl\repository\DmnDeploymentBuilderImpl.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class StockChangeDetailQuery
{
@Nullable
public static StockChangeDetailQuery ofStockChangeDetailOrNull(
@Nullable final StockChangeDetail stockChangeDetail)
{
if (stockChangeDetail == null)
{
return null;
}
return StockChangeDetailQuery.builder()
.freshQuantityOnHandRepoId(stockChangeDetail.getFreshQuantityOnHandRepoId())
.freshQuantityOnHandLineRepoId(stockChangeDetail.getFreshQuantityOnHandLineRepoId())
.inventoryId(stockChangeDetail.getInventoryId())
.inventoryLineId(stockChangeDetail.getInventoryLineId())
.isReverted(stockChangeDetail.getIsReverted())
.build();
}
@Nullable
Integer freshQuantityOnHandRepoId;
@Nullable
Integer freshQuantityOnHandLineRepoId;
@Nullable
InventoryId inventoryId;
@Nullable
InventoryLineId inventoryLineId;
@Nullable
Boolean isReverted;
public void augmentQueryBuilder(@NonNull final IQueryBuilder<I_MD_Candidate> builder)
{
final IQueryBL queryBL = Services.get(IQueryBL.class);
final IQueryBuilder<I_MD_Candidate_StockChange_Detail> stockChangeDetailSubQueryBuilder = queryBL | .createQueryBuilder(I_MD_Candidate_StockChange_Detail.class)
.addOnlyActiveRecordsFilter();
final Integer computedFreshQtyOnHandId = NumberUtils.asInteger(getFreshQuantityOnHandRepoId(), -1);
if (computedFreshQtyOnHandId > 0)
{
stockChangeDetailSubQueryBuilder.addEqualsFilter(I_MD_Candidate_StockChange_Detail.COLUMN_Fresh_QtyOnHand_ID, computedFreshQtyOnHandId);
}
final Integer computedFreshQtyOnHandLineId = NumberUtils.asInteger(getFreshQuantityOnHandLineRepoId(), -1);
if (computedFreshQtyOnHandLineId > 0)
{
stockChangeDetailSubQueryBuilder.addEqualsFilter(I_MD_Candidate_StockChange_Detail.COLUMN_Fresh_QtyOnHand_Line_ID, computedFreshQtyOnHandLineId);
}
final Integer computedInventoryId = NumberUtils.asInteger(getInventoryId(), -1);
if (computedInventoryId > 0)
{
stockChangeDetailSubQueryBuilder.addEqualsFilter(I_MD_Candidate_StockChange_Detail.COLUMN_M_Inventory_ID, computedInventoryId);
}
final Integer computedInventoryLineId = NumberUtils.asInteger(getInventoryLineId(), -1);
if (computedInventoryLineId > 0)
{
stockChangeDetailSubQueryBuilder.addEqualsFilter(I_MD_Candidate_StockChange_Detail.COLUMN_M_InventoryLine_ID, computedInventoryLineId);
}
if (getIsReverted() != null)
{
stockChangeDetailSubQueryBuilder.addEqualsFilter(I_MD_Candidate_StockChange_Detail.COLUMN_IsReverted, getIsReverted());
}
builder.addInSubQueryFilter(I_MD_Candidate.COLUMN_MD_Candidate_ID,
I_MD_Candidate_StockChange_Detail.COLUMN_MD_Candidate_ID,
stockChangeDetailSubQueryBuilder.create());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.material\dispo-commons\src\main\java\de\metas\material\dispo\commons\repository\query\StockChangeDetailQuery.java | 2 |
请完成以下Java代码 | public static void main(String[] args) {
SpringApplication.run(SpringBoot2JdbcWithH2Application.class, args);
}
@Override
public void run(String... args) {
LOGGER.info("WITH JDBC TEMPLATE APPROACH...");
LOGGER.info("Student id 10001 -> {}", repository.findById(10001L));
LOGGER.info("Inserting -> {}", repository.insert(new Student(10010L, "John", "A1234657")));
LOGGER.info("Update 10003 -> {}", repository.update(new Student(10001L, "Name-Updated", "New-Passport")));
repository.deleteById(10002L);
LOGGER.info("All users -> {}", repository.findAll());
LOGGER.info("With Json format users -> {}", repository.findAll()); | // repository.findAll().forEach(student -> System.out.println(student.toJSON()));
LOGGER.info("WITH JDBC CLIENT APPROACH...");
LOGGER.info("Student id 10001 -> {}", jdbcClientRepository.findById(10001L));
LOGGER.info("Inserting -> {}", jdbcClientRepository.insert(new Student(10011L, "Ranga", "R1234657")));
LOGGER.info("Update 10011 -> {}", jdbcClientRepository.update(new Student(10011L, "Ranga Karanam", "New-Passport")));
jdbcClientRepository.deleteById(10002L);
LOGGER.info("All users -> {}", jdbcClientRepository.findAll());
}
} | repos\spring-boot-examples-master\spring-boot-2-jdbc-with-h2\src\main\java\com\in28minutes\springboot\jdbc\h2\example\SpringBoot2JdbcWithH2Application.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void setContent(String value) {
this.content = value;
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="Link" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"name",
"link"
})
public static class LinkAttachment {
@XmlElement(name = "Name")
protected String name;
@XmlElement(name = "Link", required = true)
protected String link;
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/** | * Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the link property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLink() {
return link;
}
/**
* Sets the value of the link property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLink(String value) {
this.link = value;
}
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\AttachmentsType.java | 2 |
请完成以下Java代码 | public class InOutDocumentLocationAdapterFactory implements DocumentLocationAdapterFactory
{
public static DocumentLocationAdapter locationAdapter(@NonNull final I_M_InOut delegate)
{
return new DocumentLocationAdapter(delegate);
}
public static DocumentDeliveryLocationAdapter deliveryLocationAdapter(@NonNull final I_M_InOut delegate)
{
return new DocumentDeliveryLocationAdapter(delegate);
}
@Override
public Optional<IDocumentLocationAdapter> getDocumentLocationAdapterIfHandled(final Object record)
{
return toInOut(record).map(InOutDocumentLocationAdapterFactory::locationAdapter);
}
@Override
public Optional<IDocumentBillLocationAdapter> getDocumentBillLocationAdapterIfHandled(final Object record)
{
return Optional.empty();
} | @Override
public Optional<IDocumentDeliveryLocationAdapter> getDocumentDeliveryLocationAdapter(final Object record)
{
return toInOut(record).map(InOutDocumentLocationAdapterFactory::deliveryLocationAdapter);
}
@Override
public Optional<IDocumentHandOverLocationAdapter> getDocumentHandOverLocationAdapter(final Object record)
{
return Optional.empty();
}
private static Optional<I_M_InOut> toInOut(final Object record)
{
return InterfaceWrapperHelper.isInstanceOf(record, I_M_InOut.class)
? Optional.of(InterfaceWrapperHelper.create(record, I_M_InOut.class))
: Optional.empty();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\inout\location\adapter\InOutDocumentLocationAdapterFactory.java | 1 |
请完成以下Java代码 | public <T extends CoreExecution> void performOperation(CoreAtomicOperation<T> operation) {
LOG.debugPerformingAtomicOperation(operation, this);
operation.execute((T) this);
}
@SuppressWarnings("unchecked")
public <T extends CoreExecution> void performOperationSync(CoreAtomicOperation<T> operation) {
LOG.debugPerformingAtomicOperation(operation, this);
operation.execute((T) this);
}
// event handling ////////////////////////////////////////////////////////
public String getEventName() {
return eventName;
}
public void setEventName(String eventName) {
this.eventName = eventName;
}
public CoreModelElement getEventSource() {
return eventSource;
}
public void setEventSource(CoreModelElement eventSource) {
this.eventSource = eventSource;
}
public int getListenerIndex() {
return listenerIndex;
}
public void setListenerIndex(int listenerIndex) {
this.listenerIndex = listenerIndex;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public void invokeListener(DelegateListener listener) throws Exception {
listener.notify(this);
}
public boolean hasFailedOnEndListeners() {
return false;
}
// getters / setters /////////////////////////////////////////////////
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getBusinessKeyWithoutCascade() {
return businessKeyWithoutCascade;
}
public void setBusinessKey(String businessKey) {
this.businessKey = businessKey;
this.businessKeyWithoutCascade = businessKey; | }
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public boolean isSkipCustomListeners() {
return skipCustomListeners;
}
public void setSkipCustomListeners(boolean skipCustomListeners) {
this.skipCustomListeners = skipCustomListeners;
}
public boolean isSkipIoMappings() {
return skipIoMapping;
}
public void setSkipIoMappings(boolean skipIoMappings) {
this.skipIoMapping = skipIoMappings;
}
public boolean isSkipSubprocesses() {
return skipSubprocesses;
}
public void setSkipSubprocesseses(boolean skipSubprocesses) {
this.skipSubprocesses = skipSubprocesses;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\core\instance\CoreExecution.java | 1 |
请完成以下Java代码 | protected void addConditionalStartEventSubscription(EventSubscriptionDeclaration conditionalEventDefinition, ProcessDefinitionEntity processDefinition) {
EventSubscriptionEntity newSubscription = conditionalEventDefinition.createSubscriptionForStartEvent(processDefinition);
newSubscription.insert();
}
enum ExprType {
USER, GROUP;
}
protected void addAuthorizationsFromIterator(Set<Expression> exprSet, ProcessDefinitionEntity processDefinition, ExprType exprType) {
if (exprSet != null) {
for (Expression expr : exprSet) {
IdentityLinkEntity identityLink = new IdentityLinkEntity();
identityLink.setProcessDef(processDefinition);
if (exprType.equals(ExprType.USER)) {
identityLink.setUserId(expr.toString());
} else if (exprType.equals(ExprType.GROUP)) {
identityLink.setGroupId(expr.toString());
}
identityLink.setType(IdentityLinkType.CANDIDATE);
identityLink.setTenantId(processDefinition.getTenantId());
identityLink.insert();
}
}
}
protected void addAuthorizations(ProcessDefinitionEntity processDefinition) {
addAuthorizationsFromIterator(processDefinition.getCandidateStarterUserIdExpressions(), processDefinition, ExprType.USER);
addAuthorizationsFromIterator(processDefinition.getCandidateStarterGroupIdExpressions(), processDefinition, ExprType.GROUP);
}
// context ///////////////////////////////////////////////////////////////////////////////////////////
protected DbEntityManager getDbEntityManager() {
return getCommandContext().getDbEntityManager();
}
protected JobManager getJobManager() {
return getCommandContext().getJobManager();
}
protected JobDefinitionManager getJobDefinitionManager() { | return getCommandContext().getJobDefinitionManager();
}
protected EventSubscriptionManager getEventSubscriptionManager() {
return getCommandContext().getEventSubscriptionManager();
}
protected ProcessDefinitionManager getProcessDefinitionManager() {
return getCommandContext().getProcessDefinitionManager();
}
// getters/setters ///////////////////////////////////////////////////////////////////////////////////
public ExpressionManager getExpressionManager() {
return expressionManager;
}
public void setExpressionManager(ExpressionManager expressionManager) {
this.expressionManager = expressionManager;
}
public BpmnParser getBpmnParser() {
return bpmnParser;
}
public void setBpmnParser(BpmnParser bpmnParser) {
this.bpmnParser = bpmnParser;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\bpmn\deployer\BpmnDeployer.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class DefaultDeviceAuthService implements DeviceAuthService {
private final DeviceService deviceService;
private final DeviceCredentialsService deviceCredentialsService;
public DefaultDeviceAuthService(DeviceService deviceService, DeviceCredentialsService deviceCredentialsService) {
this.deviceService = deviceService;
this.deviceCredentialsService = deviceCredentialsService;
}
@Override
public DeviceAuthResult process(DeviceCredentialsFilter credentialsFilter) {
log.trace("Lookup device credentials using filter {}", credentialsFilter);
DeviceCredentials credentials = deviceCredentialsService.findDeviceCredentialsByCredentialsId(credentialsFilter.getCredentialsId());
if (credentials != null) {
log.trace("Credentials found {}", credentials);
if (credentials.getCredentialsType() == credentialsFilter.getCredentialsType()) {
switch (credentials.getCredentialsType()) {
case ACCESS_TOKEN: | // Credentials ID matches Credentials value in this
// primitive case;
return DeviceAuthResult.of(credentials.getDeviceId());
case X509_CERTIFICATE:
return DeviceAuthResult.of(credentials.getDeviceId());
case LWM2M_CREDENTIALS:
return DeviceAuthResult.of(credentials.getDeviceId());
default:
return DeviceAuthResult.of("Credentials Type is not supported yet!");
}
} else {
return DeviceAuthResult.of("Credentials Type mismatch!");
}
} else {
log.trace("Credentials not found!");
return DeviceAuthResult.of("Credentials Not Found!");
}
}
} | repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\security\device\DefaultDeviceAuthService.java | 2 |
请完成以下Java代码 | public class DefaultApplicationArguments implements ApplicationArguments {
private final Source source;
private final String[] args;
public DefaultApplicationArguments(String... args) {
Assert.notNull(args, "'args' must not be null");
this.source = new Source(args);
this.args = args;
}
@Override
public String[] getSourceArgs() {
return this.args;
}
@Override
public Set<String> getOptionNames() {
String[] names = this.source.getPropertyNames();
return Collections.unmodifiableSet(new HashSet<>(Arrays.asList(names)));
}
@Override
public boolean containsOption(String name) {
return this.source.containsProperty(name);
}
@Override
public @Nullable List<String> getOptionValues(String name) {
List<String> values = this.source.getOptionValues(name);
return (values != null) ? Collections.unmodifiableList(values) : null;
}
@Override
public List<String> getNonOptionArgs() {
return this.source.getNonOptionArgs(); | }
private static class Source extends SimpleCommandLinePropertySource {
Source(String[] args) {
super(args);
}
@Override
public List<String> getNonOptionArgs() {
return super.getNonOptionArgs();
}
@Override
public @Nullable List<String> getOptionValues(String name) {
return super.getOptionValues(name);
}
}
} | repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\DefaultApplicationArguments.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public long findBatchPartCountByQueryCriteria(BatchPartQuery batchPartQuery) {
return dataManager.findBatchPartCountByQueryCriteria((BatchPartQueryImpl) batchPartQuery);
}
@Override
public BatchPartEntity createBatchPart(BatchEntity parentBatch, String status, String scopeId, String subScopeId, String scopeType) {
BatchPartEntity batchPartEntity = dataManager.create();
batchPartEntity.setBatchId(parentBatch.getId());
batchPartEntity.setType(parentBatch.getBatchType());
batchPartEntity.setBatchType(parentBatch.getBatchType());
batchPartEntity.setScopeId(scopeId);
batchPartEntity.setSubScopeId(subScopeId);
batchPartEntity.setScopeType(scopeType);
batchPartEntity.setSearchKey(parentBatch.getBatchSearchKey());
batchPartEntity.setSearchKey2(parentBatch.getBatchSearchKey2());
batchPartEntity.setBatchSearchKey(parentBatch.getBatchSearchKey());
batchPartEntity.setBatchSearchKey2(parentBatch.getBatchSearchKey2());
batchPartEntity.setStatus(status);
if (parentBatch.getTenantId() != null) {
batchPartEntity.setTenantId(parentBatch.getTenantId());
}
batchPartEntity.setCreateTime(getClock().getCurrentTime());
insert(batchPartEntity);
return batchPartEntity;
}
@Override
public BatchPartEntity completeBatchPart(String batchPartId, String status, String resultJson) {
BatchPartEntity batchPartEntity = getBatchPartEntityManager().findById(batchPartId); | batchPartEntity.setCompleteTime(getClock().getCurrentTime());
batchPartEntity.setStatus(status);
batchPartEntity.setResultDocumentJson(resultJson, serviceConfiguration.getEngineName());
return batchPartEntity;
}
@Override
public void deleteBatchPartEntityAndResources(BatchPartEntity batchPartEntity) {
ByteArrayRef resultDocRefId = batchPartEntity.getResultDocRefId();
if (resultDocRefId != null && resultDocRefId.getId() != null) {
resultDocRefId.delete(serviceConfiguration.getEngineName());
}
delete(batchPartEntity);
}
protected BatchPartEntityManager getBatchPartEntityManager() {
return serviceConfiguration.getBatchPartEntityManager();
}
} | repos\flowable-engine-main\modules\flowable-batch-service\src\main\java\org\flowable\batch\service\impl\persistence\entity\BatchPartEntityManagerImpl.java | 2 |
请完成以下Java代码 | public class BufferedReaderExample {
public String readAllLines(BufferedReader reader) throws IOException {
StringBuilder content = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
content.append(line);
content.append(System.lineSeparator());
}
return content.toString();
}
public String readAllLinesWithStream(BufferedReader reader) {
return reader
.lines()
.collect(Collectors.joining(System.lineSeparator()));
}
public String readAllCharsOneByOne(BufferedReader reader) throws IOException {
StringBuilder content = new StringBuilder();
int value;
while ((value = reader.read()) != -1) {
content.append((char) value);
}
return content.toString();
}
public String readMultipleChars(BufferedReader reader) throws IOException {
int length = 5;
char[] chars = new char[length];
int charsRead = reader.read(chars, 0, length);
String result;
if (charsRead != -1) {
result = new String(chars, 0, charsRead);
} else { | result = "";
}
return result;
}
public String readFile() {
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader("src/main/resources/input.txt"));
String content = readAllLines(reader);
return content;
} catch (IOException e) {
e.printStackTrace();
return null;
} finally {
try {
if (reader != null) {
reader.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
public String readFileTryWithResources() {
try (BufferedReader reader = new BufferedReader(new FileReader("src/main/resources/input.txt"))) {
String content = readAllLines(reader);
return content;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
} | repos\tutorials-master\core-java-modules\core-java-io-apis\src\main\java\com\baeldung\bufferedreader\BufferedReaderExample.java | 1 |
请完成以下Java代码 | public DmnHitPolicyHandler getHitPolicyHandler() {
return hitPolicyHandler;
}
public void setHitPolicyHandler(DmnHitPolicyHandler hitPolicyHandler) {
this.hitPolicyHandler = hitPolicyHandler;
}
public List<DmnDecisionTableInputImpl> getInputs() {
return inputs;
}
public void setInputs(List<DmnDecisionTableInputImpl> inputs) {
this.inputs = inputs;
}
public List<DmnDecisionTableOutputImpl> getOutputs() {
return outputs;
}
public void setOutputs(List<DmnDecisionTableOutputImpl> outputs) { | this.outputs = outputs;
}
public List<DmnDecisionTableRuleImpl> getRules() {
return rules;
}
public void setRules(List<DmnDecisionTableRuleImpl> rules) {
this.rules = rules;
}
@Override
public String toString() {
return "DmnDecisionTableImpl{" +
" hitPolicyHandler=" + hitPolicyHandler +
", inputs=" + inputs +
", outputs=" + outputs +
", rules=" + rules +
'}';
}
} | repos\camunda-bpm-platform-master\engine-dmn\engine\src\main\java\org\camunda\bpm\dmn\engine\impl\DmnDecisionTableImpl.java | 1 |
请完成以下Java代码 | default boolean getFieldValueAsBoolean(@NonNull final String fieldName, final boolean defaultValueIfNotFoundOrError)
{
return getFieldNameAndJsonValues().getAsBoolean(fieldName, defaultValueIfNotFoundOrError);
}
default Object getFieldValueAsJsonObject(@NonNull final String fieldName, final JSONOptions jsonOpts)
{
return getFieldNameAndJsonValues().getAsJsonObject(fieldName, jsonOpts);
}
default Comparable<?> getFieldValueAsComparable(@NonNull final String fieldName, final JSONOptions jsonOpts)
{
return getFieldNameAndJsonValues().getAsComparable(fieldName, jsonOpts);
}
default boolean isFieldEmpty(@NonNull final String fieldName) {return getFieldNameAndJsonValues().isEmpty(fieldName);}
default Map<String, DocumentFieldWidgetType> getWidgetTypesByFieldName()
{
return ImmutableMap.of();
}
default Map<String, ViewEditorRenderMode> getViewEditorRenderModeByFieldName()
{
return ImmutableMap.of();
}
//
// Included documents (children)
// @formatter:off
default Collection<? extends IViewRow> getIncludedRows() { return ImmutableList.of(); }
// @formatter:on
//
// Attributes
// @formatter:off
default boolean hasAttributes() { return false; } | default IViewRowAttributes getAttributes() { throw new EntityNotFoundException("Row does not support attributes"); }
// @formatter:on
//
// IncludedView
// @formatter:off
default ViewId getIncludedViewId() { return null; }
// @formatter:on
//
// Single column row
// @formatter:off
/** @return true if frontend shall display one single column */
default boolean isSingleColumn() { return false; }
/** @return text to be displayed if {@link #isSingleColumn()} */
default ITranslatableString getSingleColumnCaption() { return TranslatableStrings.empty(); }
// @formatter:on
/**
* @return a stream of given row and all it's included rows recursively
*/
default Stream<IViewRow> streamRecursive()
{
return this.getIncludedRows()
.stream()
.map(IViewRow::streamRecursive)
.reduce(Stream.of(this), Stream::concat);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\view\IViewRow.java | 1 |
请完成以下Java代码 | private static BigDecimal toBigDecimalOr(@Nullable final Quantity quantity, @Nullable final BigDecimal defaultValue)
{
if (quantity == null)
{
return defaultValue;
}
return quantity.toBigDecimal();
}
public static class QuantityDeserializer extends StdDeserializer<Quantity>
{
private static final long serialVersionUID = -5406622853902102217L;
public QuantityDeserializer()
{
super(Quantity.class);
}
@Override
public Quantity deserialize(final JsonParser p, final DeserializationContext ctx) throws IOException
{
final JsonNode node = p.getCodec().readTree(p);
final String qtyStr = node.get("qty").asText();
final int uomRepoId = (Integer)node.get("uomId").numberValue();
final String sourceQtyStr;
final int sourceUomRepoId;
if (node.has("sourceQty"))
{
sourceQtyStr = node.get("sourceQty").asText();
sourceUomRepoId = (Integer)node.get("sourceUomId").numberValue();
}
else
{
sourceQtyStr = qtyStr;
sourceUomRepoId = uomRepoId;
}
return Quantitys.of(
new BigDecimal(qtyStr), UomId.ofRepoId(uomRepoId),
new BigDecimal(sourceQtyStr), UomId.ofRepoId(sourceUomRepoId));
}
}
public static class QuantitySerializer extends StdSerializer<Quantity>
{
private static final long serialVersionUID = -8292209848527230256L;
public QuantitySerializer()
{
super(Quantity.class);
}
@Override | public void serialize(final Quantity value, final JsonGenerator gen, final SerializerProvider provider) throws IOException
{
gen.writeStartObject();
final String qtyStr = value.toBigDecimal().toString();
final int uomId = value.getUomId().getRepoId();
gen.writeFieldName("qty");
gen.writeString(qtyStr);
gen.writeFieldName("uomId");
gen.writeNumber(uomId);
final String sourceQtyStr = value.getSourceQty().toString();
final int sourceUomId = value.getSourceUomId().getRepoId();
if (!qtyStr.equals(sourceQtyStr) || uomId != sourceUomId)
{
gen.writeFieldName("sourceQty");
gen.writeString(sourceQtyStr);
gen.writeFieldName("sourceUomId");
gen.writeNumber(sourceUomId);
}
gen.writeEndObject();
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\quantity\Quantitys.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public @Nullable String retentionPolicy() {
return get(InfluxProperties::getRetentionPolicy, InfluxConfig.super::retentionPolicy);
}
@Override
public @Nullable Integer retentionReplicationFactor() {
return get(InfluxProperties::getRetentionReplicationFactor, InfluxConfig.super::retentionReplicationFactor);
}
@Override
public @Nullable String retentionDuration() {
return get(InfluxProperties::getRetentionDuration, InfluxConfig.super::retentionDuration);
}
@Override
public @Nullable String retentionShardDuration() {
return get(InfluxProperties::getRetentionShardDuration, InfluxConfig.super::retentionShardDuration);
}
@Override
public String uri() {
return obtain(InfluxProperties::getUri, InfluxConfig.super::uri);
}
@Override
public boolean compressed() {
return obtain(InfluxProperties::isCompressed, InfluxConfig.super::compressed);
}
@Override
public boolean autoCreateDb() {
return obtain(InfluxProperties::isAutoCreateDb, InfluxConfig.super::autoCreateDb);
}
@Override
public InfluxApiVersion apiVersion() {
return obtain(InfluxProperties::getApiVersion, InfluxConfig.super::apiVersion);
} | @Override
public @Nullable String org() {
return get(InfluxProperties::getOrg, InfluxConfig.super::org);
}
@Override
public String bucket() {
return obtain(InfluxProperties::getBucket, InfluxConfig.super::bucket);
}
@Override
public @Nullable String token() {
return get(InfluxProperties::getToken, InfluxConfig.super::token);
}
} | repos\spring-boot-4.0.1\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\export\influx\InfluxPropertiesConfigAdapter.java | 2 |
请完成以下Java代码 | public boolean isLessThanOrEqualTo(final int other)
{
return isLimited() && value <= other;
}
public boolean isLimitHitOrExceeded(@NonNull final Collection<?> collection)
{
return isLimitHitOrExceeded(collection.size());
}
public boolean isLimitHitOrExceeded(@NonNull final MutableInt countHolder)
{
return isLimitHitOrExceeded(countHolder.getValue());
}
public boolean isLimitHitOrExceeded(final int count)
{
return isLimited() && value <= count;
}
public boolean isBelowLimit(@NonNull final Collection<?> collection)
{
return isNoLimit() || value > collection.size();
}
public QueryLimit minusSizeOf(@NonNull final Collection<?> collection)
{ | if (isNoLimit() || collection.isEmpty())
{
return this;
}
else
{
final int collectionSize = collection.size();
final int newLimitInt = value - collectionSize;
if (newLimitInt <= 0)
{
throw new AdempiereException("Invalid collection size. It shall be less than " + value + " but it was " + collectionSize);
}
return ofInt(newLimitInt);
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\dao\QueryLimit.java | 1 |
请完成以下Java代码 | public void removeAllElements()
{
super.removeAllElements();
clear();
} // removeAllElements
private void clear()
{
// if (m_lookup != null)
// {
// m_lookup.clear();
// }
if (m_lookupDirect != null)
{
m_lookupDirect.clear();
}
}
static ArrayKey createValidationKey(final IValidationContext validationCtx, final MLookupInfo lookupInfo, final Object parentValidationKey)
{
final List<Object> keys = new ArrayList<>();
// final String rowIndexStr = validationCtx.get_ValueAsString(GridTab.CTX_CurrentRow);
// keys.add(rowIndexStr);
if (IValidationContext.NULL != validationCtx)
{
for (final String parameterName : lookupInfo.getValidationRule().getAllParameters())
{
final String parameterValue = validationCtx.get_ValueAsString(parameterName);
keys.add(parameterName);
keys.add(parameterValue);
}
}
keys.add(parentValidationKey);
return new ArrayKey(keys.toArray());
}
// metas: begin
@Override
public String getTableName()
{
return m_info.getTableName().getAsString();
}
@Override
public boolean isAutoComplete()
{
return m_info != null && m_info.isAutoComplete();
} | public MLookupInfo getLookupInfo()
{
return m_info;
}
@Override
public Set<String> getParameters()
{
return m_info.getValidationRule().getAllParameters();
}
@Override
public IValidationContext getValidationContext()
{
return m_evalCtx;
}
public boolean isNumericKey()
{
return getColumnName().endsWith("_ID");
}
@Override
public NamePair suggestValidValue(final NamePair value)
{
return null;
}
} // MLookup | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MLookup.java | 1 |
请完成以下Java代码 | public void execute(CommandContext commandContext, PlanItemInstanceEntity planItemInstanceEntity) {
// Nothing to do, logic happens on state transition
}
@Override
public void trigger(CommandContext commandContext, PlanItemInstanceEntity planItemInstanceEntity) {
RepetitionRule repetitionRule = ExpressionUtil.getRepetitionRule(planItemInstanceEntity);
if (repetitionRule != null && ExpressionUtil.evaluateRepetitionRule(commandContext, planItemInstanceEntity, planItemInstanceEntity.getStagePlanItemInstanceEntity())) {
PlanItemInstanceEntity eventPlanItemInstanceEntity = PlanItemInstanceUtil.copyAndInsertPlanItemInstance(commandContext, planItemInstanceEntity, false, false);
CmmnEngineAgenda agenda = CommandContextUtil.getAgenda(commandContext);
agenda.planCreatePlanItemInstanceWithoutEvaluationOperation(eventPlanItemInstanceEntity);
agenda.planOccurPlanItemInstanceOperation(eventPlanItemInstanceEntity);
CommandContextUtil.getCmmnEngineConfiguration(commandContext).getListenerNotificationHelper().executeLifecycleListeners(
commandContext, planItemInstanceEntity, PlanItemInstanceState.ACTIVE, PlanItemInstanceState.AVAILABLE);
} else { | CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
EventSubscriptionService eventSubscriptionService = cmmnEngineConfiguration.getEventSubscriptionServiceConfiguration().getEventSubscriptionService();
List<EventSubscriptionEntity> eventSubscriptions = eventSubscriptionService.findEventSubscriptionsBySubScopeId(planItemInstanceEntity.getId());
for (EventSubscriptionEntity eventSubscription : eventSubscriptions) {
if ("variable".equals(eventSubscription.getEventType()) && variableEventListener.getVariableName().equals(eventSubscription.getEventName())) {
eventSubscriptionService.deleteEventSubscription(eventSubscription);
}
}
CommandContextUtil.getAgenda(commandContext).planOccurPlanItemInstanceOperation(planItemInstanceEntity);
}
}
} | repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\behavior\impl\VariableEventListenerActivityBehaviour.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void setOrderedByPartyGLN(String value) {
this.orderedByPartyGLN = value;
}
/**
* Gets the value of the contractNumber property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getContractNumber() {
return contractNumber;
}
/**
* Sets the value of the contractNumber property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setContractNumber(String value) {
this.contractNumber = value;
}
/**
* Gets the value of the agreementNumber property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAgreementNumber() {
return agreementNumber;
}
/**
* Sets the value of the agreementNumber property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAgreementNumber(String value) {
this.agreementNumber = value;
}
/**
* Gets the value of the timeForPayment property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getTimeForPayment() {
return timeForPayment;
}
/**
* Sets the value of the timeForPayment property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setTimeForPayment(BigInteger value) {
this.timeForPayment = value;
}
/**
* Additional free text.Gets the value of the freeText property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the freeText property.
* | * <p>
* For example, to add a new item, do as follows:
* <pre>
* getFreeText().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link FreeTextType }
*
*
*/
public List<FreeTextType> getFreeText() {
if (freeText == null) {
freeText = new ArrayList<FreeTextType>();
}
return this.freeText;
}
/**
* Reference to the consignment.
*
* @return
* possible object is
* {@link String }
*
*/
public String getConsignmentReference() {
return consignmentReference;
}
/**
* Sets the value of the consignmentReference property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setConsignmentReference(String value) {
this.consignmentReference = value;
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\extensions\edifact\ORDERSExtensionType.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public Wsdl11Definition stockAvailabilityWebServiceV1()
{
return createWsdl(StockAvailabilityWebServiceV1.WSDL_BEAN_NAME);
}
// e.g. http://localhost:8080/ws/Msv3BestellenService.wsdl
@Bean(name = OrderWebServiceV1.WSDL_BEAN_NAME)
public Wsdl11Definition orderWebServiceV1()
{
return createWsdl(OrderWebServiceV1.WSDL_BEAN_NAME);
}
// e.g. http://localhost:8080/ws/Msv3BestellstatusAbfragenService.wsdl
@Bean(name = OrderStatusWebServiceV1.WSDL_BEAN_NAME)
public Wsdl11Definition orderStatusWebServiceV1()
{
return createWsdl(OrderStatusWebServiceV1.WSDL_BEAN_NAME);
}
@Bean("Msv3Service_schema1")
public XsdSchema msv3serviceSchemaXsdV1()
{
return createXsdSchema("Msv3Service_schema1.xsd");
} | @Bean("Msv3FachlicheFunktionen")
public XsdSchema msv3FachlicheFunktionenV1()
{
return createXsdSchema("Msv3FachlicheFunktionen.xsd");
}
private static Wsdl11Definition createWsdl(@NonNull final String beanName)
{
return new SimpleWsdl11Definition(createSchemaResource(beanName + ".wsdl"));
}
private static XsdSchema createXsdSchema(@NonNull final String resourceName)
{
return new SimpleXsdSchema(createSchemaResource(resourceName));
}
private static ClassPathResource createSchemaResource(@NonNull final String resourceName)
{
return new ClassPathResource(SCHEMA_RESOURCE_PREFIX + "/" + resourceName);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.msv3.server\src\main\java\de\metas\vertical\pharma\msv3\server\WebServiceConfigV1.java | 2 |
请完成以下Spring Boot application配置 | management:
security:
enabled: false
server:
port: 8081
spring:
boot:
admin:
url: http://localhost:8080/admin-server
info:
app:
name: "@project.name@"
description: "@project.desc | ription@"
version: "@project.version@"
spring-boot-version: "@project.parent.version@" | repos\SpringAll-master\23.Spring-Boot-Admin\Spring Boot Admin Client\src\main\resources\application.yml | 2 |
请在Spring Boot框架中完成以下Java代码 | public Book getBook(@PathVariable Long id) {
return books.get(id);
}
@ApiOperation(value="更新信息", notes="根据url的id来指定更新图书信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "图书ID", required = true, dataType = "Long",paramType = "path"),
@ApiImplicitParam(name = "book", value = "图书实体book", required = true, dataType = "Book")
})
@RequestMapping(value="/{id}", method= RequestMethod.PUT)
public String putUser(@PathVariable Long id, @RequestBody Book book) {
Book book1 = books.get(id);
book1.setName(book.getName());
book1.setPrice(book.getPrice());
books.put(id, book1); | return "success";
}
@ApiOperation(value="删除图书", notes="根据url的id来指定删除图书")
@ApiImplicitParam(name = "id", value = "图书ID", required = true, dataType = "Long",paramType = "path")
@RequestMapping(value="/{id}", method=RequestMethod.DELETE)
public String deleteUser(@PathVariable Long id) {
books.remove(id);
return "success";
}
@ApiIgnore//使用该注解忽略这个API
@RequestMapping(value = "/hi", method = RequestMethod.GET)
public String jsonTest() {
return " hi you!";
}
} | repos\SpringBootLearning-master\springboot-swagger\src\main\java\com\forezp\controller\BookContrller.java | 2 |
请完成以下Spring Boot application配置 | #spring.datasource.url=jdbc:h2:file:C:/data/demodb
#spring.datasource.url=jdbc:h2:file:~/demodb
spring.datasource.url=jdbc:h2:file:./src/main/resources/db/demodb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.h2.console.enabled=true
spring.jpa.hibernate.ddl-auto=create-drop
spring.jp | a.database-platform=org.hibernate.dialect.H2Dialect
spring.h2.console.path=/h2-console
spring.jpa.properties.hibernate.globally_quoted_identifiers=true | repos\tutorials-master\persistence-modules\spring-boot-persistence-h2\src\main\resources\application-persistent-on.properties | 2 |
请完成以下Java代码 | public <R> R map(@NonNull final CaseMappingFunction<T, R> mappingFunction)
{
switch (type)
{
case ANY:
return mappingFunction.anyValue();
case IS_NULL:
return mappingFunction.valueIsNull();
case NOT_NULL:
return mappingFunction.valueIsNotNull();
case EQUALS_TO:
return mappingFunction.valueEqualsTo(Objects.requireNonNull(onlyValue));
case EQUALS_TO_OR_NULL:
return mappingFunction.valueEqualsToOrNull(Objects.requireNonNull(onlyValue));
default:
throw new AdempiereException("Unhandled type: " + type); // shall not happen
}
}
public <RecordType> void appendFilter(@NonNull final IQueryBuilder<RecordType> queryBuilder, @NonNull final String columnName)
{
map(new CaseMappingFunction<T, Void>()
{
@Override
public Void anyValue()
{
// do nothing
return null;
}
@Override | public Void valueIsNull()
{
queryBuilder.addEqualsFilter(columnName, null);
return null;
}
@Override
public Void valueIsNotNull()
{
queryBuilder.addNotNull(columnName);
return null;
}
@Override
public Void valueEqualsTo(@NonNull final T value)
{
queryBuilder.addEqualsFilter(columnName, value);
return null;
}
@Override
public Void valueEqualsToOrNull(@NonNull final T value)
{
//noinspection unchecked
queryBuilder.addInArrayFilter(columnName, null, value);
return null;
}
});
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\dao\ValueRestriction.java | 1 |
请在Spring Boot框架中完成以下Java代码 | class CaffeineCacheConfiguration {
@Bean
CaffeineCacheManager cacheManager(CacheProperties cacheProperties, CacheManagerCustomizers customizers,
ObjectProvider<Caffeine<Object, Object>> caffeine, ObjectProvider<CaffeineSpec> caffeineSpec,
ObjectProvider<CacheLoader<Object, Object>> cacheLoader) {
CaffeineCacheManager cacheManager = createCacheManager(cacheProperties, caffeine, caffeineSpec, cacheLoader);
List<String> cacheNames = cacheProperties.getCacheNames();
if (!CollectionUtils.isEmpty(cacheNames)) {
cacheManager.setCacheNames(cacheNames);
}
return customizers.customize(cacheManager);
}
private CaffeineCacheManager createCacheManager(CacheProperties cacheProperties,
ObjectProvider<Caffeine<Object, Object>> caffeine, ObjectProvider<CaffeineSpec> caffeineSpec,
ObjectProvider<CacheLoader<Object, Object>> cacheLoader) {
CaffeineCacheManager cacheManager = new CaffeineCacheManager();
setCacheBuilder(cacheProperties, caffeineSpec.getIfAvailable(), caffeine.getIfAvailable(), cacheManager);
cacheLoader.ifAvailable(cacheManager::setCacheLoader);
return cacheManager;
} | private void setCacheBuilder(CacheProperties cacheProperties, @Nullable CaffeineSpec caffeineSpec,
@Nullable Caffeine<Object, Object> caffeine, CaffeineCacheManager cacheManager) {
String specification = cacheProperties.getCaffeine().getSpec();
if (StringUtils.hasText(specification)) {
cacheManager.setCacheSpecification(specification);
}
else if (caffeineSpec != null) {
cacheManager.setCaffeineSpec(caffeineSpec);
}
else if (caffeine != null) {
cacheManager.setCaffeine(caffeine);
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-cache\src\main\java\org\springframework\boot\cache\autoconfigure\CaffeineCacheConfiguration.java | 2 |
请完成以下Java代码 | public JobQuery includeJobsWithoutTenantId() {
this.includeJobsWithoutTenantId = true;
return this;
}
//sorting //////////////////////////////////////////
public JobQuery orderByJobDuedate() {
return orderBy(JobQueryProperty.DUEDATE);
}
public JobQuery orderByExecutionId() {
return orderBy(JobQueryProperty.EXECUTION_ID);
}
public JobQuery orderByJobId() {
return orderBy(JobQueryProperty.JOB_ID);
}
public JobQuery orderByProcessInstanceId() {
return orderBy(JobQueryProperty.PROCESS_INSTANCE_ID);
}
public JobQuery orderByProcessDefinitionId() {
return orderBy(JobQueryProperty.PROCESS_DEFINITION_ID);
}
public JobQuery orderByProcessDefinitionKey() {
return orderBy(JobQueryProperty.PROCESS_DEFINITION_KEY);
}
public JobQuery orderByJobRetries() {
return orderBy(JobQueryProperty.RETRIES);
}
public JobQuery orderByJobPriority() {
return orderBy(JobQueryProperty.PRIORITY);
}
public JobQuery orderByTenantId() {
return orderBy(JobQueryProperty.TENANT_ID);
}
//results //////////////////////////////////////////
@Override
public long executeCount(CommandContext commandContext) {
checkQueryOk();
return commandContext
.getJobManager()
.findJobCountByQueryCriteria(this);
}
@Override | public List<Job> executeList(CommandContext commandContext, Page page) {
checkQueryOk();
return commandContext
.getJobManager()
.findJobsByQueryCriteria(this, page);
}
@Override
public List<ImmutablePair<String, String>> executeDeploymentIdMappingsList(CommandContext commandContext) {
checkQueryOk();
return commandContext
.getJobManager()
.findDeploymentIdMappingsByQueryCriteria(this);
}
//getters //////////////////////////////////////////
public Set<String> getIds() {
return ids;
}
public String getRootProcessInstanceId() {
return rootProcessInstanceId;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public Set<String> getProcessInstanceIds() {
return processInstanceIds;
}
public String getExecutionId() {
return executionId;
}
public boolean getRetriesLeft() {
return retriesLeft;
}
public boolean getExecutable() {
return executable;
}
public Date getNow() {
return ClockUtil.getCurrentTime();
}
public boolean isWithException() {
return withException;
}
public String getExceptionMessage() {
return exceptionMessage;
}
public boolean getAcquired() {
return acquired;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\JobQueryImpl.java | 1 |
请完成以下Java代码 | private Mono<Void> saveChangeSessionId() {
if (!hasChangedSessionId()) {
return Mono.empty();
}
String sessionId = getId();
Publisher<Void> replaceSessionId = (s) -> {
this.originalSessionId = sessionId;
s.onComplete();
};
if (this.isNew) {
return Mono.from(replaceSessionId);
}
else {
String originalSessionKey = getSessionKey(this.originalSessionId);
String sessionKey = getSessionKey(sessionId);
return ReactiveRedisSessionRepository.this.sessionRedisOperations.rename(originalSessionKey, sessionKey)
.flatMap((unused) -> Mono.fromDirect(replaceSessionId))
.onErrorResume((ex) -> {
String message = NestedExceptionUtils.getMostSpecificCause(ex).getMessage();
return StringUtils.startsWithIgnoreCase(message, "ERR no such key");
}, (ex) -> Mono.empty());
} | }
}
private static final class RedisSessionMapperAdapter
implements BiFunction<String, Map<String, Object>, Mono<MapSession>> {
private final RedisSessionMapper mapper = new RedisSessionMapper();
@Override
public Mono<MapSession> apply(String sessionId, Map<String, Object> map) {
return Mono.fromSupplier(() -> this.mapper.apply(sessionId, map));
}
}
} | repos\spring-session-main\spring-session-data-redis\src\main\java\org\springframework\session\data\redis\ReactiveRedisSessionRepository.java | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.