instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请完成以下Java代码
|
public final class MessagePropertiesBuilder extends MessageBuilderSupport<MessageProperties> {
/**
* Returns a builder with an initial set of properties.
* @return The builder.
*/
public static MessagePropertiesBuilder newInstance() {
return new MessagePropertiesBuilder();
}
/**
* Initializes the builder with the supplied properties; the same
* object will be returned by {@link #build()}.
* @param properties The properties.
* @return The builder.
*/
public static MessagePropertiesBuilder fromProperties(MessageProperties properties) {
return new MessagePropertiesBuilder(properties);
}
/**
* Performs a shallow copy of the properties for the initial value.
* @param properties The properties.
* @return The builder.
*/
public static MessagePropertiesBuilder fromClonedProperties(MessageProperties properties) {
MessagePropertiesBuilder builder = newInstance();
return builder.copyProperties(properties);
}
|
private MessagePropertiesBuilder() {
}
private MessagePropertiesBuilder(MessageProperties properties) {
super(properties);
}
@Override
public MessagePropertiesBuilder copyProperties(MessageProperties properties) {
super.copyProperties(properties);
return this;
}
@Override
public MessageProperties build() {
return this.buildProperties();
}
}
|
repos\spring-amqp-main\spring-amqp\src\main\java\org\springframework\amqp\core\MessagePropertiesBuilder.java
| 1
|
请完成以下Java代码
|
public static int formatDate(@NonNull final LocalDate date)
{
return Integer.parseInt(date.format(DateTimeFormatter.BASIC_ISO_DATE));
}
/**
* Return Day Of Week as Integer
* - 0 = Sunday
* - 1 = Monday
* - etc.
*/
public static int getPickupDayOfTheWeek(@NonNull final PickupDate pickupDate)
{
final DayOfWeek dayOfWeek = pickupDate.getDate().getDayOfWeek();
return dayOfWeek.getValue() % 7;
}
/**
* Dpd weight UOM is Decagrams (Dag).
* <p>
|
* Conversion is: 1dag = 10g => 100dag = 1kg
*/
public static int convertWeightKgToDag(final int weightInKg)
{
return weightInKg * 100;
}
/**
* Return the time as Integer in format `hhmm`
*/
public static int formatTime(@NonNull final LocalTime time)
{
return Integer.parseInt(time.format(DateTimeFormatter.ofPattern("HHmm")));
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.dpd\src\main\java\de\metas\shipper\gateway\dpd\util\DpdConversionUtil.java
| 1
|
请完成以下Java代码
|
public static List<GroupDto> fromGroupList(List<Group> dbGroupList) {
List<GroupDto> resultList = new ArrayList<GroupDto>();
for (Group group : dbGroupList) {
resultList.add(fromGroup(group));
}
return resultList;
}
// Getters / Setters ///////////////////////////
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
|
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\identity\GroupDto.java
| 1
|
请完成以下Java代码
|
static ClientHttpConnectorBuilder<? extends ClientHttpConnector> detect() {
return detect(null);
}
/**
* Detect the most suitable {@link ClientHttpConnectorBuilder} based on the classpath.
* The method favors builders in the following order:
* <ol>
* <li>{@link #reactor()}</li>
* <li>{@link #jetty()}</li>
* <li>{@link #httpComponents()}</li>
* <li>{@link #jdk()}</li>
* </ol>
* @param classLoader the class loader to use for detection
* @return the most suitable {@link ClientHttpConnectorBuilder} for the classpath
*/
|
static ClientHttpConnectorBuilder<? extends ClientHttpConnector> detect(@Nullable ClassLoader classLoader) {
if (ReactorClientHttpConnectorBuilder.Classes.present(classLoader)) {
return reactor();
}
if (JettyClientHttpConnectorBuilder.Classes.present(classLoader)) {
return jetty();
}
if (HttpComponentsClientHttpConnectorBuilder.Classes.present(classLoader)) {
return httpComponents();
}
if (JdkClientHttpConnectorBuilder.Classes.present(classLoader)) {
return jdk();
}
throw new IllegalStateException("Unable to detect any ClientHttpConnectorBuilder");
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-http-client\src\main\java\org\springframework\boot\http\client\reactive\ClientHttpConnectorBuilder.java
| 1
|
请完成以下Java代码
|
private static ProductWithDemandSupply ofResultSet(@NonNull final ResultSet rs) throws SQLException
{
return ProductWithDemandSupply.builder()
.warehouseId(WarehouseId.ofRepoIdOrNull(rs.getInt("M_Warehouse_ID")))
.attributesKey(AttributesKey.ofString(rs.getString("AttributesKey")))
.productId(ProductId.ofRepoId(rs.getInt("M_Product_ID")))
.uomId(UomId.ofRepoId(rs.getInt("C_UOM_ID")))
.qtyReserved(rs.getBigDecimal("QtyReserved"))
.qtyToMove(rs.getBigDecimal("QtyToMove"))
.build();
}
public QtyDemandQtySupply getById(@NonNull final QtyDemandQtySupplyId id)
{
final I_QtyDemand_QtySupply_V po = queryBL.createQueryBuilder(I_QtyDemand_QtySupply_V.class)
.addEqualsFilter(I_QtyDemand_QtySupply_V.COLUMNNAME_QtyDemand_QtySupply_V_ID, id)
.create()
.firstOnly(I_QtyDemand_QtySupply_V.class);
return fromPO(po);
}
private QtyDemandQtySupply fromPO(@NonNull final I_QtyDemand_QtySupply_V po)
{
|
final UomId uomId = UomId.ofRepoId(po.getC_UOM_ID());
return QtyDemandQtySupply.builder()
.id(QtyDemandQtySupplyId.ofRepoId(po.getQtyDemand_QtySupply_V_ID()))
.productId(ProductId.ofRepoId(po.getM_Product_ID()))
.warehouseId(WarehouseId.ofRepoId(po.getM_Warehouse_ID()))
.attributesKey(AttributesKey.ofString(po.getAttributesKey()))
.qtyToMove(Quantitys.of(po.getQtyToMove(), uomId))
.qtyReserved(Quantitys.of(po.getQtyReserved(), uomId))
.qtyForecasted(Quantitys.of(po.getQtyForecasted(), uomId))
.qtyToProduce(Quantitys.of(po.getQtyToProduce(), uomId))
.qtyStock(Quantitys.of(po.getQtyStock(), uomId))
.orgId(OrgId.ofRepoId(po.getAD_Org_ID()))
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.material\cockpit\src\main\java\de\metas\material\cockpit\QtyDemandSupplyRepository.java
| 1
|
请完成以下Java代码
|
public Predicate<ServerWebExchange> apply(Config config) {
return (ServerWebExchange t) -> {
List<HttpCookie> cookies = t.getRequest()
.getCookies()
.get(config.getCustomerIdCookie());
boolean isGolden;
if ( cookies == null || cookies.isEmpty()) {
isGolden = false;
}
else {
String customerId = cookies.get(0).getValue();
isGolden = goldenCustomerService.isGoldenCustomer(customerId);
}
return config.isGolden()?isGolden:!isGolden;
};
}
@Validated
public static class Config {
boolean isGolden = true;
@NotEmpty
String customerIdCookie = "customerId";
|
public Config() {}
public Config( boolean isGolden, String customerIdCookie) {
this.isGolden = isGolden;
this.customerIdCookie = customerIdCookie;
}
public boolean isGolden() {
return isGolden;
}
public void setGolden(boolean value) {
this.isGolden = value;
}
/**
* @return the customerIdCookie
*/
public String getCustomerIdCookie() {
return customerIdCookie;
}
/**
* @param customerIdCookie the customerIdCookie to set
*/
public void setCustomerIdCookie(String customerIdCookie) {
this.customerIdCookie = customerIdCookie;
}
}
}
|
repos\tutorials-master\spring-cloud-modules\spring-cloud-bootstrap\spring-cloud-gateway-intro\src\main\java\com\baeldung\springcloudgateway\custompredicates\factories\GoldenCustomerRoutePredicateFactory.java
| 1
|
请完成以下Java代码
|
public boolean isTableBased ()
{
Object oo = get_Value(COLUMNNAME_IsTableBased);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
@Override
public org.compiere.model.I_AD_Process getJasperProcess() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_JasperProcess_ID, org.compiere.model.I_AD_Process.class);
}
@Override
public void setJasperProcess(org.compiere.model.I_AD_Process JasperProcess)
{
set_ValueFromPO(COLUMNNAME_JasperProcess_ID, org.compiere.model.I_AD_Process.class, JasperProcess);
}
/** Set Jasper Process.
@param JasperProcess_ID
The Jasper Process used by the printengine if any process defined
*/
@Override
public void setJasperProcess_ID (int JasperProcess_ID)
{
if (JasperProcess_ID < 1)
set_Value (COLUMNNAME_JasperProcess_ID, null);
else
set_Value (COLUMNNAME_JasperProcess_ID, Integer.valueOf(JasperProcess_ID));
}
/** Get Jasper Process.
@return The Jasper Process used by the printengine if any process defined
*/
@Override
public int getJasperProcess_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_JasperProcess_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
@Override
public void setName (java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
|
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
@Override
public java.lang.String getName ()
{
return (java.lang.String)get_Value(COLUMNNAME_Name);
}
/** Set Drucker.
@param PrinterName
Name of the Printer
*/
@Override
public void setPrinterName (java.lang.String PrinterName)
{
set_Value (COLUMNNAME_PrinterName, PrinterName);
}
/** Get Drucker.
@return Name of the Printer
*/
@Override
public java.lang.String getPrinterName ()
{
return (java.lang.String)get_Value(COLUMNNAME_PrinterName);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_PrintFormat.java
| 1
|
请完成以下Java代码
|
public class CalloutException extends AdempiereException
{
/**
*
*/
private static final long serialVersionUID = 2766621229698377244L;
@Getter private ICalloutInstance calloutInstance = null;
@Getter private ICalloutExecutor calloutExecutor = null;
private ICalloutField field;
public CalloutException(final String message, final Throwable cause)
{
super(message, cause);
}
protected CalloutException(final String message)
{
super(message);
}
@Override
public CalloutException setParameter(final @NonNull String name, final Object value)
{
super.setParameter(name, value);
return this;
}
public CalloutException setCalloutInstance(final ICalloutInstance calloutInstance)
{
this.calloutInstance = calloutInstance;
setParameter("calloutInstance", calloutInstance);
return this;
}
public CalloutException setCalloutInstanceIfAbsent(final ICalloutInstance calloutInstance)
{
if (this.calloutInstance == null)
{
setCalloutInstance(calloutInstance);
}
return this;
}
public CalloutException setCalloutExecutor(final ICalloutExecutor calloutExecutor)
{
this.calloutExecutor = calloutExecutor;
return this;
|
}
public CalloutException setCalloutExecutorIfAbsent(final ICalloutExecutor calloutExecutor)
{
if (this.calloutExecutor == null)
{
setCalloutExecutor(calloutExecutor);
}
return this;
}
public CalloutException setField(final ICalloutField field)
{
this.field = field;
setParameter("field", field);
return this;
}
public CalloutException setFieldIfAbsent(final ICalloutField field)
{
if (this.field == null)
{
setField(field);
}
return this;
}
public ICalloutField getCalloutField()
{
return field;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\callout\exceptions\CalloutException.java
| 1
|
请完成以下Java代码
|
public HistoricDetailQuery orderByTenantId() {
return orderBy(HistoricDetailQueryProperty.TENANT_ID);
}
// getters and setters //////////////////////////////////////////////////////
public String getProcessInstanceId() {
return processInstanceId;
}
public String getCaseInstanceId() {
return caseInstanceId;
}
public String getExecutionId() {
return executionId;
}
public String getCaseExecutionId() {
return caseExecutionId;
}
public String getTaskId() {
return taskId;
}
public String getActivityId() {
return activityId;
}
public String getType() {
return type;
}
public boolean getExcludeTaskRelated() {
return excludeTaskRelated;
}
public String getDetailId() {
return detailId;
|
}
public String[] getProcessInstanceIds() {
return processInstanceIds;
}
public Date getOccurredBefore() {
return occurredBefore;
}
public Date getOccurredAfter() {
return occurredAfter;
}
public boolean isTenantIdSet() {
return isTenantIdSet;
}
public boolean isInitial() {
return initial;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\HistoricDetailQueryImpl.java
| 1
|
请完成以下Java代码
|
public class HttpComponentsClientHttpRequestFactoryDigestAuth extends HttpComponentsClientHttpRequestFactory {
HttpHost host;
public HttpComponentsClientHttpRequestFactoryDigestAuth(final HttpHost host, final HttpClient httpClient) {
super(httpClient);
this.host = host;
}
@Override
protected HttpContext createHttpContext(final HttpMethod httpMethod, final URI uri) {
return createHttpContext();
}
private HttpContext createHttpContext() {
// Create AuthCache instance
final AuthCache authCache = new BasicAuthCache();
// Generate DIGEST scheme object, initialize it and add it to the local auth cache
|
final DigestScheme digestAuth = new DigestScheme();
// If we already know the realm name
digestAuth.initPreemptive(new UsernamePasswordCredentials("user1", "user1Pass".toCharArray()),
"", "Custom Realm Name");
// digestAuth.overrideParamter("nonce", "MTM3NTU2OTU4MDAwNzoyYWI5YTQ5MTlhNzc5N2UxMGM5M2Y5M2ViOTc4ZmVhNg==");
authCache.put(host, digestAuth);
// Add AuthCache to the execution context
final BasicHttpContext localcontext = new BasicHttpContext();
localcontext.setAttribute(HttpClientContext.AUTH_CACHE, authCache);
return localcontext;
}
}
|
repos\tutorials-master\spring-security-modules\spring-security-web-digest-auth\src\main\java\com\baeldung\client\HttpComponentsClientHttpRequestFactoryDigestAuth.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getLdif() {
return this.ldif;
}
public void setLdif(String ldif) {
this.ldif = ldif;
}
public Validation getValidation() {
return this.validation;
}
public static class Credential {
/**
* Embedded LDAP username.
*/
private @Nullable String username;
/**
* Embedded LDAP password.
*/
private @Nullable String password;
public @Nullable String getUsername() {
return this.username;
}
public void setUsername(@Nullable String username) {
this.username = username;
}
public @Nullable String getPassword() {
return this.password;
}
public void setPassword(@Nullable String password) {
this.password = password;
}
boolean isAvailable() {
return StringUtils.hasText(this.username) && StringUtils.hasText(this.password);
}
}
public static class Validation {
/**
* Whether to enable LDAP schema validation.
*/
private boolean enabled = true;
|
/**
* Path to the custom schema.
*/
private @Nullable Resource schema;
public boolean isEnabled() {
return this.enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public @Nullable Resource getSchema() {
return this.schema;
}
public void setSchema(@Nullable Resource schema) {
this.schema = schema;
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-ldap\src\main\java\org\springframework\boot\ldap\autoconfigure\embedded\EmbeddedLdapProperties.java
| 2
|
请完成以下Java代码
|
private Iterator<I_C_Invoice_Candidate_Assignment> iterateAssignments(
@NonNull final FlatrateTermId contractId,
@NonNull final RefundConfigId refundConfigId)
{
final IQueryBL queryBL = Services.get(IQueryBL.class);
return queryBL.createQueryBuilder(I_C_Invoice_Candidate_Assignment.class)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_C_Invoice_Candidate_Assignment.COLUMN_C_Flatrate_Term_ID, contractId)
.addEqualsFilter(I_C_Invoice_Candidate_Assignment.COLUMN_C_Flatrate_RefundConfig_ID, refundConfigId)
.create()
.iterate(I_C_Invoice_Candidate_Assignment.class);
}
@lombok.Value
public static class UpdateAssignmentResult
{
public static final UpdateAssignmentResult updateDone(
@NonNull final AssignableInvoiceCandidate candidate,
@NonNull final List<AssignableInvoiceCandidate> additionalChangedCandidates)
{
return new UpdateAssignmentResult(true, candidate, additionalChangedCandidates);
}
public static final UpdateAssignmentResult noUpdateDone(@NonNull final AssignableInvoiceCandidate candidate)
{
return new UpdateAssignmentResult(false, candidate, ImmutableList.of());
}
/** {@code false} means that no update was required since the data as loaded from the DB was already up to date. */
boolean updateWasDone;
/** The result, as loaded from the DB. */
AssignableInvoiceCandidate assignableInvoiceCandidate;
List<AssignableInvoiceCandidate> additionalChangedCandidates;
|
}
@lombok.Value
@lombok.Builder(toBuilder = true)
public static class UnassignResult
{
/**
* The assignable candidate after the unassignment.
* Note that this candidate has no assignments anymore.
*/
@NonNull
AssignableInvoiceCandidate assignableCandidate;
/**
* Each pair's {@link AssignCandidatesRequest#getAssignableInvoiceCandidate()} is this result's {@link #assignableCandidate}.
*/
@Singular
List<UnassignedPairOfCandidates> unassignedPairs;
/**
* Further candidates whose assignments also changed due to the unassignment.
*/
@Singular("additionalChangedCandidate")
List<AssignableInvoiceCandidate> additionalChangedCandidates;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\refund\CandidateAssignmentService.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getInterchangeRef() {
return interchangeRef;
}
/**
* Sets the value of the interchangeRef property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setInterchangeRef(String value) {
this.interchangeRef = value;
}
/**
* Gets the value of the dateTime property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getDateTime() {
return dateTime;
}
/**
* Sets the value of the dateTime property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setDateTime(XMLGregorianCalendar value) {
this.dateTime = value;
}
/**
* Gets the value of the testIndicator property.
*
* @return
* possible object is
* {@link String }
|
*
*/
public String getTestIndicator() {
return testIndicator;
}
/**
* Sets the value of the testIndicator property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTestIndicator(String value) {
this.testIndicator = value;
}
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_metasfreshinhousev1\de\metas\edi\esb\jaxb\metasfreshinhousev1\EDIMessage.java
| 2
|
请完成以下Java代码
|
public class Person3 {
private String name;
private String dtob;
public Person3() {
}
public Person3(String name, String dtob) {
super();
this.name = name;
this.dtob = dtob;
}
public String getName() {
return name;
}
|
public void setName(String name) {
this.name = name;
}
public String getDtob() {
return dtob;
}
public void setDtob(String dtob) {
this.dtob = dtob;
}
@Override
public String toString() {
return "Person3 [name=" + name + ", dtob=" + dtob + "]";
}
}
|
repos\tutorials-master\libraries-data\src\main\java\com\baeldung\dozer\Person3.java
| 1
|
请完成以下Java代码
|
public class CompressRedis extends JdkSerializationRedisSerializer {
public static final int BUFFER_SIZE = 4096;
private JacksonRedisSerializer<User> jacksonRedisSerializer;
public CompressRedis() {
this.jacksonRedisSerializer = getValueSerializer();
}
@Override
public byte[] serialize(Object graph) throws SerializationException {
if (graph == null) {
return new byte[0];
}
ByteArrayOutputStream bos = null;
GZIPOutputStream gzip = null;
try {
// serialize
byte[] bytes = jacksonRedisSerializer.serialize(graph);
log.info("bytes size{}",bytes.length);
bos = new ByteArrayOutputStream();
gzip = new GZIPOutputStream(bos);
// compress
gzip.write(bytes);
gzip.finish();
byte[] result = bos.toByteArray();
log.info("result size{}",result.length);
//return result;
return new BASE64Encoder().encode(result).getBytes();
} catch (Exception e) {
throw new SerializationException("Gzip Serialization Error", e);
} finally {
IOUtils.closeQuietly(bos);
IOUtils.closeQuietly(gzip);
}
}
@Override
public Object deserialize(byte[] bytes) throws SerializationException {
if (bytes == null || bytes.length == 0) {
return null;
}
ByteArrayOutputStream bos = null;
ByteArrayInputStream bis = null;
GZIPInputStream gzip = null;
try {
bos = new ByteArrayOutputStream();
byte[] compressed = new sun.misc.BASE64Decoder().decodeBuffer( new String(bytes));;
|
bis = new ByteArrayInputStream(compressed);
gzip = new GZIPInputStream(bis);
byte[] buff = new byte[BUFFER_SIZE];
int n;
// uncompress
while ((n = gzip.read(buff, 0, BUFFER_SIZE)) > 0) {
bos.write(buff, 0, n);
}
//deserialize
Object result = jacksonRedisSerializer.deserialize(bos.toByteArray());
return result;
} catch (Exception e) {
throw new SerializationException("Gzip deserizelie error", e);
} finally {
IOUtils.closeQuietly(bos);
IOUtils.closeQuietly(bis);
IOUtils.closeQuietly(gzip);
}
}
private static JacksonRedisSerializer<User> getValueSerializer() {
JacksonRedisSerializer<User> jackson2JsonRedisSerializer = new JacksonRedisSerializer<>(User.class);
ObjectMapper mapper=new ObjectMapper();
jackson2JsonRedisSerializer.setObjectMapper(mapper);
return jackson2JsonRedisSerializer;
}
}
|
repos\springboot-demo-master\gzip\src\main\java\com\et\gzip\config\CompressRedis.java
| 1
|
请完成以下Java代码
|
private void createCurrencyExchangeGainLoss(@NonNull final Fact fact)
{
//
// Make sure source amounts are balanced
fact.balanceSource();
if (!fact.isSourceBalanced())
{
throw newPostingException()
.setDetailMessage("Source amounts shall be balanced in order to calculate currency conversion gain/loss")
.setFact(fact);
}
final Money acctBalance = fact.getAcctBalance().toMoney();
if (acctBalance.isZero())
{
return;
}
final PostingSign postingSign;
final Account account;
final Money amt;
if (acctBalance.signum() > 0)
|
{
postingSign = PostingSign.CREDIT;
account = fact.getAcctSchema().getDefaultAccounts().getRealizedGainAcct();
amt = acctBalance;
}
else // acctBalance < 0
{
postingSign = PostingSign.DEBIT;
account = fact.getAcctSchema().getDefaultAccounts().getRealizedLossAcct();
amt = acctBalance.negate();
}
final FactLine factLine = fact.createLine()
.setAccount(account)
.setAmtSource(postingSign, amt)
.setAmtAcct(postingSign, amt)
.alsoAddZeroLine()
.buildAndAddNotNull();
factLine.setFromDimension(glJournal.getDimension());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\gljournal_sap\acct\Doc_SAPGLJournal.java
| 1
|
请完成以下Java代码
|
public java.sql.Timestamp getDateDoc ()
{
return (java.sql.Timestamp)get_Value(COLUMNNAME_DateDoc);
}
/** Set Beschreibung.
@param Description Beschreibung */
@Override
public void setDescription (java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Beschreibung.
@return Beschreibung */
@Override
public java.lang.String getDescription ()
{
return (java.lang.String)get_Value(COLUMNNAME_Description);
}
/** Set Zählbestand Einkauf (fresh).
@param Fresh_QtyOnHand_ID Zählbestand Einkauf (fresh) */
@Override
public void setFresh_QtyOnHand_ID (int Fresh_QtyOnHand_ID)
{
if (Fresh_QtyOnHand_ID < 1)
set_ValueNoCheck (COLUMNNAME_Fresh_QtyOnHand_ID, null);
else
set_ValueNoCheck (COLUMNNAME_Fresh_QtyOnHand_ID, Integer.valueOf(Fresh_QtyOnHand_ID));
}
/** Get Zählbestand Einkauf (fresh).
@return Zählbestand Einkauf (fresh) */
@Override
|
public int getFresh_QtyOnHand_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Fresh_QtyOnHand_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Verarbeitet.
@param Processed
Checkbox sagt aus, ob der Beleg verarbeitet wurde.
*/
@Override
public void setProcessed (boolean Processed)
{
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
}
/** Get Verarbeitet.
@return Checkbox sagt aus, ob der Beleg verarbeitet wurde.
*/
@Override
public boolean isProcessed ()
{
Object oo = get_Value(COLUMNNAME_Processed);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.fresh\de.metas.fresh.base\src\main\java-gen\de\metas\fresh\model\X_Fresh_QtyOnHand.java
| 1
|
请完成以下Java代码
|
public static Set<HuId> fromRepoIds(@Nullable final Collection<Integer> huRepoIds)
{
if (huRepoIds == null || huRepoIds.isEmpty())
{
return ImmutableSet.of();
}
return huRepoIds.stream().map(HuId::ofRepoIdOrNull).filter(Objects::nonNull).collect(ImmutableSet.toImmutableSet());
}
public static HuId ofHUValue(@NonNull final String huValue)
{
try
{
return ofRepoId(Integer.parseInt(huValue));
}
catch (final Exception ex)
{
final AdempiereException metasfreshException = new AdempiereException("Invalid HUValue `" + huValue + "`. It cannot be converted to M_HU_ID.");
metasfreshException.addSuppressed(ex);
throw metasfreshException;
}
}
public static HuId ofHUValueOrNull(@Nullable final String huValue)
{
final String huValueNorm = StringUtils.trimBlankToNull(huValue);
if (huValueNorm == null) {return null;}
try
{
|
return ofRepoIdOrNull(NumberUtils.asIntOrZero(huValueNorm));
}
catch (final Exception ex)
{
return null;
}
}
public String toHUValue() {return String.valueOf(repoId);}
int repoId;
private HuId(final int repoId)
{
this.repoId = Check.assumeGreaterThanZero(repoId, "M_HU_ID");
}
@Override
@JsonValue
public int getRepoId()
{
return repoId;
}
public static boolean equals(@Nullable final HuId o1, @Nullable final HuId o2)
{
return Objects.equals(o1, o2);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\handlingunits\HuId.java
| 1
|
请完成以下Java代码
|
public int getC_PaymentTerm_ID()
{
return get_ValueAsInt(COLUMNNAME_C_PaymentTerm_ID);
}
@Override
public void setDescription (final java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
@Override
public java.lang.String getDescription()
{
return get_ValueAsString(COLUMNNAME_Description);
}
@Override
public void setOffsetDays (final int OffsetDays)
{
set_Value (COLUMNNAME_OffsetDays, OffsetDays);
}
@Override
public int getOffsetDays()
{
return get_ValueAsInt(COLUMNNAME_OffsetDays);
}
@Override
public void setPercent (final int Percent)
{
set_Value (COLUMNNAME_Percent, Percent);
}
@Override
public int getPercent()
{
return get_ValueAsInt(COLUMNNAME_Percent);
}
/**
* ReferenceDateType AD_Reference_ID=541989
* Reference name: ReferenceDateType
*/
public static final int REFERENCEDATETYPE_AD_Reference_ID=541989;
/** InvoiceDate = IV */
public static final String REFERENCEDATETYPE_InvoiceDate = "IV";
/** BLDate = BL */
|
public static final String REFERENCEDATETYPE_BLDate = "BL";
/** OrderDate = OD */
public static final String REFERENCEDATETYPE_OrderDate = "OD";
/** LCDate = LC */
public static final String REFERENCEDATETYPE_LCDate = "LC";
/** ETADate = ET */
public static final String REFERENCEDATETYPE_ETADate = "ET";
@Override
public void setReferenceDateType (final java.lang.String ReferenceDateType)
{
set_Value (COLUMNNAME_ReferenceDateType, ReferenceDateType);
}
@Override
public java.lang.String getReferenceDateType()
{
return get_ValueAsString(COLUMNNAME_ReferenceDateType);
}
@Override
public void setSeqNo (final int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, SeqNo);
}
@Override
public int getSeqNo()
{
return get_ValueAsInt(COLUMNNAME_SeqNo);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_PaymentTerm_Break.java
| 1
|
请完成以下Java代码
|
private boolean isReferenceNumberConvertible(@NonNull final XmlRequest xAugmentedRequest)
{
return StringUtils.cleanWhitespace(((XmlEsr9)xAugmentedRequest.getPayload()
.getBody()
.getEsr())
.getReferenceNumber())
.length() == 27;
}
private XmlEsr createEsrQrFromEsr9WithExistingBank(final @NonNull XmlEsr9 esr9, @NonNull final String qrIban)
{
final XmlEsrQR.XmlEsrQRBuilder xEsrQR = XmlEsrQR.builder();
xEsrQR.bank(esr9.getBank());
xEsrQR.creditor(esr9.getCreditor());
xEsrQR.type(jaxbRequestObjectFactory.createEsrQRType().getType());
xEsrQR.iban(qrIban);
xEsrQR.referenceNumber(StringUtils.cleanWhitespace(esr9.getReferenceNumber()));
xEsrQR.paymentReason(Collections.emptyList());
return xEsrQR.build();
}
private XmlEsr createEsrQrFromEsr9UsingDbInfo(final @NonNull XmlEsr9 esr9, @NonNull final BPartnerBankAccount bankAccount, @NonNull final Bank bank, @NonNull final Location location)
{
final XmlEsrQR.XmlEsrQRBuilder xEsrQR = XmlEsrQR.builder();
xEsrQR.bank(CoalesceUtil.coalesceSuppliers(esr9::getBank, () -> createEsrBank(bank, location)));
xEsrQR.creditor(esr9.getCreditor());
xEsrQR.type(jaxbRequestObjectFactory.createEsrQRType().getType());
xEsrQR.iban(bankAccount.getQrIban());
xEsrQR.referenceNumber(StringUtils.cleanWhitespace(esr9.getReferenceNumber()));
xEsrQR.paymentReason(Collections.emptyList());
return xEsrQR.build();
}
private XmlAddress createEsrBank(final @NonNull Bank bank, @NonNull final Location location)
{
return XmlAddress.builder()
.company(XmlCompany.builder()
.companyname(bank.getBankName())
|
.postal(XmlPostal.builder()
.zip(location.getPostal())
.city(location.getCity())
.countryCode(location.getCountryCode())
.build())
.build())
.build();
}
private boolean isXmlEsr9(final XmlRequest xAugmentedRequest)
{
return xAugmentedRequest.getPayload().getBody().getEsr() instanceof XmlEsr9;
}
@Nullable
private BPartnerBankAccount getBPartnerBankAccountOrNull(final BPartnerId bpartnerID)
{
return bpBankAccountDAO.getBpartnerBankAccount(BankAccountQuery.builder()
.bpBankAcctUses(ImmutableSet.of(BPBankAcctUse.DEBIT_OR_DEPOSIT, BPBankAcctUse.DEPOSIT))
.containsQRIBAN(true)
.bPartnerId(bpartnerID)
.build())
.stream()
.findFirst()
.orElse(null);
}
}
|
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_450_request\src\main\java\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_450\Invoice450FromCrossVersionModelTool.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getAccountCheckBatchNo() {
return accountCheckBatchNo;
}
public void setAccountCheckBatchNo(String accountCheckBatchNo) {
this.accountCheckBatchNo = accountCheckBatchNo;
}
public Date getBillDate() {
return billDate;
}
public void setBillDate(Date billDate) {
this.billDate = billDate;
}
public String getBankType() {
return bankType;
}
public void setBankType(String bankType) {
this.bankType = bankType;
}
public Date getOrderTime() {
return orderTime;
}
public void setOrderTime(Date orderTime) {
this.orderTime = orderTime;
}
public Date getBankTradeTime() {
return bankTradeTime;
}
public void setBankTradeTime(Date bankTradeTime) {
this.bankTradeTime = bankTradeTime;
}
public String getBankOrderNo() {
return bankOrderNo;
}
public void setBankOrderNo(String bankOrderNo) {
this.bankOrderNo = bankOrderNo;
}
public String getBankTrxNo() {
return bankTrxNo;
}
public void setBankTrxNo(String bankTrxNo) {
this.bankTrxNo = bankTrxNo;
}
public String getBankTradeStatus() {
return bankTradeStatus;
}
|
public void setBankTradeStatus(String bankTradeStatus) {
this.bankTradeStatus = bankTradeStatus;
}
public BigDecimal getBankAmount() {
return bankAmount;
}
public void setBankAmount(BigDecimal bankAmount) {
this.bankAmount = bankAmount;
}
public BigDecimal getBankRefundAmount() {
return bankRefundAmount;
}
public void setBankRefundAmount(BigDecimal bankRefundAmount) {
this.bankRefundAmount = bankRefundAmount;
}
public BigDecimal getBankFee() {
return bankFee;
}
public void setBankFee(BigDecimal bankFee) {
this.bankFee = bankFee;
}
}
|
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\reconciliation\vo\ReconciliationEntityVo.java
| 2
|
请完成以下Java代码
|
private String mkKey(final ITableRecordReference tableRecordReference)
{
return tableRecordReference.getTableName();
}
@Override
public Map<Integer, Set<ITableRecordReference>> getDlmPartitionId2Record()
{
return ImmutableMap.copyOf(dlmPartitionId2Record);
}
@Override
public Map<String, Collection<ITableRecordReference>> getTableName2Record()
{
final Map<String, Collection<ITableRecordReference>> result = new HashMap<>();
tableName2Record.entrySet().forEach(e -> {
result.put(e.getKey(), e.getValue());
});
return result;
}
@Override
public int size()
{
return size;
}
@Override
public boolean isQueueEmpty()
{
final boolean iteratorEmpty = !iterator.hasNext();
return iteratorEmpty && queueItemsToProcess.isEmpty();
}
@Override
public ITableRecordReference nextFromQueue()
{
final WorkQueue result = nextFromQueue0();
if (result.getDLM_Partition_Workqueue_ID() > 0)
{
queueItemsToDelete.add(result);
}
return result.getTableRecordReference();
}
private WorkQueue nextFromQueue0()
{
if (iterator.hasNext())
{
// once we get the record from the queue, we also add it to our result
final WorkQueue next = iterator.next();
final ITableRecordReference tableRecordReference = next.getTableRecordReference();
final IDLMAware model = tableRecordReference.getModel(ctxAware, IDLMAware.class);
add0(tableRecordReference, model.getDLM_Partition_ID(), true);
return next;
}
return queueItemsToProcess.removeFirst();
}
@Override
public List<WorkQueue> getQueueRecordsToStore()
{
return queueItemsToProcess;
}
@Override
public List<WorkQueue> getQueueRecordsToDelete()
{
|
return queueItemsToDelete;
}
/**
* @return the {@link Partition} from the last invokation of {@link #clearAfterPartitionStored(Partition)}, or an empty partition.
*/
@Override
public Partition getPartition()
{
return partition;
}
@Override
public void registerHandler(IIterateResultHandler handler)
{
handlerSupport.registerListener(handler);
}
@Override
public List<IIterateResultHandler> getRegisteredHandlers()
{
return handlerSupport.getRegisteredHandlers();
}
@Override
public boolean isHandlerSignaledToStop()
{
return handlerSupport.isHandlerSignaledToStop();
}
@Override
public String toString()
{
return "IterateResult [queueItemsToProcess.size()=" + queueItemsToProcess.size()
+ ", queueItemsToDelete.size()=" + queueItemsToDelete.size()
+ ", size=" + size
+ ", tableName2Record.size()=" + tableName2Record.size()
+ ", dlmPartitionId2Record.size()=" + dlmPartitionId2Record.size()
+ ", iterator=" + iterator
+ ", ctxAware=" + ctxAware
+ ", partition=" + partition + "]";
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.dlm\base\src\main\java\de\metas\dlm\partitioner\impl\CreatePartitionIterateResult.java
| 1
|
请完成以下Java代码
|
public void setExternalTaskId(String externalTaskId) {
this.externalTaskId = externalTaskId;
}
@CamundaQueryParam("operationType")
public void setOperationType(String operationType) {
this.operationType = operationType;
}
@CamundaQueryParam("entityType")
public void setEntityType(String entityType) {
this.entityType = entityType;
}
@CamundaQueryParam(value = "entityTypeIn", converter = StringArrayConverter.class)
public void setEntityTypeIn(String[] entityTypes) {
this.entityTypes = entityTypes;
}
@CamundaQueryParam("category")
public void setcategory(String category) {
this.category = category;
}
@CamundaQueryParam(value = "categoryIn", converter = StringArrayConverter.class)
public void setCategoryIn(String[] categories) {
this.categories = categories;
}
|
@CamundaQueryParam("property")
public void setProperty(String property) {
this.property = property;
}
@CamundaQueryParam(value = "afterTimestamp", converter = DateConverter.class)
public void setAfterTimestamp(Date after) {
this.afterTimestamp = after;
}
@CamundaQueryParam(value = "beforeTimestamp", converter = DateConverter.class)
public void setBeforeTimestamp(Date before) {
this.beforeTimestamp = before;
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\history\UserOperationLogQueryDto.java
| 1
|
请完成以下Java代码
|
private void saveLine(@NonNull final IQualityInvoiceLine line)
{
final I_C_Invoice_Candidate invoiceCandidate = getC_Invoice_Candidate();
final int seqNo = _seqNoNext;
final Quantity lineQty = line.getQty();
// Pricing
final IPricingResult pricingResult = line.getPrice();
final UomId priceUOMId;
final BigDecimal price;
final BigDecimal discount;
final BigDecimal qtyEnteredInPriceUOM;
if (pricingResult != null)
{
priceUOMId = pricingResult.getPriceUomId();
price = pricingResult.getPriceStd();
discount = pricingResult.getDiscount().toBigDecimal();
final IUOMConversionBL uomConversionBL = Services.get(IUOMConversionBL.class);
qtyEnteredInPriceUOM = uomConversionBL
.convertQuantityTo(
lineQty,
UOMConversionContext.of(line.getProductId()),
priceUOMId)
.toBigDecimal();
}
else
{
priceUOMId = lineQty.getUomId();
price = null;
discount = null;
qtyEnteredInPriceUOM = lineQty.toBigDecimal();
}
final I_C_Invoice_Detail invoiceDetail = InterfaceWrapperHelper.newInstance(I_C_Invoice_Detail.class, getContext());
invoiceDetail.setAD_Org_ID(invoiceCandidate.getAD_Org_ID());
invoiceDetail.setC_Invoice_Candidate(invoiceCandidate);
invoiceDetail.setSeqNo(seqNo);
invoiceDetail.setIsActive(true);
invoiceDetail.setIsDetailOverridesLine(isPrintOverride());
invoiceDetail.setIsPrinted(isPrintOverride() ? true : line.isDisplayed()); // the override-details line is always printed
|
invoiceDetail.setDescription(line.getDescription());
invoiceDetail.setIsPrintBefore(isPrintBefore());
invoiceDetail.setM_Product_ID(ProductId.toRepoId(line.getProductId()));
invoiceDetail.setNote(line.getProductName());
// invoiceDetail.setM_AttributeSetInstance(M_AttributeSetInstance);
invoiceDetail.setQty(lineQty.toBigDecimal());
invoiceDetail.setC_UOM_ID(lineQty.getUomId().getRepoId());
invoiceDetail.setDiscount(discount);
invoiceDetail.setPriceEntered(price);
invoiceDetail.setPriceActual(price);
invoiceDetail.setQtyEnteredInPriceUOM(qtyEnteredInPriceUOM);
invoiceDetail.setPrice_UOM_ID(UomId.toRepoId(priceUOMId));
invoiceDetail.setPercentage(line.getPercentage());
invoiceDetail.setPP_Order(line.getPP_Order());
// Set Handling Units specific infos
handlingUnitsInfoFactory.updateInvoiceDetail(invoiceDetail, line.getHandlingUnitsInfo());
//
// Save detail line
InterfaceWrapperHelper.save(invoiceDetail);
I_C_Invoice_Detail.DYNATTR_C_Invoice_Detail_IQualityInvoiceLine.setValue(invoiceDetail, line);
_createdLines.add(invoiceDetail);
_seqNoNext += 10;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java\de\metas\materialtracking\qualityBasedInvoicing\ic\spi\impl\InvoiceDetailWriter.java
| 1
|
请完成以下Java代码
|
public static Integer getWordAsMultiplier(String word) {
switch (word) {
case "double":
return 2;
case "triple":
return 3;
case "quadruple":
return 4;
default:
return null;
}
}
public static String getWordAsDigit(String word) {
switch (word) {
case "zero":
return "0";
case "one":
return "1";
case "two":
return "2";
case "three":
return "3";
case "four":
return "4";
case "five":
|
return "5";
case "six":
return "6";
case "seven":
return "7";
case "eight":
return "8";
case "nine":
return "9";
default:
throw new IllegalArgumentException("Invalid word: " + word);
}
}
}
|
repos\tutorials-master\core-java-modules\core-java-numbers-7\src\main\java\com\baeldung\convertphonenumberinwordstonumber\UseSwitchToConvertPhoneNumberInWordsToNumber.java
| 1
|
请完成以下Java代码
|
public String getAttributeValue(String namespace, String name) {
List<DmnExtensionAttribute> attributes = getAttributes().get(name);
if (attributes != null && !attributes.isEmpty()) {
for (DmnExtensionAttribute attribute : attributes) {
if ((namespace == null && attribute.getNamespace() == null)
|| namespace.equals(attribute.getNamespace())) {
return attribute.getValue();
}
}
}
return null;
}
public void addAttribute(DmnExtensionAttribute attribute) {
if (attribute != null && attribute.getName() != null && !attribute.getName().trim().isEmpty()) {
List<DmnExtensionAttribute> attributeList = null;
if (!this.attributes.containsKey(attribute.getName())) {
attributeList = new ArrayList<>();
this.attributes.put(attribute.getName(), attributeList);
}
this.attributes.get(attribute.getName()).add(attribute);
}
}
public void setValues(DmnElement otherElement) {
setId(otherElement.getId());
extensionElements = new LinkedHashMap<>();
if (otherElement.getExtensionElements() != null && !otherElement.getExtensionElements().isEmpty()) {
for (String key : otherElement.getExtensionElements().keySet()) {
List<DmnExtensionElement> otherElementList = otherElement.getExtensionElements().get(key);
if (otherElementList != null && !otherElementList.isEmpty()) {
List<DmnExtensionElement> elementList = new ArrayList<>();
|
for (DmnExtensionElement extensionElement : otherElementList) {
elementList.add(extensionElement.clone());
}
extensionElements.put(key, elementList);
}
}
}
attributes = new LinkedHashMap<>();
if (otherElement.getAttributes() != null && !otherElement.getAttributes().isEmpty()) {
for (String key : otherElement.getAttributes().keySet()) {
List<DmnExtensionAttribute> otherAttributeList = otherElement.getAttributes().get(key);
if (otherAttributeList != null && !otherAttributeList.isEmpty()) {
List<DmnExtensionAttribute> attributeList = new ArrayList<>();
for (DmnExtensionAttribute extensionAttribute : otherAttributeList) {
attributeList.add(extensionAttribute.clone());
}
attributes.put(key, attributeList);
}
}
}
}
}
|
repos\flowable-engine-main\modules\flowable-dmn-model\src\main\java\org\flowable\dmn\model\DmnElement.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void stop() {
stopped = true;
}
public String getSessionId() {
return sessionRef.getSessionId();
}
public TenantId getTenantId() {
return sessionRef.getSecurityCtx().getTenantId();
}
public CustomerId getCustomerId() {
return sessionRef.getSecurityCtx().getCustomerId();
}
public UserId getUserId() {
return sessionRef.getSecurityCtx().getId();
}
|
public EntityId getOwnerId() {
var customerId = getCustomerId();
return customerId != null && !customerId.isNullUid() ? customerId : getTenantId();
}
public void sendWsMsg(CmdUpdate update) {
wsLock.lock();
try {
wsService.sendUpdate(sessionRef.getSessionId(), update);
} finally {
wsLock.unlock();
}
}
}
|
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\subscription\TbAbstractSubCtx.java
| 2
|
请完成以下Java代码
|
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Process Now.
@param Processing Process Now */
public void setProcessing (boolean Processing)
{
set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
}
/** Get Process Now.
@return Process Now */
public boolean isProcessing ()
{
Object oo = get_Value(COLUMNNAME_Processing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Reminder Days.
@param RemindDays
Days between sending Reminder Emails for a due or inactive Document
*/
public void setRemindDays (int RemindDays)
{
set_Value (COLUMNNAME_RemindDays, Integer.valueOf(RemindDays));
}
/** Get Reminder Days.
@return Days between sending Reminder Emails for a due or inactive Document
*/
public int getRemindDays ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_RemindDays);
if (ii == null)
return 0;
|
return ii.intValue();
}
public I_AD_User getSupervisor() throws RuntimeException
{
return (I_AD_User)MTable.get(getCtx(), I_AD_User.Table_Name)
.getPO(getSupervisor_ID(), get_TrxName()); }
/** Set Supervisor.
@param Supervisor_ID
Supervisor for this user/organization - used for escalation and approval
*/
public void setSupervisor_ID (int Supervisor_ID)
{
if (Supervisor_ID < 1)
set_Value (COLUMNNAME_Supervisor_ID, null);
else
set_Value (COLUMNNAME_Supervisor_ID, Integer.valueOf(Supervisor_ID));
}
/** Get Supervisor.
@return Supervisor for this user/organization - used for escalation and approval
*/
public int getSupervisor_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Supervisor_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_WorkflowProcessor.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class cartService {
@Autowired
private cartDao cartDao;
public Cart addCart(Cart cart) {
return cartDao.addCart(cart);
}
// public Cart getCart(int id)
// {
// return cartDao.getCart(id);
// }
public List<Cart> getCarts() {
return this.cartDao.getCarts();
}
|
public void updateCart(Cart cart) {
cartDao.updateCart(cart);
}
public void deleteCart(Cart cart) {
cartDao.deleteCart(cart);
}
// pubiic List<Cart> getCartByUserId(int customer_id){
// return cartDao.getCartsByCustomerID(customer_id);
// }
}
|
repos\E-commerce-project-springBoot-master2\JtProject\src\main\java\com\jtspringproject\JtSpringProject\services\cartService.java
| 2
|
请完成以下Java代码
|
public void setC_BPartner_ID(final int C_BPartner_ID)
{
if (C_BPartner_ID < 1)
set_Value(COLUMNNAME_C_BPartner_ID, null);
else
set_Value(COLUMNNAME_C_BPartner_ID, C_BPartner_ID);
}
@Override
public int getC_BPartner_ID()
{
return get_ValueAsInt(COLUMNNAME_C_BPartner_ID);
}
@Override
public void setC_BPartner_Report_Text_ID(final int C_BPartner_Report_Text_ID)
{
if (C_BPartner_Report_Text_ID < 1)
set_ValueNoCheck(COLUMNNAME_C_BPartner_Report_Text_ID, null);
else
|
set_ValueNoCheck(COLUMNNAME_C_BPartner_Report_Text_ID, C_BPartner_Report_Text_ID);
}
@Override
public int getC_BPartner_Report_Text_ID()
{
return get_ValueAsInt(COLUMNNAME_C_BPartner_Report_Text_ID);
}
@Override
public void setValue(final String Value)
{
set_Value(COLUMNNAME_Value, Value);
}
@Override
public String getValue()
{
return get_ValueAsString(COLUMNNAME_Value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.fresh\de.metas.fresh.base\src\main\java\de\metas\fresh\partnerreporttext\model\X_C_BPartner_Report_Text.java
| 1
|
请完成以下Java代码
|
private int getIDOrNull(final Object object)
{
return object == null ? 0 : InterfaceWrapperHelper.getId(object);
}
private boolean openSOWindow(final int bPartnerId,
final int locationShipId, final int locationBillId,
final int contactId, final int billContactId)
{
final AdWindowId SALES_ORDER_WINDOW_ID = AdWindowId.ofRepoId(143);
final AWindow soFrame = new AWindow();
final MQuery query = new MQuery(Table_Name);
query.addRestriction(I_C_BPartner_Location.COLUMNNAME_C_BPartner_ID
+ "=" + bPartnerId);
final boolean success = soFrame
.initWindow(SALES_ORDER_WINDOW_ID, query);
if (!success)
{
return false;
}
soFrame.pack();
AEnv.addToWindowManager(soFrame);
|
final GridTab tab = soFrame.getAPanel().getCurrentTab();
tab.dataNew(DataNewCopyMode.NoCopy);
tab.setValue(I_C_Order.COLUMNNAME_C_BPartner_ID, bPartnerId);
tab.setValue(I_C_Order.COLUMNNAME_C_BPartner_Location_ID,
locationShipId);
tab.setValue(I_C_Order.COLUMNNAME_Bill_Location_ID, locationBillId);
if (contactId > 0)
{
tab.setValue(I_C_Order.COLUMNNAME_AD_User_ID, contactId);
}
if (billContactId > 0)
{
tab.setValue(I_C_Order.COLUMNNAME_Bill_User_ID, billContactId);
}
AEnv.showCenterScreen(soFrame);
return success;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\adempiere\callout\BPartnerCockpit.java
| 1
|
请完成以下Java代码
|
private static byte[] toByteArray(final BufferedImage image, final String formatName)
{
try
{
final ByteArrayOutputStream buf = new ByteArrayOutputStream();
ImageIO.write(image, formatName, buf);
return buf.toByteArray();
}
catch (IOException e)
{
throw AdempiereException.wrapIfNeeded(e);
}
}
public static Dimension computeScaledDimension(final Dimension size, final Dimension maxSize)
{
// credits: http://stackoverflow.com/questions/10245220/java-image-resize-maintain-aspect-ratio
final int widthOrig = size.width;
final int heightOrig = size.height;
final int widthMax = maxSize.width;
final int heightMax = maxSize.height;
int widthNew;
int heightNew;
// first check if we need to scale width
if (widthMax > 0 && widthOrig > widthMax)
{
// scale width to fit
widthNew = widthMax;
// scale height to maintain aspect ratio
heightNew = widthNew * heightOrig / widthOrig;
}
else
{
widthNew = widthOrig;
heightNew = heightOrig;
}
// then check if we need to scale even with the new height
if (heightMax > 0 && heightNew > heightMax)
{
// scale height to fit instead
|
heightNew = heightMax;
// scale width to maintain aspect ratio
widthNew = heightNew * widthOrig / heightOrig;
}
return new Dimension(widthNew, heightNew);
}
private static String computeImageFormatNameByContentType(@NonNull final String contentType)
{
final String fileExtension = MimeType.getExtensionByTypeWithoutDot(contentType);
if (Check.isEmpty(fileExtension))
{
return "png";
}
return fileExtension;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\image\AdImage.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public int getServerId() {
return this.serverId;
}
public void setServerId(int serverId) {
this.serverId = serverId;
}
public boolean isEnabled() {
return this.enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public boolean isPersistent() {
return this.persistent;
}
public void setPersistent(boolean persistent) {
this.persistent = persistent;
}
public @Nullable String getDataDirectory() {
return this.dataDirectory;
}
public void setDataDirectory(@Nullable String dataDirectory) {
this.dataDirectory = dataDirectory;
}
public String[] getQueues() {
return this.queues;
}
public void setQueues(String[] queues) {
this.queues = queues;
}
public String[] getTopics() {
return this.topics;
}
public void setTopics(String[] topics) {
this.topics = topics;
}
public String getClusterPassword() {
return this.clusterPassword;
}
public void setClusterPassword(String clusterPassword) {
|
this.clusterPassword = clusterPassword;
this.defaultClusterPassword = false;
}
public boolean isDefaultClusterPassword() {
return this.defaultClusterPassword;
}
/**
* Creates the minimal transport parameters for an embedded transport
* configuration.
* @return the transport parameters
* @see TransportConstants#SERVER_ID_PROP_NAME
*/
public Map<String, Object> generateTransportParameters() {
Map<String, Object> parameters = new HashMap<>();
parameters.put(TransportConstants.SERVER_ID_PROP_NAME, getServerId());
return parameters;
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-artemis\src\main\java\org\springframework\boot\artemis\autoconfigure\ArtemisProperties.java
| 2
|
请完成以下Java代码
|
public static String determineDatabaseType(DataSource dataSource, Logger logger) {
return determineDatabaseType(dataSource, logger, getDefaultDatabaseTypeMappings());
}
public static String determineDatabaseType(DataSource dataSource, Logger logger, Properties databaseTypeMappings) {
Connection connection = null;
String databaseType = null;
try {
connection = dataSource.getConnection();
DatabaseMetaData databaseMetaData = connection.getMetaData();
String databaseProductName = databaseMetaData.getDatabaseProductName();
logger.debug("database product name: '{}'", databaseProductName);
// CRDB does not expose the version through the jdbc driver, so we need to fetch it through version().
if (PRODUCT_NAME_POSTGRES.equalsIgnoreCase(databaseProductName)) {
try (PreparedStatement preparedStatement = connection.prepareStatement("select version() as version;");
ResultSet resultSet = preparedStatement.executeQuery()) {
String version = null;
if (resultSet.next()) {
version = resultSet.getString("version");
}
if (StringUtils.isNotEmpty(version) && version.toLowerCase().startsWith(PRODUCT_NAME_CRDB.toLowerCase())) {
databaseProductName = PRODUCT_NAME_CRDB;
logger.info("CockroachDB version '{}' detected", version);
}
}
}
databaseType = databaseTypeMappings.getProperty(databaseProductName);
if (databaseType == null) {
throw new FlowableException("couldn't deduct database type from database product name '" + databaseProductName + "'");
|
}
logger.debug("using database type: {}", databaseType);
} catch (SQLException e) {
throw new RuntimeException("Exception while initializing Database connection", e);
} finally {
try {
if (connection != null) {
connection.close();
}
} catch (SQLException e) {
logger.error("Exception while closing the Database connection", e);
}
}
return databaseType;
}
}
|
repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\util\DbUtil.java
| 1
|
请完成以下Java代码
|
public class BoolDataPoint extends AbstractDataPoint {
@Getter
private final boolean value;
public BoolDataPoint(long ts, boolean value) {
super(ts);
this.value = value;
}
@Override
public DataType getType() {
return DataType.BOOLEAN;
}
@Override
public boolean getBool() {
|
return value;
}
@Override
public String valueToString() {
return Boolean.toString(value);
}
@Override
public int compareTo(DataPoint dataPoint) {
if (dataPoint.getType() == DataType.BOOLEAN) {
return Boolean.compare(value, dataPoint.getBool());
} else {
return super.compareTo(dataPoint);
}
}
}
|
repos\thingsboard-master\common\edqs\src\main\java\org\thingsboard\server\edqs\data\dp\BoolDataPoint.java
| 1
|
请完成以下Java代码
|
private void handle(ADHyperlink link)
{
if (link == null)
{
return;
}
else if (ADHyperlink.Action.ShowWindow == link.getAction())
{
handleShowWindow(link);
}
}
private void handleShowWindow(ADHyperlink link)
{
Map<String, String> params = link.getParameters();
int AD_Table_ID = Integer.valueOf(params.get("AD_Table_ID"));
if (AD_Table_ID <= 0)
{
return;
}
int adWindowId = -1;
String adWindowIdStr = params.get("AD_Window_ID");
if (adWindowIdStr != null && !adWindowIdStr.isEmpty())
{
adWindowId = Integer.valueOf(adWindowIdStr);
}
|
String whereClause = params.get("WhereClause");
MQuery query = new MQuery(AD_Table_ID);
if (!Check.isEmpty(whereClause))
query.addRestriction(whereClause);
if (adWindowId > 0)
{
AEnv.zoom(query, adWindowId);
}
else
{
AEnv.zoom(query);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\de\metas\adempiere\gui\ADHyperlinkHandler.java
| 1
|
请完成以下Java代码
|
public boolean doCatch(final Throwable e) throws Throwable
{
success = false;
// Just pass it through
throw e;
}
@Override
public void doFinally()
{
//
// NOTE: don't do any kind of processing here because we are running out-of-transaction
//
//
// Dispose the attribute transactiosn builder/listeners
if (trxAttributesBuilder != null)
|
{
// If there was a failure, discard all collected transactions first
if (!success)
{
trxAttributesBuilder.clearTransactions();
}
// We are disposing (i.e. unregistering all underlying listeners) of this builder,
// no matter if this processing was a success or not because,
// there nothing we can do anyway with this builder
trxAttributesBuilder.dispose();
trxAttributesBuilder = null;
}
}
});
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\allocation\impl\HUContextProcessorExecutor.java
| 1
|
请完成以下Java代码
|
public boolean isOnWednesday ()
{
Object oo = get_Value(COLUMNNAME_OnWednesday);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Ressourcenart.
@param S_ResourceType_ID Ressourcenart */
@Override
public void setS_ResourceType_ID (int S_ResourceType_ID)
{
if (S_ResourceType_ID < 1)
set_ValueNoCheck (COLUMNNAME_S_ResourceType_ID, null);
else
set_ValueNoCheck (COLUMNNAME_S_ResourceType_ID, Integer.valueOf(S_ResourceType_ID));
}
/** Get Ressourcenart.
@return Ressourcenart */
@Override
public int getS_ResourceType_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_S_ResourceType_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Endzeitpunkt.
@param TimeSlotEnd
Time when timeslot ends
*/
@Override
public void setTimeSlotEnd (java.sql.Timestamp TimeSlotEnd)
{
set_Value (COLUMNNAME_TimeSlotEnd, TimeSlotEnd);
}
/** Get Endzeitpunkt.
@return Time when timeslot ends
*/
@Override
public java.sql.Timestamp getTimeSlotEnd ()
{
return (java.sql.Timestamp)get_Value(COLUMNNAME_TimeSlotEnd);
}
/** Set Startzeitpunkt.
@param TimeSlotStart
Time when timeslot starts
*/
@Override
public void setTimeSlotStart (java.sql.Timestamp TimeSlotStart)
|
{
set_Value (COLUMNNAME_TimeSlotStart, TimeSlotStart);
}
/** Get Startzeitpunkt.
@return Time when timeslot starts
*/
@Override
public java.sql.Timestamp getTimeSlotStart ()
{
return (java.sql.Timestamp)get_Value(COLUMNNAME_TimeSlotStart);
}
/** Set Suchschlüssel.
@param Value
Search key for the record in the format required - must be unique
*/
@Override
public void setValue (java.lang.String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
/** Get Suchschlüssel.
@return Search key for the record in the format required - must be unique
*/
@Override
public java.lang.String getValue ()
{
return (java.lang.String)get_Value(COLUMNNAME_Value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_S_ResourceType.java
| 1
|
请完成以下Java代码
|
public String getTitle() {
return title;
}
public String getBody() {
return body;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public void setTitle(String title) {
this.title = title;
}
|
public void setBody(String body) {
this.body = body;
}
public void setTagUris(List<URI> tagUris) {
this.tagUris = tagUris;
}
@JsonProperty("tags")
public List<URI> getTagUris() {
return this.tagUris;
}
}
|
repos\tutorials-master\spring-5-rest-docs\src\main\java\com\baeldung\restdocs\CrudInput.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Bean
ApplicationRunner runner(ConcurrentKafkaListenerContainerFactory<String, String> factory) {
return args -> {
createContainer(factory, "topic1", "group1");
};
}
@Bean
public ApplicationRunner runner1(ApplicationContext applicationContext) {
return args -> {
// tag::getBeans[]
applicationContext.getBean(MyPojo.class, "one", "topic2");
applicationContext.getBean(MyPojo.class, "two", "topic3");
// end::getBeans[]
};
}
// tag::create[]
private ConcurrentMessageListenerContainer<String, String> createContainer(
ConcurrentKafkaListenerContainerFactory<String, String> factory, String topic, String group) {
ConcurrentMessageListenerContainer<String, String> container = factory.createContainer(topic);
container.getContainerProperties().setMessageListener(new MyListener());
container.getContainerProperties().setGroupId(group);
container.setBeanName(group);
container.start();
return container;
}
// end::create[]
@Bean
public KafkaAdmin.NewTopics topics() {
|
return new KafkaAdmin.NewTopics(
TopicBuilder.name("topic1")
.partitions(10)
.replicas(1)
.build(),
TopicBuilder.name("topic2")
.partitions(10)
.replicas(1)
.build(),
TopicBuilder.name("topic3")
.partitions(10)
.replicas(1)
.build());
}
// tag::pojoBean[]
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
MyPojo pojo(String id, String topic) {
return new MyPojo(id, topic);
}
//end::pojoBean[]
}
|
repos\spring-kafka-main\spring-kafka-docs\src\main\java\org\springframework\kafka\jdocs\dynamic\Application.java
| 2
|
请完成以下Java代码
|
void waitUntilReady(List<RunningService> runningServices) {
Duration timeout = this.properties.getTimeout();
Instant start = this.clock.instant();
while (true) {
List<ServiceNotReadyException> exceptions = check(runningServices);
if (exceptions.isEmpty()) {
return;
}
Duration elapsed = Duration.between(start, this.clock.instant());
if (elapsed.compareTo(timeout) > 0) {
throw new ReadinessTimeoutException(timeout, exceptions);
}
this.sleep.accept(SLEEP_BETWEEN_READINESS_TRIES);
}
}
private List<ServiceNotReadyException> check(List<RunningService> runningServices) {
List<ServiceNotReadyException> exceptions = null;
for (RunningService service : runningServices) {
if (isDisabled(service)) {
continue;
}
logger.trace(LogMessage.format("Checking readiness of service '%s'", service));
try {
this.check.check(service);
logger.trace(LogMessage.format("Service '%s' is ready", service));
}
catch (ServiceNotReadyException ex) {
logger.trace(LogMessage.format("Service '%s' is not ready", service), ex);
exceptions = (exceptions != null) ? exceptions : new ArrayList<>();
exceptions.add(ex);
}
}
|
return (exceptions != null) ? exceptions : Collections.emptyList();
}
private boolean isDisabled(RunningService service) {
return service.labels().containsKey(DISABLE_LABEL);
}
private static void sleep(Duration duration) {
try {
Thread.sleep(duration.toMillis());
}
catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
}
}
|
repos\spring-boot-4.0.1\core\spring-boot-docker-compose\src\main\java\org\springframework\boot\docker\compose\lifecycle\ServiceReadinessChecks.java
| 1
|
请完成以下Java代码
|
public class HTMLUtils {
/**
* 获取HTML内的文本,不包含标签
*
* @param html HTML 代码
*/
public static String getInnerText(String html) {
if (StringUtils.isNotBlank(html)) {
//去掉 html 的标签
String content = html.replaceAll("</?[^>]+>", "");
// 将多个空格合并成一个空格
content = content.replaceAll("( )+", " ");
// 反向转义字符
content = HtmlUtils.htmlUnescape(content);
return content.trim();
}
return "";
}
|
/**
* 将Markdown解析成Html
* @param markdownContent
* @return
*/
public static String parseMarkdown(String markdownContent) {
/*PegDownProcessor pdp = new PegDownProcessor();
return pdp.markdownToHtml(markdownContent);*/
Parser parser = Parser.builder().build();
Node document = parser.parse(markdownContent);
HtmlRenderer renderer = HtmlRenderer.builder().build();
return renderer.render(document);
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-boot-base-core\src\main\java\org\jeecg\common\util\HTMLUtils.java
| 1
|
请完成以下Java代码
|
private Observation deserializeObs(byte[] data) {
return data == null ? null : observationSerDes.deserialize(data);
}
/* *************** Expiration handling **************** */
/**
* Start regular cleanup of dead registrations.
*/
@Override
public synchronized void start() {
if (!started) {
started = true;
cleanerTask = schedExecutor.scheduleAtFixedRate(new Cleaner(), cleanPeriod, cleanPeriod, TimeUnit.SECONDS);
}
}
/**
* Stop the underlying cleanup of the registrations.
*/
@Override
public synchronized void stop() {
if (started) {
started = false;
if (cleanerTask != null) {
cleanerTask.cancel(false);
cleanerTask = null;
}
}
}
/**
* Destroy "cleanup" scheduler.
*/
@Override
public synchronized void destroy() {
started = false;
schedExecutor.shutdownNow();
try {
schedExecutor.awaitTermination(5, TimeUnit.SECONDS);
} catch (InterruptedException e) {
log.warn("Destroying RedisRegistrationStore was interrupted.", e);
}
}
private class Cleaner implements Runnable {
|
@Override
public void run() {
try (var connection = connectionFactory.getConnection()) {
Set<byte[]> endpointsExpired = connection.zRangeByScore(EXP_EP, Double.NEGATIVE_INFINITY,
System.currentTimeMillis(), 0, cleanLimit);
for (byte[] endpoint : endpointsExpired) {
byte[] data = connection.get(toEndpointKey(endpoint));
if (data != null && data.length > 0) {
Registration r = deserializeReg(data);
if (!r.isAlive(gracePeriod)) {
Deregistration dereg = removeRegistration(connection, r.getId(), true);
if (dereg != null)
expirationListener.registrationExpired(dereg.getRegistration(), dereg.getObservations());
}
}
}
} catch (Exception e) {
log.warn("Unexpected Exception while registration cleaning", e);
}
}
}
@Override
public void setExpirationListener(ExpirationListener listener) {
expirationListener = listener;
}
public void setExecutor(ScheduledExecutorService executor) {
// TODO should we reuse californium executor ?
}
}
|
repos\thingsboard-master\common\transport\lwm2m\src\main\java\org\thingsboard\server\transport\lwm2m\server\store\TbLwM2mRedisRegistrationStore.java
| 1
|
请完成以下Spring Boot application配置
|
server.port=18080
keycloak.enabled=true
client.id = baeldung-soap-services
spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:8080/realms/baeldung-soap-services
# Custom properties begin here
ws.api.path=/ws/api/v1/*
ws.port.type.name=ProductsPort
ws.target.namespace
|
=http://www.baeldung.com/springbootsoap/keycloak
ws.location.uri=http://localhost:18080/ws/api/v1/
logging.level.root=DEBUG
|
repos\tutorials-master\spring-boot-modules\spring-boot-keycloak-2\src\main\resources\application-keycloak.properties
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public Sender sender() { // Sender 采用 HTTP 通信方式
return OkHttpSender.create("http://127.0.0.1:9411/api/v2/spans");
}
/**
* Configuration for how to buffer spans into messages for Zipkin
*/
@Bean
public AsyncReporter<Span> spanReporter() { // 异步 Reporter
return AsyncReporter.create(sender());
}
/**
* Controls aspects of tracing such as the service name that shows up in the UI
*/
@Bean
public Tracing tracing(@Value("${spring.application.name}") String serviceName) {
return Tracing.newBuilder()
.localServiceName(serviceName) // 应用名
.spanReporter(this.spanReporter()).build();
}
/**
* Allows someone to add tags to a span if a trace is in progress
*/
@Bean
public SpanCustomizer spanCustomizer(Tracing tracing) {
return CurrentSpanCustomizer.create(tracing);
}
// ==================== HTTP 相关 ====================
/**
* Decides how to name and tag spans. By default they are named the same as the http method
*/
@Bean
public HttpTracing httpTracing(Tracing tracing) {
return HttpTracing.create(tracing);
}
/**
* Creates server spans for http requests
*/
@Bean
public Filter tracingFilter(HttpTracing httpTracing) { // 拦截请求,记录 HTTP 请求的链路信息
return TracingFilter.create(httpTracing);
}
// ==================== SpringMVC 相关 ====================
// @see SpringMvcConfiguration 类上的,@Import(SpanCustomizingAsyncHandlerInterceptor.class) 。因为 SpanCustomizingAsyncHandlerInterceptor 未提供 public 构造方法
|
// ==================== RabbitMQ 相关 ====================
@Bean
public JmsTracing jmsTracing(Tracing tracing) {
return JmsTracing.newBuilder(tracing)
.remoteServiceName("demo-mq-activemq") // 远程 ActiveMQ 服务名,可自定义
.build();
}
@Bean
public BeanPostProcessor activeMQBeanPostProcessor(JmsTracing jmsTracing) {
return new BeanPostProcessor() {
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
return bean;
}
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
// 如果是 ConnectionFactory ,针对 ActiveMQ Producer 和 Consumer
if (bean instanceof ConnectionFactory) {
return jmsTracing.connectionFactory((ConnectionFactory) bean);
}
return bean;
}
};
}
}
|
repos\SpringBoot-Labs-master\lab-40\lab-40-activemq\src\main\java\cn\iocoder\springboot\lab40\zipkindemo\config\ZipkinConfiguration.java
| 2
|
请完成以下Java代码
|
public final @Nullable ConnectionFactory getConnectionFactory() {
return (this.rabbitOperations != null ? this.rabbitOperations.getConnectionFactory() : null);
}
/**
* Set the {@link RabbitOperations} for the gateway.
* @param rabbitOperations The Rabbit operations.
* @see #setConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory)
*/
public final void setRabbitOperations(RabbitOperations rabbitOperations) {
this.rabbitOperations = rabbitOperations;
}
/**
* @return The {@link RabbitOperations} for the gateway.
*/
public final @Nullable RabbitOperations getRabbitOperations() {
return this.rabbitOperations;
}
@Override
public final void afterPropertiesSet() throws IllegalArgumentException, BeanInitializationException {
if (this.rabbitOperations == null) {
throw new IllegalArgumentException("'connectionFactory' or 'rabbitTemplate' is required");
}
|
try {
initGateway();
}
catch (Exception ex) {
throw new BeanInitializationException("Initialization of Rabbit gateway failed: " + ex.getMessage(), ex);
}
}
/**
* Subclasses can override this for custom initialization behavior.
* Gets called after population of this instance's bean properties.
*/
protected void initGateway() {
}
}
|
repos\spring-amqp-main\spring-rabbit\src\main\java\org\springframework\amqp\rabbit\core\RabbitGatewaySupport.java
| 1
|
请完成以下Java代码
|
private static Class loadClass(ClassLoader classLoader, String className) throws ClassNotFoundException {
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
boolean useClassForName =
processEngineConfiguration == null || processEngineConfiguration.isUseClassForNameClassLoading();
return useClassForName ? Class.forName(className, true, classLoader) : classLoader.loadClass(className);
}
public static boolean isGetter(Method method) {
String name = method.getName();
Class<?> type = method.getReturnType();
Class<?> params[] = method.getParameterTypes();
if (!GETTER_PATTERN.matcher(name).matches()) {
return false;
}
// special for isXXX boolean
if (name.startsWith("is")) {
return params.length == 0 && type.getSimpleName().equalsIgnoreCase("boolean");
}
return params.length == 0 && !type.equals(Void.TYPE);
}
public static boolean isSetter(Method method, boolean allowBuilderPattern) {
String name = method.getName();
Class<?> type = method.getReturnType();
Class<?> params[] = method.getParameterTypes();
if (!SETTER_PATTERN.matcher(name).matches()) {
return false;
}
return (
params.length == 1 &&
(type.equals(Void.TYPE) || (allowBuilderPattern && method.getDeclaringClass().isAssignableFrom(type)))
);
}
public static boolean isSetter(Method method) {
return isSetter(method, false);
}
public static String getGetterShorthandName(Method method) {
if (!isGetter(method)) {
return method.getName();
}
String name = method.getName();
if (name.startsWith("get")) {
|
name = name.substring(3);
name = name.substring(0, 1).toLowerCase(Locale.ENGLISH) + name.substring(1);
} else if (name.startsWith("is")) {
name = name.substring(2);
name = name.substring(0, 1).toLowerCase(Locale.ENGLISH) + name.substring(1);
}
return name;
}
public static String getSetterShorthandName(Method method) {
if (!isSetter(method)) {
return method.getName();
}
String name = method.getName();
if (name.startsWith("set")) {
name = name.substring(3);
name = name.substring(0, 1).toLowerCase(Locale.ENGLISH) + name.substring(1);
}
return name;
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\util\ReflectUtil.java
| 1
|
请完成以下Java代码
|
public void execute(DelegateExecution execution) {
prepareAndExecuteRequest(execution);
}
@Override
protected FlowableMailClient getMailClient(DelegateExecution execution) {
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration();
String tenantId = execution.getTenantId();
FlowableMailClient mailClient = null;
if (StringUtils.isNotBlank(tenantId)) {
mailClient = processEngineConfiguration.getMailClient(tenantId);
}
if (mailClient == null) {
mailClient = processEngineConfiguration.getDefaultMailClient();
|
}
return mailClient;
}
@Override
protected Expression createExpression(String expressionText) {
return CommandContextUtil.getProcessEngineConfiguration().getExpressionManager().createExpression(expressionText);
}
@Override
protected ContentService getContentService() {
return CommandContextUtil.getContentService();
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\bpmn\mail\BpmnMailActivityDelegate.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void setProgressNumberDifference(BigInteger value) {
this.progressNumberDifference = value;
}
/**
* Gets the value of the kanbanID 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 kanbanID property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getKanbanID().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link String }
*
*
*/
public List<String> getKanbanID() {
if (kanbanID == null) {
kanbanID = new ArrayList<String>();
}
return this.kanbanID;
}
/**
* The classification of the product/service in free-text form.Gets the value of the classification 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 classification property.
*
* <p>
* For example, to add a new item, do as follows:
|
* <pre>
* getClassification().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ClassificationType }
*
*
*/
public List<ClassificationType> getClassification() {
if (classification == null) {
classification = new ArrayList<ClassificationType>();
}
return this.classification;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\AdditionalLineItemInformationType.java
| 2
|
请完成以下Java代码
|
public void handleDeployedChannelDefinitions() {
// Fetching and deploying all existing channel definitions at bootup
List<ChannelDefinition> channelDefinitions = repositoryService.createChannelDefinitionQuery().latestVersion().list();
for (ChannelDefinition channelDefinition : channelDefinitions) {
// Getting the channel model will trigger a deployment and set up the channel and associated adapters
ChannelModel channelModel = repositoryService.getChannelModelById(channelDefinition.getId());
LOGGER.info("Booted up channel {} ", channelModel.getKey());
}
}
@Override
public void close() {
EventRegistryEngines.unregister(this);
if (engineConfiguration.getEventRegistryChangeDetectionExecutor() != null) {
engineConfiguration.getEventRegistryChangeDetectionExecutor().shutdown();
}
engineConfiguration.close();
if (engineConfiguration.getEngineLifecycleListeners() != null) {
for (EngineLifecycleListener engineLifecycleListener : engineConfiguration.getEngineLifecycleListeners()) {
engineLifecycleListener.onEngineClosed(this);
}
}
}
// getters and setters
// //////////////////////////////////////////////////////
@Override
public String getName() {
return name;
}
@Override
public EventRepositoryService getEventRepositoryService() {
return repositoryService;
|
}
@Override
public EventManagementService getEventManagementService() {
return managementService;
}
@Override
public EventRegistry getEventRegistry() {
return eventRegistry;
}
@Override
public EventRegistryEngineConfiguration getEventRegistryEngineConfiguration() {
return engineConfiguration;
}
}
|
repos\flowable-engine-main\modules\flowable-event-registry\src\main\java\org\flowable\eventregistry\impl\EventRegistryEngineImpl.java
| 1
|
请完成以下Java代码
|
private ListenableFuture<List<TsKvEntry>> convertAsyncResultSetToTsKvEntryList(TbResultSet rs) {
return Futures.transform(rs.allRows(readResultsProcessingExecutor),
rows -> this.convertResultToTsKvEntryList(rows), readResultsProcessingExecutor);
}
private PreparedStatement getLatestStmt() {
if (latestInsertStmt == null) {
latestInsertStmt = prepare(INSERT_INTO + ModelConstants.TS_KV_LATEST_CF +
"(" + ModelConstants.ENTITY_TYPE_COLUMN +
"," + ModelConstants.ENTITY_ID_COLUMN +
"," + ModelConstants.KEY_COLUMN +
"," + ModelConstants.TS_COLUMN +
"," + ModelConstants.BOOLEAN_VALUE_COLUMN +
"," + ModelConstants.STRING_VALUE_COLUMN +
"," + ModelConstants.LONG_VALUE_COLUMN +
"," + ModelConstants.DOUBLE_VALUE_COLUMN +
"," + ModelConstants.JSON_VALUE_COLUMN + ")" +
" VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)");
}
return latestInsertStmt;
}
private PreparedStatement getFindLatestStmt() {
if (findLatestStmt == null) {
findLatestStmt = prepare(SELECT_PREFIX +
ModelConstants.KEY_COLUMN + "," +
ModelConstants.TS_COLUMN + "," +
ModelConstants.STRING_VALUE_COLUMN + "," +
ModelConstants.BOOLEAN_VALUE_COLUMN + "," +
ModelConstants.LONG_VALUE_COLUMN + "," +
ModelConstants.DOUBLE_VALUE_COLUMN + "," +
ModelConstants.JSON_VALUE_COLUMN + " " +
"FROM " + ModelConstants.TS_KV_LATEST_CF + " " +
"WHERE " + ModelConstants.ENTITY_TYPE_COLUMN + EQUALS_PARAM +
"AND " + ModelConstants.ENTITY_ID_COLUMN + EQUALS_PARAM +
"AND " + ModelConstants.KEY_COLUMN + EQUALS_PARAM);
}
|
return findLatestStmt;
}
private PreparedStatement getFindAllLatestStmt() {
if (findAllLatestStmt == null) {
findAllLatestStmt = prepare(SELECT_PREFIX +
ModelConstants.KEY_COLUMN + "," +
ModelConstants.TS_COLUMN + "," +
ModelConstants.STRING_VALUE_COLUMN + "," +
ModelConstants.BOOLEAN_VALUE_COLUMN + "," +
ModelConstants.LONG_VALUE_COLUMN + "," +
ModelConstants.DOUBLE_VALUE_COLUMN + "," +
ModelConstants.JSON_VALUE_COLUMN + " " +
"FROM " + ModelConstants.TS_KV_LATEST_CF + " " +
"WHERE " + ModelConstants.ENTITY_TYPE_COLUMN + EQUALS_PARAM +
"AND " + ModelConstants.ENTITY_ID_COLUMN + EQUALS_PARAM);
}
return findAllLatestStmt;
}
}
|
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\timeseries\CassandraBaseTimeseriesLatestDao.java
| 1
|
请完成以下Java代码
|
public String getOnTransaction() {
return onTransaction;
}
public void setOnTransaction(String onTransaction) {
this.onTransaction = onTransaction;
}
public String getCustomPropertiesResolverImplementationType() {
return customPropertiesResolverImplementationType;
}
public void setCustomPropertiesResolverImplementationType(String customPropertiesResolverImplementationType) {
this.customPropertiesResolverImplementationType = customPropertiesResolverImplementationType;
}
public String getCustomPropertiesResolverImplementation() {
return customPropertiesResolverImplementation;
}
public void setCustomPropertiesResolverImplementation(String customPropertiesResolverImplementation) {
this.customPropertiesResolverImplementation = customPropertiesResolverImplementation;
}
public Object getInstance() {
return instance;
}
public void setInstance(Object instance) {
|
this.instance = instance;
}
public ActivitiListener clone() {
ActivitiListener clone = new ActivitiListener();
clone.setValues(this);
return clone;
}
public void setValues(ActivitiListener otherListener) {
setEvent(otherListener.getEvent());
setImplementation(otherListener.getImplementation());
setImplementationType(otherListener.getImplementationType());
fieldExtensions = new ArrayList<FieldExtension>();
if (otherListener.getFieldExtensions() != null && !otherListener.getFieldExtensions().isEmpty()) {
for (FieldExtension extension : otherListener.getFieldExtensions()) {
fieldExtensions.add(extension.clone());
}
}
}
}
|
repos\Activiti-develop\activiti-core\activiti-bpmn-model\src\main\java\org\activiti\bpmn\model\ActivitiListener.java
| 1
|
请完成以下Java代码
|
public void setDurationMillis (int DurationMillis)
{
set_Value (COLUMNNAME_DurationMillis, Integer.valueOf(DurationMillis));
}
/** Get Duration (ms).
@return Duration (ms) */
@Override
public int getDurationMillis ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_DurationMillis);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Fehler.
@param IsError
Ein Fehler ist bei der Durchführung aufgetreten
*/
@Override
public void setIsError (boolean IsError)
{
set_Value (COLUMNNAME_IsError, Boolean.valueOf(IsError));
}
/** Get Fehler.
@return Ein Fehler ist bei der Durchführung aufgetreten
*/
@Override
public boolean isError ()
{
Object oo = get_Value(COLUMNNAME_IsError);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Request Message.
@param RequestMessage Request Message */
|
@Override
public void setRequestMessage (java.lang.String RequestMessage)
{
set_Value (COLUMNNAME_RequestMessage, RequestMessage);
}
/** Get Request Message.
@return Request Message */
@Override
public java.lang.String getRequestMessage ()
{
return (java.lang.String)get_Value(COLUMNNAME_RequestMessage);
}
/** Set Response Message.
@param ResponseMessage Response Message */
@Override
public void setResponseMessage (java.lang.String ResponseMessage)
{
set_Value (COLUMNNAME_ResponseMessage, ResponseMessage);
}
/** Get Response Message.
@return Response Message */
@Override
public java.lang.String getResponseMessage ()
{
return (java.lang.String)get_Value(COLUMNNAME_ResponseMessage);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.dpd\src\main\java-gen\de\metas\shipper\gateway\dpd\model\X_DPD_StoreOrder_Log.java
| 1
|
请完成以下Java代码
|
public DeadLetterJobEntityManager getDeadLetterJobEntityManager() {
return processEngineConfiguration.getDeadLetterJobEntityManager();
}
public AttachmentEntityManager getAttachmentEntityManager() {
return processEngineConfiguration.getAttachmentEntityManager();
}
public TableDataManager getTableDataManager() {
return processEngineConfiguration.getTableDataManager();
}
public CommentEntityManager getCommentEntityManager() {
return processEngineConfiguration.getCommentEntityManager();
}
public PropertyEntityManager getPropertyEntityManager() {
return processEngineConfiguration.getPropertyEntityManager();
}
public EventSubscriptionEntityManager getEventSubscriptionEntityManager() {
return processEngineConfiguration.getEventSubscriptionEntityManager();
}
public HistoryManager getHistoryManager() {
return processEngineConfiguration.getHistoryManager();
}
public JobManager getJobManager() {
return processEngineConfiguration.getJobManager();
}
// Involved executions ////////////////////////////////////////////////////////
public void addInvolvedExecution(ExecutionEntity executionEntity) {
if (executionEntity.getId() != null) {
involvedExecutions.put(executionEntity.getId(), executionEntity);
}
}
public boolean hasInvolvedExecutions() {
return involvedExecutions.size() > 0;
}
public Collection<ExecutionEntity> getInvolvedExecutions() {
return involvedExecutions.values();
}
// getters and setters
// //////////////////////////////////////////////////////
public Command<?> getCommand() {
return command;
}
|
public Map<Class<?>, Session> getSessions() {
return sessions;
}
public Throwable getException() {
return exception;
}
public FailedJobCommandFactory getFailedJobCommandFactory() {
return failedJobCommandFactory;
}
public ProcessEngineConfigurationImpl getProcessEngineConfiguration() {
return processEngineConfiguration;
}
public ActivitiEventDispatcher getEventDispatcher() {
return processEngineConfiguration.getEventDispatcher();
}
public ActivitiEngineAgenda getAgenda() {
return agenda;
}
public Object getResult() {
return resultStack.pollLast();
}
public void setResult(Object result) {
resultStack.add(result);
}
public boolean isReused() {
return reused;
}
public void setReused(boolean reused) {
this.reused = reused;
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\interceptor\CommandContext.java
| 1
|
请完成以下Java代码
|
public ElementPermissions getFormPermissions()
{
return formAccesses;
}
public UserRolePermissionsBuilder setFormPermissions(final ElementPermissions formAccesses)
{
this.formAccesses = formAccesses;
return this;
}
public UserRolePermissionsBuilder setMobileApplicationAccesses(final MobileApplicationPermissions mobileApplicationAccesses)
{
this.mobileApplicationAccesses = mobileApplicationAccesses;
return this;
}
UserRolePermissionsBuilder setMiscPermissions(final GenericPermissions permissions)
{
Check.assumeNull(miscPermissions, "permissions not already configured");
miscPermissions = permissions;
return this;
}
public GenericPermissions getMiscPermissions()
{
Check.assumeNotNull(miscPermissions, "permissions configured");
return miscPermissions;
}
UserRolePermissionsBuilder setConstraints(final Constraints constraints)
{
Check.assumeNull(this.constraints, "constraints not already configured");
this.constraints = constraints;
return this;
}
public Constraints getConstraints()
{
Check.assumeNotNull(constraints, "constraints configured");
return constraints;
}
@SuppressWarnings("UnusedReturnValue")
public UserRolePermissionsBuilder includeUserRolePermissions(final UserRolePermissions userRolePermissions, final int seqNo)
{
userRolePermissionsToInclude.add(UserRolePermissionsInclude.of(userRolePermissions, seqNo));
return this;
}
UserRolePermissionsBuilder setAlreadyIncludedRolePermissions(final UserRolePermissionsIncludesList userRolePermissionsAlreadyIncluded)
{
Check.assumeNotNull(userRolePermissionsAlreadyIncluded, "included not null");
Check.assumeNull(this.userRolePermissionsAlreadyIncluded, "already included permissions were not configured before");
|
this.userRolePermissionsAlreadyIncluded = userRolePermissionsAlreadyIncluded;
return this;
}
UserRolePermissionsIncludesList getUserRolePermissionsIncluded()
{
Check.assumeNotNull(userRolePermissionsIncluded, "userRolePermissionsIncluded not null");
return userRolePermissionsIncluded;
}
public UserRolePermissionsBuilder setMenuInfo(final UserMenuInfo menuInfo)
{
this._menuInfo = menuInfo;
return this;
}
public UserMenuInfo getMenuInfo()
{
if (_menuInfo == null)
{
_menuInfo = findMenuInfo();
}
return _menuInfo;
}
private UserMenuInfo findMenuInfo()
{
final Role adRole = getRole();
final AdTreeId roleMenuTreeId = adRole.getMenuTreeId();
if (roleMenuTreeId != null)
{
return UserMenuInfo.of(roleMenuTreeId, adRole.getRootMenuId());
}
final I_AD_ClientInfo adClientInfo = getAD_ClientInfo();
final AdTreeId adClientMenuTreeId = AdTreeId.ofRepoIdOrNull(adClientInfo.getAD_Tree_Menu_ID());
if (adClientMenuTreeId != null)
{
return UserMenuInfo.of(adClientMenuTreeId, adRole.getRootMenuId());
}
// Fallback: when role has NO menu and there is no menu defined on AD_ClientInfo level - shall not happen
return UserMenuInfo.DEFAULT_MENU;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\security\impl\UserRolePermissionsBuilder.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
boolean isAvailable() {
return StringUtils.hasText(this.username) && StringUtils.hasText(this.password);
}
}
public static class Validation {
/**
* Whether to enable LDAP schema validation.
*/
private boolean enabled = true;
/**
* Path to the custom schema.
*/
private @Nullable Resource schema;
|
public boolean isEnabled() {
return this.enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public @Nullable Resource getSchema() {
return this.schema;
}
public void setSchema(@Nullable Resource schema) {
this.schema = schema;
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-ldap\src\main\java\org\springframework\boot\ldap\autoconfigure\embedded\EmbeddedLdapProperties.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class DunningExportServiceRegistry
{
private final Map<String, DunningExportClientFactory> dunningExportClientFactoriesByGatewayId;
public DunningExportServiceRegistry(Optional<List<DunningExportClientFactory>> dunningExportClientFactories)
{
dunningExportClientFactoriesByGatewayId = dunningExportClientFactories.orElse(ImmutableList.of())
.stream()
.filter(Objects::nonNull)
.collect(GuavaCollectors.toImmutableMapByKey(DunningExportClientFactory::getDunningExportProviderId));
}
public boolean hasServiceSupport(@Nullable final String dunningExportGatewayId)
{
if (Check.isEmpty(dunningExportGatewayId, true))
{
return false;
}
return dunningExportClientFactoriesByGatewayId.containsKey(dunningExportGatewayId);
|
}
public List<DunningExportClient> createExportClients(@NonNull final DunningToExport dunning)
{
final Collection<DunningExportClientFactory> factories = dunningExportClientFactoriesByGatewayId.values();
final ImmutableList.Builder<DunningExportClient> result = ImmutableList.builder();
for (final DunningExportClientFactory factory : factories)
{
final Optional<DunningExportClient> newClientForDunning = factory.newClientForDunning(dunning);
newClientForDunning.ifPresent(result::add);
}
return result.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.dunning_gateway.api\src\main\java\de\metas\dunning_gateway\api\DunningExportServiceRegistry.java
| 2
|
请完成以下Java代码
|
public static boolean equals(@Nullable final IdsToFilter obj1, @Nullable final IdsToFilter obj2)
{
return Objects.equals(obj1, obj2);
}
public boolean isNoValue()
{
return noValue;
}
public boolean isSingleValue()
{
return singleValue != null;
}
public boolean isMultipleValues()
{
return multipleValues != null;
}
@Nullable
public Object getSingleValueAsObject()
{
if (noValue)
{
return null;
}
else if (singleValue != null)
{
return singleValue;
}
else
{
throw new AdempiereException("Not a single value instance: " + this);
}
}
public ImmutableList<Object> getMultipleValues()
{
if (multipleValues != null)
{
return multipleValues;
}
else
{
throw new AdempiereException("Not a multiple values instance: " + this);
}
}
@Nullable
public Integer getSingleValueAsInteger(@Nullable final Integer defaultValue)
{
final Object value = getSingleValueAsObject();
if (value == null)
{
return defaultValue;
}
else if (value instanceof Number)
{
return ((Number)value).intValue();
}
else
{
final String valueStr = StringUtils.trimBlankToNull(value.toString());
if (valueStr == null)
{
return defaultValue;
|
}
else
{
return Integer.parseInt(valueStr);
}
}
}
@Nullable
public String getSingleValueAsString()
{
final Object value = getSingleValueAsObject();
return value != null ? value.toString() : null;
}
public Stream<IdsToFilter> streamSingleValues()
{
if (noValue)
{
return Stream.empty();
}
else if (singleValue != null)
{
return Stream.of(this);
}
else
{
Objects.requireNonNull(multipleValues);
return multipleValues.stream().map(IdsToFilter::ofSingleValue);
}
}
public ImmutableList<Object> toImmutableList()
{
if (noValue)
{
return ImmutableList.of();
}
else if (singleValue != null)
{
return ImmutableList.of(singleValue);
}
else
{
Objects.requireNonNull(multipleValues);
return multipleValues;
}
}
public IdsToFilter mergeWith(@NonNull final IdsToFilter other)
{
if (other.isNoValue())
{
return this;
}
else if (isNoValue())
{
return other;
}
else
{
final ImmutableSet<Object> multipleValues = Stream.concat(toImmutableList().stream(), other.toImmutableList().stream())
.distinct()
.collect(ImmutableSet.toImmutableSet());
return ofMultipleValues(multipleValues);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\model\lookup\IdsToFilter.java
| 1
|
请完成以下Java代码
|
default RT process(@NonNull final List<? extends IT> items)
{
return process(items.iterator());
}
/** Configures the context. Also see {@link #setContext(Properties, String)}. */
ITrxItemExecutorBuilder<IT, RT> setContext(Properties ctx);
/**
* Configures the context
*
* @param trxName use {@link org.adempiere.ad.trx.api.ITrx#TRXNAME_None} if you want each chunk to be processed in a single transaction.
*/
ITrxItemExecutorBuilder<IT, RT> setContext(Properties ctx, @Nullable String trxName);
/** Configures the context */
ITrxItemExecutorBuilder<IT, RT> setContext(ITrxItemProcessorContext processorCtx);
/** Configures the processor to be used. Here you will inject your nice code ;) */
ITrxItemExecutorBuilder<IT, RT> setProcessor(ITrxItemProcessor<IT, RT> processor);
/** Configures the processor to be used. Here you will inject your nice code ;) */
default ITrxItemExecutorBuilder<IT, RT> setProcessor(final Consumer<IT> processor)
{
Preconditions.checkNotNull(processor, "processor is null");
setProcessor(new TrxItemProcessorAdapter<IT, RT>()
{
@Override
public void process(IT item) throws Exception
{
processor.accept(item);
}
});
return this;
}
/**
* Sets exception handler to be used if processing fails.
*
* @see ITrxItemProcessorExecutor#setExceptionHandler(ITrxItemExceptionHandler)
|
* @see ITrxItemProcessorExecutor#DEFAULT_ExceptionHandler
*/
ITrxItemExecutorBuilder<IT, RT> setExceptionHandler(ITrxItemExceptionHandler exceptionHandler);
/**
* Specifies what to do if processing an item fails.
*
* @see ITrxItemProcessorExecutor#DEFAULT_OnItemErrorPolicy for the default value.
*
* task https://github.com/metasfresh/metasfresh/issues/302
*/
ITrxItemExecutorBuilder<IT, RT> setOnItemErrorPolicy(OnItemErrorPolicy onItemErrorPolicy);
/**
* Sets how many items we shall maximally process in one batch/transaction.
*
* @param itemsPerBatch items per batch or {@link Integer#MAX_VALUE} if you want to not enforce the restriction.
*/
ITrxItemExecutorBuilder<IT, RT> setItemsPerBatch(int itemsPerBatch);
/**
* Sets if the executor shall use transaction savepoints on individual chunks internally.
* This setting is only relevant, if the executor's parent-trx is null (see {@link #setContext(Properties, String)}).
* <p>
* If <code>true</code> and the executor has an external not-null transaction,
* then the executor will create a {@link ITrxSavepoint} when starting a new chunk.
* If a chunk fails and is canceled, the executor will roll back to the savepoint.
* Without a savepoint, the executor will not roll back.
*
*
* @see ITrxItemProcessorExecutor#setUseTrxSavepoints(boolean)
*/
ITrxItemExecutorBuilder<IT, RT> setUseTrxSavepoints(boolean useTrxSavepoints);
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\trx\processor\api\ITrxItemExecutorBuilder.java
| 1
|
请完成以下Java代码
|
public int getRV_DATEV_Export_Fact_Acct_Invoice_ID()
{
return get_ValueAsInt(COLUMNNAME_RV_DATEV_Export_Fact_Acct_Invoice_ID);
}
@Override
public void setTaxAmtSource (final @Nullable BigDecimal TaxAmtSource)
{
set_ValueNoCheck (COLUMNNAME_TaxAmtSource, TaxAmtSource);
}
@Override
public BigDecimal getTaxAmtSource()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_TaxAmtSource);
|
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setVATCode (final @Nullable java.lang.String VATCode)
{
set_ValueNoCheck (COLUMNNAME_VATCode, VATCode);
}
@Override
public java.lang.String getVATCode()
{
return get_ValueAsString(COLUMNNAME_VATCode);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.datev\src\main\java-gen\de\metas\datev\model\X_RV_DATEV_Export_Fact_Acct_Invoice.java
| 1
|
请完成以下Java代码
|
public void addLink(String rel, URI hrefUri) {
addLink(rel, hrefUri.toString());
}
public void addEmbedded(String name, HalResource<?> embedded) {
linker.mergeLinks(embedded);
addEmbeddedObject(name, embedded);
}
private void addEmbeddedObject(String name, Object embedded) {
if(_embedded == null) {
_embedded = new TreeMap<String, Object>();
}
_embedded.put(name, embedded);
}
public void addEmbedded(String name, List<HalResource<?>> embeddedCollection) {
for (HalResource<?> resource : embeddedCollection) {
linker.mergeLinks(resource);
}
addEmbeddedObject(name, embeddedCollection);
}
public Object getEmbedded(String name) {
return _embedded.get(name);
}
|
/**
* Can be used to embed a relation. Embedded all linked resources in the given relation.
*
* @param relation the relation to embedded
* @param processEngine used to resolve the resources
* @return the resource itself.
*/
@SuppressWarnings("unchecked")
public T embed(HalRelation relation, ProcessEngine processEngine) {
List<HalResource<?>> resolvedLinks = linker.resolve(relation, processEngine);
if(resolvedLinks != null && resolvedLinks.size() > 0) {
addEmbedded(relation.relName, resolvedLinks);
}
return (T) this;
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\hal\HalResource.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public ConcurrentMap<UUID, TbProtoQueueMsg<TransportProtos.ToRuleEngineMsg>> getPendingMap() {
return orderedMsgList.stream().collect(Collectors.toConcurrentMap(pair -> pair.uuid, pair -> pair.msg));
}
@Override
public void update(ConcurrentMap<UUID, TbProtoQueueMsg<TransportProtos.ToRuleEngineMsg>> reprocessMap) {
List<IdMsgPair<TransportProtos.ToRuleEngineMsg>> newOrderedMsgList = new ArrayList<>(reprocessMap.size());
for (IdMsgPair<TransportProtos.ToRuleEngineMsg> pair : orderedMsgList) {
if (reprocessMap.containsKey(pair.uuid)) {
if (StringUtils.isNotEmpty(pair.getMsg().getValue().getFailureMessage())) {
var toRuleEngineMsg = TransportProtos.ToRuleEngineMsg.newBuilder(pair.getMsg().getValue())
.clearFailureMessage()
.clearRelationTypes()
.build();
var newMsg = new TbProtoQueueMsg<>(pair.getMsg().getKey(), toRuleEngineMsg, pair.getMsg().getHeaders());
newOrderedMsgList.add(new IdMsgPair<>(pair.getUuid(), newMsg));
} else {
newOrderedMsgList.add(pair);
}
|
}
}
orderedMsgList = newOrderedMsgList;
}
@Override
public void onSuccess(UUID id) {
if (!stopped) {
doOnSuccess(id);
}
}
@Override
public void stop() {
stopped = true;
}
}
|
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\queue\processing\AbstractTbRuleEngineSubmitStrategy.java
| 2
|
请完成以下Java代码
|
public void setActive(final Boolean active)
{
this.active = active;
this.activeSet = true;
}
public void setName(final String name)
{
this.name = name;
this.nameSet = true;
}
public void setBpartnerName(final String bpartnerName)
{
this.bpartnerName = bpartnerName;
this.bpartnerNameSet = true;
}
public void setAddress1(final String address1)
{
this.address1 = address1;
this.address1Set = true;
}
public void setAddress2(final String address2)
{
this.address2 = address2;
this.address2Set = true;
}
public void setAddress3(final String address3)
{
this.address3 = address3;
this.address3Set = true;
}
public void setAddress4(final String address4)
{
this.address4 = address4;
this.address4Set = true;
}
public void setPoBox(final String poBox)
{
this.poBox = poBox;
this.poBoxSet = true;
}
public void setPostal(final String postal)
{
this.postal = postal;
this.postalSet = true;
}
public void setCity(final String city)
{
this.city = city;
this.citySet = true;
}
public void setDistrict(final String district)
{
this.district = district;
this.districtSet = true;
}
public void setRegion(final String region)
{
this.region = region;
this.regionSet = true;
}
public void setCountryCode(final String countryCode)
{
|
this.countryCode = countryCode;
this.countryCodeSet = true;
}
public void setGln(final String gln)
{
this.gln = gln;
this.glnSet = true;
}
public void setShipTo(final Boolean shipTo)
{
this.shipTo = shipTo;
this.shipToSet = true;
}
public void setShipToDefault(final Boolean shipToDefault)
{
this.shipToDefault = shipToDefault;
this.shipToDefaultSet = true;
}
public void setBillTo(final Boolean billTo)
{
this.billTo = billTo;
this.billToSet = true;
}
public void setBillToDefault(final Boolean billToDefault)
{
this.billToDefault = billToDefault;
this.billToDefaultSet = true;
}
public void setSyncAdvise(final SyncAdvise syncAdvise)
{
this.syncAdvise = syncAdvise;
this.syncAdviseSet = true;
}
}
|
repos\metasfresh-new_dawn_uat\misc\de-metas-common\de-metas-common-bpartner\src\main\java\de\metas\common\bpartner\v1\request\JsonRequestLocation.java
| 1
|
请完成以下Java代码
|
public void setIsManualImport (final boolean IsManualImport)
{
set_Value (COLUMNNAME_IsManualImport, IsManualImport);
}
@Override
public boolean isManualImport()
{
return get_ValueAsBoolean(COLUMNNAME_IsManualImport);
}
@Override
public void setIsMultiLine (final boolean IsMultiLine)
{
set_Value (COLUMNNAME_IsMultiLine, IsMultiLine);
}
@Override
public boolean isMultiLine()
{
return get_ValueAsBoolean(COLUMNNAME_IsMultiLine);
}
@Override
public void setName (final java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
@Override
|
public void setProcessing (final boolean Processing)
{
set_Value (COLUMNNAME_Processing, Processing);
}
@Override
public boolean isProcessing()
{
return get_ValueAsBoolean(COLUMNNAME_Processing);
}
@Override
public void setSkipFirstNRows (final int SkipFirstNRows)
{
set_Value (COLUMNNAME_SkipFirstNRows, SkipFirstNRows);
}
@Override
public int getSkipFirstNRows()
{
return get_ValueAsInt(COLUMNNAME_SkipFirstNRows);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_ImpFormat.java
| 1
|
请完成以下Java代码
|
private WFState[] getNewStateOptions()
{
if (isNotStarted())
return new WFState[] { Running, Aborted, Terminated };
else if (isRunning())
return new WFState[] { Suspended, Completed, Aborted, Terminated };
else if (isSuspended())
return new WFState[] { Running, Aborted, Terminated };
else
return new WFState[] {};
}
/**
* Is the new State valid based on current state
*
* @param newState new state
* @return true valid new state
*/
public boolean isValidNewState(final WFState newState)
{
final WFState[] options = getNewStateOptions();
for (final WFState option : options)
{
if (option.equals(newState))
return true;
}
return false;
}
/**
* @return true if the action is valid based on current state
*/
public boolean isValidAction(final WFAction action)
{
final WFAction[] options = getActionOptions();
for (final WFAction option : options)
{
if (option.equals(action))
|
{
return true;
}
}
return false;
}
/**
* @return valid actions based on current State
*/
private WFAction[] getActionOptions()
{
if (isNotStarted())
return new WFAction[] { WFAction.Start, WFAction.Abort, WFAction.Terminate };
if (isRunning())
return new WFAction[] { WFAction.Suspend, WFAction.Complete, WFAction.Abort, WFAction.Terminate };
if (isSuspended())
return new WFAction[] { WFAction.Resume, WFAction.Abort, WFAction.Terminate };
else
return new WFAction[] {};
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\workflow\WFState.java
| 1
|
请完成以下Java代码
|
public class Operation implements Serializable {
private Integer number1;
private Integer number2;
private String operator;
public Operation(Integer number1, Integer number2, String operator) {
this.number1 = number1;
this.number2 = number2;
this.operator = operator;
}
public Integer getNumber1() {
return number1;
}
public void setNumber1(Integer number1) {
this.number1 = number1;
}
public Integer getNumber2() {
return number2;
}
public void setNumber2(Integer number2) {
|
this.number2 = number2;
}
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
@Override
public String toString() {
return "Operation{" +
"number1=" + number1 +
", number2=" + number2 +
", operator='" + operator + '\'' +
'}';
}
}
|
repos\tutorials-master\libraries-server-2\src\main\java\com\baeldung\netty\Operation.java
| 1
|
请完成以下Java代码
|
private List<RemittanceAdviceLine> retrieveLines(@NonNull final RemittanceAdviceId remittanceAdviceId,
@NonNull final CurrencyId remittanceCurrencyId,
@Nullable final CurrencyId serviceFeeCurrencyId)
{
return queryBL.createQueryBuilder(I_C_RemittanceAdvice_Line.class)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_C_RemittanceAdvice_Line.COLUMN_C_RemittanceAdvice_ID, remittanceAdviceId.getRepoId())
.orderBy(I_C_RemittanceAdvice_Line.COLUMN_C_RemittanceAdvice_Line_ID) // ordering them for reproducibility
.create()
.list()
.stream()
.map(line -> toRemittanceAdviceLine(line, remittanceCurrencyId, serviceFeeCurrencyId))
.collect(Collectors.toList());
}
@NonNull
private I_C_RemittanceAdvice_Line getLineRecordById(@NonNull final RemittanceAdviceLineId remittanceAdviceLineId)
|
{
return queryBL.createQueryBuilder(I_C_RemittanceAdvice_Line.class)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_C_RemittanceAdvice_Line.COLUMN_C_RemittanceAdvice_Line_ID, remittanceAdviceLineId)
.create()
.firstOnlyNotNull(I_C_RemittanceAdvice_Line.class);
}
@NonNull
private I_C_RemittanceAdvice getRecordById(@NonNull final RemittanceAdviceId remittanceAdviceId)
{
return queryBL.createQueryBuilder(I_C_RemittanceAdvice.class)
.addEqualsFilter(I_C_RemittanceAdvice.COLUMNNAME_C_RemittanceAdvice_ID, remittanceAdviceId)
.create()
.firstOnlyNotNull(I_C_RemittanceAdvice.class);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\remittanceadvice\RemittanceAdviceRepository.java
| 1
|
请完成以下Java代码
|
public boolean isDisplayed ()
{
Object oo = get_Value(COLUMNNAME_IsDisplayed);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Included.
@param IsInclude
Defines whether this content / template is included into another one
*/
public void setIsInclude (boolean IsInclude)
{
set_Value (COLUMNNAME_IsInclude, Boolean.valueOf(IsInclude));
}
/** Get Included.
@return Defines whether this content / template is included into another one
*/
public boolean isInclude ()
{
Object oo = get_Value(COLUMNNAME_IsInclude);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Printed.
@param IsPrinted
Indicates if this document / line is printed
*/
public void setIsPrinted (boolean IsPrinted)
{
set_Value (COLUMNNAME_IsPrinted, Boolean.valueOf(IsPrinted));
}
/** Get Printed.
@return Indicates if this document / line is printed
*/
public boolean isPrinted ()
{
Object oo = get_Value(COLUMNNAME_IsPrinted);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
|
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Sequence.
@param SeqNo
Method of ordering records; lowest number comes first
*/
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();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_HR_PayrollConcept.java
| 1
|
请完成以下Java代码
|
public ReceiptQty getQtyAndQuality(final org.compiere.model.I_M_InOutLine inoutLine0)
{
I_M_InOutLine inoutLine = InterfaceWrapperHelper.create(inoutLine0, I_M_InOutLine.class);
final ProductId productId = ProductId.ofRepoId(inoutLine.getM_Product_ID());
// note: QtyEnetered and MovementQty are currently the same, but that's just because we are in the habit of setting M_InOutLine.C_UOM to the respective prodcuts stocking UOM.
// therefore, we need to use MovementQty, unless we decide to add the UOM to this game, too (but currently i don't see the point).
final BigDecimal qtyInUOM;
final UomId uomId;
final ReceiptQty qtys;
if (InterfaceWrapperHelper.isNull(inoutLine, I_M_InOutLine.COLUMNNAME_QtyDeliveredCatch))
{
qtyInUOM = null;
uomId = null;
qtys = ReceiptQty.newWithoutCatchWeight(productId);
}
else
{
qtyInUOM = inoutLine.getQtyDeliveredCatch();
uomId = UomId.ofRepoId(inoutLine.getCatch_UOM_ID());
qtys = ReceiptQty.newWithCatchWeight(productId, uomId);
}
|
final StockQtyAndUOMQty qtyMoved = StockQtyAndUOMQtys.create(inoutLine.getMovementQty(), productId, qtyInUOM, uomId);
final StockQtyAndUOMQty qtyMovedWithIssues;
if (inoutLine.isInDispute())
{
qtyMovedWithIssues = qtyMoved;
}
else
{
qtyMovedWithIssues = qtyMoved.toZero();
}
qtys.addQtyAndQtyWithIssues(qtyMoved, qtyMovedWithIssues);
qtys.addQualityNotices(QualityNoticesCollection.valueOfQualityNoticesString(inoutLine.getQualityNote()));
return qtys;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\inoutcandidate\api\impl\InOutCandidateBL.java
| 1
|
请完成以下Java代码
|
public void setB_TopicType_ID (int B_TopicType_ID)
{
if (B_TopicType_ID < 1)
set_ValueNoCheck (COLUMNNAME_B_TopicType_ID, null);
else
set_ValueNoCheck (COLUMNNAME_B_TopicType_ID, Integer.valueOf(B_TopicType_ID));
}
/** Get Topic Type.
@return Auction Topic Type
*/
public int getB_TopicType_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_B_TopicType_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
|
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** 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_B_TopicCategory.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getProcessInstanceUrl() {
return processInstanceUrl;
}
public void setProcessInstanceUrl(String processInstanceUrl) {
this.processInstanceUrl = processInstanceUrl;
}
@ApiModelProperty(example = "6")
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
|
public RestVariable getVariable() {
return variable;
}
public void setVariable(RestVariable variable) {
this.variable = variable;
}
public String getExecutionId() {
return executionId;
}
public void setExecutionId(String executionId) {
this.executionId = executionId;
}
}
|
repos\flowable-engine-main\modules\flowable-rest\src\main\java\org\flowable\rest\service\api\history\HistoricVariableInstanceResponse.java
| 2
|
请完成以下Java代码
|
public abstract class AbstractJsonParser implements JsonParser {
protected final Map<String, Object> parseMap(@Nullable String json, Function<String, Map<String, Object>> parser) {
return trimParse(json, "{", parser);
}
protected final List<Object> parseList(@Nullable String json, Function<String, List<Object>> parser) {
return trimParse(json, "[", parser);
}
protected final <T> T trimParse(@Nullable String json, String prefix, Function<String, T> parser) {
String trimmed = (json != null) ? json.trim() : "";
if (trimmed.startsWith(prefix)) {
return parser.apply(trimmed);
}
throw new JsonParseException();
}
|
protected final <T> T tryParse(Callable<T> parser, Class<? extends Exception> check) {
try {
return parser.call();
}
catch (Exception ex) {
if (check.isAssignableFrom(ex.getClass())) {
throw new JsonParseException(ex);
}
ReflectionUtils.rethrowRuntimeException(ex);
throw new IllegalStateException(ex);
}
}
}
|
repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\json\AbstractJsonParser.java
| 1
|
请完成以下Java代码
|
public class Foo {
public int intValue;
public String stringValue;
public Foo(final int intValue, final String stringValue) {
this.intValue = intValue;
this.stringValue = stringValue;
}
public Foo(final String stringValue) {
this.stringValue = stringValue;
}
public Foo() {
super();
}
// API
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = (prime * result) + intValue;
result = (prime * result) + ((stringValue == null) ? 0 : stringValue.hashCode());
return result;
}
@Override
public boolean equals(final Object obj) {
|
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Foo other = (Foo) obj;
if (intValue != other.intValue) {
return false;
}
if (stringValue == null) {
if (other.stringValue != null) {
return false;
}
} else if (!stringValue.equals(other.stringValue)) {
return false;
}
return true;
}
@Override
public String toString() {
return "TargetClass{" + "intValue= " + intValue + ", stringValue= " + stringValue + '}';
}
}
|
repos\tutorials-master\json-modules\gson-2\src\main\java\com\baeldung\gson\deserialization\Foo.java
| 1
|
请完成以下Java代码
|
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public boolean isRequired() {
return required;
}
public void setRequired(boolean required) {
this.required = required;
}
@Override
public Boolean getDisplay() {
return display;
}
public void setDisplay(Boolean display) {
this.display = display;
}
@Override
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
@Override
public boolean isAnalytics() {
return analytics;
}
public void setAnalytics(boolean analytics) {
this.analytics = analytics;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
VariableDefinitionImpl that = (VariableDefinitionImpl) o;
return (
required == that.required &&
Objects.equals(display, that.display) &&
|
Objects.equals(id, that.id) &&
Objects.equals(name, that.name) &&
Objects.equals(description, that.description) &&
Objects.equals(type, that.type) &&
Objects.equals(displayName, that.displayName) &&
Objects.equals(analytics, that.analytics)
);
}
@Override
public int hashCode() {
return Objects.hash(id, name, description, type, required, display, displayName, analytics);
}
@Override
public String toString() {
return (
"VariableDefinitionImpl{" +
"id='" +
id +
'\'' +
", name='" +
name +
'\'' +
", description='" +
description +
'\'' +
", type='" +
type +
'\'' +
", required=" +
required +
", display=" +
display +
", displayName='" +
displayName +
'\'' +
", analytics='" +
analytics +
'\'' +
'}'
);
}
}
|
repos\Activiti-develop\activiti-core\activiti-api-impl\activiti-api-process-model-impl\src\main\java\org\activiti\api\runtime\model\impl\VariableDefinitionImpl.java
| 1
|
请完成以下Java代码
|
public I_M_ShippingPackage createShippingPackage(final ShipperTransportationId shipperTransportationId, final I_M_Package mpackage)
{
final I_M_ShippingPackage shippingPackage = InterfaceWrapperHelper.newInstance(I_M_ShippingPackage.class, mpackage);
shippingPackage.setM_ShipperTransportation_ID(ShipperTransportationId.toRepoId(shipperTransportationId));
updateShippingPackageFromPackage(shippingPackage, mpackage);
InterfaceWrapperHelper.save(shippingPackage);
return shippingPackage;
}
private void updateShippingPackageFromPackage(final I_M_ShippingPackage shippingPackage, final I_M_Package mpackage)
{
shippingPackage.setM_Package_ID(mpackage.getM_Package_ID());
shippingPackage.setC_BPartner_ID(mpackage.getC_BPartner_ID());
shippingPackage.setC_BPartner_Location_ID(mpackage.getC_BPartner_Location_ID());
if (mpackage.getM_InOut_ID() > 0)
{
shippingPackage.setM_InOut_ID(mpackage.getM_InOut_ID());
shippingPackage.setC_BPartner_ID(mpackage.getM_InOut().getC_BPartner_ID());
shippingPackage.setC_BPartner_Location_ID(mpackage.getM_InOut().getC_BPartner_Location_ID());
}
// @TODO: Calculate PackageNetTotal and PackageWeight ??
shippingPackage.setPackageNetTotal(mpackage.getPackageNetTotal());
shippingPackage.setPackageWeight(mpackage.getPackageWeight());
}
@Override
public void setC_DocType(@NonNull final I_M_ShipperTransportation shipperTransportation)
{
final String docBaseType = de.metas.shipping.util.Constants.C_DocType_DocBaseType_ShipperTransportation;
final int adClientId = shipperTransportation.getAD_Client_ID();
final int adOrgId = shipperTransportation.getAD_Org_ID();
final IDocTypeDAO docTypeDAO = Services.get(IDocTypeDAO.class);
final DocTypeQuery query = DocTypeQuery.builder()
|
.docBaseType(docBaseType)
.docSubType(DocTypeQuery.DOCSUBTYPE_Any)
.adClientId(adClientId)
.adOrgId(adOrgId)
.build();
final int docTypeId = docTypeDAO.getDocTypeId(query).getRepoId();
shipperTransportation.setC_DocType_ID(docTypeId);
}
@Override
public boolean isAnyOrderAssignedToDifferentTransportationOrder(final @NonNull ShipperTransportationId shipperTransportationId, final @NonNull Collection<OrderId> orderIds)
{
return shipperTransportationDAO.anyMatch(ShipperTransportationQuery.builder()
.shipperTransportationToExclude(shipperTransportationId)
.orderIds(orderIds)
.build());
}
@Override
public void setShipper(@NonNull final I_M_ShipperTransportation shipperTransportation, @NonNull final ShipperId shipperId)
{
shipperTransportation.setM_Shipper_ID(ShipperId.toRepoId(shipperId));
final I_M_Shipper shipper = shipperDAO.getById(shipperId);
shipperTransportation.setPickupTimeFrom(shipper.getPickupTimeFrom());
shipperTransportation.setPickupTimeTo(shipper.getPickupTimeTo());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\shipping\api\impl\ShipperTransportationBL.java
| 1
|
请完成以下Java代码
|
private void extractProject(ProjectGenerationResponse entity, @Nullable String output, boolean overwrite)
throws IOException {
File outputDirectory = (output != null) ? new File(output) : new File(System.getProperty("user.dir"));
if (!outputDirectory.exists()) {
outputDirectory.mkdirs();
}
byte[] content = entity.getContent();
Assert.state(content != null, "'content' must not be null");
try (ZipInputStream zipStream = new ZipInputStream(new ByteArrayInputStream(content))) {
extractFromStream(zipStream, overwrite, outputDirectory);
fixExecutableFlag(outputDirectory, "mvnw");
fixExecutableFlag(outputDirectory, "gradlew");
Log.info("Project extracted to '" + outputDirectory.getAbsolutePath() + "'");
}
}
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代码
|
protected I_M_AttributeSetInstance getModelFromObject(final Object modelObj)
{
if (modelObj == null)
{
return null;
}
final IAttributeSetInstanceAware asiAware = asiAwareFactory.createOrNull(modelObj);
if (asiAware == null)
{
return null;
}
if (asiAware.getM_AttributeSetInstance_ID() <= 0)
{
// We are dealing with an ASI Aware model, but there is no ASI
// Return a Null ASI marker which will be handled later.
// NOTE: this particular case is handled by isNullModel() method which will return true
final I_M_AttributeSetInstance asiNew = InterfaceWrapperHelper.newInstance(I_M_AttributeSetInstance.class);
InterfaceWrapperHelper.setSaveDeleteDisabled(asiNew, true);
return asiNew;
}
return asiAware.getM_AttributeSetInstance();
}
@Override
protected ArrayKey mkKey(final I_M_AttributeSetInstance model)
{
return Util.mkKey(model.getClass().getName(), model.getM_AttributeSetInstance_ID());
}
@Override
protected boolean isNullModel(final I_M_AttributeSetInstance model)
{
if (model == null)
{
return true;
}
// Case: null marker was returned. See "getModelFromObject" method.
return model.getM_AttributeSetInstance_ID() <= 0;
}
|
@Override
protected ASIWithPackingItemTemplateAttributeStorage createAttributeStorage(final I_M_AttributeSetInstance model)
{
return new ASIWithPackingItemTemplateAttributeStorage(this, model);
}
@Override
public IAttributeStorage getAttributeStorageIfHandled(final Object modelObj)
{
final I_M_AttributeSetInstance asi = getModelFromObject(modelObj);
if (asi == null)
{
return null;
}
// Case: this modelObj is handled by this factory but there was no ASI value set
// => don't go forward and ask other factories but instead return an NullAttributeStorage
if (asi.getM_AttributeSetInstance_ID() <= 0)
{
return NullAttributeStorage.instance;
}
return getAttributeStorageForModel(asi);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\attribute\storage\impl\ASIAwareAttributeStorageFactory.java
| 1
|
请完成以下Java代码
|
public static FlatrateDataEntryDetailId ofRepoId(@NonNull final FlatrateDataEntryId dataEntryId, final int repoId)
{
return new FlatrateDataEntryDetailId(dataEntryId, repoId);
}
@Nullable
public static FlatrateDataEntryDetailId ofRepoIdOrNull(@NonNull final FlatrateDataEntryId dataEntryId, final int repoId)
{
return repoId > 0 ? new FlatrateDataEntryDetailId(dataEntryId, repoId) : null;
}
public static int toRepoId(@Nullable final FlatrateDataEntryDetailId dataEntryDetailId)
{
return dataEntryDetailId != null ? dataEntryDetailId.getRepoId() : -1;
}
|
FlatrateDataEntryId dataEntryId;
int repoId;
private FlatrateDataEntryDetailId(@NonNull final FlatrateDataEntryId dataEntryId, final int repoId)
{
this.dataEntryId = dataEntryId;
this.repoId = Check.assumeGreaterThanZero(repoId, "repoId");
}
@Override
@JsonValue
public int getRepoId()
{
return repoId;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\flatrate\dataEntry\FlatrateDataEntryDetailId.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void addAuthorWithBooks(){
Author author = new Author();
author.setName("Alicia Tom");
author.setAge(38);
author.setGenre("Anthology");
Book book = new Book();
book.setIsbn("001-AT");
book.setTitle("The book of swords");
author.addBook(book); // use addBook() helper
authorRepository.save(author);
}
@Transactional
|
public void removeBookOfAuthor() {
Author author = authorRepository.findByName("Alicia Tom");
Book book = bookRepository.findByTitle("The book of swords");
author.removeBook(book); // use removeBook() helper
}
@Transactional
public void removeAllBooksOfAuthor() {
Author author = authorRepository.findByName("Joana Nimar");
author.removeBooks(); // use removeBooks() helper
}
}
|
repos\Hibernate-SpringBoot-master\HibernateSpringBootFlywayMySQLDatabase\src\main\java\com\bookstore\service\BookstoreService.java
| 2
|
请完成以下Java代码
|
protected void deleteExceptionByteArrayRef(SuspendedJobEntity jobEntity) {
ByteArrayRef exceptionByteArrayRef = jobEntity.getExceptionByteArrayRef();
if (exceptionByteArrayRef != null) {
exceptionByteArrayRef.delete();
}
}
protected SuspendedJobEntity createSuspendedJob(AbstractJobEntity job) {
SuspendedJobEntity newSuspendedJobEntity = create();
newSuspendedJobEntity.setJobHandlerConfiguration(job.getJobHandlerConfiguration());
newSuspendedJobEntity.setJobHandlerType(job.getJobHandlerType());
newSuspendedJobEntity.setExclusive(job.isExclusive());
newSuspendedJobEntity.setRepeat(job.getRepeat());
newSuspendedJobEntity.setRetries(job.getRetries());
newSuspendedJobEntity.setEndDate(job.getEndDate());
newSuspendedJobEntity.setExecutionId(job.getExecutionId());
|
newSuspendedJobEntity.setProcessInstanceId(job.getProcessInstanceId());
newSuspendedJobEntity.setProcessDefinitionId(job.getProcessDefinitionId());
// Inherit tenant
newSuspendedJobEntity.setTenantId(job.getTenantId());
newSuspendedJobEntity.setJobType(job.getJobType());
return newSuspendedJobEntity;
}
protected SuspendedJobDataManager getDataManager() {
return jobDataManager;
}
public void setJobDataManager(SuspendedJobDataManager jobDataManager) {
this.jobDataManager = jobDataManager;
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\persistence\entity\SuspendedJobEntityManagerImpl.java
| 1
|
请完成以下Java代码
|
private List<I_M_InOutLine_To_C_Customs_Invoice_Line> retrieveAllocationRecords(final CustomsInvoiceLineId customsInvoiceLineId)
{
return queryBL.createQueryBuilder(I_M_InOutLine_To_C_Customs_Invoice_Line.class)
.addEqualsFilter(I_M_InOutLine_To_C_Customs_Invoice_Line.COLUMN_C_Customs_Invoice_Line_ID, customsInvoiceLineId)
.orderBy(I_M_InOutLine_To_C_Customs_Invoice_Line.COLUMN_M_InOutLine_To_C_Customs_Invoice_Line_ID)
.create()
.list();
}
private static InOutAndLineId extractInOutAndLineId(final I_M_InOutLine_To_C_Customs_Invoice_Line record)
{
return InOutAndLineId.ofRepoId(record.getM_InOut_ID(), record.getM_InOutLine_ID());
}
private ImmutableListMultimap<CustomsInvoiceLineId, CustomsInvoiceLineAlloc> retrieveAllocations(final CustomsInvoiceId customsInvoiceId)
{
return queryBL.createQueryBuilder(I_M_InOutLine_To_C_Customs_Invoice_Line.class)
.addEqualsFilter(I_M_InOutLine_To_C_Customs_Invoice_Line.COLUMN_C_Customs_Invoice_ID, customsInvoiceId)
.orderBy(I_M_InOutLine_To_C_Customs_Invoice_Line.COLUMN_M_InOutLine_To_C_Customs_Invoice_Line_ID)
.create()
.stream()
.collect(ImmutableListMultimap.toImmutableListMultimap(
record -> extractCustomsInvoiceLineId(record),
record -> toCustomsInvoiceLineAlloc(record)));
}
private CustomsInvoiceLineAlloc toCustomsInvoiceLineAlloc(final I_M_InOutLine_To_C_Customs_Invoice_Line record)
{
|
return CustomsInvoiceLineAlloc.builder()
.inoutAndLineId(extractInOutAndLineId(record))
.price(Money.of(record.getPriceActual(), CurrencyId.ofRepoId(record.getC_Currency_ID())))
.quantityInPriceUOM(Quantity.of(record.getMovementQty(), uomDAO.getById(record.getC_UOM_ID())))
.build();
}
private static CustomsInvoiceLineId extractCustomsInvoiceLineId(final I_M_InOutLine_To_C_Customs_Invoice_Line record)
{
return CustomsInvoiceLineId.ofRepoId(record.getC_Customs_Invoice_ID(), record.getC_Customs_Invoice_Line_ID());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\customs\CustomsInvoiceRepository.java
| 1
|
请完成以下Java代码
|
public static KPIDataContext ofEnvProperties(@NonNull final Properties ctx)
{
return builder()
.userId(Env.getLoggedUserIdIfExists(ctx).orElse(null))
.roleId(Env.getLoggedRoleIdIfExists(ctx).orElse(null))
.clientId(Env.getClientId(ctx))
.orgId(Env.getOrgId(ctx))
.build();
}
public KPIDataContext retainOnlyRequiredParameters(@NonNull final Set<CtxName> requiredParameters)
{
UserId userId_new = null;
RoleId roleId_new = null;
ClientId clientId_new = null;
OrgId orgId_new = null;
for (final CtxName requiredParam : requiredParameters)
{
final String requiredParamName = requiredParam.getName();
if (CTXNAME_AD_User_ID.getName().equals(requiredParamName)
|| Env.CTXNAME_AD_User_ID.equals(requiredParamName))
{
userId_new = this.userId;
}
else if (CTXNAME_AD_Role_ID.getName().equals(requiredParamName)
|| Env.CTXNAME_AD_Role_ID.equals(requiredParamName))
{
roleId_new = this.roleId;
|
}
else if (CTXNAME_AD_Client_ID.getName().equals(requiredParamName)
|| Env.CTXNAME_AD_Client_ID.equals(requiredParamName))
{
clientId_new = this.clientId;
}
else if (CTXNAME_AD_Org_ID.getName().equals(requiredParamName)
|| Env.CTXNAME_AD_Org_ID.equals(requiredParamName))
{
orgId_new = this.orgId;
}
}
return toBuilder()
.userId(userId_new)
.roleId(roleId_new)
.clientId(clientId_new)
.orgId(orgId_new)
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\kpi\data\KPIDataContext.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class PredictServiceImpl implements PredictService {
/**
* -1表示识别失败
*/
private static final int RLT_INVALID = -1;
/**
* 模型文件的位置
*/
@Value("${predict.modelpath}")
private String modelPath;
/**
* 处理图片文件的目录
*/
@Value("${predict.imagefilepath}")
private String imageFilePath;
/**
* 神经网络
*/
private MultiLayerNetwork net;
/**
* bean实例化成功就加载模型
*/
@PostConstruct
private void loadModel() {
log.info("load model from [{}]", modelPath);
// 加载模型
try {
net = ModelSerializer.restoreMultiLayerNetwork(new File(modelPath));
log.info("module summary\n{}", net.summary());
} catch (Exception exception) {
log.error("loadModel error", exception);
}
}
|
@Override
public int predict(MultipartFile file, boolean isNeedRevert) throws Exception {
log.info("start predict, file [{}], isNeedRevert [{}]", file.getOriginalFilename(), isNeedRevert);
// 先存文件
String rawFileName = ImageFileUtil.save(imageFilePath, file);
if (null==rawFileName) {
return RLT_INVALID;
}
// 反色处理后的文件名
String revertFileName = null;
// 调整大小后的文件名
String resizeFileName;
// 是否需要反色处理
if (isNeedRevert) {
// 把原始文件做反色处理,返回结果是反色处理后的新文件
revertFileName = ImageFileUtil.colorRevert(imageFilePath, rawFileName);
// 把反色处理后调整为28*28大小的文件
resizeFileName = ImageFileUtil.resize(imageFilePath, revertFileName);
} else {
// 直接把原始文件调整为28*28大小的文件
resizeFileName = ImageFileUtil.resize(imageFilePath, rawFileName);
}
// 现在已经得到了结果反色和调整大小处理过后的文件,
// 那么原始文件和反色处理过的文件就可以删除了
ImageFileUtil.clear(imageFilePath, rawFileName, revertFileName);
// 取出该黑白图片的特征
INDArray features = ImageFileUtil.getGrayImageFeatures(imageFilePath, resizeFileName);
// 将特征传给模型去识别
return net.predict(features)[0];
}
}
|
repos\springboot-demo-master\Deeplearning4j\src\main\java\com\et\dl4j\service\impl\PredictServiceImpl.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public Optional<PickingJob> getDraftBySalesOrderId(
@NonNull final OrderId salesOrderId,
@NonNull final PickingJobLoaderSupportingServices loadingSupportServices)
{
return queryBL.createQueryBuilder(I_M_Picking_Job.class)
.addEqualsFilter(I_M_Picking_Job.COLUMNNAME_DocStatus, PickingJobDocStatus.Drafted.getCode())
.addEqualsFilter(I_M_Picking_Job.COLUMNNAME_C_Order_ID, salesOrderId)
.create()
.firstIdOnlyOptional(PickingJobId::ofRepoIdOrNull)
.map(pickingJobId -> PickingJobLoaderAndSaver.forLoading(loadingSupportServices).loadById(pickingJobId));
}
@NonNull
public Map<ShipmentScheduleId, List<PickingJobId>> getPickingJobIdsByScheduleId(
@NonNull final Set<ShipmentScheduleId> shipmentScheduleIds)
{
return queryBL.createQueryBuilder(I_M_Picking_Job_Step.class)
.addInArrayFilter(I_M_Picking_Job_Step.COLUMNNAME_M_ShipmentSchedule_ID, shipmentScheduleIds)
.create()
.stream()
.collect(Collectors.groupingBy(
|
step -> ShipmentScheduleId.ofRepoId(step.getM_ShipmentSchedule_ID()),
Collectors.mapping(step -> PickingJobId.ofRepoId(step.getM_Picking_Job_ID()),
Collectors.toList())));
}
@NonNull
public List<PickingJob> getDraftedByPickingSlotId(
@NonNull final PickingSlotId slotId,
@NonNull final PickingJobLoaderSupportingServices loadingSupportServices)
{
final ImmutableSet<PickingJobId> pickingJobIds = queryBL.createQueryBuilder(I_M_Picking_Job.class)
.addEqualsFilter(I_M_Picking_Job.COLUMNNAME_DocStatus, PickingJobDocStatus.Drafted.getCode())
.addEqualsFilter(I_M_Picking_Job.COLUMNNAME_M_PickingSlot_ID, slotId)
.create()
.idsAsSet(PickingJobId::ofRepoId);
return PickingJobLoaderAndSaver.forLoading(loadingSupportServices)
.loadByIds(pickingJobIds);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\job\repository\PickingJobRepository.java
| 2
|
请完成以下Java代码
|
public I_M_ShipmentSchedule getByOrderLineId(@NonNull final OrderLineId orderLineId)
{
return shipmentSchedulePA.getByOrderLineId(orderLineId);
}
@Override
public void assertSalesOrderCanBeReactivated(@NonNull final OrderId salesOrderId)
{
if (shipmentSchedulePA.existsExportedShipmentScheduleForOrder(salesOrderId))
{
throw new AdempiereException(MSG_REACTIVATION_VOID_NOT_ALLOWED_BECAUSE_ALREADY_EXPORTED);
}
if (shipmentSchedulePA.existsSheduledForPickingShipmentScheduleForOrder(salesOrderId))
{
throw new AdempiereException(MSG_REACTIVATION_VOID_NOT_ALLOWED_BECAUSE_SCHEDULED_FOR_PICKING);
}
}
@Override
public Quantity getQtyScheduledForPicking(@NonNull final I_M_ShipmentSchedule shipmentScheduleRecord)
{
final BigDecimal qtyScheduledForPicking = shipmentScheduleRecord.getQtyScheduledForPicking();
final I_C_UOM uom = getUomOfProduct(shipmentScheduleRecord);
return Quantity.of(qtyScheduledForPicking, uom);
}
@Override
public Quantity getQtyRemainingToScheduleForPicking(@NonNull final I_M_ShipmentSchedule shipmentScheduleRecord)
|
{
final Quantity qtyToDeliver = getQtyToDeliver(shipmentScheduleRecord);
final Quantity qtyScheduledForPicking = getQtyScheduledForPicking(shipmentScheduleRecord);
return qtyToDeliver.subtract(qtyScheduledForPicking).toZeroIfNegative();
}
@Override
public ShipmentScheduleLoadingCache<I_M_ShipmentSchedule> newLoadingCache()
{
return newLoadingCache(I_M_ShipmentSchedule.class);
}
@Override
public <T extends I_M_ShipmentSchedule> ShipmentScheduleLoadingCache<T> newLoadingCache(@NonNull Class<T> modelClass)
{
return ShipmentScheduleLoadingCache.<T>builder()
.shipmentSchedulePA(shipmentSchedulePA)
.modelClass(modelClass)
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\inoutcandidate\api\impl\ShipmentScheduleBL.java
| 1
|
请完成以下Java代码
|
public void setLogmessage (final @Nullable java.lang.String Logmessage)
{
set_Value (COLUMNNAME_Logmessage, Logmessage);
}
@Override
public java.lang.String getLogmessage()
{
return get_ValueAsString(COLUMNNAME_Logmessage);
}
@Override
public void setRecord_ID (final int Record_ID)
{
if (Record_ID < 0)
set_Value (COLUMNNAME_Record_ID, null);
else
set_Value (COLUMNNAME_Record_ID, Record_ID);
}
@Override
public int getRecord_ID()
{
return get_ValueAsInt(COLUMNNAME_Record_ID);
}
@Override
public void setTrxName (final @Nullable java.lang.String TrxName)
{
set_Value (COLUMNNAME_TrxName, TrxName);
}
@Override
public java.lang.String getTrxName()
{
return get_ValueAsString(COLUMNNAME_TrxName);
|
}
/**
* Type AD_Reference_ID=541329
* Reference name: TypeList
*/
public static final int TYPE_AD_Reference_ID=541329;
/** Created = Created */
public static final String TYPE_Created = "Created";
/** Updated = Updated */
public static final String TYPE_Updated = "Updated";
/** Deleted = Deleted */
public static final String TYPE_Deleted = "Deleted";
@Override
public void setType (final @Nullable java.lang.String Type)
{
set_Value (COLUMNNAME_Type, Type);
}
@Override
public java.lang.String getType()
{
return get_ValueAsString(COLUMNNAME_Type);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_API_Request_Audit_Log.java
| 1
|
请完成以下Java代码
|
public ByteArrayEntity create() {
return new ByteArrayEntityImpl();
}
@Override
public Class<? extends ByteArrayEntity> getManagedEntityClass() {
return ByteArrayEntityImpl.class;
}
@Override
@SuppressWarnings("unchecked")
public List<ByteArrayEntity> findAll() {
return getDbSqlSession().selectList("selectByteArrays");
}
|
@Override
public void deleteByteArrayNoRevisionCheck(String byteArrayEntityId) {
getDbSqlSession().delete("deleteByteArrayNoRevisionCheck", byteArrayEntityId, ByteArrayEntityImpl.class);
}
@Override
public void bulkDeleteByteArraysNoRevisionCheck(List<String> byteArrayEntityIds) {
getDbSqlSession().delete("deleteByteArraysNoRevisionCheck", createSafeInValuesList(byteArrayEntityIds), ByteArrayEntityImpl.class);
}
@Override
protected IdGenerator getIdGenerator() {
return idGenerator;
}
}
|
repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\persistence\entity\data\impl\MybatisByteArrayDataManager.java
| 1
|
请完成以下Java代码
|
public static List<String> getStaffLevelNames() {
return Arrays.asList(MINISTER.getName(), VICE_MINISTER.getName(), STAFF.getName());
}
/**
* 获取所有领导层级名称
* @return 领导层级名称列表
*/
public static List<String> getLeaderLevelNames() {
return Arrays.asList(CHAIRMAN.getName(), GENERAL_MANAGER.getName(), VICE_GENERAL_MANAGER.getName());
}
/**
* 获取所有职级名称(按等级排序)
* @return 所有职级名称列表
*/
public static List<String> getAllPositionNames() {
return Arrays.asList(
CHAIRMAN.getName(), GENERAL_MANAGER.getName(), VICE_GENERAL_MANAGER.getName(),
|
MINISTER.getName(), VICE_MINISTER.getName(), STAFF.getName()
);
}
/**
* 获取指定等级范围的职级
* @param minLevel 最小等级
* @param maxLevel 最大等级
* @return 职级名称列表
*/
public static List<String> getPositionsByLevelRange(int minLevel, int maxLevel) {
return Arrays.stream(values())
.filter(p -> p.getLevel() >= minLevel && p.getLevel() <= maxLevel)
.map(PositionLevelEnum::getName)
.collect(java.util.stream.Collectors.toList());
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-boot-base-core\src\main\java\org\jeecg\common\constant\enums\PositionLevelEnum.java
| 1
|
请完成以下Java代码
|
public void setReferenceNo (final @Nullable java.lang.String ReferenceNo)
{
set_Value (COLUMNNAME_ReferenceNo, ReferenceNo);
}
@Override
public java.lang.String getReferenceNo()
{
return get_ValueAsString(COLUMNNAME_ReferenceNo);
}
@Override
public void setStatementLineDate (final java.sql.Timestamp StatementLineDate)
{
set_Value (COLUMNNAME_StatementLineDate, StatementLineDate);
}
@Override
public java.sql.Timestamp getStatementLineDate()
{
return get_ValueAsTimestamp(COLUMNNAME_StatementLineDate);
}
@Override
public void setStmtAmt (final BigDecimal StmtAmt)
{
set_Value (COLUMNNAME_StmtAmt, StmtAmt);
}
@Override
public BigDecimal getStmtAmt()
{
|
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_StmtAmt);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setTrxAmt (final BigDecimal TrxAmt)
{
set_Value (COLUMNNAME_TrxAmt, TrxAmt);
}
@Override
public BigDecimal getTrxAmt()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_TrxAmt);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setValutaDate (final java.sql.Timestamp ValutaDate)
{
set_Value (COLUMNNAME_ValutaDate, ValutaDate);
}
@Override
public java.sql.Timestamp getValutaDate()
{
return get_ValueAsTimestamp(COLUMNNAME_ValutaDate);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.base\src\main\java-gen\org\compiere\model\X_C_BankStatementLine.java
| 1
|
请完成以下Java代码
|
public void syncSendOrderly(Enum topic, Message<?> message, String hashKey) {
syncSendOrderly(topic.name(), message, hashKey);
}
/**
* 发送顺序消息
*
* @param message
* @param topic
* @param hashKey
*/
public void syncSendOrderly(String topic, Message<?> message, String hashKey) {
LOG.info("发送顺序消息,topic:" + topic + ",hashKey:" + hashKey);
rocketMQTemplate.syncSendOrderly(topic, message, hashKey);
}
/**
* 发送顺序消息
*
* @param message
* @param topic
* @param hashKey
* @param timeout
*/
public void syncSendOrderly(String topic, Message<?> message, String hashKey, long timeout) {
LOG.info("发送顺序消息,topic:" + topic + ",hashKey:" + hashKey + ",timeout:" + timeout);
rocketMQTemplate.syncSendOrderly(topic, message, hashKey, timeout);
}
/**
* 默认CallBack函数
*
* @return
*/
private SendCallback getDefaultSendCallBack() {
return new SendCallback() {
@Override
public void onSuccess(SendResult sendResult) {
|
LOG.info("---发送MQ成功---");
}
@Override
public void onException(Throwable throwable) {
throwable.printStackTrace();
LOG.error("---发送MQ失败---"+throwable.getMessage(), throwable.getMessage());
}
};
}
@PreDestroy
public void destroy() {
LOG.info("---RocketMq助手注销---");
}
}
|
repos\springboot-demo-master\rocketmq\src\main\java\demo\et59\rocketmq\util\RocketMqHelper.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class UserDTO implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private String login;
public UserDTO() {
// Empty constructor needed for Jackson.
}
public UserDTO(User user) {
this.id = user.getId();
// Customize it here if you need, or not, firstName/lastName/etc
this.login = user.getLogin();
}
public Long getId() {
return id;
}
|
public void setId(Long id) {
this.id = id;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
// prettier-ignore
@Override
public String toString() {
return "UserDTO{" +
"id='" + id + '\'' +
", login='" + login + '\'' +
"}";
}
}
|
repos\tutorials-master\jhipster-8-modules\jhipster-8-microservice\gateway-app\src\main\java\com\gateway\service\dto\UserDTO.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class ElasticsearchAutoConfiguration {
private final ElasticsearchProperties elasticsearchProperties;
private List<HttpHost> httpHosts = new ArrayList<>();
@Bean
@ConditionalOnMissingBean
public RestHighLevelClient restHighLevelClient() {
List<String> clusterNodes = elasticsearchProperties.getClusterNodes();
clusterNodes.forEach(node -> {
try {
String[] parts = StringUtils.split(node, ":");
Assert.notNull(parts, "Must defined");
Assert.state(parts.length == 2, "Must be defined as 'host:port'");
httpHosts.add(new HttpHost(parts[0], Integer.parseInt(parts[1]), elasticsearchProperties.getSchema()));
} catch (Exception e) {
throw new IllegalStateException("Invalid ES nodes " + "property '" + node + "'", e);
}
});
RestClientBuilder builder = RestClient.builder(httpHosts.toArray(new HttpHost[0]));
return getRestHighLevelClient(builder, elasticsearchProperties);
}
/**
* get restHistLevelClient
*
* @param builder RestClientBuilder
* @param elasticsearchProperties elasticsearch default properties
* @return {@link org.elasticsearch.client.RestHighLevelClient}
* @author fxbin
*/
private static RestHighLevelClient getRestHighLevelClient(RestClientBuilder builder, ElasticsearchProperties elasticsearchProperties) {
// Callback used the default {@link RequestConfig} being set to the {@link CloseableHttpClient}
builder.setRequestConfigCallback(requestConfigBuilder -> {
requestConfigBuilder.setConnectTimeout(elasticsearchProperties.getConnectTimeout());
requestConfigBuilder.setSocketTimeout(elasticsearchProperties.getSocketTimeout());
requestConfigBuilder.setConnectionRequestTimeout(elasticsearchProperties.getConnectionRequestTimeout());
|
return requestConfigBuilder;
});
// Callback used to customize the {@link CloseableHttpClient} instance used by a {@link RestClient} instance.
builder.setHttpClientConfigCallback(httpClientBuilder -> {
httpClientBuilder.setMaxConnTotal(elasticsearchProperties.getMaxConnectTotal());
httpClientBuilder.setMaxConnPerRoute(elasticsearchProperties.getMaxConnectPerRoute());
return httpClientBuilder;
});
// Callback used the basic credential auth
ElasticsearchProperties.Account account = elasticsearchProperties.getAccount();
if (!StringUtils.isEmpty(account.getUsername()) && !StringUtils.isEmpty(account.getUsername())) {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(account.getUsername(), account.getPassword()));
}
return new RestHighLevelClient(builder);
}
}
|
repos\spring-boot-demo-master\demo-elasticsearch-rest-high-level-client\src\main\java\com\xkcoding\elasticsearch\config\ElasticsearchAutoConfiguration.java
| 2
|
请完成以下Java代码
|
public ClassBasedFacetCollectorFactory<ModelType> setLogger(final Logger logger)
{
Check.assumeNotNull(logger, "logger not null");
this.logger = logger;
return this;
}
public ClassBasedFacetCollectorFactory<ModelType> registerFacetCollectorClass(final Class<? extends IFacetCollector<ModelType>> facetCollectorClass)
{
Check.assumeNotNull(facetCollectorClass, "facetCollectorClass not null");
facetCollectorClasses.addIfAbsent(facetCollectorClass);
return this;
}
@SafeVarargs
public final ClassBasedFacetCollectorFactory<ModelType> registerFacetCollectorClasses(final Class<? extends IFacetCollector<ModelType>>... facetCollectorClasses)
{
if (facetCollectorClasses == null || facetCollectorClasses.length == 0)
{
return this;
}
for (final Class<? extends IFacetCollector<ModelType>> facetCollectorClass : facetCollectorClasses)
{
registerFacetCollectorClass(facetCollectorClass);
}
return this;
}
|
public IFacetCollector<ModelType> createFacetCollectors()
{
final CompositeFacetCollector<ModelType> collectors = new CompositeFacetCollector<>();
for (final Class<? extends IFacetCollector<ModelType>> collectorClass : facetCollectorClasses)
{
try
{
final IFacetCollector<ModelType> collector = collectorClass.newInstance();
collectors.addFacetCollector(collector);
}
catch (final Exception e)
{
logger.warn("Failed to instantiate collector " + collectorClass + ". Skip it.", e);
}
}
if (!collectors.hasCollectors())
{
throw new IllegalStateException("No valid facet collector classes were defined");
}
return collectors;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\facet\ClassBasedFacetCollectorFactory.java
| 1
|
请完成以下Java代码
|
public String getJobHandlerType() {
return jobHandlerType;
}
protected JobHandler resolveJobHandler() {
JobHandler jobHandler = Context.getProcessEngineConfiguration().getJobHandlers().get(jobHandlerType);
ensureNotNull("Cannot find job handler '" + jobHandlerType + "' from job '" + this + "'", "jobHandler", jobHandler);
return jobHandler;
}
protected String resolveJobHandlerType(S context) {
return jobHandlerType;
}
protected abstract JobHandlerConfiguration resolveJobHandlerConfiguration(S context);
protected boolean resolveExclusive(S context) {
return exclusive;
}
protected int resolveRetries(S context) {
return Context.getProcessEngineConfiguration().getDefaultNumberOfRetries();
}
public Date resolveDueDate(S context) {
ProcessEngineConfiguration processEngineConfiguration = Context.getProcessEngineConfiguration();
if (processEngineConfiguration != null && (processEngineConfiguration.isJobExecutorAcquireByDueDate() || processEngineConfiguration.isEnsureJobDueDateNotNull())) {
return ClockUtil.getCurrentTime();
}
else {
return null;
}
}
public boolean isExclusive() {
return exclusive;
}
public void setExclusive(boolean exclusive) {
this.exclusive = exclusive;
}
public String getActivityId() {
if (activity != null) {
return activity.getId();
}
|
else {
return null;
}
}
public ActivityImpl getActivity() {
return activity;
}
public void setActivity(ActivityImpl activity) {
this.activity = activity;
}
public ProcessDefinitionImpl getProcessDefinition() {
if (activity != null) {
return activity.getProcessDefinition();
}
else {
return null;
}
}
public String getJobConfiguration() {
return jobConfiguration;
}
public void setJobConfiguration(String jobConfiguration) {
this.jobConfiguration = jobConfiguration;
}
public ParameterValueProvider getJobPriorityProvider() {
return jobPriorityProvider;
}
public void setJobPriorityProvider(ParameterValueProvider jobPriorityProvider) {
this.jobPriorityProvider = jobPriorityProvider;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\jobexecutor\JobDeclaration.java
| 1
|
请完成以下Java代码
|
private Map<String, Object> getVendorProperties() {
return hibernateProperties.determineHibernateProperties(jpaProperties.getProperties(), new HibernateSettings());
}
@Primary
@Bean(name = "entityManagerPrimary")
public EntityManager entityManager(EntityManagerFactoryBuilder builder) {
return entityManagerFactoryPrimary(builder).getObject().createEntityManager();
}
@Primary
@Bean(name = "entityManagerFactoryPrimary")
public LocalContainerEntityManagerFactoryBean entityManagerFactoryPrimary (EntityManagerFactoryBuilder builder) {
// HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();
// jpaVendorAdapter.setGenerateDdl(true);
|
return builder
.dataSource(primaryDataSource)
.packages("com.didispace.chapter38.p") //设置实体类所在位置
.persistenceUnit("primaryPersistenceUnit")
.properties(getVendorProperties())
.build();
}
@Primary
@Bean(name = "transactionManagerPrimary")
public PlatformTransactionManager transactionManagerPrimary(EntityManagerFactoryBuilder builder) {
return new JpaTransactionManager(entityManagerFactoryPrimary(builder).getObject());
}
}
|
repos\SpringBoot-Learning-master\2.x\chapter3-8\src\main\java\com\didispace\chapter38\PrimaryConfig.java
| 1
|
请完成以下Java代码
|
public void setAD_NotificationGroup_ID (int AD_NotificationGroup_ID)
{
if (AD_NotificationGroup_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_NotificationGroup_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_NotificationGroup_ID, Integer.valueOf(AD_NotificationGroup_ID));
}
/** Get Notification group.
@return Notification group */
@Override
public int getAD_NotificationGroup_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_NotificationGroup_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Beschreibung.
@param Description Beschreibung */
@Override
public void setDescription (java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Beschreibung.
@return Beschreibung */
@Override
public java.lang.String getDescription ()
{
return (java.lang.String)get_Value(COLUMNNAME_Description);
}
/**
* EntityType AD_Reference_ID=389
* Reference name: _EntityTypeNew
*/
public static final int ENTITYTYPE_AD_Reference_ID=389;
/** Set Entitäts-Art.
@param EntityType
Dictionary Entity Type; Determines ownership and synchronization
*/
@Override
public void setEntityType (java.lang.String EntityType)
{
set_Value (COLUMNNAME_EntityType, EntityType);
|
}
/** Get Entitäts-Art.
@return Dictionary Entity Type; Determines ownership and synchronization
*/
@Override
public java.lang.String getEntityType ()
{
return (java.lang.String)get_Value(COLUMNNAME_EntityType);
}
/** Set Interner Name.
@param InternalName
Generally used to give records a name that can be safely referenced from code.
*/
@Override
public void setInternalName (java.lang.String InternalName)
{
set_Value (COLUMNNAME_InternalName, InternalName);
}
/** Get Interner Name.
@return Generally used to give records a name that can be safely referenced from code.
*/
@Override
public java.lang.String getInternalName ()
{
return (java.lang.String)get_Value(COLUMNNAME_InternalName);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
@Override
public void setName (java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
@Override
public java.lang.String getName ()
{
return (java.lang.String)get_Value(COLUMNNAME_Name);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_NotificationGroup.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private boolean checkForMasterDataFiles(@NonNull final Exchange exchange)
{
final FileSystem fileSystem = FileSystems.getDefault();
final PathMatcher bpartnerFileMatcher = fileSystem.getPathMatcher("glob:" + fileEndpointConfig.getFileNamePatternBPartner());
final PathMatcher warehouseFileMatcher = fileSystem.getPathMatcher("glob:" + fileEndpointConfig.getFileNamePatternWarehouse());
final PathMatcher productFileMatcher = fileSystem.getPathMatcher("glob:" + fileEndpointConfig.getFileNamePatternProduct());
final Path rootLocation = Paths.get(fileEndpointConfig.getRootLocation());
final EnumSet<FileVisitOption> options = EnumSet.noneOf(FileVisitOption.class);
final Path[] existingMasterDataFile = new Path[1];
final SimpleFileVisitor<Path> visitor = new SimpleFileVisitor<>()
{
@Override
public FileVisitResult visitFile(@NonNull final Path currentFile, final BasicFileAttributes attrs)
{
if (bpartnerFileMatcher.matches(currentFile.getFileName()))
{
existingMasterDataFile[0] = currentFile;
return FileVisitResult.TERMINATE;
}
if (warehouseFileMatcher.matches(currentFile.getFileName()))
{
existingMasterDataFile[0] = currentFile;
return FileVisitResult.TERMINATE;
}
if (productFileMatcher.matches(currentFile.getFileName()))
{
existingMasterDataFile[0] = currentFile;
return FileVisitResult.TERMINATE;
}
return FileVisitResult.CONTINUE;
}
};
try
{
Files.walkFileTree(rootLocation, options, 1, visitor); // maxDepth=1 means to check the folder and its included files
}
catch (final IOException e)
|
{
throw new RuntimeCamelException("Caught exception while checking for existing master data files", e);
}
final boolean atLEastOneFileFound = existingMasterDataFile[0] != null;
if (atLEastOneFileFound)
{
final String fileName = exchange.getIn().getBody(GenericFile.class).getFileName();
pInstanceLogger.logMessage("There is at least the masterdata file " + existingMasterDataFile[0].getFileName() + " which has to be processed first => stall the processing of orders file " + fileName + " for now");
}
return atLEastOneFileFound;
}
@Override
protected void doStop()
{
stopWaitLoop.set(true);
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-pcm-file-import\src\main\java\de\metas\camel\externalsystems\pcm\purchaseorder\StallWhileMasterdataFilesExistPolicy.java
| 2
|
请完成以下Java代码
|
public class MAlertRecipient extends X_AD_AlertRecipient
{
/**
*
*/
private static final long serialVersionUID = -7388195934030609324L;
/**
* Standard Constructor
* @param ctx context
* @param AD_AlertRecipient_ID id
* @param trxName transaction
*/
public MAlertRecipient (Properties ctx, int AD_AlertRecipient_ID, String trxName)
{
super (ctx, AD_AlertRecipient_ID, trxName);
} // MAlertRecipient
/**
* Load Constructor
* @param ctx context
* @param rs result set
* @param trxName transaction
*/
public MAlertRecipient (Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
} // MAlertRecipient
/**
* Get User
* @return AD_User_ID or -1 if none
*/
public int getAD_User_ID ()
{
Integer ii = (Integer)get_Value("AD_User_ID");
if (ii == null)
return -1;
return ii.intValue();
} // getAD_User_ID
/**
* Get Role
* @return AD_Role_ID or -1 if none
|
*/
public int getAD_Role_ID ()
{
Integer ii = (Integer)get_Value("AD_Role_ID");
if (ii == null)
return -1;
return ii.intValue();
} // getAD_Role_ID
/**
* String Representation
* @return info
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MAlertRecipient[");
sb.append(get_ID())
.append(",AD_User_ID=").append(getAD_User_ID())
.append(",AD_Role_ID=").append(getAD_Role_ID())
.append ("]");
return sb.toString ();
} // toString
} // MAlertRecipient
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MAlertRecipient.java
| 1
|
请完成以下Java代码
|
public String getExecutionJson() {
return executionJson;
}
@Override
public void setExecutionJson(String executionJson) {
this.executionJson = executionJson;
}
@Override
public String getDecisionKey() {
return decisionKey;
}
public void setDecisionKey(String decisionKey) {
this.decisionKey = decisionKey;
}
@Override
public String getDecisionName() {
return decisionName;
}
|
public void setDecisionName(String decisionName) {
this.decisionName = decisionName;
}
@Override
public String getDecisionVersion() {
return decisionVersion;
}
public void setDecisionVersion(String decisionVersion) {
this.decisionVersion = decisionVersion;
}
@Override
public String toString() {
return "HistoricDecisionExecutionEntity[" + id + "]";
}
}
|
repos\flowable-engine-main\modules\flowable-dmn-engine\src\main\java\org\flowable\dmn\engine\impl\persistence\entity\HistoricDecisionExecutionEntityImpl.java
| 1
|
请完成以下Java代码
|
public String getSerNo ()
{
return (String)get_Value(COLUMNNAME_SerNo);
}
/** Set Details.
@param TextDetails Details */
public void setTextDetails (String TextDetails)
{
set_ValueNoCheck (COLUMNNAME_TextDetails, TextDetails);
}
/** Get Details.
@return Details */
public String getTextDetails ()
{
return (String)get_Value(COLUMNNAME_TextDetails);
}
/** Set Usable Life - Months.
@param UseLifeMonths
Months of the usable life of the asset
*/
public void setUseLifeMonths (int UseLifeMonths)
{
set_ValueNoCheck (COLUMNNAME_UseLifeMonths, Integer.valueOf(UseLifeMonths));
}
/** Get Usable Life - Months.
@return Months of the usable life of the asset
*/
public int getUseLifeMonths ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_UseLifeMonths);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Usable Life - Years.
@param UseLifeYears
Years of the usable life of the asset
*/
public void setUseLifeYears (int UseLifeYears)
{
set_ValueNoCheck (COLUMNNAME_UseLifeYears, Integer.valueOf(UseLifeYears));
}
/** Get Usable Life - Years.
@return Years of the usable life of the asset
*/
public int getUseLifeYears ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_UseLifeYears);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Use units.
@param UseUnits
Currently used units of the assets
*/
public void setUseUnits (int UseUnits)
{
set_Value (COLUMNNAME_UseUnits, Integer.valueOf(UseUnits));
|
}
/** Get Use units.
@return Currently used units of the assets
*/
public int getUseUnits ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_UseUnits);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Version No.
@param VersionNo
Version Number
*/
public void setVersionNo (String VersionNo)
{
set_ValueNoCheck (COLUMNNAME_VersionNo, VersionNo);
}
/** Get Version No.
@return Version Number
*/
public String getVersionNo ()
{
return (String)get_Value(COLUMNNAME_VersionNo);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_A_Asset_Change.java
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.