instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请在Spring Boot框架中完成以下Java代码
|
public Percent getDiscount()
{
return CoalesceUtil.coalesceNotNull(discount, Percent.ZERO);
}
@Override
public void setDiscount(@NonNull final Percent discount)
{
if (isDisallowDiscount())
{
throw new AdempiereException("Attempt to set the discount although isDisallowDiscount()==true")
.appendParametersToMessage()
.setParameter("this", this);
}
if (isDontOverrideDiscountAdvice())
{
return;
}
this.discount = discount;
this.isDiscountCalculated = true;
}
@Override
public void addPricingRuleApplied(@NonNull final IPricingRule rule)
{
rulesApplied.add(rule);
}
@Override
public List<IPricingAttribute> getPricingAttributes()
{
return pricingAttributes;
}
@Override
public void addPricingAttributes(final Collection<IPricingAttribute> pricingAttributesToAdd)
{
if (pricingAttributesToAdd == null || pricingAttributesToAdd.isEmpty())
{
return;
}
pricingAttributes.addAll(pricingAttributesToAdd);
}
/**
* Supposed to be called by the pricing engine.
* <p>
* task https://github.com/metasfresh/metasfresh/issues/4376
*/
public void updatePriceScales()
{
priceStd = scaleToPrecision(priceStd);
priceLimit = scaleToPrecision(priceLimit);
priceList = scaleToPrecision(priceList);
|
}
@Nullable
private BigDecimal scaleToPrecision(@Nullable final BigDecimal priceToRound)
{
if (priceToRound == null || precision == null)
{
return priceToRound;
}
return precision.round(priceToRound);
}
@Override
public boolean isCampaignPrice()
{
return campaignPrice;
}
@Override
public IPricingResult setLoggableMessages(@NonNull final ImmutableList<String> loggableMessages)
{
this.loggableMessages = loggableMessages;
return this;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\pricing\service\impl\PricingResult.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
Neo4jManagedTypes neo4jManagedTypes(ApplicationContext applicationContext) throws ClassNotFoundException {
Set<Class<?>> initialEntityClasses = new EntityScanner(applicationContext).scan(Node.class,
RelationshipProperties.class);
return Neo4jManagedTypes.fromIterable(initialEntityClasses);
}
@Bean
@ConditionalOnMissingBean
Neo4jMappingContext neo4jMappingContext(Neo4jManagedTypes managedTypes, Neo4jConversions neo4jConversions) {
Neo4jMappingContext context = new Neo4jMappingContext(neo4jConversions);
context.setManagedTypes(managedTypes);
return context;
}
@Bean
@ConditionalOnMissingBean
DatabaseSelectionProvider databaseSelectionProvider(DataNeo4jProperties properties) {
String database = properties.getDatabase();
return (database != null) ? DatabaseSelectionProvider.createStaticDatabaseSelectionProvider(database)
: DatabaseSelectionProvider.getDefaultSelectionProvider();
}
@Bean(Neo4jRepositoryConfigurationExtension.DEFAULT_NEO4J_CLIENT_BEAN_NAME)
@ConditionalOnMissingBean
Neo4jClient neo4jClient(Driver driver, DatabaseSelectionProvider databaseNameProvider) {
return Neo4jClient.create(driver, databaseNameProvider);
}
@Bean(Neo4jRepositoryConfigurationExtension.DEFAULT_NEO4J_TEMPLATE_BEAN_NAME)
|
@ConditionalOnMissingBean(Neo4jOperations.class)
Neo4jTemplate neo4jTemplate(Neo4jClient neo4jClient, Neo4jMappingContext neo4jMappingContext) {
return new Neo4jTemplate(neo4jClient, neo4jMappingContext);
}
@Bean(Neo4jRepositoryConfigurationExtension.DEFAULT_TRANSACTION_MANAGER_BEAN_NAME)
@ConditionalOnMissingBean(TransactionManager.class)
Neo4jTransactionManager transactionManager(Driver driver, DatabaseSelectionProvider databaseNameProvider,
ObjectProvider<TransactionManagerCustomizers> optionalCustomizers) {
Neo4jTransactionManager transactionManager = new Neo4jTransactionManager(driver, databaseNameProvider);
optionalCustomizers.ifAvailable((customizer) -> customizer.customize(transactionManager));
return transactionManager;
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-data-neo4j\src\main\java\org\springframework\boot\data\neo4j\autoconfigure\DataNeo4jAutoConfiguration.java
| 2
|
请完成以下Java代码
|
public void setC_Commission_Share_ID (final int C_Commission_Share_ID)
{
if (C_Commission_Share_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Commission_Share_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Commission_Share_ID, C_Commission_Share_ID);
}
@Override
public int getC_Commission_Share_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Commission_Share_ID);
}
@Override
public void setC_Invoice_Candidate_Commission_ID (final int C_Invoice_Candidate_Commission_ID)
{
if (C_Invoice_Candidate_Commission_ID < 1)
set_Value (COLUMNNAME_C_Invoice_Candidate_Commission_ID, null);
else
set_Value (COLUMNNAME_C_Invoice_Candidate_Commission_ID, C_Invoice_Candidate_Commission_ID);
}
@Override
public int getC_Invoice_Candidate_Commission_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Invoice_Candidate_Commission_ID);
}
/**
* Commission_Fact_State AD_Reference_ID=541042
* Reference name: C_Commission_Fact_State
*/
public static final int COMMISSION_FACT_STATE_AD_Reference_ID=541042;
/** FORECASTED = FORECASTED */
public static final String COMMISSION_FACT_STATE_FORECASTED = "FORECASTED";
/** INVOICEABLE = INVOICEABLE */
public static final String COMMISSION_FACT_STATE_INVOICEABLE = "INVOICEABLE";
/** INVOICED = INVOICED */
public static final String COMMISSION_FACT_STATE_INVOICED = "INVOICED";
|
/** SETTLED = SETTLED */
public static final String COMMISSION_FACT_STATE_SETTLED = "SETTLED";
/** TO_SETTLE = TO_SETTLE */
public static final String COMMISSION_FACT_STATE_TO_SETTLE = "TO_SETTLE";
@Override
public void setCommission_Fact_State (final java.lang.String Commission_Fact_State)
{
set_ValueNoCheck (COLUMNNAME_Commission_Fact_State, Commission_Fact_State);
}
@Override
public java.lang.String getCommission_Fact_State()
{
return get_ValueAsString(COLUMNNAME_Commission_Fact_State);
}
@Override
public void setCommissionFactTimestamp (final java.lang.String CommissionFactTimestamp)
{
set_ValueNoCheck (COLUMNNAME_CommissionFactTimestamp, CommissionFactTimestamp);
}
@Override
public java.lang.String getCommissionFactTimestamp()
{
return get_ValueAsString(COLUMNNAME_CommissionFactTimestamp);
}
@Override
public void setCommissionPoints (final BigDecimal CommissionPoints)
{
set_ValueNoCheck (COLUMNNAME_CommissionPoints, CommissionPoints);
}
@Override
public BigDecimal getCommissionPoints()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_CommissionPoints);
return bd != null ? bd : BigDecimal.ZERO;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java-gen\de\metas\contracts\commission\model\X_C_Commission_Fact.java
| 1
|
请完成以下Java代码
|
private static void startInitFromDB() {
LOG.info("get data from database");
int pageNum = 1;
int numPerPage = 500;
PageParam pageParam = new PageParam(pageNum, numPerPage);
// 查询状态和通知次数符合以下条件的数据进行通知
String[] status = new String[]{"101", "102", "200", "201"};
Integer[] notifyTime = new Integer[]{0, 1, 2, 3, 4};
// 组装查询条件
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("statusList", status);
paramMap.put("notifyTimeList", notifyTime);
PageBean<RpNotifyRecord> pager = cacheRpNotifyService.queryNotifyRecordListPage(pageParam, paramMap);
int totalSize = (pager.getNumPerPage() - 1) / numPerPage + 1;//总页数
|
while (pageNum <= totalSize) {
List<RpNotifyRecord> list = pager.getRecordList();
for (int i = 0; i < list.size(); i++) {
RpNotifyRecord notifyRecord = list.get(i);
notifyRecord.setLastNotifyTime(new Date());
cacheNotifyQueue.addElementToList(notifyRecord);
}
pageNum++;
LOG.info(String.format("调用通知服务.rpNotifyService.queryNotifyRecordListPage(%s, %s, %s)", pageNum, numPerPage, paramMap));
pageParam = new PageParam(pageNum, numPerPage);
pager = cacheRpNotifyService.queryNotifyRecordListPage(pageParam, paramMap);
}
}
}
|
repos\roncoo-pay-master\roncoo-pay-app-notify\src\main\java\com\roncoo\pay\AppNotifyApplication.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class JsonRemittanceAdviceLine
{
@ApiModelProperty(required = true,
dataType = "java.lang.String",
value = "This translates to LineIdentifier")
@NonNull
String lineIdentifier;
@ApiModelProperty(required = true,
dataType = "java.lang.String",
value = "This translates to InvoiceIdentifier")
@NonNull
String invoiceIdentifier;
@ApiModelProperty(required = true,
dataType = "java.math.BigDecimal",
value = "This translates to RemittanceAmt")
@NonNull
BigDecimal remittedAmount;
@ApiModelProperty(dataType = "java.lang.String",
value = "This translates to InvoiceDate")
@Nullable
String dateInvoiced;
@ApiModelProperty(dataType = "java.lang.String",
value = "This translates to Service_BPartner_ID")
@Nullable
String bpartnerIdentifier;
@ApiModelProperty(dataType = "java.lang.String",
value = "This translates to ExternalInvoiceDocBaseType")
@Nullable
String invoiceBaseDocType;
|
@ApiModelProperty(dataType = "java.math.BigDecimal",
value = "This translates as InvoiceGrossAmount")
@Nullable
BigDecimal invoiceGrossAmount;
@ApiModelProperty(dataType = "java.math.BigDecimal",
value = "This translates to PaymentDiscountAmt")
@Nullable
BigDecimal paymentDiscountAmount;
@ApiModelProperty(dataType = "java.math.BigDecimal",
value = "This translates to ServiceFeeAmount")
@Nullable
BigDecimal serviceFeeAmount;
@ApiModelProperty(dataType = "java.math.BigDecimal",
value = "This translates to ServiceFeeVatRate")
@Nullable
BigDecimal serviceFeeVatRate;
@JsonIgnoreProperties(ignoreUnknown = true) // the annotation to ignore properties should be set on the deserializer method (on the builder), and not on the base class
@JsonPOJOBuilder(withPrefix = "")
public static class JsonRemittanceAdviceLineBuilder
{
}
}
|
repos\metasfresh-new_dawn_uat\misc\de-metas-common\de-metas-common-rest_api\src\main\java\de\metas\common\rest_api\v1\remittanceadvice\JsonRemittanceAdviceLine.java
| 2
|
请完成以下Java代码
|
public java.lang.String getSEPA_CreditorName ()
{
return (java.lang.String)get_Value(COLUMNNAME_SEPA_CreditorName);
}
/** Set SEPA Export.
@param SEPA_Export_ID SEPA Export */
@Override
public void setSEPA_Export_ID (int SEPA_Export_ID)
{
if (SEPA_Export_ID < 1)
set_ValueNoCheck (COLUMNNAME_SEPA_Export_ID, null);
else
set_ValueNoCheck (COLUMNNAME_SEPA_Export_ID, Integer.valueOf(SEPA_Export_ID));
}
/** Get SEPA Export.
@return SEPA Export */
@Override
public int getSEPA_Export_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SEPA_Export_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/**
* SEPA_Protocol AD_Reference_ID=541110
* Reference name: SEPA_Protocol
*/
public static final int SEPA_PROTOCOL_AD_Reference_ID=541110;
/** Credit Transfer (pain.001.001.03.ch.02) = pain.001.001.03.ch.02 */
public static final String SEPA_PROTOCOL_CreditTransferPain00100103Ch02 = "pain.001.001.03.ch.02";
/** Direct Debit (pain.008.003.02) = pain.008.003.02 */
public static final String SEPA_PROTOCOL_DirectDebitPain00800302 = "pain.008.003.02";
|
/** Set SEPA Protocol.
@param SEPA_Protocol SEPA Protocol */
@Override
public void setSEPA_Protocol (java.lang.String SEPA_Protocol)
{
set_Value (COLUMNNAME_SEPA_Protocol, SEPA_Protocol);
}
/** Get SEPA Protocol.
@return SEPA Protocol */
@Override
public java.lang.String getSEPA_Protocol ()
{
return (java.lang.String)get_Value(COLUMNNAME_SEPA_Protocol);
}
/** Set Swift code.
@param SwiftCode
Swift Code or BIC
*/
@Override
public void setSwiftCode (java.lang.String SwiftCode)
{
set_Value (COLUMNNAME_SwiftCode, SwiftCode);
}
/** Get Swift code.
@return Swift Code or BIC
*/
@Override
public java.lang.String getSwiftCode ()
{
return (java.lang.String)get_Value(COLUMNNAME_SwiftCode);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.sepa\base\src\main\java-gen\de\metas\payment\sepa\model\X_SEPA_Export.java
| 1
|
请完成以下Java代码
|
private Workflow getWorkflow()
{
return context.getWorkflow();
}
/**
* Start WF Execution
*/
public void startWork()
{
if (!getState().isValidAction(WFAction.Start))
{
log.warn("Cannot start from state {}", getState());
return;
}
//
// Make sure is saved
context.save(this);
final WFNodeId firstWFNodeId = getWorkflow().getFirstNodeId();
changeWFStateTo(WFState.Running);
try
{
// Start first Activity with first Node
final WFActivity firstActivity = newActivity(firstWFNodeId);
firstActivity.run();
}
catch (final Throwable ex)
{
setProcessingResultMessage(ex);
changeWFStateTo(WFState.Terminated);
throw AdempiereException.wrapIfNeeded(ex);
}
}
@Nullable
public AdIssueId getIssueId() { return state.getIssueId(); }
private void setIssueId(@NonNull final AdIssueId issueId) { state.setIssueId(issueId); }
@Nullable
public String getTextMsg() { return state.getTextMsg(); }
private void setTextMsg(@Nullable final String textMsg)
{
state.setTextMsg(textMsg);
}
void addTextMsg(@Nullable final String textMsg)
{
if (textMsg == null || textMsg.isEmpty())
{
return;
}
final String oldText = StringUtils.trimBlankToNull(getTextMsg());
if (oldText == null)
{
setTextMsg(textMsg.trim());
}
else
{
setTextMsg(oldText + "\n" + textMsg.trim());
}
}
|
private void addTextMsg(@Nullable final Throwable ex)
{
if (ex == null)
{
return;
}
addTextMsg(AdempiereException.extractMessage(ex));
final AdempiereException metasfreshException = AdempiereException.wrapIfNeeded(ex);
final AdIssueId adIssueId = context.createIssue(metasfreshException);
setIssueId(adIssueId);
}
void setProcessingResultMessage(@Nullable final String msg)
{
this.processingResultMessage = msg;
this.processingResultException = null;
addTextMsg(msg);
}
void setProcessingResultMessage(@NonNull final Throwable ex)
{
this.processingResultMessage = AdempiereException.extractMessage(ex);
this.processingResultException = ex;
addTextMsg(ex);
}
@Nullable
public String getProcessingResultMessage() { return processingResultMessage; }
@Nullable
public Throwable getProcessingResultException() { return processingResultException; }
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\workflow\execution\WFProcess.java
| 1
|
请完成以下Java代码
|
public void delete(final I_PP_Order_Qty ppOrderQty)
{
InterfaceWrapperHelper.delete(ppOrderQty);
}
@Override
public List<I_PP_Order_Qty> retrieveOrderQtys(final PPOrderId ppOrderId)
{
return retrieveOrderQtys(Env.getCtx(), ppOrderId, ITrx.TRXNAME_ThreadInherited);
}
@SuppressWarnings("SameParameterValue")
@Cached(cacheName = I_PP_Order_Qty.Table_Name + "#by#PP_Order_ID", expireMinutes = 10)
ImmutableList<I_PP_Order_Qty> retrieveOrderQtys(@CacheCtx final Properties ctx, @NonNull final PPOrderId ppOrderId, @CacheTrx final String trxName)
{
return Services.get(IQueryBL.class)
.createQueryBuilder(I_PP_Order_Qty.class, ctx, trxName)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_PP_Order_Qty.COLUMN_PP_Order_ID, ppOrderId)
.orderBy(I_PP_Order_Qty.COLUMNNAME_PP_Order_Qty_ID)
.create()
.listImmutable(I_PP_Order_Qty.class);
}
@Override
public I_PP_Order_Qty retrieveOrderQtyForCostCollector(
@NonNull final PPOrderId ppOrderId,
@NonNull final PPCostCollectorId costCollectorId)
{
return retrieveOrderQtys(ppOrderId)
.stream()
.filter(cand -> cand.getPP_Cost_Collector_ID() == costCollectorId.getRepoId())
// .peek(cand -> Check.assume(cand.isProcessed(), "Candidate was expected to be processed: {}", cand))
.reduce((cand1, cand2) -> {
throw new HUException("Expected only one candidate but got: " + cand1 + ", " + cand2);
|
})
.orElse(null);
}
@Override
public List<I_PP_Order_Qty> retrieveOrderQtyForFinishedGoodsReceive(@NonNull final PPOrderId ppOrderId)
{
return retrieveOrderQtys(ppOrderId)
.stream()
.filter(cand -> cand.getPP_Order_BOMLine_ID() <= 0)
.collect(ImmutableList.toImmutableList());
}
@Override
public Optional<I_PP_Order_Qty> retrieveOrderQtyForHu(
@NonNull final PPOrderId ppOrderId,
@NonNull final HuId huId)
{
return retrieveOrderQtys(ppOrderId)
.stream()
.filter(cand -> cand.getM_HU_ID() == huId.getRepoId())
.reduce((cand1, cand2) -> {
throw new HUException("Expected only one candidate but got: " + cand1 + ", " + cand2);
});
}
@Override
public boolean hasUnprocessedOrderQty(@NonNull final PPOrderId ppOrderId)
{
return streamOrderQtys(ppOrderId)
.anyMatch(candidate -> !candidate.isProcessed());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\pporder\api\impl\HUPPOrderQtyDAO.java
| 1
|
请完成以下Java代码
|
public void setMaxBackoff(Duration maxBackoff) {
this.maxBackoff = maxBackoff;
}
public int getFactor() {
return factor;
}
public void setFactor(int factor) {
this.factor = factor;
}
public boolean isBasedOnPreviousValue() {
return basedOnPreviousValue;
}
public void setBasedOnPreviousValue(boolean basedOnPreviousValue) {
this.basedOnPreviousValue = basedOnPreviousValue;
}
@Override
public String toString() {
return new ToStringCreator(this).append("firstBackoff", firstBackoff)
.append("maxBackoff", maxBackoff)
.append("factor", factor)
.append("basedOnPreviousValue", basedOnPreviousValue)
.toString();
}
}
public static class JitterConfig {
private double randomFactor = 0.5;
public void validate() {
Assert.isTrue(randomFactor >= 0 && randomFactor <= 1,
"random factor must be between 0 and 1 (default 0.5)");
}
public JitterConfig() {
}
|
public JitterConfig(double randomFactor) {
this.randomFactor = randomFactor;
}
public double getRandomFactor() {
return randomFactor;
}
public void setRandomFactor(double randomFactor) {
this.randomFactor = randomFactor;
}
@Override
public String toString() {
return new ToStringCreator(this).append("randomFactor", randomFactor).toString();
}
}
}
|
repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webflux\src\main\java\org\springframework\cloud\gateway\filter\factory\RetryGatewayFilterFactory.java
| 1
|
请完成以下Java代码
|
public void setMinimumAmt (BigDecimal MinimumAmt)
{
set_Value (COLUMNNAME_MinimumAmt, MinimumAmt);
}
/** Get Minimum Amt.
@return Minumum Amout in Document Currency
*/
public BigDecimal getMinimumAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_MinimumAmt);
if (bd == null)
return Env.ZERO;
return bd;
}
public I_M_PromotionGroup getM_PromotionGroup() throws RuntimeException
{
return (I_M_PromotionGroup)MTable.get(getCtx(), I_M_PromotionGroup.Table_Name)
.getPO(getM_PromotionGroup_ID(), get_TrxName()); }
/** Set Promotion Group.
@param M_PromotionGroup_ID Promotion Group */
public void setM_PromotionGroup_ID (int M_PromotionGroup_ID)
{
if (M_PromotionGroup_ID < 1)
set_Value (COLUMNNAME_M_PromotionGroup_ID, null);
else
set_Value (COLUMNNAME_M_PromotionGroup_ID, Integer.valueOf(M_PromotionGroup_ID));
}
/** Get Promotion Group.
@return Promotion Group */
public int getM_PromotionGroup_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_PromotionGroup_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_M_Promotion getM_Promotion() throws RuntimeException
{
return (I_M_Promotion)MTable.get(getCtx(), I_M_Promotion.Table_Name)
.getPO(getM_Promotion_ID(), get_TrxName()); }
/** Set Promotion.
@param M_Promotion_ID Promotion */
|
public void setM_Promotion_ID (int M_Promotion_ID)
{
if (M_Promotion_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Promotion_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Promotion_ID, Integer.valueOf(M_Promotion_ID));
}
/** Get Promotion.
@return Promotion */
public int getM_Promotion_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Promotion_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Promotion Line.
@param M_PromotionLine_ID Promotion Line */
public void setM_PromotionLine_ID (int M_PromotionLine_ID)
{
if (M_PromotionLine_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_PromotionLine_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_PromotionLine_ID, Integer.valueOf(M_PromotionLine_ID));
}
/** Get Promotion Line.
@return Promotion Line */
public int getM_PromotionLine_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_PromotionLine_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_PromotionLine.java
| 1
|
请完成以下Java代码
|
public void configure(AuthorizationServerSecurityConfigurer oauthServer) throws Exception {
oauthServer.tokenKeyAccess("isAnonymous() || hasAuthority('ROLE_TRUSTED_CLIENT')");
oauthServer.checkTokenAccess("hasAuthority('ROLE_TRUSTED_CLIENT')");
}
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.inMemory()
.withClient("normal-app")
.authorizedGrantTypes("authorization_code", "implicit")
.authorities("ROLE_CLIENT")
.scopes("read", "write")
.resourceIds(resourceId)
.accessTokenValiditySeconds(accessTokenValiditySeconds)
.and()
.withClient("trusted-app")
.authorizedGrantTypes("client_credentials", "password")
.authorities("ROLE_TRUSTED_CLIENT")
|
.scopes("read", "write")
.resourceIds(resourceId)
.accessTokenValiditySeconds(accessTokenValiditySeconds)
.secret("secret");
}
/**
* token store
*
* @return
*/
@Bean
public TokenStore tokenStore() {
return new RedisTokenStore(redisConnectionFactory);
}
}
|
repos\spring-boot-quick-master\quick-oauth2\quick-oauth2-server\src\main\java\com\quick\auth\server\security\AuthorizationServerConfiguration.java
| 1
|
请完成以下Java代码
|
public String getSubaddressing() {
return subaddressing;
}
/**
* Sets the value of the subaddressing property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSubaddressing(String value) {
this.subaddressing = value;
}
/**
* Gets the value of the postal property.
*
* @return
* possible object is
* {@link PostalAddressType }
*
*/
public PostalAddressType getPostal() {
return postal;
}
/**
* Sets the value of the postal property.
*
* @param value
* allowed object is
* {@link PostalAddressType }
*
*/
public void setPostal(PostalAddressType value) {
this.postal = value;
}
/**
* Gets the value of the telecom property.
*
* @return
* possible object is
* {@link TelecomAddressType }
*
*/
public TelecomAddressType getTelecom() {
return telecom;
}
/**
* Sets the value of the telecom property.
*
|
* @param value
* allowed object is
* {@link TelecomAddressType }
*
*/
public void setTelecom(TelecomAddressType value) {
this.telecom = value;
}
/**
* Gets the value of the online property.
*
* @return
* possible object is
* {@link OnlineAddressType }
*
*/
public OnlineAddressType getOnline() {
return online;
}
/**
* Sets the value of the online property.
*
* @param value
* allowed object is
* {@link OnlineAddressType }
*
*/
public void setOnline(OnlineAddressType value) {
this.online = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_request\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\request\CompanyType.java
| 1
|
请完成以下Java代码
|
public String toString()
{
return "basic layout elements";
}
@Override
public boolean test(final DocumentLayoutElementDescriptor layoutElement)
{
return !layoutElement.isAdvancedField();
}
};
private static final Predicate<DocumentLayoutElementDescriptor> FILTER_DocumentLayoutElementDescriptor_ALL = new Predicate<DocumentLayoutElementDescriptor>()
{
@Override
public String toString()
{
|
return "all layout elements";
}
@Override
public boolean test(final DocumentLayoutElementDescriptor layoutElement)
{
return true;
}
};
public String getAdLanguage()
{
return getJsonOpts().getAdLanguage();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\datatypes\json\JSONDocumentLayoutOptions.java
| 1
|
请完成以下Java代码
|
public Integer getMaxJobsPerAcquisition() {
return maxJobsPerAcquisition;
}
public void setMaxJobsPerAcquisition(Integer maxJobsPerAcquisition) {
this.maxJobsPerAcquisition = maxJobsPerAcquisition;
}
public Integer getWaitTimeInMillis() {
return waitTimeInMillis;
}
public void setWaitTimeInMillis(Integer waitTimeInMillis) {
this.waitTimeInMillis = waitTimeInMillis;
}
public Long getMaxWait() {
return maxWait;
}
public void setMaxWait(Long maxWait) {
this.maxWait = maxWait;
}
public Integer getBackoffTimeInMillis() {
return backoffTimeInMillis;
}
public void setBackoffTimeInMillis(Integer backoffTimeInMillis) {
this.backoffTimeInMillis = backoffTimeInMillis;
}
public Long getMaxBackoff() {
return maxBackoff;
}
public void setMaxBackoff(Long maxBackoff) {
this.maxBackoff = maxBackoff;
}
public Integer getBackoffDecreaseThreshold() {
return backoffDecreaseThreshold;
}
public void setBackoffDecreaseThreshold(Integer backoffDecreaseThreshold) {
|
this.backoffDecreaseThreshold = backoffDecreaseThreshold;
}
public Float getWaitIncreaseFactor() {
return waitIncreaseFactor;
}
public void setWaitIncreaseFactor(Float waitIncreaseFactor) {
this.waitIncreaseFactor = waitIncreaseFactor;
}
@Override
public String toString() {
return joinOn(this.getClass())
.add("enabled=" + enabled)
.add("deploymentAware=" + deploymentAware)
.add("corePoolSize=" + corePoolSize)
.add("maxPoolSize=" + maxPoolSize)
.add("keepAliveSeconds=" + keepAliveSeconds)
.add("queueCapacity=" + queueCapacity)
.add("lockTimeInMillis=" + lockTimeInMillis)
.add("maxJobsPerAcquisition=" + maxJobsPerAcquisition)
.add("waitTimeInMillis=" + waitTimeInMillis)
.add("maxWait=" + maxWait)
.add("backoffTimeInMillis=" + backoffTimeInMillis)
.add("maxBackoff=" + maxBackoff)
.add("backoffDecreaseThreshold=" + backoffDecreaseThreshold)
.add("waitIncreaseFactor=" + waitIncreaseFactor)
.toString();
}
}
|
repos\camunda-bpm-platform-master\spring-boot-starter\starter\src\main\java\org\camunda\bpm\spring\boot\starter\property\JobExecutionProperty.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class Department {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private int id;
@Column(name = "name")
private String name;
@OneToMany(mappedBy = "department", cascade = CascadeType.ALL, orphanRemoval = true)
private Set<Employee> employees = new HashSet<>();
public void addEmployee(Employee employee) {
employees.add(employee);
}
// standard getters and setters
public Department() {
}
public Department(int id) {
this.id = id;
}
public Department(int id, String name) {
this.id = id;
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
|
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Set<Employee> getEmployees() {
return employees;
}
public void setEmployees(Set<Employee> employees) {
this.employees = employees;
}
}
|
repos\tutorials-master\persistence-modules\hibernate-exceptions\src\main\java\com\baeldung\hibernate\exception\transientobject\entity\Department.java
| 2
|
请完成以下Java代码
|
public boolean hasUnions()
{
final List<SqlQueryUnion<T>> unions = this.unions;
return unions != null && !unions.isEmpty();
}
@Override
<ToModelType> QueryInsertExecutorResult executeInsert(
@NonNull final QueryInsertExecutor<ToModelType, T> queryInserter)
{
Check.assume(!queryInserter.isEmpty(), "At least one column to be inserted needs to be specified: {}", queryInserter);
final List<Object> sqlParams = new ArrayList<>();
final boolean collectSqlParamsFromSelectClause = unions == null || unions.isEmpty();
final TokenizedStringBuilder sqlToSelectColumns = new TokenizedStringBuilder("\n, ")
.setAutoAppendSeparator(true);
final TokenizedStringBuilder sqlFromSelectColumns = new TokenizedStringBuilder("\n, ")
.setAutoAppendSeparator(true);
for (final Map.Entry<String, IQueryInsertFromColumn> toColumnName2from : queryInserter.getColumnMapping().entrySet())
{
// To
final String toColumnName = toColumnName2from.getKey();
sqlToSelectColumns.append(toColumnName);
// From
final IQueryInsertFromColumn from = toColumnName2from.getValue();
final String fromSql = from.getSql(collectSqlParamsFromSelectClause ? sqlParams : null);
sqlFromSelectColumns.append(fromSql);
}
//
// Build sql: SELECT ... FROM ... WHERE ...
sqlFromSelectColumns.asStringBuilder().insert(0, "SELECT \n");
final StringBuilder fromClause = new StringBuilder(" FROM ").append(getSqlFrom());
final String groupByClause = null;
final String sqlFrom = buildSQL(sqlFromSelectColumns.asStringBuilder(), fromClause, groupByClause, false); // useOrderByClause=false
sqlParams.addAll(getParametersEffective());
//
// Build sql: INSERT INTO ... SELECT ... FROM ... WHERE ...
final StringBuilder sqlInsert = new StringBuilder()
|
.append("INSERT INTO ").append(queryInserter.getToTableName()).append(" (")
.append("\n").append(sqlToSelectColumns)
.append("\n)\n")
.append(sqlFrom);
//
// Wrap the INSERT SQL and create the insert selection ID if required
final PInstanceId insertSelectionId;
final String sql;
if (queryInserter.isCreateSelectionOfInsertedRows())
{
insertSelectionId = Services.get(IADPInstanceDAO.class).createSelectionId();
final String toKeyColumnName = queryInserter.getToKeyColumnName();
sql = "WITH insert_code AS ("
+ "\n" + sqlInsert
+ "\n RETURNING " + toKeyColumnName
+ "\n )"
//
+ "\n INSERT INTO T_Selection (AD_PInstance_ID, T_Selection_ID)"
+ "\n SELECT " + insertSelectionId.getRepoId() + ", " + toKeyColumnName + " FROM insert_code"
//
;
}
else
{
insertSelectionId = null;
sql = sqlInsert.toString();
}
//
// Execute the INSERT and return how many records were inserted
final int countInsert = DB.executeUpdateAndThrowExceptionOnFail(sql, sqlParams.toArray(), getTrxName());
return QueryInsertExecutorResult.of(countInsert, insertSelectionId);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\adempiere\ad\dao\impl\TypedSqlQuery.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private static File convertInputStreamToFile(InputStream inputStream, String savePath) {
OutputStream outputStream = null;
File file = new File(savePath);
try {
outputStream = new FileOutputStream(file);
int read;
byte[] bytes = new byte[1024];
while ((read = inputStream.read(bytes)) != -1) {
outputStream.write(bytes, 0, read);
}
log.info("convert InputStream to file done, savePath is : {}", savePath);
} catch (IOException e) {
log.error("error:", e);
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
log.error("error:", e);
|
}
}
}
return file;
}
private static File convert(MultipartFile file) throws IOException {
File convertFile = new File(file.getOriginalFilename());
convertFile.createNewFile();
FileOutputStream fos = new FileOutputStream(convertFile);
fos.write(file.getBytes());
fos.close();
return convertFile;
}
}
|
repos\springboot-demo-master\sftp\src\main\java\com\et\sftp\service\impl\SftpServiceImpl.java
| 2
|
请完成以下Java代码
|
public void close() throws IOException {
if (this.closed) {
return;
}
this.closed = true;
synchronized (this.zipFileSystems) {
this.zipFileSystems.values()
.stream()
.filter(FileSystem.class::isInstance)
.map(FileSystem.class::cast)
.forEach(this::closeZipFileSystem);
}
this.provider.removeFileSystem(this);
}
private void closeZipFileSystem(FileSystem zipFileSystem) {
try {
zipFileSystem.close();
}
catch (Exception ex) {
// Ignore
}
}
@Override
public boolean isOpen() {
return !this.closed;
}
@Override
public boolean isReadOnly() {
return true;
}
@Override
public String getSeparator() {
return "/!";
}
@Override
public Iterable<Path> getRootDirectories() {
assertNotClosed();
return Collections.emptySet();
}
@Override
public Iterable<FileStore> getFileStores() {
assertNotClosed();
return Collections.emptySet();
}
@Override
public Set<String> supportedFileAttributeViews() {
assertNotClosed();
return SUPPORTED_FILE_ATTRIBUTE_VIEWS;
}
@Override
public Path getPath(String first, String... more) {
assertNotClosed();
if (more.length != 0) {
throw new IllegalArgumentException("Nested paths must contain a single element");
}
return new NestedPath(this, first);
}
@Override
public PathMatcher getPathMatcher(String syntaxAndPattern) {
throw new UnsupportedOperationException("Nested paths do not support path matchers");
|
}
@Override
public UserPrincipalLookupService getUserPrincipalLookupService() {
throw new UnsupportedOperationException("Nested paths do not have a user principal lookup service");
}
@Override
public WatchService newWatchService() throws IOException {
throw new UnsupportedOperationException("Nested paths do not support the WatchService");
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
NestedFileSystem other = (NestedFileSystem) obj;
return this.jarPath.equals(other.jarPath);
}
@Override
public int hashCode() {
return this.jarPath.hashCode();
}
@Override
public String toString() {
return this.jarPath.toAbsolutePath().toString();
}
private void assertNotClosed() {
if (this.closed) {
throw new ClosedFileSystemException();
}
}
}
|
repos\spring-boot-4.0.1\loader\spring-boot-loader\src\main\java\org\springframework\boot\loader\nio\file\NestedFileSystem.java
| 1
|
请完成以下Java代码
|
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
|
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", commentId=").append(commentId);
sb.append(", memberNickName=").append(memberNickName);
sb.append(", memberIcon=").append(memberIcon);
sb.append(", content=").append(content);
sb.append(", createTime=").append(createTime);
sb.append(", type=").append(type);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
|
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\PmsCommentReplay.java
| 1
|
请完成以下Java代码
|
public String getType() {
return this.type;
}
/**
* Set a queue type.
* @param type the queue type: {@code quorum}, {@code classic} or {@code stream}
* @since 4.0
*/
public void setType(String type) {
this.type = type;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + this.name.hashCode();
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
|
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
QueueInformation other = (QueueInformation) obj;
return this.name.equals(other.name);
}
@Override
public String toString() {
return "QueueInformation [name=" + this.name + ", messageCount=" + this.messageCount + ", consumerCount="
+ this.consumerCount + "]";
}
}
|
repos\spring-amqp-main\spring-amqp\src\main\java\org\springframework\amqp\core\QueueInformation.java
| 1
|
请完成以下Java代码
|
public String getDeleteReason() {
return historicProcessInstance.getDeleteReason();
}
@Override
public String getSuperProcessInstanceId() {
return historicProcessInstance.getSuperProcessInstanceId();
}
@Override
public String getTenantId() {
return historicProcessInstance.getTenantId();
}
@Override
public List<HistoricData> getHistoricData() {
return historicData;
}
public void addHistoricData(HistoricData historicEvent) {
|
historicData.add(historicEvent);
}
public void addHistoricData(Collection<? extends HistoricData> historicEvents) {
historicData.addAll(historicEvents);
}
public void orderHistoricData() {
Collections.sort(
historicData,
new Comparator<HistoricData>() {
@Override
public int compare(HistoricData data1, HistoricData data2) {
return data1.getTime().compareTo(data2.getTime());
}
}
);
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\ProcessInstanceHistoryLogImpl.java
| 1
|
请完成以下Java代码
|
protected ScriptEngine getPaScriptEngine(String language, ProcessApplicationReference pa) {
try {
ProcessApplicationInterface processApplication = pa.getProcessApplication();
ProcessApplicationInterface rawObject = processApplication.getRawObject();
if (rawObject instanceof AbstractProcessApplication) {
AbstractProcessApplication abstractProcessApplication = (AbstractProcessApplication) rawObject;
return abstractProcessApplication.getScriptEngineForName(language, enableScriptEngineCaching);
}
return null;
}
catch (ProcessApplicationUnavailableException e) {
throw new ProcessEngineException("Process Application is unavailable.", e);
}
}
protected ScriptEngine getGlobalScriptEngine(String language) {
ScriptEngine scriptEngine = scriptEngineResolver.getScriptEngine(language, enableScriptEngineCaching);
ensureNotNull("Can't find scripting engine for '" + language + "'", "scriptEngine", scriptEngine);
return scriptEngine;
}
/** override to build a spring aware ScriptingEngines
* @param engineBindin
* @param scriptEngine */
public Bindings createBindings(ScriptEngine scriptEngine, VariableScope variableScope) {
|
return scriptBindingsFactory.createBindings(variableScope, scriptEngine.createBindings());
}
public ScriptBindingsFactory getScriptBindingsFactory() {
return scriptBindingsFactory;
}
public void setScriptBindingsFactory(ScriptBindingsFactory scriptBindingsFactory) {
this.scriptBindingsFactory = scriptBindingsFactory;
}
public void setScriptEngineResolver(ScriptEngineResolver scriptEngineResolver) {
this.scriptEngineResolver = scriptEngineResolver;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\scripting\engine\ScriptingEngines.java
| 1
|
请完成以下Java代码
|
public Object getValue(final String columnName, final Class<?> returnType)
{
return gridTabWrapper.getValue(columnName, returnType);
}
@Override
public boolean setValue(final String columnName, final Object value)
{
gridTabWrapper.setValue(columnName, value);
return true;
}
@Override
public boolean setValueNoCheck(final String columnName, final Object value)
{
gridTabWrapper.setValue(columnName, value);
return true;
}
@Override
public Object getReferencedObject(final String columnName, final Method interfaceMethod) throws Exception
{
// TODO: implement
throw new UnsupportedOperationException();
}
@Override
public void setValueFromPO(final String idColumnName, final Class<?> parameterType, final Object value)
{
// TODO: implement
throw new UnsupportedOperationException();
}
|
@Override
public boolean invokeEquals(final Object[] methodArgs)
{
// TODO: implement
throw new UnsupportedOperationException();
}
@Override
public Object invokeParent(final Method method, final Object[] methodArgs) throws Exception
{
// TODO: implement
throw new UnsupportedOperationException();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\wrapper\GridTabModelInternalAccessor.java
| 1
|
请完成以下Java代码
|
public List<U> listPage(int firstResult, int maxResults) {
this.firstResult =firstResult;
this.maxResults = maxResults;
this.resultType = ResultType.LIST_PAGE;
if (commandExecutor!=null) {
return (List<U>) commandExecutor.execute(this);
}
return executeList(Context.getCommandContext(), getParameterMap(), firstResult, maxResults);
}
public long count() {
this.resultType = ResultType.COUNT;
if (commandExecutor != null) {
return (Long) commandExecutor.execute(this);
}
return executeCount(Context.getCommandContext(), getParameterMap());
}
public Object execute(CommandContext commandContext) {
if (resultType == ResultType.LIST) {
return executeList(commandContext, getParameterMap(), 0, Integer.MAX_VALUE);
} else if (resultType == ResultType.LIST_PAGE) {
Map<String, Object> parameterMap = getParameterMap();
parameterMap.put("resultType", "LIST_PAGE");
parameterMap.put("firstResult", firstResult);
parameterMap.put("maxResults", maxResults);
parameterMap.put("internalOrderBy", "RES.ID_ asc");
int firstRow = firstResult + 1;
parameterMap.put("firstRow", firstRow);
int lastRow = 0;
if(maxResults == Integer.MAX_VALUE) {
lastRow = maxResults;
} else {
lastRow = firstResult + maxResults + 1;
}
parameterMap.put("lastRow", lastRow);
return executeList(commandContext, parameterMap, firstResult, maxResults);
} else if (resultType == ResultType.SINGLE_RESULT) {
return executeSingleResult(commandContext);
} else {
return executeCount(commandContext, getParameterMap());
|
}
}
public abstract long executeCount(CommandContext commandContext, Map<String, Object> parameterMap);
/**
* Executes the actual query to retrieve the list of results.
* @param maxResults
* @param firstResult
*
* @param page
* used if the results must be paged. If null, no paging will be
* applied.
*/
public abstract List<U> executeList(CommandContext commandContext, Map<String, Object> parameterMap, int firstResult, int maxResults);
public U executeSingleResult(CommandContext commandContext) {
List<U> results = executeList(commandContext, getParameterMap(), 0, Integer.MAX_VALUE);
if (results.size() == 1) {
return results.get(0);
} else if (results.size() > 1) {
throw new ProcessEngineException("Query return " + results.size() + " results instead of max 1");
}
return null;
}
private Map<String, Object> getParameterMap() {
HashMap<String, Object> parameterMap = new HashMap<String, Object>();
parameterMap.put("sql", sqlStatement);
parameterMap.putAll(parameters);
return parameterMap;
}
public Map<String, Object> getParameters() {
return parameters;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\AbstractNativeQuery.java
| 1
|
请完成以下Java代码
|
protected ScopeImpl getScope(PvmExecutionImpl execution) {
ActivityImpl activity = execution.getActivity();
if (activity!=null) {
return activity;
} else {
PvmExecutionImpl parent = execution.getParent();
if (parent != null) {
return getScope(execution.getParent());
}
return execution.getProcessDefinition();
}
}
protected String getEventName() {
return ExecutionListener.EVENTNAME_START;
}
protected void eventNotificationsCompleted(PvmExecutionImpl execution) {
super.eventNotificationsCompleted(execution);
ScopeInstantiationContext startContext = execution.getScopeInstantiationContext();
InstantiationStack instantiationStack = startContext.getInstantiationStack();
|
// if the stack has been instantiated
if (instantiationStack.getActivities().isEmpty()) {
// done
execution.disposeScopeInstantiationContext();
return;
}
else {
// else instantiate the activity stack further
execution.setActivity(null);
execution.performOperation(ACTIVITY_INIT_STACK_AND_RETURN);
}
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\pvm\runtime\operation\PvmAtomicOperationActivityInitStackNotifyListenerReturn.java
| 1
|
请完成以下Java代码
|
public void setId(Long id) {
this.id = id;
}
// @Column(name = "first_name", nullable = false)
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
|
return emailId;
}
public void setEmail(String email) {
this.emailId = email;
}
public Employee(){
}
@Override
public String toString() {
return "Employee{" +
"id=" + id +
", firstName='" + firstName + '\'' +
", lastName='" + lastName + '\'' +
", email='" + emailId + '\'' +
'}';
}
}
|
repos\SpringBoot-Projects-FullStack-master\Part-4 Spring Boot REST API\SpringPostgreslq\src\main\java\spring\database\model\Employee.java
| 1
|
请完成以下Java代码
|
public void fireBeforeComplete(final I_C_RfQ rfq)
{
listeners.onBeforeComplete(rfq);
}
@Override
public void fireAfterComplete(final I_C_RfQ rfq)
{
listeners.onAfterComplete(rfq);
}
@Override
public void fireBeforeClose(final I_C_RfQ rfq)
{
listeners.onBeforeClose(rfq);
}
@Override
public void fireAfterClose(final I_C_RfQ rfq)
{
listeners.onAfterClose(rfq);
}
@Override
public void fireDraftCreated(final I_C_RfQResponse rfqResponse)
{
listeners.onDraftCreated(rfqResponse);
}
@Override
public void fireBeforeComplete(final I_C_RfQResponse rfqResponse)
{
listeners.onBeforeComplete(rfqResponse);
}
@Override
public void fireAfterComplete(final I_C_RfQResponse rfqResponse)
{
listeners.onAfterComplete(rfqResponse);
}
|
@Override
public void fireBeforeClose(final I_C_RfQResponse rfqResponse)
{
listeners.onBeforeClose(rfqResponse);
}
@Override
public void fireAfterClose(final I_C_RfQResponse rfqResponse)
{
listeners.onAfterClose(rfqResponse);
}
@Override
public void fireBeforeUnClose(I_C_RfQ rfq)
{
listeners.onBeforeUnClose(rfq);
}
@Override
public void fireAfterUnClose(I_C_RfQ rfq)
{
// TODO Auto-generated method stub
}
@Override
public void fireBeforeUnClose(I_C_RfQResponse rfqResponse)
{
// TODO Auto-generated method stub
}
@Override
public void fireAfterUnClose(I_C_RfQResponse rfqResponse)
{
// TODO Auto-generated method stub
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.rfq\src\main\java\de\metas\rfq\event\impl\RfQEventDispacher.java
| 1
|
请完成以下Java代码
|
public static String bytesToHexString(byte[] src){
if (src == null || src.length <= 0) {
return null;
}
StringBuilder stringBuilder = new StringBuilder("");
for (int j:src) {
int v = j & 0xFF;
String hv = Integer.toHexString(v);
if (hv.length() < 2) {
stringBuilder.append(0);
}
stringBuilder.append(hv);
}
return stringBuilder.toString();
}
/**
* 将16进制的字符串转化为byte[] 数组
* @param hexString 16进制字符串
* @return byte[] 数组
*/
public static byte[] hexStringToBytes(String hexString) {
if (StringUtils.isEmpty(hexString)) {
return new byte[0];
}
hexString = hexString.toUpperCase();
int length = hexString.length() / 2;
char[] hexChars = hexString.toCharArray();
byte[] d = new byte[length];
|
for (int i = 0; i < length; i++) {
int pos = i * 2;
d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
}
return d;
}
/**
* 将char转化为byte数组
* @param c char
* @return byte
*/
private static byte charToByte(char c) {
return (byte) BYTE_CONVERTE.indexOf(c);
}
}
|
repos\spring-boot-quick-master\mybatis-crypt-plugin\src\main\java\com\quick\db\crypt\util\Hex.java
| 1
|
请完成以下Java代码
|
public int getE_Expense_Acct ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_E_Expense_Acct);
if (ii == null)
return 0;
return ii.intValue();
}
public I_C_ValidCombination getE_Prepayment_A() throws RuntimeException
{
return (I_C_ValidCombination)MTable.get(getCtx(), I_C_ValidCombination.Table_Name)
.getPO(getE_Prepayment_Acct(), get_TrxName()); }
/** Set Employee Prepayment.
@param E_Prepayment_Acct
Account for Employee Expense Prepayments
|
*/
public void setE_Prepayment_Acct (int E_Prepayment_Acct)
{
set_Value (COLUMNNAME_E_Prepayment_Acct, Integer.valueOf(E_Prepayment_Acct));
}
/** Get Employee Prepayment.
@return Account for Employee Expense Prepayments
*/
public int getE_Prepayment_Acct ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_E_Prepayment_Acct);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_BP_Employee_Acct.java
| 1
|
请完成以下Java代码
|
private static CommandLine parseArgs(String[] args) {
Options options = new Options();
Option telemetryAllFrom = new Option("telemetryFrom", "telemetryFrom", true, "telemetry source file");
telemetryAllFrom.setRequired(true);
options.addOption(telemetryAllFrom);
Option latestTsOutOpt = new Option("latestOut", "latestTelemetryOut", true, "latest telemetry save dir");
latestTsOutOpt.setRequired(false);
options.addOption(latestTsOutOpt);
Option tsOutOpt = new Option("tsOut", "telemetryOut", true, "sstable save dir");
tsOutOpt.setRequired(false);
options.addOption(tsOutOpt);
Option partitionOutOpt = new Option("partitionsOut", "partitionsOut", true, "partitions save dir");
partitionOutOpt.setRequired(false);
options.addOption(partitionOutOpt);
Option castOpt = new Option("castEnable", "castEnable", true, "cast String to Double if possible");
castOpt.setRequired(true);
options.addOption(castOpt);
|
Option relatedOpt = new Option("relatedEntities", "relatedEntities", true, "related entities source file path");
relatedOpt.setRequired(true);
options.addOption(relatedOpt);
HelpFormatter formatter = new HelpFormatter();
CommandLineParser parser = new BasicParser();
try {
return parser.parse(options, args);
} catch (ParseException e) {
System.out.println(e.getMessage());
formatter.printHelp("utility-name", options);
System.exit(1);
}
return null;
}
}
|
repos\thingsboard-master\tools\src\main\java\org\thingsboard\client\tools\migrator\MigratorTool.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class ProcessInstanceDiagramResource extends BaseProcessInstanceResource {
@Autowired
protected RepositoryService repositoryService;
@Autowired
protected ProcessEngineConfiguration processEngineConfiguration;
@ApiOperation(value = "Get diagram for a process instance", tags = { "Process Instances" })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Indicates the process instance was found and the diagram was returned."),
@ApiResponse(code = 400, message = "Indicates the requested process instance was not found but the process does not contain any graphical information (BPMN:DI) and no diagram can be created."),
@ApiResponse(code = 404, message = "Indicates the requested process instance was not found.")
})
@GetMapping(value = "/runtime/process-instances/{processInstanceId}/diagram")
public ResponseEntity<byte[]> getProcessInstanceDiagram(@ApiParam(name = "processInstanceId") @PathVariable String processInstanceId, HttpServletResponse response) {
ProcessInstance processInstance = getProcessInstanceFromRequest(processInstanceId);
ProcessDefinition pde = repositoryService.getProcessDefinition(processInstance.getProcessDefinitionId());
if (pde != null && pde.hasGraphicalNotation()) {
BpmnModel bpmnModel = repositoryService.getBpmnModel(pde.getId());
ProcessDiagramGenerator diagramGenerator = processEngineConfiguration.getProcessDiagramGenerator();
|
InputStream resource = diagramGenerator.generateDiagram(bpmnModel, "png", runtimeService.getActiveActivityIds(processInstance.getId()), Collections.emptyList(),
processEngineConfiguration.getActivityFontName(), processEngineConfiguration.getLabelFontName(),
processEngineConfiguration.getAnnotationFontName(), processEngineConfiguration.getClassLoader(), 1.0,processEngineConfiguration.isDrawSequenceFlowNameWithNoLabelDI());
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.set("Content-Type", "image/png");
try {
return new ResponseEntity<>(IOUtils.toByteArray(resource), responseHeaders, HttpStatus.OK);
} catch (Exception e) {
throw new FlowableIllegalArgumentException("Error exporting diagram", e);
}
} else {
throw new FlowableIllegalArgumentException("Process instance with id '" + processInstance.getId() + "' has no graphical notation defined.");
}
}
}
|
repos\flowable-engine-main\modules\flowable-rest\src\main\java\org\flowable\rest\service\api\runtime\process\ProcessInstanceDiagramResource.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public XMLGregorianCalendar getDateOrdered() {
return dateOrdered;
}
/**
* Sets the value of the dateOrdered property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setDateOrdered(XMLGregorianCalendar value) {
this.dateOrdered = value;
}
/**
* Gets the value of the ediCctop111VID property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getEDICctop111VID() {
return ediCctop111VID;
}
/**
* Sets the value of the ediCctop111VID property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setEDICctop111VID(BigInteger value) {
this.ediCctop111VID = value;
}
/**
* Gets the value of the mInOutID property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getMInOutID() {
return mInOutID;
}
/**
* Sets the value of the mInOutID property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setMInOutID(BigInteger value) {
this.mInOutID = value;
}
/**
* Gets the value of the movementDate property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getMovementDate() {
return movementDate;
}
/**
* Sets the value of the movementDate property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setMovementDate(XMLGregorianCalendar value) {
this.movementDate = value;
|
}
/**
* Gets the value of the poReference property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPOReference() {
return poReference;
}
/**
* Sets the value of the poReference property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPOReference(String value) {
this.poReference = value;
}
/**
* Gets the value of the shipmentDocumentno property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getShipmentDocumentno() {
return shipmentDocumentno;
}
/**
* Sets the value of the shipmentDocumentno property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setShipmentDocumentno(String value) {
this.shipmentDocumentno = value;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_metasfreshinhousev1\de\metas\edi\esb\jaxb\metasfreshinhousev1\EDICctop111VType.java
| 2
|
请完成以下Java代码
|
protected String doIt() throws Exception
{
getSelectedInventoryLines()
.stream()
.forEach(inventoryLine -> markAsCounted(inventoryLine));
return MSG_OK;
}
private void markAsCounted(final I_M_InventoryLine inventoryLine)
{
if (!inventoryLine.isCounted())
{
inventoryLine.setIsCounted(true);
save(inventoryLine);
}
}
|
private List<I_M_InventoryLine> getSelectedInventoryLines()
{
final IQueryFilter<I_M_InventoryLine> selectedInventoryLines = getProcessInfo().getQueryFilterOrElseFalse();
final IQueryBL queryBL = Services.get(IQueryBL.class);
final IQueryBuilder<I_M_InventoryLine> queryBuilder = queryBL.createQueryBuilder(I_M_InventoryLine.class);
return queryBuilder
.filter(selectedInventoryLines)
.addOnlyActiveRecordsFilter()
.orderBy().addColumn(I_M_InventoryLine.COLUMNNAME_M_Locator_ID).endOrderBy()
.create()
.list(I_M_InventoryLine.class);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\inventory\process\M_InventoryLine_MarkAsCounted.java
| 1
|
请完成以下Java代码
|
public class TbSendEmailNodeConfiguration implements NodeConfiguration {
private boolean useSystemSmtpSettings;
private String smtpHost;
private int smtpPort;
private String username;
private String password;
private String smtpProtocol;
private int timeout;
private boolean enableTls;
private String tlsVersion;
private boolean enableProxy;
private String proxyHost;
private String proxyPort;
private String proxyUser;
|
private String proxyPassword;
@Override
public TbSendEmailNodeConfiguration defaultConfiguration() {
TbSendEmailNodeConfiguration configuration = new TbSendEmailNodeConfiguration();
configuration.setUseSystemSmtpSettings(true);
configuration.setSmtpHost("localhost");
configuration.setSmtpProtocol("smtp");
configuration.setSmtpPort(25);
configuration.setTimeout(10000);
configuration.setEnableTls(false);
configuration.setTlsVersion("TLSv1.2");
configuration.setEnableProxy(false);
return configuration;
}
}
|
repos\thingsboard-master\rule-engine\rule-engine-components\src\main\java\org\thingsboard\rule\engine\mail\TbSendEmailNodeConfiguration.java
| 1
|
请完成以下Java代码
|
protected String getInternalValueStringInitial()
{
return null;
}
/**
* @return <code>null</code>.
*/
@Override
protected BigDecimal getInternalValueNumberInitial()
{
return null;
}
@Override
protected void setInternalValueStringInitial(final String value)
{
throw new UnsupportedOperationException("Setting initial value not supported");
}
@Override
protected void setInternalValueNumberInitial(final BigDecimal value)
{
throw new UnsupportedOperationException("Setting initial value not supported");
}
@Override
public boolean isNew()
{
return InterfaceWrapperHelper.isNew(attributeInstance);
}
@Override
protected void setInternalValueDate(Date value)
{
attributeInstance.setValueDate(TimeUtil.asTimestamp(value));
}
@Override
protected Date getInternalValueDate()
{
return attributeInstance.getValueDate();
}
@Override
protected void setInternalValueDateInitial(Date value)
{
throw new UnsupportedOperationException("Setting initial value not supported");
}
@Override
protected Date getInternalValueDateInitial()
{
return null;
}
/**
* @return {@code PROPAGATIONTYPE_NoPropagation}.
*/
@Override
public String getPropagationType()
{
return X_M_HU_PI_Attribute.PROPAGATIONTYPE_NoPropagation;
}
/**
* @return {@link NullAggregationStrategy#instance}.
*/
@Override
public IAttributeAggregationStrategy retrieveAggregationStrategy()
{
return NullAggregationStrategy.instance;
}
/**
* @return {@link NullSplitterStrategy#instance}.
*/
@Override
public IAttributeSplitterStrategy retrieveSplitterStrategy()
{
return NullSplitterStrategy.instance;
}
/**
* @return {@link CopyHUAttributeTransferStrategy#instance}.
*/
@Override
public IHUAttributeTransferStrategy retrieveTransferStrategy()
{
return CopyHUAttributeTransferStrategy.instance;
}
/**
* @return {@code true}.
*/
@Override
public boolean isReadonlyUI()
{
return true;
}
/**
|
* @return {@code true}.
*/
@Override
public boolean isDisplayedUI()
{
return true;
}
@Override
public boolean isMandatory()
{
return false;
}
@Override
public boolean isOnlyIfInProductAttributeSet()
{
return false;
}
/**
* @return our attribute instance's {@code M_Attribute_ID}.
*/
@Override
public int getDisplaySeqNo()
{
return attributeInstance.getM_Attribute_ID();
}
/**
* @return {@code true}
*/
@Override
public boolean isUseInASI()
{
return true;
}
/**
* @return {@code false}, since no HU-PI attribute is involved.
*/
@Override
public boolean isDefinedByTemplate()
{
return false;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\attribute\storage\AIAttributeValue.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getTenantIdLike() {
return tenantIdLike;
}
public void setTenantIdLike(String tenantIdLike) {
this.tenantIdLike = tenantIdLike;
}
public String getRootScopeId() {
return rootScopeId;
}
public void setRootScopeId(String rootScopeId) {
this.rootScopeId = rootScopeId;
}
public String getParentScopeId() {
|
return parentScopeId;
}
public void setParentScopeId(String parentScopeId) {
this.parentScopeId = parentScopeId;
}
public Set<String> getCallbackIds() {
return callbackIds;
}
public void setCallbackIds(Set<String> callbackIds) {
this.callbackIds = callbackIds;
}
}
|
repos\flowable-engine-main\modules\flowable-rest\src\main\java\org\flowable\rest\service\api\runtime\process\ProcessInstanceQueryRequest.java
| 2
|
请完成以下Java代码
|
protected void putPropertyValue(String key, String value, ObjectNode propertiesNode) {
if (StringUtils.isNotBlank(value)) {
propertiesNode.put(key, value);
}
}
protected void putPropertyValue(String key, List<String> values, ObjectNode propertiesNode) {
// we don't set a node value if the collection is null.
// An empty collection is a indicator. if a task has candidate users you can only overrule it by putting an empty array as dynamic candidate users
if (values != null) {
ArrayNode arrayNode = propertiesNode.putArray(key);
for (String value : values) {
arrayNode.add(value);
}
}
|
}
protected void putPropertyValue(String key, JsonNode node, ObjectNode propertiesNode) {
if (node != null) {
if (!node.isMissingNode() && !node.isNull()) {
propertiesNode.set(key, node);
}
}
}
protected abstract ObjectNode createPropertiesNode(FlowElement flowElement, ObjectNode flowElementNode, ObjectMapper objectMapper);
@Override
public abstract boolean supports(FlowElement flowElement);
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\dynamic\BasePropertiesParser.java
| 1
|
请完成以下Java代码
|
public String getProcessInstanceId() {
return processInstanceId;
}
public void setExecutionId(String executionId) {
this.executionId = executionId;
}
@Override
public String getExecutionId() {
return executionId;
}
@Override
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String getLocalizedName() {
if (localizedName != null && localizedName.length() > 0) {
return localizedName;
} else {
return name;
}
}
public void setLocalizedName(String localizedName) {
this.localizedName = localizedName;
}
@Override
public String getDescription() {
if (localizedDescription != null && localizedDescription.length() > 0) {
return localizedDescription;
|
} else {
return description;
}
}
public void setDescription(String description) {
this.description = description;
}
@Override
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
@Override
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public String getDataObjectDefinitionKey() {
return dataObjectDefinitionKey;
}
public void setDataObjectDefinitionKey(String dataObjectDefinitionKey) {
this.dataObjectDefinitionKey = dataObjectDefinitionKey;
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\DataObjectImpl.java
| 1
|
请完成以下Java代码
|
public ViewRowFieldNameAndJsonValues getFieldNameAndJsonValues()
{
return values.get(this);
}
public OrderAttachmentRow withChanges(@NonNull final Boolean updatedIsAttachPurchaseOrderFlag)
{
final OrderAttachmentRow.OrderAttachmentRowBuilder rowBuilder = toBuilder();
rowBuilder.isAttachToPurchaseOrder(updatedIsAttachPurchaseOrderFlag);
return rowBuilder.build();
}
Optional<AttachmentLinksRequest> toAttachmentLinksRequest()
{
final Map<String, String> emailAttachmentTagAsMap = new HashMap<>();
emailAttachmentTagAsMap.put(TAGNAME_SEND_VIA_EMAIL, Boolean.TRUE.toString());
final AttachmentTags emailAttachmentTag = AttachmentTags.ofMap(emailAttachmentTagAsMap);
final TableRecordReference purchaseOrderRecordRef = getPurchaseOrderRecordRef();
if (isAttachToPurchaseOrder)
{
return Optional.of(AttachmentLinksRequest.builder()
.attachmentEntryId(attachmentEntry.getId())
.linksToAdd(ImmutableList.of(purchaseOrderRecordRef))
.tagsToAdd(emailAttachmentTag)
.build());
}
else if (isDirectlyAttachToPurchaseOrder)
{
return isAttachmentLinkedOnlyToPO()
? Optional.of(AttachmentLinksRequest.builder()
.attachmentEntryId(attachmentEntry.getId())
.tagsToRemove(emailAttachmentTag)
.build())
: Optional.of(AttachmentLinksRequest.builder()
|
.attachmentEntryId(attachmentEntry.getId())
.linksToRemove(ImmutableList.of(purchaseOrderRecordRef))
.tagsToRemove(emailAttachmentTag)
.build());
}
return Optional.empty();
}
private boolean isAttachmentLinkedOnlyToPO()
{
return attachmentEntry.getLinkedRecords().size() == 1
&& attachmentEntry.getLinkedRecords().contains(getPurchaseOrderRecordRef());
}
private TableRecordReference getPurchaseOrderRecordRef()
{
return TableRecordReference.of(I_C_Order.Table_Name, selectedPurchaseOrder.getC_Order_ID());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\order\attachmenteditor\OrderAttachmentRow.java
| 1
|
请完成以下Java代码
|
public static Integer parseToInteger(String integer) {
Integer parsedInteger = null;
try {
parsedInteger = Integer.parseInt(integer);
} catch (Exception e) {
}
return parsedInteger;
}
public static Date parseToDate(String date) {
Date parsedDate = null;
try {
parsedDate = shortDateFormat.parse(date);
} catch (Exception e) {
}
return parsedDate;
}
public static List<String> parseToList(String value) {
if (value == null || value.isEmpty()) {
return null;
}
|
String[] valueParts = value.split(",");
List<String> values = new ArrayList<>(valueParts.length);
Collections.addAll(values, valueParts);
return values;
}
public static Set<String> parseToSet(String value) {
if (value == null || value.isEmpty()) {
return null;
}
String[] valueParts = value.split(",");
Set<String> values = new HashSet<>(valueParts.length);
Collections.addAll(values, valueParts);
return values;
}
}
|
repos\flowable-engine-main\modules\flowable-common-rest\src\main\java\org\flowable\common\rest\api\RequestUtil.java
| 1
|
请完成以下Java代码
|
public class JobFailureCollector implements CommandContextListener {
protected Throwable failure;
protected JobEntity job;
protected String jobId;
protected String failedActivityId;
public JobFailureCollector(String jobId) {
this.jobId = jobId;
}
public void setFailure(Throwable failure) {
// log failure if not already present
if (this.failure == null) {
this.failure = failure;
}
}
public Throwable getFailure() {
return failure;
}
@Override
public void onCommandFailed(CommandContext commandContext, Throwable t) {
setFailure(t);
}
@Override
|
public void onCommandContextClose(CommandContext commandContext) {
// ignore
}
public void setJob(JobEntity job) {
this.job = job;
}
public JobEntity getJob() {
return job;
}
public String getJobId() {
return jobId;
}
public String getFailedActivityId() {
return failedActivityId;
}
public void setFailedActivityId(String activityId) {
this.failedActivityId = activityId;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\jobexecutor\JobFailureCollector.java
| 1
|
请完成以下Java代码
|
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_R_InterestArea[")
.append(get_ID()).append("]");
return sb.toString();
}
/** 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 Self-Service.
@param IsSelfService
This is a Self-Service entry or this entry can be changed via Self-Service
*/
public void setIsSelfService (boolean IsSelfService)
{
set_Value (COLUMNNAME_IsSelfService, Boolean.valueOf(IsSelfService));
}
/** Get Self-Service.
@return This is a Self-Service entry or this entry can be changed via Self-Service
*/
public boolean isSelfService ()
{
Object oo = get_Value(COLUMNNAME_IsSelfService);
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 Interest Area.
@param R_InterestArea_ID
Interest Area or Topic
*/
public void setR_InterestArea_ID (int R_InterestArea_ID)
{
if (R_InterestArea_ID < 1)
set_ValueNoCheck (COLUMNNAME_R_InterestArea_ID, null);
else
set_ValueNoCheck (COLUMNNAME_R_InterestArea_ID, Integer.valueOf(R_InterestArea_ID));
}
/** Get Interest Area.
@return Interest Area or Topic
*/
public int getR_InterestArea_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_R_InterestArea_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Search Key.
@param Value
Search key for the record in the format required - must be unique
*/
public void setValue (String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
/** Get Search Key.
@return Search key for the record in the format required - must be unique
*/
public String getValue ()
{
return (String)get_Value(COLUMNNAME_Value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_R_InterestArea.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class CurrentUserApi {
private UserQueryService userQueryService;
private UserService userService;
@GetMapping
public ResponseEntity currentUser(
@AuthenticationPrincipal User currentUser,
@RequestHeader(value = "Authorization") String authorization) {
UserData userData = userQueryService.findById(currentUser.getId()).get();
return ResponseEntity.ok(
userResponse(new UserWithToken(userData, authorization.split(" ")[1])));
}
@PutMapping
public ResponseEntity updateProfile(
|
@AuthenticationPrincipal User currentUser,
@RequestHeader("Authorization") String token,
@Valid @RequestBody UpdateUserParam updateUserParam) {
userService.updateUser(new UpdateUserCommand(currentUser, updateUserParam));
UserData userData = userQueryService.findById(currentUser.getId()).get();
return ResponseEntity.ok(userResponse(new UserWithToken(userData, token.split(" ")[1])));
}
private Map<String, Object> userResponse(UserWithToken userWithToken) {
return new HashMap<String, Object>() {
{
put("user", userWithToken);
}
};
}
}
|
repos\spring-boot-realworld-example-app-master\src\main\java\io\spring\api\CurrentUserApi.java
| 2
|
请完成以下Java代码
|
public class DeleteJobsCmd implements Command<Void> {
private static final long serialVersionUID = 1L;
protected List<String> jobIds;
protected boolean cascade;
public DeleteJobsCmd(List<String> jobIds) {
this(jobIds, false);
}
public DeleteJobsCmd(List<String> jobIds, boolean cascade) {
this.jobIds = jobIds;
this.cascade = cascade;
}
public DeleteJobsCmd(String jobId) {
this(jobId, false);
}
public DeleteJobsCmd(String jobId, boolean cascade) {
this.jobIds = new ArrayList<String>();
jobIds.add(jobId);
this.cascade = cascade;
}
public Void execute(CommandContext commandContext) {
JobEntity jobToDelete = null;
for (String jobId: jobIds) {
|
jobToDelete = Context
.getCommandContext()
.getJobManager()
.findJobById(jobId);
if(jobToDelete != null) {
// When given job doesn't exist, ignore
jobToDelete.delete();
if (cascade) {
commandContext
.getHistoricJobLogManager()
.deleteHistoricJobLogByJobId(jobId);
}
}
}
return null;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmd\DeleteJobsCmd.java
| 1
|
请完成以下Java代码
|
public String getSuperCaseInstanceId() {
return superCaseInstanceId;
}
public String getSubCaseInstanceId() {
return subCaseInstanceId;
}
public boolean isTenantIdSet() {
return isTenantIdSet;
}
public boolean isRootProcessInstances() {
return isRootProcessInstances;
}
public boolean isProcessDefinitionWithoutTenantId() {
return isProcessDefinitionWithoutTenantId;
}
public boolean isLeafProcessInstances() {
return isLeafProcessInstances;
}
public String[] getTenantIds() {
return tenantIds;
}
@Override
public ProcessInstanceQuery or() {
if (this != queries.get(0)) {
|
throw new ProcessEngineException("Invalid query usage: cannot set or() within 'or' query");
}
ProcessInstanceQueryImpl orQuery = new ProcessInstanceQueryImpl();
orQuery.isOrQueryActive = true;
orQuery.queries = queries;
queries.add(orQuery);
return orQuery;
}
@Override
public ProcessInstanceQuery endOr() {
if (!queries.isEmpty() && this != queries.get(queries.size()-1)) {
throw new ProcessEngineException("Invalid query usage: cannot set endOr() before or()");
}
return queries.get(0);
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\ProcessInstanceQueryImpl.java
| 1
|
请完成以下Java代码
|
public void setExpanded(Boolean expanded) {
this.expanded = expanded;
}
public BaseElement getElement() {
return element;
}
public void setElement(BaseElement element) {
this.element = element;
}
public int getXmlRowNumber() {
return xmlRowNumber;
}
public void setXmlRowNumber(int xmlRowNumber) {
this.xmlRowNumber = xmlRowNumber;
}
public int getXmlColumnNumber() {
return xmlColumnNumber;
}
public void setXmlColumnNumber(int xmlColumnNumber) {
this.xmlColumnNumber = xmlColumnNumber;
}
public double getRotation() {
return rotation;
}
public void setRotation(double rotation) {
this.rotation = rotation;
}
public boolean equals(GraphicInfo ginfo) {
if (this.getX() != ginfo.getX()) {
return false;
}
|
if (this.getY() != ginfo.getY()) {
return false;
}
if (this.getHeight() != ginfo.getHeight()) {
return false;
}
if (this.getWidth() != ginfo.getWidth()) {
return false;
}
if (this.getRotation() != ginfo.getRotation()) {
return false;
}
// check for zero value in case we are comparing model value to BPMN DI value
// model values do not have xml location information
if (0 != this.getXmlColumnNumber() && 0 != ginfo.getXmlColumnNumber() && this.getXmlColumnNumber() != ginfo.getXmlColumnNumber()) {
return false;
}
if (0 != this.getXmlRowNumber() && 0 != ginfo.getXmlRowNumber() && this.getXmlRowNumber() != ginfo.getXmlRowNumber()) {
return false;
}
// only check for elements that support this value
if (null != this.getExpanded() && null != ginfo.getExpanded() && !this.getExpanded().equals(ginfo.getExpanded())) {
return false;
}
return true;
}
}
|
repos\flowable-engine-main\modules\flowable-bpmn-model\src\main\java\org\flowable\bpmn\model\GraphicInfo.java
| 1
|
请完成以下Java代码
|
public DocumentId getDocumentId()
{
return data.getDocumentId();
}
AttributeSetId getAttributeSetId()
{
return descriptor.getAttributeSetId();
}
void processValueChanges(final List<JSONDocumentChangedEvent> events, final ReasonSupplier reason)
{
assertNotCompleted();
data.processValueChanges(events, reason);
}
public Collection<IDocumentFieldView> getFieldViews()
{
return data.getFieldViews();
}
public JSONASIDocument toJSONASIDocument(
final JSONDocumentOptions docOpts,
final JSONDocumentLayoutOptions layoutOpts)
{
return JSONASIDocument.builder()
.id(data.getDocumentId())
.layout(JSONASILayout.of(getLayout(), layoutOpts))
.fieldsByName(JSONDocument.ofDocument(data, docOpts).getFieldsByName())
.build();
}
public LookupValuesPage getFieldLookupValuesForQuery(final String attributeName, final String query)
{
return data.getFieldLookupValuesForQuery(attributeName, query);
}
public LookupValuesList getFieldLookupValues(final String attributeName)
{
return data.getFieldLookupValues(attributeName);
}
public boolean isCompleted()
{
return completed;
}
IntegerLookupValue complete()
{
assertNotCompleted();
final I_M_AttributeSetInstance asiRecord = createM_AttributeSetInstance(this);
final IntegerLookupValue lookupValue = IntegerLookupValue.of(asiRecord.getM_AttributeSetInstance_ID(), asiRecord.getDescription());
completed = true;
return lookupValue;
}
private static I_M_AttributeSetInstance createM_AttributeSetInstance(final ASIDocument asiDoc)
|
{
//
// Create M_AttributeSetInstance
final AttributeSetId attributeSetId = asiDoc.getAttributeSetId();
final I_M_AttributeSetInstance asiRecord = InterfaceWrapperHelper.newInstance(I_M_AttributeSetInstance.class);
asiRecord.setM_AttributeSet_ID(attributeSetId.getRepoId());
InterfaceWrapperHelper.save(asiRecord);
//
// Create M_AttributeInstances
asiDoc.getFieldViews()
.forEach(asiField -> asiField
.getDescriptor()
.getDataBindingNotNull(ASIAttributeFieldBinding.class)
.createAndSaveM_AttributeInstance(asiRecord, asiField));
//
// Update the ASI description
Services.get(IAttributeSetInstanceBL.class).setDescription(asiRecord);
InterfaceWrapperHelper.save(asiRecord);
return asiRecord;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\pattribute\ASIDocument.java
| 1
|
请完成以下Java代码
|
public void process(WatchedEvent we) {
if (we.getType() == Event.EventType.None) {
switch (we.getState()) {
case Expired:
connectedSignal.countDown();
break;
}
} else {
String path = ZKConstants.ZK_FIRST_PATH;
try {
byte[] bn = zk.getData(path,
false, null);
String data = new String(bn,
"UTF-8");
System.out.println(data);
connectedSignal.countDown();
|
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
}
}
}, null);
String data = new String(b, "UTF-8");
System.out.println(data);
connectedSignal.await();
} else {
System.out.println("Node does not exists");
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
|
repos\spring-boot-quick-master\quick-zookeeper\src\main\java\com\quick\zookeeper\client\ZKGetData.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class BlogProperties {
@Value("${com.didispace.blog.name}")
private String name;
@Value("${com.didispace.blog.title}")
private String title;
@Value("${com.didispace.blog.desc}")
private String desc;
@Value("${com.didispace.blog.value}")
private String value;
@Value("${com.didispace.blog.number}")
private Integer number;
@Value("${com.didispace.blog.bignumber}")
private Long bignumber;
@Value("${com.didispace.blog.test1}")
private Integer test1;
@Value("${com.didispace.blog.test2}")
private Integer test2;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
|
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public Integer getNumber() {
return number;
}
public void setNumber(Integer number) {
this.number = number;
}
public Long getBignumber() {
return bignumber;
}
public void setBignumber(Long bignumber) {
this.bignumber = bignumber;
}
public Integer getTest1() {
return test1;
}
public void setTest1(Integer test1) {
this.test1 = test1;
}
public Integer getTest2() {
return test2;
}
public void setTest2(Integer test2) {
this.test2 = test2;
}
}
|
repos\SpringBoot-Learning-master\1.x\Chapter2-1-1\src\main\java\com\didispace\service\BlogProperties.java
| 2
|
请完成以下Java代码
|
public class SpringCacheManagerWrapper implements CacheManager {
private org.springframework.cache.CacheManager cacheManager;
/**
* 设置spring cache manager
*
* @param cacheManager
*/
public void setCacheManager(org.springframework.cache.CacheManager cacheManager) {
this.cacheManager = cacheManager;
}
@SuppressWarnings("unchecked")
@Override
public <K, V> Cache<K, V> getCache(String name) throws CacheException {
org.springframework.cache.Cache springCache = cacheManager.getCache(name);
return new SpringCacheWrapper(springCache);
}
@SuppressWarnings("rawtypes")
static class SpringCacheWrapper implements Cache {
private org.springframework.cache.Cache springCache;
SpringCacheWrapper(org.springframework.cache.Cache springCache) {
this.springCache = springCache;
}
@Override
public Object get(Object key) throws CacheException {
Object value = springCache.get(key);
if (value instanceof SimpleValueWrapper) {
return ((SimpleValueWrapper) value).get();
}
return value;
}
@Override
public Object put(Object key, Object value) throws CacheException {
springCache.put(key, value);
return value;
}
@Override
public Object remove(Object key) throws CacheException {
springCache.evict(key);
return null;
}
@Override
|
public void clear() throws CacheException {
springCache.clear();
}
@Override
public int size() {
if (springCache.getNativeCache() instanceof Ehcache) {
Ehcache ehcache = (Ehcache) springCache.getNativeCache();
return ehcache.getSize();
}
throw new UnsupportedOperationException("invoke spring cache abstract size method not supported");
}
@SuppressWarnings("unchecked")
@Override
public Set keys() {
if (springCache.getNativeCache() instanceof Ehcache) {
Ehcache ehcache = (Ehcache) springCache.getNativeCache();
return new HashSet(ehcache.getKeys());
}
throw new UnsupportedOperationException("invoke spring cache abstract keys method not supported");
}
@SuppressWarnings("unchecked")
@Override
public Collection values() {
if (springCache.getNativeCache() instanceof Ehcache) {
Ehcache ehcache = (Ehcache) springCache.getNativeCache();
List keys = ehcache.getKeys();
if (!CollectionUtils.isEmpty(keys)) {
List values = new ArrayList(keys.size());
for (Object key : keys) {
Object value = get(key);
if (value != null) {
values.add(value);
}
}
return Collections.unmodifiableList(values);
} else {
return Collections.emptyList();
}
}
throw new UnsupportedOperationException("invoke spring cache abstract values method not supported");
}
}
}
|
repos\roncoo-pay-master\roncoo-pay-web-boss\src\main\java\com\roncoo\pay\permission\shiro\spring\SpringCacheManagerWrapper.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class TestController {
/**
* 拥有 ROLE_ADMIN 的用户才能访问的资源
*
* @return ADMIN
*/
@PreAuthorize("hasRole('ADMIN')")
@GetMapping("/admin")
public String admin() {
return "ADMIN";
}
/**
* 拥有 ROLE_TEST 的用户才能访问的资源
*
* @return TEST
*/
@PreAuthorize("hasRole('TEST')")
@GetMapping("/test")
public String test() {
return "TEST";
}
/**
* scope 有 READ 的用户资源才能访问
*
* @return READ
*/
@PreAuthorize("#oauth2.hasScope('READ')")
@GetMapping("/read")
|
public String read() {
return "READ";
}
/**
* scope 有 WRITE 的用户资源才能访问
*
* @return WRITE
*/
@PreAuthorize("#oauth2.hasScope('WRITE')")
@GetMapping("/write")
public String write() {
return "WRITE";
}
}
|
repos\spring-boot-demo-master\demo-oauth\oauth-resource-server\src\main\java\com\xkcoding\oauth\controller\TestController.java
| 2
|
请完成以下Java代码
|
public void setCarrier_Product_ID (final int Carrier_Product_ID)
{
if (Carrier_Product_ID < 1)
set_Value (COLUMNNAME_Carrier_Product_ID, null);
else
set_Value (COLUMNNAME_Carrier_Product_ID, Carrier_Product_ID);
}
@Override
public int getCarrier_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_Carrier_Product_ID);
}
@Override
public void setC_Workplace_Carrier_Product_ID (final int C_Workplace_Carrier_Product_ID)
{
if (C_Workplace_Carrier_Product_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Workplace_Carrier_Product_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Workplace_Carrier_Product_ID, C_Workplace_Carrier_Product_ID);
}
@Override
public int getC_Workplace_Carrier_Product_ID()
|
{
return get_ValueAsInt(COLUMNNAME_C_Workplace_Carrier_Product_ID);
}
@Override
public void setC_Workplace_ID (final int C_Workplace_ID)
{
if (C_Workplace_ID < 1)
set_Value (COLUMNNAME_C_Workplace_ID, null);
else
set_Value (COLUMNNAME_C_Workplace_ID, C_Workplace_ID);
}
@Override
public int getC_Workplace_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Workplace_ID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Workplace_Carrier_Product.java
| 1
|
请完成以下Java代码
|
public void setC_BPartner_ID (int C_BPartner_ID)
{
if (C_BPartner_ID < 1)
set_Value (COLUMNNAME_C_BPartner_ID, null);
else
set_Value (COLUMNNAME_C_BPartner_ID, Integer.valueOf(C_BPartner_ID));
}
/** Get Business Partner .
@return Identifies a Business Partner
*/
public int getC_BPartner_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_BPartner_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Counter.
@param Counter
Count Value
*/
public void setCounter (int Counter)
{
throw new IllegalArgumentException ("Counter is virtual column"); }
/** Get Counter.
@return Count Value
*/
public int getCounter ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Counter);
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());
}
/** Set Page URL.
@param PageURL Page URL */
public void setPageURL (String PageURL)
{
set_Value (COLUMNNAME_PageURL, PageURL);
}
/** Get Page URL.
@return Page URL */
public String getPageURL ()
{
return (String)get_Value(COLUMNNAME_PageURL);
}
/** Set Counter Count.
@param W_CounterCount_ID
Web Counter Count Management
*/
public void setW_CounterCount_ID (int W_CounterCount_ID)
{
if (W_CounterCount_ID < 1)
set_ValueNoCheck (COLUMNNAME_W_CounterCount_ID, null);
else
set_ValueNoCheck (COLUMNNAME_W_CounterCount_ID, Integer.valueOf(W_CounterCount_ID));
}
/** Get Counter Count.
@return Web Counter Count Management
*/
public int getW_CounterCount_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_W_CounterCount_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_W_CounterCount.java
| 1
|
请完成以下Java代码
|
public List<I_AD_UI_ElementGroup> getUIElementGroups(final I_AD_UI_Column uiColumn)
{
return column2elementGroups.get(uiColumn);
}
@Override
public void consume(final I_AD_UI_Element uiElement, final I_AD_UI_ElementGroup parent)
{
logger.debug("Generated in memory {} for {}", uiElement, parent);
elementGroup2elements.put(parent, uiElement);
}
@Override
public List<I_AD_UI_Element> getUIElements(final I_AD_UI_ElementGroup uiElementGroup)
{
return elementGroup2elements.get(uiElementGroup);
}
@Override
public List<I_AD_UI_Element> getUIElementsOfType(@NonNull final AdTabId adTabId, @NonNull final LayoutElementType layoutElementType)
{
return elementGroup2elements.values().stream()
.filter(uiElement -> layoutElementType.getCode().equals(uiElement.getAD_UI_ElementType()))
|
.collect(ImmutableList.toImmutableList());
}
@Override
public void consume(final I_AD_UI_ElementField uiElementField, final I_AD_UI_Element parent)
{
logger.debug("Generated in memory {} for {}", uiElementField, parent);
element2elementFields.put(parent, uiElementField);
}
@Override
public List<I_AD_UI_ElementField> getUIElementFields(final I_AD_UI_Element uiElement)
{
return element2elementFields.get(uiElement);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\descriptor\factory\standard\InMemoryUIElementsProvider.java
| 1
|
请完成以下Java代码
|
void colorB_actionPerformed(ActionEvent e) {
// Fix until Sun's JVM supports more locales...
UIManager.put(
"ColorChooser.swatchesNameText",
Local.getString("Swatches"));
UIManager.put("ColorChooser.hsbNameText", Local.getString("HSB"));
UIManager.put("ColorChooser.rgbNameText", Local.getString("RGB"));
UIManager.put(
"ColorChooser.swatchesRecentText",
Local.getString("Recent:"));
UIManager.put("ColorChooser.previewText", Local.getString("Preview"));
UIManager.put(
"ColorChooser.sampleText",
Local.getString("Sample Text")
+ " "
+ Local.getString("Sample Text"));
UIManager.put("ColorChooser.okText", Local.getString("OK"));
UIManager.put("ColorChooser.cancelText", Local.getString("Cancel"));
UIManager.put("ColorChooser.resetText", Local.getString("Reset"));
UIManager.put("ColorChooser.hsbHueText", Local.getString("H"));
UIManager.put("ColorChooser.hsbSaturationText", Local.getString("S"));
|
UIManager.put("ColorChooser.hsbBrightnessText", Local.getString("B"));
UIManager.put("ColorChooser.hsbRedText", Local.getString("R"));
UIManager.put("ColorChooser.hsbGreenText", Local.getString("G"));
UIManager.put("ColorChooser.hsbBlueText", Local.getString("B2"));
UIManager.put("ColorChooser.rgbRedText", Local.getString("Red"));
UIManager.put("ColorChooser.rgbGreenText", Local.getString("Green"));
UIManager.put("ColorChooser.rgbBlueText", Local.getString("Blue"));
Color c = JColorChooser.showDialog(this, Local.getString("Font color"),
Util.decodeColor(colorField.getText()));
if (c == null) return;
colorField.setText(Util.encodeColor(c));
Util.setColorField(colorField);
sample.setForeground(c);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\net\sf\memoranda\ui\htmleditor\FontDialog.java
| 1
|
请完成以下Java代码
|
private static String writeValueAsString(@NonNull final JsonOLCandCreateBulkRequest object)
{
final ObjectMapper jsonObjectMapper = JsonObjectMapperHolder.newJsonObjectMapper()
.enable(SerializationFeature.INDENT_OUTPUT);
try
{
final String json = jsonObjectMapper.writeValueAsString(object);
return json;
}
catch (final JsonProcessingException e)
{
throw new JsonOLCandUtilException("JsonProcessingException", e);
}
}
public static class JsonOLCandUtilException extends RuntimeException
{
private static final long serialVersionUID = -626001461757553239L;
public JsonOLCandUtilException(final String msg, final Throwable cause)
{
super(msg, cause);
}
}
public static JsonOLCandCreateBulkRequest loadJsonOLCandCreateBulkRequest(@NonNull final String resourceName)
{
return fromRessource(resourceName, JsonOLCandCreateBulkRequest.class);
}
|
public static JsonOLCandCreateRequest loadJsonOLCandCreateRequest(@NonNull final String resourceName)
{
return fromRessource(resourceName, JsonOLCandCreateRequest.class);
}
private static <T> T fromRessource(@NonNull final String resourceName, @NonNull final Class<T> clazz)
{
final InputStream inputStream = Check.assumeNotNull(
JsonOLCandUtil.class.getResourceAsStream(resourceName),
"There needs to be a loadable resource with name={}", resourceName);
final ObjectMapper jsonObjectMapper = JsonObjectMapperHolder.sharedJsonObjectMapper();
try
{
return jsonObjectMapper.readValue(inputStream, clazz);
}
catch (final JsonParseException e)
{
throw new JsonOLCandUtilException("JsonParseException", e);
}
catch (final JsonMappingException e)
{
throw new JsonOLCandUtilException("JsonMappingException", e);
}
catch (final IOException e)
{
throw new JsonOLCandUtilException("IOException", e);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\v1\ordercandidates\impl\JsonOLCandUtil.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
final public class UserQueryDocumentFilterDescriptorsProviderFactory implements DocumentFilterDescriptorsProviderFactory
{
private final IADTableDAO adTablesRepo = Services.get(IADTableDAO.class);
public UserQueryDocumentFilterDescriptorsProviderFactory()
{
}
@Override
public DocumentFilterDescriptorsProvider createFiltersProvider(@NonNull final CreateFiltersProviderContext context)
{
final String tableName = StringUtils.trimBlankToNull(context.getTableName());
final AdTabId adTabId = context.getAdTabId();
if (tableName == null || adTabId == null)
{
return NullDocumentFilterDescriptorsProvider.instance;
}
final AdTableId adTableId = adTablesRepo.retrieveAdTableId(tableName);
final List<IUserQueryField> searchFields = context.getFields()
.stream()
.map(UserQueryDocumentFilterDescriptorsProviderFactory::createUserQueryField)
|
.collect(ImmutableList.toImmutableList());
final UserQueryRepository repository = UserQueryRepository.builder()
.setAD_Tab_ID(adTabId.getRepoId())
.setAD_Table_ID(adTableId.getRepoId())
.setAD_User_ID(UserId.METASFRESH.getRepoId()) // FIXME: hardcoded, see https://github.com/metasfresh/metasfresh-webui/issues/162
.setSearchFields(searchFields)
.setColumnDisplayTypeProvider(POInfo.getPOInfoNotNull(tableName))
.build();
return new UserQueryDocumentFilterDescriptorsProvider(repository);
}
private static UserQueryField createUserQueryField(final DocumentFieldDescriptor field)
{
return UserQueryField.builder()
.columnName(field.getFieldName())
.displayName(field.getCaption())
.widgetType(field.getWidgetType())
// TODO: use a lookup descriptor without validation rules with params
.lookupDescriptor(field.getLookupDescriptorForFiltering())
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\document\filter\provider\userQuery\UserQueryDocumentFilterDescriptorsProviderFactory.java
| 2
|
请完成以下Java代码
|
public OrderFactory shipBPartner(
@NonNull final BPartnerId bpartnerId,
@Nullable final BPartnerLocationId bpartnerLocationId,
@Nullable final BPartnerContactId contactId)
{
assertNotBuilt();
OrderDocumentLocationAdapterFactory
.locationAdapter(order)
.setFrom(DocumentLocation.builder()
.bpartnerId(bpartnerId)
.bpartnerLocationId(bpartnerLocationId)
.contactId(contactId)
.build());
return this;
}
public OrderFactory shipBPartner(final BPartnerId bpartnerId)
{
shipBPartner(bpartnerId, null, null);
return this;
}
public BPartnerId getShipBPartnerId()
{
return BPartnerId.ofRepoId(order.getC_BPartner_ID());
}
public OrderFactory pricingSystemId(@NonNull final PricingSystemId pricingSystemId)
{
assertNotBuilt();
order.setM_PricingSystem_ID(pricingSystemId.getRepoId());
return this;
}
|
public OrderFactory poReference(@Nullable final String poReference)
{
assertNotBuilt();
order.setPOReference(poReference);
return this;
}
public OrderFactory salesRepId(@Nullable final UserId salesRepId)
{
assertNotBuilt();
order.setSalesRep_ID(UserId.toRepoId(salesRepId));
return this;
}
public OrderFactory projectId(@Nullable final ProjectId projectId)
{
assertNotBuilt();
order.setC_Project_ID(ProjectId.toRepoId(projectId));
return this;
}
public OrderFactory campaignId(final int campaignId)
{
assertNotBuilt();
order.setC_Campaign_ID(campaignId);
return this;
}
public DocTypeId getDocTypeTargetId()
{
return docTypeTargetId;
}
public void setDocTypeTargetId(final DocTypeId docTypeTargetId)
{
this.docTypeTargetId = docTypeTargetId;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\order\OrderFactory.java
| 1
|
请完成以下Java代码
|
public void setType(String type) {
this.type = type;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public String getSuggest() {
return suggest;
}
public void setSuggest(String suggest) {
this.suggest = suggest;
}
public Integer getBusinessSystemId() {
return businessSystemId;
}
public void setBusinessSystemId(Integer businessSystemId) {
this.businessSystemId = businessSystemId;
}
public Integer getDepartmentId() {
return departmentId;
}
public void setDepartmentId(Integer departmentId) {
this.departmentId = departmentId;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Integer getOccurCount() {
return occurCount;
}
public void setOccurCount(Integer occurCount) {
this.occurCount = occurCount;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public Date getResponsedTime() {
return responsedTime;
}
public void setResponsedTime(Date responsedTime) {
this.responsedTime = responsedTime;
}
public String getResponsedBy() {
return responsedBy;
}
public void setResponsedBy(String responsedBy) {
|
this.responsedBy = responsedBy;
}
public Date getResolvedTime() {
return resolvedTime;
}
public void setResolvedTime(Date resolvedTime) {
this.resolvedTime = resolvedTime;
}
public String getResolvedBy() {
return resolvedBy;
}
public void setResolvedBy(String resolvedBy) {
this.resolvedBy = resolvedBy;
}
public Date getClosedTime() {
return closedTime;
}
public void setClosedTime(Date closedTime) {
this.closedTime = closedTime;
}
public String getClosedBy() {
return closedBy;
}
public void setClosedBy(String closedBy) {
this.closedBy = closedBy;
}
@Override
public String toString() {
return "Event{" +
"id=" + id +
", rawEventId=" + rawEventId +
", host=" + host +
", ip=" + ip +
", source=" + source +
", type=" + type +
", startTime=" + startTime +
", endTime=" + endTime +
", content=" + content +
", dataType=" + dataType +
", suggest=" + suggest +
", businessSystemId=" + businessSystemId +
", departmentId=" + departmentId +
", status=" + status +
", occurCount=" + occurCount +
", owner=" + owner +
", responsedTime=" + responsedTime +
", responsedBy=" + responsedBy +
", resolvedTime=" + resolvedTime +
", resolvedBy=" + resolvedBy +
", closedTime=" + closedTime +
", closedBy=" + closedBy +
'}';
}
}
|
repos\springBoot-master\springboot-shiro\src\main\java\com\us\bean\Event.java
| 1
|
请完成以下Java代码
|
public int getC_BPartner_ID()
{
return get_ValueAsInt(COLUMNNAME_C_BPartner_ID);
}
@Override
public void setC_Invoice_Candidate_Agg_ID (final int C_Invoice_Candidate_Agg_ID)
{
if (C_Invoice_Candidate_Agg_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Invoice_Candidate_Agg_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Invoice_Candidate_Agg_ID, C_Invoice_Candidate_Agg_ID);
}
@Override
public int getC_Invoice_Candidate_Agg_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Invoice_Candidate_Agg_ID);
}
@Override
public void setClassname (final @Nullable java.lang.String Classname)
{
set_Value (COLUMNNAME_Classname, Classname);
}
@Override
public java.lang.String getClassname()
{
return get_ValueAsString(COLUMNNAME_Classname);
}
@Override
public void setDescription (final @Nullable java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
@Override
public java.lang.String getDescription()
{
return get_ValueAsString(COLUMNNAME_Description);
}
@Override
public de.metas.invoicecandidate.model.I_M_ProductGroup getM_ProductGroup()
{
return get_ValueAsPO(COLUMNNAME_M_ProductGroup_ID, de.metas.invoicecandidate.model.I_M_ProductGroup.class);
|
}
@Override
public void setM_ProductGroup(final de.metas.invoicecandidate.model.I_M_ProductGroup M_ProductGroup)
{
set_ValueFromPO(COLUMNNAME_M_ProductGroup_ID, de.metas.invoicecandidate.model.I_M_ProductGroup.class, M_ProductGroup);
}
@Override
public void setM_ProductGroup_ID (final int M_ProductGroup_ID)
{
if (M_ProductGroup_ID < 1)
set_Value (COLUMNNAME_M_ProductGroup_ID, null);
else
set_Value (COLUMNNAME_M_ProductGroup_ID, M_ProductGroup_ID);
}
@Override
public int getM_ProductGroup_ID()
{
return get_ValueAsInt(COLUMNNAME_M_ProductGroup_ID);
}
@Override
public void setName (final java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
@Override
public 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.swat\de.metas.swat.base\src\main\java-gen\de\metas\invoicecandidate\model\X_C_Invoice_Candidate_Agg.java
| 1
|
请完成以下Java代码
|
class JsonEscape {
String escapeJson(String input) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("message", input);
return jsonObject.toString();
}
String escapeGson(String input) {
JsonObject gsonObject = new JsonObject();
gsonObject.addProperty("message", input);
return gsonObject.toString();
}
String escapeJackson(String input) throws JsonProcessingException {
return new ObjectMapper().writeValueAsString(new Payload(input));
}
|
static class Payload {
String message;
Payload(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
}
|
repos\tutorials-master\json-modules\json\src\main\java\com\baeldung\escape\JsonEscape.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public ADSystemInfo get()
{
return cache.getOrLoad(0, this::retrieveADSystemInfo);
}
private ADSystemInfo retrieveADSystemInfo()
{
final I_AD_System record = queryBL.createQueryBuilderOutOfTrx(I_AD_System.class)
.create()
.firstOnly(I_AD_System.class);
// shall not happen
if (record == null)
{
throw new AdempiereException("No AD_System record found");
}
return ADSystemInfo.builder()
.dbVersion(record.getDBVersion())
.systemStatus(record.getSystemStatus())
.lastBuildInfo(record.getLastBuildInfo())
.failOnMissingModelValidator(record.isFailOnMissingModelValidator())
.build();
}
/*
* Allow remember me feature
* ZK_LOGIN_ALLOW_REMEMBER_ME and SWING_ALLOW_REMEMBER_ME parameter allow the next values
* U - Allow remember the username (default for zk)
* P - Allow remember the username and password (default for swing)
* N - None
*
* @return boolean representing if remember me feature is allowed
|
*/
public static final String SYSTEM_ALLOW_REMEMBER_USER = "U";
public static final String SYSTEM_ALLOW_REMEMBER_PASSWORD = "P";
@Override
public boolean isRememberUserAllowed(@NonNull final String sysConfigKey)
{
String ca = Services.get(ISysConfigBL.class).getValue(sysConfigKey, SYSTEM_ALLOW_REMEMBER_PASSWORD);
return (ca.equalsIgnoreCase(SYSTEM_ALLOW_REMEMBER_USER) || ca.equalsIgnoreCase(SYSTEM_ALLOW_REMEMBER_PASSWORD));
}
@Override
public boolean isRememberPasswordAllowed(@NonNull final String sysConfigKey)
{
String ca = Services.get(ISysConfigBL.class).getValue(sysConfigKey, SYSTEM_ALLOW_REMEMBER_PASSWORD);
return (ca.equalsIgnoreCase(SYSTEM_ALLOW_REMEMBER_PASSWORD));
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\service\impl\SystemBL.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@ApiModelProperty(example = "2016-12-14T10:16:37.000+01:00")
public Date getDeploymentTime() {
return deploymentTime;
}
public void setDeploymentTime(Date deploymentTime) {
this.deploymentTime = deploymentTime;
}
@ApiModelProperty(example = "dmnExamples")
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
@ApiModelProperty(example = "http://localhost:8080/flowable-rest/dmn-api/dmn-repository/deployments/03ab310d-c1de-11e6-a4f4-62ce84ef239e")
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
@ApiModelProperty(example = "17510")
public String getParentDeploymentId() {
|
return parentDeploymentId;
}
public void setParentDeploymentId(String parentDeploymentId) {
this.parentDeploymentId = parentDeploymentId;
}
@ApiModelProperty(example = "null")
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
}
|
repos\flowable-engine-main\modules\flowable-dmn-rest\src\main\java\org\flowable\dmn\rest\service\api\repository\DmnDeploymentResponse.java
| 2
|
请完成以下Java代码
|
public int getR_IssueStatus_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_R_IssueStatus_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_R_Request getR_Request() throws RuntimeException
{
return (I_R_Request)MTable.get(getCtx(), I_R_Request.Table_Name)
.getPO(getR_Request_ID(), get_TrxName()); }
/** Set Request.
@param R_Request_ID
Request from a Business Partner or Prospect
*/
public void setR_Request_ID (int R_Request_ID)
{
if (R_Request_ID < 1)
set_Value (COLUMNNAME_R_Request_ID, null);
else
set_Value (COLUMNNAME_R_Request_ID, Integer.valueOf(R_Request_ID));
}
/** Get Request.
@return Request from a Business Partner or Prospect
*/
public int getR_Request_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_R_Request_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Source Class.
@param SourceClassName
Source Class Name
*/
public void setSourceClassName (String SourceClassName)
{
set_Value (COLUMNNAME_SourceClassName, SourceClassName);
}
/** Get Source Class.
|
@return Source Class Name
*/
public String getSourceClassName ()
{
return (String)get_Value(COLUMNNAME_SourceClassName);
}
/** Set Source Method.
@param SourceMethodName
Source Method Name
*/
public void setSourceMethodName (String SourceMethodName)
{
set_Value (COLUMNNAME_SourceMethodName, SourceMethodName);
}
/** Get Source Method.
@return Source Method Name
*/
public String getSourceMethodName ()
{
return (String)get_Value(COLUMNNAME_SourceMethodName);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_R_IssueKnown.java
| 1
|
请完成以下Java代码
|
public class Movie {
private String id;
@NotEmpty(message = "Movie name cannot be empty.")
private String name;
public Movie(String name) {
this.id = UUID.randomUUID()
.toString();
this.name = name;
}
public Movie(){
}
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;
}
}
|
repos\tutorials-master\spring-web-modules\spring-mvc-basics-4\src\main\java\com\baeldung\validation\listvalidation\model\Movie.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void setLINENUMBER(String value) {
this.linenumber = value;
}
/**
* Gets the value of the deliveryinstruction property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDELIVERYINSTRUCTION() {
return deliveryinstruction;
}
/**
* Sets the value of the deliveryinstruction property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDELIVERYINSTRUCTION(String value) {
this.deliveryinstruction = value;
}
/**
* Gets the value of the freetext property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFREETEXT() {
return freetext;
}
/**
* Sets the value of the freetext property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFREETEXT(String value) {
this.freetext = value;
}
/**
* Gets the value of the freetextlanguage property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFREETEXTLANGUAGE() {
return freetextlanguage;
}
|
/**
* Sets the value of the freetextlanguage property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFREETEXTLANGUAGE(String value) {
this.freetextlanguage = value;
}
/**
* Gets the value of the dplqu1 property.
*
* @return
* possible object is
* {@link DPLQU1 }
*
*/
public DPLQU1 getDPLQU1() {
return dplqu1;
}
/**
* Sets the value of the dplqu1 property.
*
* @param value
* allowed object is
* {@link DPLQU1 }
*
*/
public void setDPLQU1(DPLQU1 value) {
this.dplqu1 = value;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_stepcom_desadv\de\metas\edi\esb\jaxb\stepcom\desadv\DLPIN1.java
| 2
|
请完成以下Java代码
|
public void setC_SubscriptionProgress_ID (final int C_SubscriptionProgress_ID)
{
if (C_SubscriptionProgress_ID < 1)
set_Value (COLUMNNAME_C_SubscriptionProgress_ID, null);
else
set_Value (COLUMNNAME_C_SubscriptionProgress_ID, C_SubscriptionProgress_ID);
}
@Override
public int getC_SubscriptionProgress_ID()
{
return get_ValueAsInt(COLUMNNAME_C_SubscriptionProgress_ID);
}
@Override
public void setMD_Cockpit_DocumentDetail_ID (final int MD_Cockpit_DocumentDetail_ID)
{
if (MD_Cockpit_DocumentDetail_ID < 1)
set_ValueNoCheck (COLUMNNAME_MD_Cockpit_DocumentDetail_ID, null);
else
set_ValueNoCheck (COLUMNNAME_MD_Cockpit_DocumentDetail_ID, MD_Cockpit_DocumentDetail_ID);
}
@Override
public int getMD_Cockpit_DocumentDetail_ID()
{
return get_ValueAsInt(COLUMNNAME_MD_Cockpit_DocumentDetail_ID);
}
@Override
public de.metas.material.cockpit.model.I_MD_Cockpit getMD_Cockpit()
{
return get_ValueAsPO(COLUMNNAME_MD_Cockpit_ID, de.metas.material.cockpit.model.I_MD_Cockpit.class);
}
@Override
public void setMD_Cockpit(final de.metas.material.cockpit.model.I_MD_Cockpit MD_Cockpit)
{
set_ValueFromPO(COLUMNNAME_MD_Cockpit_ID, de.metas.material.cockpit.model.I_MD_Cockpit.class, MD_Cockpit);
}
@Override
public void setMD_Cockpit_ID (final int MD_Cockpit_ID)
{
if (MD_Cockpit_ID < 1)
set_ValueNoCheck (COLUMNNAME_MD_Cockpit_ID, null);
else
set_ValueNoCheck (COLUMNNAME_MD_Cockpit_ID, MD_Cockpit_ID);
}
@Override
public int getMD_Cockpit_ID()
{
return get_ValueAsInt(COLUMNNAME_MD_Cockpit_ID);
}
@Override
public void setM_ReceiptSchedule_ID (final int M_ReceiptSchedule_ID)
{
if (M_ReceiptSchedule_ID < 1)
set_Value (COLUMNNAME_M_ReceiptSchedule_ID, null);
else
set_Value (COLUMNNAME_M_ReceiptSchedule_ID, M_ReceiptSchedule_ID);
}
@Override
public int getM_ReceiptSchedule_ID()
{
return get_ValueAsInt(COLUMNNAME_M_ReceiptSchedule_ID);
}
@Override
public void setM_ShipmentSchedule_ID (final int M_ShipmentSchedule_ID)
|
{
if (M_ShipmentSchedule_ID < 1)
set_Value (COLUMNNAME_M_ShipmentSchedule_ID, null);
else
set_Value (COLUMNNAME_M_ShipmentSchedule_ID, M_ShipmentSchedule_ID);
}
@Override
public int getM_ShipmentSchedule_ID()
{
return get_ValueAsInt(COLUMNNAME_M_ShipmentSchedule_ID);
}
@Override
public void setQtyOrdered (final @Nullable BigDecimal QtyOrdered)
{
set_Value (COLUMNNAME_QtyOrdered, QtyOrdered);
}
@Override
public BigDecimal getQtyOrdered()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyOrdered);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyReserved (final @Nullable BigDecimal QtyReserved)
{
set_Value (COLUMNNAME_QtyReserved, QtyReserved);
}
@Override
public BigDecimal getQtyReserved()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyReserved);
return bd != null ? bd : BigDecimal.ZERO;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.material\cockpit\src\main\java-gen\de\metas\material\cockpit\model\X_MD_Cockpit_DocumentDetail.java
| 1
|
请完成以下Java代码
|
public void setReversalLine_ID (int ReversalLine_ID)
{
if (ReversalLine_ID < 1)
set_Value (COLUMNNAME_ReversalLine_ID, null);
else
set_Value (COLUMNNAME_ReversalLine_ID, Integer.valueOf(ReversalLine_ID));
}
/** Get Storno-Zeile.
@return Storno-Zeile */
@Override
public int getReversalLine_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_ReversalLine_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Abschreiben.
@param WriteOffAmt
Amount to write-off
*/
|
@Override
public void setWriteOffAmt (java.math.BigDecimal WriteOffAmt)
{
set_ValueNoCheck (COLUMNNAME_WriteOffAmt, WriteOffAmt);
}
/** Get Abschreiben.
@return Amount to write-off
*/
@Override
public java.math.BigDecimal getWriteOffAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_WriteOffAmt);
if (bd == null)
return BigDecimal.ZERO;
return bd;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_AllocationLine.java
| 1
|
请完成以下Java代码
|
public boolean accept(@Nullable final IValidationContext evalCtx, @Nullable final NamePair item)
{
final PaySelectionTrxType trxType = extractPaySelectionTrxType(evalCtx);
if (trxType == null)
{
return true;
}
final PaySelectionMatchingMode paySelectionMatchingMode = extractPaySelectionMatchingMode(item);
if (paySelectionMatchingMode == null)
{
return false;
}
return paySelectionMatchingMode.isCompatibleWith(trxType);
}
@Contract("null -> false")
private static boolean isContextAvailable(@Nullable final IValidationContext evalCtx)
{
return evalCtx != IValidationContext.NULL
&& evalCtx != IValidationContext.DISABLED;
}
@Nullable
private static PaySelectionTrxType extractPaySelectionTrxType(@Nullable final IValidationContext evalCtx)
{
if (!isContextAvailable(evalCtx))
{
return null;
}
final String code = evalCtx.get_ValueAsString(PARAM_PaySelectionTrxType);
if (Check.isBlank(code))
|
{
return null;
}
return PaySelectionTrxType.ofCode(code);
}
@Nullable
private static PaySelectionMatchingMode extractPaySelectionMatchingMode(@Nullable final NamePair item)
{
return item != null
? PaySelectionMatchingMode.ofNullableCode(item.getID())
: null;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.base\src\main\java\de\metas\banking\payment\PaySelectionModeByPaySelectionTrxTypeValRule.java
| 1
|
请完成以下Java代码
|
private static class LocalCacheData{
private String key;
private Object val;
private long timeoutTime;
public LocalCacheData() {
}
public LocalCacheData(String key, Object val, long timeoutTime) {
this.key = key;
this.val = val;
this.timeoutTime = timeoutTime;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public Object getVal() {
return val;
}
public void setVal(Object val) {
this.val = val;
}
public long getTimeoutTime() {
return timeoutTime;
}
public void setTimeoutTime(long timeoutTime) {
this.timeoutTime = timeoutTime;
}
}
/**
* set cache
*
* @param key
* @param val
* @param cacheTime
* @return
*/
public static boolean set(String key, Object val, long cacheTime){
// clean timeout cache, before set new cache (avoid cache too much)
cleanTimeoutCache();
// set new cache
if (key==null || key.trim().length()==0) {
return false;
}
if (val == null) {
remove(key);
}
if (cacheTime <= 0) {
remove(key);
}
long timeoutTime = System.currentTimeMillis() + cacheTime;
LocalCacheData localCacheData = new LocalCacheData(key, val, timeoutTime);
cacheRepository.put(localCacheData.getKey(), localCacheData);
return true;
}
/**
* remove cache
*
* @param key
|
* @return
*/
public static boolean remove(String key){
if (key==null || key.trim().length()==0) {
return false;
}
cacheRepository.remove(key);
return true;
}
/**
* get cache
*
* @param key
* @return
*/
public static Object get(String key){
if (key==null || key.trim().length()==0) {
return null;
}
LocalCacheData localCacheData = cacheRepository.get(key);
if (localCacheData!=null && System.currentTimeMillis()<localCacheData.getTimeoutTime()) {
return localCacheData.getVal();
} else {
remove(key);
return null;
}
}
/**
* clean timeout cache
*
* @return
*/
public static boolean cleanTimeoutCache(){
if (!cacheRepository.keySet().isEmpty()) {
for (String key: cacheRepository.keySet()) {
LocalCacheData localCacheData = cacheRepository.get(key);
if (localCacheData!=null && System.currentTimeMillis()>=localCacheData.getTimeoutTime()) {
cacheRepository.remove(key);
}
}
}
return true;
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-server-cloud\jeecg-visual\jeecg-cloud-xxljob\src\main\java\com\xxl\job\admin\core\util\LocalCacheUtil.java
| 1
|
请完成以下Java代码
|
public void setQty(FinancialInstrumentQuantityChoice value) {
this.qty = value;
}
/**
* Gets the value of the orgnlAndCurFaceAmt property.
*
* @return
* possible object is
* {@link OriginalAndCurrentQuantities1 }
*
*/
public OriginalAndCurrentQuantities1 getOrgnlAndCurFaceAmt() {
return orgnlAndCurFaceAmt;
}
/**
* Sets the value of the orgnlAndCurFaceAmt property.
*
* @param value
* allowed object is
* {@link OriginalAndCurrentQuantities1 }
*
*/
public void setOrgnlAndCurFaceAmt(OriginalAndCurrentQuantities1 value) {
this.orgnlAndCurFaceAmt = value;
}
/**
* Gets the value of the prtry property.
*
* @return
* possible object is
|
* {@link ProprietaryQuantity1 }
*
*/
public ProprietaryQuantity1 getPrtry() {
return prtry;
}
/**
* Sets the value of the prtry property.
*
* @param value
* allowed object is
* {@link ProprietaryQuantity1 }
*
*/
public void setPrtry(ProprietaryQuantity1 value) {
this.prtry = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_04\TransactionQuantities2Choice.java
| 1
|
请完成以下Java代码
|
public void setSecurPharmService(@NonNull final SecurPharmService securPharmService)
{
this.handlers.forEach(handler -> handler.setSecurPharmService(securPharmService));
}
@Override
public void post(@NonNull final SecurPharmaActionRequest request)
{
eventBus.enqueueObject(request);
}
@ToString(of = "delegate")
private static class AsyncSecurPharmActionsHandler
{
private final SecurPharmActionsHandler delegate;
|
private final Executor executor;
private AsyncSecurPharmActionsHandler(
@NonNull final SecurPharmActionsHandler delegate,
@NonNull final Executor executor)
{
this.delegate = delegate;
this.executor = executor;
}
public void handleActionRequest(@NonNull final SecurPharmaActionRequest request)
{
executor.execute(() -> delegate.handleActionRequest(request));
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.securpharm\src\main\java\de\metas\vertical\pharma\securpharm\actions\AsyncSecurPharmActionsDispatcher.java
| 1
|
请完成以下Java代码
|
public void setMemberOfTenant(String tenantId) {
this.tenantId = tenantId;
}
@Override
protected boolean isValidSortByValue(String value) {
return VALID_SORT_BY_VALUES.contains(value);
}
@Override
protected UserQuery createNewQuery(ProcessEngine engine) {
return engine.getIdentityService().createUserQuery();
}
@Override
protected void applyFilters(UserQuery query) {
if (id != null) {
query.userId(id);
}
if(idIn != null) {
query.userIdIn(idIn);
}
if (firstName != null) {
query.userFirstName(firstName);
}
if (firstNameLike != null) {
query.userFirstNameLike(firstNameLike);
}
if (lastName != null) {
query.userLastName(lastName);
}
if (lastNameLike != null) {
query.userLastNameLike(lastNameLike);
}
|
if (email != null) {
query.userEmail(email);
}
if (emailLike != null) {
query.userEmailLike(emailLike);
}
if (memberOfGroup != null) {
query.memberOfGroup(memberOfGroup);
}
if (potentialStarter != null) {
query.potentialStarter(potentialStarter);
}
if (tenantId != null) {
query.memberOfTenant(tenantId);
}
}
@Override
protected void applySortBy(UserQuery query, String sortBy, Map<String, Object> parameters, ProcessEngine engine) {
if (sortBy.equals(SORT_BY_USER_ID_VALUE)) {
query.orderByUserId();
} else if (sortBy.equals(SORT_BY_USER_FIRSTNAME_VALUE)) {
query.orderByUserFirstName();
} else if (sortBy.equals(SORT_BY_USER_LASTNAME_VALUE)) {
query.orderByUserLastName();
} else if (sortBy.equals(SORT_BY_USER_EMAIL_VALUE)) {
query.orderByUserEmail();
}
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\identity\UserQueryDto.java
| 1
|
请完成以下Java代码
|
public String getExplanation() {
return explanation;
}
/**
* Sets the value of the explanation property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setExplanation(String value) {
this.explanation = value;
}
/**
* Gets the value of the message 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 message property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getMessage().add(newItem);
|
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link NotificationType }
*
*
*/
public List<NotificationType> getMessage() {
if (message == null) {
message = new ArrayList<NotificationType>();
}
return this.message;
}
}
|
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_response\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\response\PendingType.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private List<PPOrderLineCandidate> toPPOrderLineCandidates(@NonNull final I_PP_Order_Candidate ppOrderCandidateRecord)
{
final List<PPOrderLineCandidate> lines = new ArrayList<>();
final PPOrderCandidateId ppOrderCandidateId = PPOrderCandidateId.ofRepoId(ppOrderCandidateRecord.getPP_Order_Candidate_ID());
for (final I_PP_OrderLine_Candidate ppOrderLineCandidate : ppOrderCandidateDAO.getLinesByCandidateId(ppOrderCandidateId))
{
final PPOrderLineCandidate orderLineCandidatePojo = toPPOrderLineCandidate(ppOrderLineCandidate, ppOrderCandidateRecord);
lines.add(orderLineCandidatePojo);
}
return lines;
}
private PPOrderLineCandidate toPPOrderLineCandidate(
@NonNull final I_PP_OrderLine_Candidate ppOrderLineCandidate,
@NonNull final I_PP_Order_Candidate ppOrderCandidateRecord)
{
final Optional<BOMComponentType> componentTypeOptional = BOMComponentType.optionalOfNullableCode(ppOrderLineCandidate.getComponentType());
final boolean receipt = componentTypeOptional.map(BOMComponentType::isReceipt).orElse(false);
final Instant issueOrReceiveDate = asInstantNonNull(receipt ? ppOrderCandidateRecord.getDatePromised() : ppOrderCandidateRecord.getDateStartSchedule());
return PPOrderLineCandidate.builder()
.ppOrderLineData(PPOrderLineData.builder()
.productDescriptor(productDescriptorFactory.createProductDescriptor(ppOrderLineCandidate))
.description(ppOrderLineCandidate.getDescription())
.productBomLineId(ppOrderLineCandidate.getPP_Product_BOMLine_ID())
.qtyRequired(getRequiredQtyInStockUOM(ppOrderLineCandidate).toBigDecimal())
.issueOrReceiveDate(issueOrReceiveDate)
.receipt(receipt)
.build())
.ppOrderLineCandidateId(ppOrderLineCandidate.getPP_OrderLine_Candidate_ID())
|
.build();
}
@NonNull
private Quantity getRequiredQtyInStockUOM(@NonNull final I_PP_OrderLine_Candidate ppOrderLineCandidate)
{
final ProductId lineProductId = ProductId.ofRepoId(ppOrderLineCandidate.getM_Product_ID());
final I_C_UOM lineUom = uomDAO.getById(ppOrderLineCandidate.getC_UOM_ID());
final Quantity qtyRequired = Quantity.of(ppOrderLineCandidate.getQtyEntered(), lineUom);
return uomConversionBL.convertToProductUOM(qtyRequired, lineProductId);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\productioncandidate\service\PPOrderCandidatePojoConverter.java
| 2
|
请完成以下Java代码
|
public class HystrixSyncHttpCommand extends HystrixCommand<String> {
private URI uri;
private RequestConfig requestConfig;
HystrixSyncHttpCommand(URI uri, int timeoutMillis) {
super(Setter
.withGroupKey(HystrixCommandGroupKey.Factory.asKey("hystrix-ratpack-sync"))
.andCommandPropertiesDefaults(HystrixCommandProperties
.Setter()
.withExecutionTimeoutInMilliseconds(timeoutMillis)));
requestConfig = RequestConfig
.custom()
.setSocketTimeout(timeoutMillis)
.setConnectTimeout(timeoutMillis)
.setConnectionRequestTimeout(timeoutMillis)
.build();
this.uri = uri;
}
@Override
protected String run() throws Exception {
HttpGet request = new HttpGet(uri);
|
return EntityUtils.toString(HttpClientBuilder
.create()
.setDefaultRequestConfig(requestConfig)
.setDefaultHeaders(Collections.singleton(new BasicHeader("User-Agent", "Baeldung Blocking HttpClient")))
.build()
.execute(request)
.getEntity());
}
@Override
protected String getFallback() {
return "eugenp's sync fallback profile";
}
}
|
repos\tutorials-master\web-modules\ratpack\src\main\java\com\baeldung\hystrix\HystrixSyncHttpCommand.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class CachingUserDetailsService implements UserDetailsService {
private UserCache userCache = new NullUserCache();
private final UserDetailsService delegate;
public CachingUserDetailsService(UserDetailsService delegate) {
this.delegate = delegate;
}
public UserCache getUserCache() {
return this.userCache;
}
public void setUserCache(UserCache userCache) {
this.userCache = userCache;
|
}
@Override
public UserDetails loadUserByUsername(String username) {
UserDetails user = this.userCache.getUserFromCache(username);
if (user == null) {
user = this.delegate.loadUserByUsername(username);
}
Assert.notNull(user, () -> "UserDetailsService " + this.delegate + " returned null for username " + username
+ ". " + "This is an interface contract violation");
this.userCache.putUserInCache(user);
return user;
}
}
|
repos\spring-security-main\core\src\main\java\org\springframework\security\authentication\CachingUserDetailsService.java
| 2
|
请完成以下Java代码
|
public String getRemote_Addr ()
{
return (String)get_Value(COLUMNNAME_Remote_Addr);
}
/** Set Remote Host.
@param Remote_Host
Remote host Info
*/
public void setRemote_Host (String Remote_Host)
{
set_ValueNoCheck (COLUMNNAME_Remote_Host, Remote_Host);
}
/** Get Remote Host.
@return Remote host Info
*/
public String getRemote_Host ()
{
return (String)get_Value(COLUMNNAME_Remote_Host);
}
/** Set Sales Volume in 1.000.
@param SalesVolume
Total Volume of Sales in Thousands of Currency
*/
public void setSalesVolume (int SalesVolume)
{
set_Value (COLUMNNAME_SalesVolume, Integer.valueOf(SalesVolume));
}
/** Get Sales Volume in 1.000.
@return Total Volume of Sales in Thousands of Currency
*/
public int getSalesVolume ()
|
{
Integer ii = (Integer)get_Value(COLUMNNAME_SalesVolume);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Start Implementation/Production.
@param StartProductionDate
The day you started the implementation (if implementing) - or production (went life) with Adempiere
*/
public void setStartProductionDate (Timestamp StartProductionDate)
{
set_Value (COLUMNNAME_StartProductionDate, StartProductionDate);
}
/** Get Start Implementation/Production.
@return The day you started the implementation (if implementing) - or production (went life) with Adempiere
*/
public Timestamp getStartProductionDate ()
{
return (Timestamp)get_Value(COLUMNNAME_StartProductionDate);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Registration.java
| 1
|
请完成以下Java代码
|
public boolean isColumnTypeCalculation()
{
return COLUMNTYPE_Calculation.equals(getColumnType());
}
/**
* Column Type Relative Period
* @return true if relative period
*/
public boolean isColumnTypeRelativePeriod()
{
return COLUMNTYPE_RelativePeriod.equals(getColumnType());
}
/**
* Column Type Segment Value
* @return true if segment value
*/
public boolean isColumnTypeSegmentValue()
{
return COLUMNTYPE_SegmentValue.equals(getColumnType());
}
/**
* Get Relative Period As Int
* @return relative period
*/
public int getRelativePeriodAsInt ()
{
BigDecimal bd = getRelativePeriod();
if (bd == null)
return 0;
return bd.intValue();
} // getRelativePeriodAsInt
/**
* Get Relative Period
* @return relative period
*/
@Override
public BigDecimal getRelativePeriod()
{
if (getColumnType().equals(COLUMNTYPE_RelativePeriod)
|| getColumnType().equals(COLUMNTYPE_SegmentValue))
return super.getRelativePeriod();
return null;
} // getRelativePeriod
/**
* Get Element Type
*/
@Override
public String getElementType()
{
if (getColumnType().equals(COLUMNTYPE_SegmentValue))
{
return super.getElementType();
}
else
{
return null;
}
} // getElementType
/**
* Get Calculation Type
|
*/
@Override
public String getCalculationType()
{
if (getColumnType().equals(COLUMNTYPE_Calculation))
return super.getCalculationType();
return null;
} // getCalculationType
/**
* Before Save
* @param newRecord new
* @return true
*/
@Override
protected boolean beforeSave(boolean newRecord)
{
// Validate Type
String ct = getColumnType();
if (ct.equals(COLUMNTYPE_RelativePeriod))
{
setElementType(null);
setCalculationType(null);
}
else if (ct.equals(COLUMNTYPE_Calculation))
{
setElementType(null);
setRelativePeriod(null);
}
else if (ct.equals(COLUMNTYPE_SegmentValue))
{
setCalculationType(null);
}
return true;
} // beforeSave
/**************************************************************************
/**
* Copy
* @param ctx context
* @param AD_Client_ID parent
* @param AD_Org_ID parent
* @param PA_ReportColumnSet_ID parent
* @param source copy source
* @param trxName transaction
* @return Report Column
*/
public static MReportColumn copy (Properties ctx, int AD_Client_ID, int AD_Org_ID,
int PA_ReportColumnSet_ID, MReportColumn source, String trxName)
{
MReportColumn retValue = new MReportColumn (ctx, 0, trxName);
MReportColumn.copyValues(source, retValue, AD_Client_ID, AD_Org_ID);
//
retValue.setPA_ReportColumnSet_ID(PA_ReportColumnSet_ID); // parent
retValue.setOper_1_ID(0);
retValue.setOper_2_ID(0);
return retValue;
} // copy
} // MReportColumn
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\report\MReportColumn.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public AcceptPaymentDisputeRequest returnAddress(ReturnAddress returnAddress)
{
this.returnAddress = returnAddress;
return this;
}
/**
* Get returnAddress
*
* @return returnAddress
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public ReturnAddress getReturnAddress()
{
return returnAddress;
}
public void setReturnAddress(ReturnAddress returnAddress)
{
this.returnAddress = returnAddress;
}
public AcceptPaymentDisputeRequest revision(Integer revision)
{
this.revision = revision;
return this;
}
/**
* This integer value indicates the revision number of the payment dispute. This field is required. The current revision number for a payment dispute can be retrieved with the getPaymentDispute method. Each time an action is taken against a payment dispute, this integer value increases by 1.
*
* @return revision
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "This integer value indicates the revision number of the payment dispute. This field is required. The current revision number for a payment dispute can be retrieved with the getPaymentDispute method. Each time an action is taken against a payment dispute, this integer value increases by 1.")
public Integer getRevision()
{
return revision;
}
public void setRevision(Integer revision)
{
this.revision = revision;
}
@Override
public boolean equals(Object o)
{
if (this == o)
|
{
return true;
}
if (o == null || getClass() != o.getClass())
{
return false;
}
AcceptPaymentDisputeRequest acceptPaymentDisputeRequest = (AcceptPaymentDisputeRequest)o;
return Objects.equals(this.returnAddress, acceptPaymentDisputeRequest.returnAddress) &&
Objects.equals(this.revision, acceptPaymentDisputeRequest.revision);
}
@Override
public int hashCode()
{
return Objects.hash(returnAddress, revision);
}
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("class AcceptPaymentDisputeRequest {\n");
sb.append(" returnAddress: ").append(toIndentedString(returnAddress)).append("\n");
sb.append(" revision: ").append(toIndentedString(revision)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o)
{
if (o == null)
{
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-ebay\ebay-api-client\src\main\java\de\metas\camel\externalsystems\ebay\api\model\AcceptPaymentDisputeRequest.java
| 2
|
请完成以下Java代码
|
class RecordableServerHttpRequest implements RecordableHttpRequest {
private final String method;
private final HttpHeaders headers;
private final URI uri;
private final @Nullable String remoteAddress;
RecordableServerHttpRequest(ServerHttpRequest request) {
this.method = request.getMethod().name();
this.headers = request.getHeaders();
this.uri = request.getURI();
this.remoteAddress = getRemoteAddress(request);
}
private static @Nullable String getRemoteAddress(ServerHttpRequest request) {
InetSocketAddress remoteAddress = request.getRemoteAddress();
InetAddress address = (remoteAddress != null) ? remoteAddress.getAddress() : null;
return (address != null) ? address.toString() : null;
}
@Override
public String getMethod() {
return this.method;
}
@Override
public URI getUri() {
return this.uri;
|
}
@Override
public Map<String, List<String>> getHeaders() {
Map<String, List<String>> headers = new LinkedHashMap<>();
this.headers.forEach(headers::put);
return Collections.unmodifiableMap(headers);
}
@Override
public @Nullable String getRemoteAddress() {
return this.remoteAddress;
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-webflux\src\main\java\org\springframework\boot\webflux\actuate\web\exchanges\RecordableServerHttpRequest.java
| 1
|
请完成以下Java代码
|
public int getAD_User_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set User Notification Group.
@param AD_User_NotificationGroup_ID User Notification Group */
@Override
public void setAD_User_NotificationGroup_ID (int AD_User_NotificationGroup_ID)
{
if (AD_User_NotificationGroup_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_User_NotificationGroup_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_User_NotificationGroup_ID, Integer.valueOf(AD_User_NotificationGroup_ID));
}
/** Get User Notification Group.
@return User Notification Group */
@Override
public int getAD_User_NotificationGroup_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_NotificationGroup_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/**
* NotificationType AD_Reference_ID=344
* Reference name: AD_User NotificationType
*/
public static final int NOTIFICATIONTYPE_AD_Reference_ID=344;
/** EMail = E */
public static final String NOTIFICATIONTYPE_EMail = "E";
/** Notice = N */
public static final String NOTIFICATIONTYPE_Notice = "N";
/** None = X */
public static final String NOTIFICATIONTYPE_None = "X";
/** EMailPlusNotice = B */
public static final String NOTIFICATIONTYPE_EMailPlusNotice = "B";
/** NotifyUserInCharge = O */
|
public static final String NOTIFICATIONTYPE_NotifyUserInCharge = "O";
/** Set Benachrichtigungs-Art.
@param NotificationType
Art der Benachrichtigung
*/
@Override
public void setNotificationType (java.lang.String NotificationType)
{
set_Value (COLUMNNAME_NotificationType, NotificationType);
}
/** Get Benachrichtigungs-Art.
@return Art der Benachrichtigung
*/
@Override
public java.lang.String getNotificationType ()
{
return (java.lang.String)get_Value(COLUMNNAME_NotificationType);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_User_NotificationGroup.java
| 1
|
请完成以下Java代码
|
private XMLGregorianCalendar asXmlCalendar(@NonNull final Calendar cal)
{
try
{
final GregorianCalendar gregorianCal = new GregorianCalendar(cal.getTimeZone());
gregorianCal.setTime(cal.getTime());
return DatatypeFactory.newInstance().newXMLGregorianCalendar(gregorianCal);
}
catch (final DatatypeConfigurationException e)
{
throw new AdempiereException(e).appendParametersToMessage()
.setParameter("cal", cal);
}
}
private SoftwareMod createSoftwareMod(@NonNull final MetasfreshVersion metasfreshVersion)
{
final long versionNumber = metasfreshVersion.getMajor() * 100 + metasfreshVersion.getMinor(); // .. as advised in the documentation
return SoftwareMod
.builder()
.name("metasfresh")
|
.version(versionNumber)
.description(metasfreshVersion.getFullVersion())
.id(0L)
.copyright("Copyright (C) 2018 metas GmbH")
.build();
}
private BalanceMod createBalanceMod(@NonNull final DunningToExport dunning)
{
final Money amount = dunning.getAmount();
final Money alreadyPaidAmount = dunning.getAlreadyPaidAmount();
final BigDecimal amountDue = amount.getAmount().subtract(alreadyPaidAmount.getAmount());
return BalanceMod.builder()
.currency(amount.getCurrency())
.amount(amount.getAmount())
.amountDue(amountDue)
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_base\src\main\java\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\base\export\dunning\DunningExportClientImpl.java
| 1
|
请完成以下Java代码
|
public final void setParameters(final IParams parameters)
{
this.parameters = parameters;
}
/**
* @return workpackage parameters; never return <code>null</code>
*/
protected final IParams getParameters()
{
return parameters == null ? IParams.NULL : parameters;
}
@Override
public final void setC_Queue_WorkPackage(final I_C_Queue_WorkPackage workpackage)
{
this.workpackage = workpackage;
}
@NonNull
protected final I_C_Queue_WorkPackage getC_Queue_WorkPackage()
{
Check.assumeNotNull(workpackage, "workpackage not null");
return this.workpackage;
}
@NonNull
protected final QueueWorkPackageId getQueueWorkPackageId()
{
Check.assumeNotNull(workpackage, "workpackage not null");
return QueueWorkPackageId.ofRepoId(this.workpackage.getC_Queue_WorkPackage_ID());
}
/**
* @return <code>true</code>, i.e. ask the executor to run this processor in transaction (backward compatibility)
*/
@Override
public boolean isRunInTransaction()
{
return true;
}
@Override
public boolean isAllowRetryOnError()
{
return true;
}
@Override
public final Optional<ILock> getElementsLock()
{
final String elementsLockOwnerName = getParameters().getParameterAsString(PARAMETERNAME_ElementsLockOwner);
if (Check.isBlank(elementsLockOwnerName))
{
return Optional.empty(); // no lock was created for this workpackage
}
final LockOwner elementsLockOwner = LockOwner.forOwnerName(elementsLockOwnerName);
try
{
final ILock existingLockForOwner = Services.get(ILockManager.class).getExistingLockForOwner(elementsLockOwner);
return Optional.of(existingLockForOwner);
}
catch (final LockFailedException e)
{
// this can happen, if e.g. there was a restart, or if the WP was flagged as error once
Loggables.addLog("Missing lock for ownerName={}; was probably cleaned up meanwhile", elementsLockOwnerName);
return Optional.empty();
}
|
}
/**
* Returns the {@link NullLatchStrategy}.
*/
@Override
public ILatchStragegy getLatchStrategy()
{
return NullLatchStrategy.INSTANCE;
}
public final <T> List<T> retrieveItems(final Class<T> modelType)
{
return Services.get(IQueueDAO.class).retrieveAllItemsSkipMissing(getC_Queue_WorkPackage(), modelType);
}
/**
* Retrieves all active POs, even the ones that are caught in other packages
*/
public final <T> List<T> retrieveAllItems(final Class<T> modelType)
{
return Services.get(IQueueDAO.class).retrieveAllItems(getC_Queue_WorkPackage(), modelType);
}
public final List<I_C_Queue_Element> retrieveQueueElements(final boolean skipAlreadyScheduledItems)
{
return Services.get(IQueueDAO.class).retrieveQueueElements(getC_Queue_WorkPackage(), skipAlreadyScheduledItems);
}
/**
* retrieves all active PO's IDs, even the ones that are caught in other packages
*/
public final Set<Integer> retrieveAllItemIds()
{
return Services.get(IQueueDAO.class).retrieveAllItemIds(getC_Queue_WorkPackage());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java\de\metas\async\spi\WorkpackageProcessorAdapter.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Book createBook(Book book) {
final Book newBook = new Book();
newBook.setTitle(book.getTitle());
newBook.setAuthor(book.getAuthor());
return bookRepository.save(newBook);
}
@Transactional(propagation = Propagation.REQUIRED)
public void deleteBook(Long bookId) {
bookRepository.deleteById(bookId);
}
@Transactional(propagation = Propagation.REQUIRED)
public Book updateBook(Map<String, String> updates, Long bookId) {
final Book book = findBookById(bookId);
updates.keySet()
.forEach(key -> {
switch (key) {
case "author":
book.setAuthor(updates.get(key));
break;
case "title":
|
book.setTitle(updates.get(key));
}
});
return bookRepository.save(book);
}
@Transactional(propagation = Propagation.REQUIRED)
public Book updateBook(Book book, Long bookId) {
Preconditions.checkNotNull(book);
Preconditions.checkState(book.getId() == bookId);
Preconditions.checkArgument(bookRepository.findById(bookId)
.isPresent());
return bookRepository.save(book);
}
}
|
repos\tutorials-master\spring-cloud-modules\spring-cloud-bootstrap\zipkin-log-svc-book\src\main\java\com\baeldung\spring\cloud\bootstrap\svcbook\book\BookService.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
protected AttachmentResponse createBinaryAttachment(MultipartHttpServletRequest request, Task task) {
String name = null;
String description = null;
String type = null;
Map<String, String[]> paramMap = request.getParameterMap();
for (String parameterName : paramMap.keySet()) {
if (paramMap.get(parameterName).length > 0) {
if ("name".equalsIgnoreCase(parameterName)) {
name = paramMap.get(parameterName)[0];
} else if ("description".equalsIgnoreCase(parameterName)) {
description = paramMap.get(parameterName)[0];
} else if ("type".equalsIgnoreCase(parameterName)) {
type = paramMap.get(parameterName)[0];
}
}
}
if (name == null) {
throw new FlowableIllegalArgumentException("Attachment name is required.");
}
|
if (request.getFileMap().size() == 0) {
throw new FlowableIllegalArgumentException("Attachment content is required.");
}
MultipartFile file = request.getFileMap().values().iterator().next();
if (file == null) {
throw new FlowableIllegalArgumentException("Attachment content is required.");
}
try {
Attachment createdAttachment = taskService.createAttachment(type, task.getId(), task.getProcessInstanceId(), name, description, file.getInputStream());
return restResponseFactory.createAttachmentResponse(createdAttachment);
} catch (Exception e) {
throw new FlowableException("Error creating attachment response", e);
}
}
}
|
repos\flowable-engine-main\modules\flowable-rest\src\main\java\org\flowable\rest\service\api\runtime\task\TaskAttachmentCollectionResource.java
| 2
|
请完成以下Java代码
|
public UserAuthentication removeByEngineName(String engineName) {
return authentications.remove(engineName);
}
/**
* @return all active {@link Authentication Authentications}.
*/
public List<UserAuthentication> getAuthentications() {
return new ArrayList<>(authentications.values());
}
/**
* Allows checking whether a user is currently authenticated for a given process engine name.
*
* @param engineName the name of the process engine for which we want to check for authentication.
* @return true if a user is authenticated for the provided process engine name.
*/
public boolean hasAuthenticationForProcessEngine(String engineName) {
return getAuthenticationForProcessEngine(engineName) != null;
}
// thread-local //////////////////////////////////////////////////////////
/**
|
* sets the {@link Authentications} for the current thread in a thread local.
*
* @param auth the {@link Authentications} to set.
*/
public static void setCurrent(Authentications auth) {
currentAuthentications.set(auth);
}
/**
* clears the {@link Authentications} for the current thread.
*/
public static void clearCurrent() {
currentAuthentications.remove();
}
/**
* Returns the authentications for the current thread.
*
* @return the authentications.
*/
public static Authentications getCurrent() {
return currentAuthentications.get();
}
}
|
repos\camunda-bpm-platform-master\webapps\assembly\src\main\java\org\camunda\bpm\webapp\impl\security\auth\Authentications.java
| 1
|
请完成以下Java代码
|
public class City implements Serializable {
private static final long serialVersionUID = -1L;
/**
* 城市编号
*/
private Long id;
/**
* 省份编号
*/
private Long provinceId;
/**
* 城市名称
*/
private String cityName;
/**
* 描述
*/
private String description;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getProvinceId() {
return provinceId;
}
public void setProvinceId(Long provinceId) {
this.provinceId = provinceId;
}
|
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public String toString() {
return "City{" +
"id=" + id +
", provinceId=" + provinceId +
", cityName='" + cityName + '\'' +
", description='" + description + '\'' +
'}';
}
}
|
repos\springboot-learning-example-master\springboot-dubbo-client\src\main\java\org\spring\springboot\domain\City.java
| 1
|
请完成以下Java代码
|
public int getMD_Candidate_RebookedFrom_ID()
{
return get_ValueAsInt(COLUMNNAME_MD_Candidate_RebookedFrom_ID);
}
@Override
public void setMD_Candidate_Transaction_Detail_ID (final int MD_Candidate_Transaction_Detail_ID)
{
if (MD_Candidate_Transaction_Detail_ID < 1)
set_ValueNoCheck (COLUMNNAME_MD_Candidate_Transaction_Detail_ID, null);
else
set_ValueNoCheck (COLUMNNAME_MD_Candidate_Transaction_Detail_ID, MD_Candidate_Transaction_Detail_ID);
}
@Override
public int getMD_Candidate_Transaction_Detail_ID()
{
return get_ValueAsInt(COLUMNNAME_MD_Candidate_Transaction_Detail_ID);
}
@Override
public void setMD_Stock_ID (final int MD_Stock_ID)
{
if (MD_Stock_ID < 1)
set_Value (COLUMNNAME_MD_Stock_ID, null);
else
set_Value (COLUMNNAME_MD_Stock_ID, MD_Stock_ID);
}
@Override
public int getMD_Stock_ID()
{
return get_ValueAsInt(COLUMNNAME_MD_Stock_ID);
}
@Override
|
public void setMovementQty (final BigDecimal MovementQty)
{
set_Value (COLUMNNAME_MovementQty, MovementQty);
}
@Override
public BigDecimal getMovementQty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_MovementQty);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setTransactionDate (final @Nullable java.sql.Timestamp TransactionDate)
{
set_Value (COLUMNNAME_TransactionDate, TransactionDate);
}
@Override
public java.sql.Timestamp getTransactionDate()
{
return get_ValueAsTimestamp(COLUMNNAME_TransactionDate);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.material\dispo-commons\src\main\java-gen\de\metas\material\dispo\model\X_MD_Candidate_Transaction_Detail.java
| 1
|
请完成以下Java代码
|
public void setMD_Cockpit(final de.metas.material.cockpit.model.I_MD_Cockpit MD_Cockpit)
{
set_ValueFromPO(COLUMNNAME_MD_Cockpit_ID, de.metas.material.cockpit.model.I_MD_Cockpit.class, MD_Cockpit);
}
@Override
public void setMD_Cockpit_ID (final int MD_Cockpit_ID)
{
if (MD_Cockpit_ID < 1)
set_ValueNoCheck (COLUMNNAME_MD_Cockpit_ID, null);
else
set_ValueNoCheck (COLUMNNAME_MD_Cockpit_ID, MD_Cockpit_ID);
}
@Override
public int getMD_Cockpit_ID()
{
return get_ValueAsInt(COLUMNNAME_MD_Cockpit_ID);
}
@Override
public void setM_ReceiptSchedule_ID (final int M_ReceiptSchedule_ID)
{
if (M_ReceiptSchedule_ID < 1)
set_Value (COLUMNNAME_M_ReceiptSchedule_ID, null);
else
set_Value (COLUMNNAME_M_ReceiptSchedule_ID, M_ReceiptSchedule_ID);
}
@Override
public int getM_ReceiptSchedule_ID()
{
return get_ValueAsInt(COLUMNNAME_M_ReceiptSchedule_ID);
}
@Override
public void setM_ShipmentSchedule_ID (final int M_ShipmentSchedule_ID)
{
if (M_ShipmentSchedule_ID < 1)
set_Value (COLUMNNAME_M_ShipmentSchedule_ID, null);
else
set_Value (COLUMNNAME_M_ShipmentSchedule_ID, M_ShipmentSchedule_ID);
}
@Override
public int getM_ShipmentSchedule_ID()
{
return get_ValueAsInt(COLUMNNAME_M_ShipmentSchedule_ID);
}
@Override
public void setQtyOrdered (final @Nullable BigDecimal QtyOrdered)
|
{
set_Value (COLUMNNAME_QtyOrdered, QtyOrdered);
}
@Override
public BigDecimal getQtyOrdered()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyOrdered);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyReserved (final @Nullable BigDecimal QtyReserved)
{
set_Value (COLUMNNAME_QtyReserved, QtyReserved);
}
@Override
public BigDecimal getQtyReserved()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyReserved);
return bd != null ? bd : BigDecimal.ZERO;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.material\cockpit\src\main\java-gen\de\metas\material\cockpit\model\X_MD_Cockpit_DocumentDetail.java
| 1
|
请完成以下Java代码
|
private ClientId extractClientId()
{
final Object documentModel = getDocumentModel();
if (documentModel != null)
{
final Integer adClientId = InterfaceWrapperHelper.getValueOrNull(documentModel, "AD_Client_ID");
if (adClientId != null)
{
return ClientId.ofRepoId(adClientId);
}
}
// shall not happen
throw new DocumentNoBuilderException("Could not get AD_Client_ID");
}
private OrgId getOrgId()
{
if (_adOrgId == null)
{
_adOrgId = extractOrgId();
}
return _adOrgId;
}
private OrgId extractOrgId()
{
final Object documentModel = getDocumentModel();
if (documentModel != null)
{
final Integer adOrgId = InterfaceWrapperHelper.getValueOrNull(documentModel, "AD_Org_ID");
if (adOrgId != null)
{
return OrgId.ofRepoId(adOrgId);
}
else
{
// return Org=* to cover the user case when user clears (temporary) the Org field.
return OrgId.ANY;
}
}
// shall not happen
throw new DocumentNoBuilderException("Could not get AD_Org_ID");
}
@Override
public IPreliminaryDocumentNoBuilder setNewDocType(@Nullable final I_C_DocType newDocType)
{
assertNotBuilt();
_newDocType = newDocType;
return this;
}
private I_C_DocType getNewDocType()
{
return _newDocType;
}
@Override
public IPreliminaryDocumentNoBuilder setOldDocType_ID(final int oldDocType_ID)
{
assertNotBuilt();
_oldDocType_ID = oldDocType_ID > 0 ? oldDocType_ID : -1;
return this;
}
|
private I_C_DocType getOldDocType()
{
if (_oldDocType == null)
{
final int oldDocTypeId = _oldDocType_ID;
if (oldDocTypeId > 0)
{
_oldDocType = InterfaceWrapperHelper.create(getCtx(), oldDocTypeId, I_C_DocType.class, ITrx.TRXNAME_None);
}
}
return _oldDocType;
}
@Override
public IPreliminaryDocumentNoBuilder setOldDocumentNo(final String oldDocumentNo)
{
assertNotBuilt();
_oldDocumentNo = oldDocumentNo;
return this;
}
private String getOldDocumentNo()
{
return _oldDocumentNo;
}
private boolean isNewDocumentNo()
{
final String oldDocumentNo = getOldDocumentNo();
if (oldDocumentNo == null)
{
return true;
}
if (IPreliminaryDocumentNoBuilder.hasPreliminaryMarkers(oldDocumentNo))
{
return true;
}
return false;
}
@Override
public IPreliminaryDocumentNoBuilder setDocumentModel(final Object documentModel)
{
_documentModel = documentModel;
return this;
}
private Object getDocumentModel()
{
Check.assumeNotNull(_documentModel, "_documentModel not null");
return _documentModel;
}
private java.util.Date getDocumentDate(final String dateColumnName)
{
final Object documentModel = getDocumentModel();
final Optional<java.util.Date> date = InterfaceWrapperHelper.getValue(documentModel, dateColumnName);
return date.orElse(null);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\document\sequence\impl\PreliminaryDocumentNoBuilder.java
| 1
|
请完成以下Java代码
|
private void addToCurrentTUQty(final Quantity qtyToAdd)
{
Check.assumeNotNull(_currentTU, "current TU is created");
if (this._currentTUQty == null)
{
this._currentTUQty = Quantity.zero(capacity.getC_UOM());
}
this._currentTUQty = this._currentTUQty.add(qtyToAdd);
}
private IHUBuilder newHUBuilder()
{
final IHUBuilder huBuilder = Services.get(IHandlingUnitsDAO.class).createHUBuilder(huContext);
huBuilder.setLocatorId(locatorId);
if (!Check.isEmpty(huStatus, true))
{
huBuilder.setHUStatus(huStatus);
}
if (bpartnerId != null)
{
huBuilder.setBPartnerId(bpartnerId);
}
if (bpartnerLocationRepoId > 0)
{
huBuilder.setC_BPartner_Location_ID(bpartnerLocationRepoId);
}
|
huBuilder.setHUPlanningReceiptOwnerPM(true);
huBuilder.setHUClearanceStatusInfo(clearanceStatusInfo);
return huBuilder;
}
private I_M_HU splitCU(final I_M_HU fromCU, final ProductId cuProductId, final Quantity qtyToSplit)
{
Check.assume(qtyToSplit.signum() > 0, "qtyToSplit shall be greater than zero but it was {}", qtyToSplit);
final HUProducerDestination destination = HUProducerDestination.ofVirtualPI();
HULoader.builder()
.source(HUListAllocationSourceDestination.of(fromCU))
.destination(destination)
.load(AllocationUtils.builder()
.setHUContext(huContext)
.setProduct(cuProductId)
.setQuantity(qtyToSplit)
.setForceQtyAllocation(false) // no need to force
.setClearanceStatusInfo(clearanceStatusInfo)
.create());
return CollectionUtils.singleElement(destination.getCreatedHUs());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\allocation\impl\TULoaderInstance.java
| 1
|
请完成以下Java代码
|
public I_CM_Template getCM_Template() throws RuntimeException
{
return (I_CM_Template)MTable.get(getCtx(), I_CM_Template.Table_Name)
.getPO(getCM_Template_ID(), get_TrxName()); }
/** Set Template.
@param CM_Template_ID
Template defines how content is displayed
*/
public void setCM_Template_ID (int CM_Template_ID)
{
if (CM_Template_ID < 1)
set_ValueNoCheck (COLUMNNAME_CM_Template_ID, null);
else
set_ValueNoCheck (COLUMNNAME_CM_Template_ID, Integer.valueOf(CM_Template_ID));
}
/** Get Template.
@return Template defines how content is displayed
*/
public int getCM_Template_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_CM_Template_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Template Table.
@param CM_TemplateTable_ID
CM Template Table Link
*/
public void setCM_TemplateTable_ID (int CM_TemplateTable_ID)
{
if (CM_TemplateTable_ID < 1)
set_ValueNoCheck (COLUMNNAME_CM_TemplateTable_ID, null);
else
set_ValueNoCheck (COLUMNNAME_CM_TemplateTable_ID, Integer.valueOf(CM_TemplateTable_ID));
}
/** Get Template Table.
@return CM Template Table Link
*/
public int getCM_TemplateTable_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_CM_TemplateTable_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());
}
/** Set Other SQL Clause.
@param OtherClause
Other SQL Clause
*/
public void setOtherClause (String OtherClause)
{
set_Value (COLUMNNAME_OtherClause, OtherClause);
}
/** Get Other SQL Clause.
@return Other SQL Clause
*/
public String getOtherClause ()
{
return (String)get_Value(COLUMNNAME_OtherClause);
}
/** Set Sql WHERE.
@param WhereClause
Fully qualified SQL WHERE clause
*/
public void setWhereClause (String WhereClause)
{
set_Value (COLUMNNAME_WhereClause, WhereClause);
}
/** Get Sql WHERE.
@return Fully qualified SQL WHERE clause
*/
public String getWhereClause ()
{
return (String)get_Value(COLUMNNAME_WhereClause);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_CM_TemplateTable.java
| 1
|
请完成以下Java代码
|
protected String doIt()
{
final DDOrderLineId ddOrderLineId = DDOrderLineId.ofRepoId(this.ddOrderLineId);
final I_M_HU huToMove = huDAO.getById(HuId.ofRepoId(mHuID));
ddOrderService.prepareAllocateFullHUsAndMove()
.toDDOrderLineId(ddOrderLineId)
.failIfCannotAllocate()
.allocateHUAndPrepareGeneratingMovements(huToMove)
.locatorToIdOverride(paramLocatorToId > 0 ? warehouseBL.getLocatorIdByRepoId(paramLocatorToId) : null)
.generateDirectMovements();
return MSG_OK;
}
private boolean huEditorWasNotOpenedFromADDOrderLine()
{
final ViewId parentViewId = getView().getParentViewId();
if (parentViewId == null || getView().getParentRowId() == null)
{
return true;
}
final String parentViewTableName = viewsRepository.getView(parentViewId).getTableNameOrNull();
return !I_DD_OrderLine.Table_Name.equals(parentViewTableName);
}
private boolean selectedRowIsNotATopHU()
{
return getView(HUEditorView.class)
.streamByIds(getSelectedRowIds())
.noneMatch(HUEditorRow::isTopLevel);
}
@Override
public Object getParameterDefaultValue(final IProcessDefaultParameter parameter)
{
final I_DD_OrderLine ddOrderLine = getViewSelectedDDOrderLine();
final String parameterName = parameter.getColumnName();
if (PARAM_M_HU_ID.equals(parameterName))
{
|
return getRecord_ID();
}
else if (PARAM_DD_ORDER_LINE_ID.equals(parameterName))
{
return ddOrderLine.getDD_OrderLine_ID();
}
else if (PARAM_LOCATOR_TO_ID.equals(parameterName))
{
return ddOrderLine.getM_LocatorTo_ID();
}
else
{
return IProcessDefaultParametersProvider.DEFAULT_VALUE_NOTAVAILABLE;
}
}
private I_DD_OrderLine getViewSelectedDDOrderLine()
{
final DDOrderLineId ddOrderLineId = getViewSelectedDDOrderLineId();
return ddOrderService.getLineById(ddOrderLineId);
}
@NonNull
private DDOrderLineId getViewSelectedDDOrderLineId()
{
final ViewId parentViewId = getView().getParentViewId();
final DocumentIdsSelection selectedParentRow = DocumentIdsSelection.of(ImmutableList.of(getView().getParentRowId()));
final int selectedOrderLineId = viewsRepository.getView(parentViewId)
.streamByIds(selectedParentRow)
.findFirst()
.orElseThrow(() -> new AdempiereException("No DD_OrderLine was selected!"))
.getFieldValueAsInt(I_DD_OrderLine.COLUMNNAME_DD_OrderLine_ID, -1);
return DDOrderLineId.ofRepoId(selectedOrderLineId);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\ddorder\process\WEBUI_DD_OrderLine_MoveSelected_HU.java
| 1
|
请完成以下Java代码
|
public class DeleteJobCmd implements Command<Object>, Serializable {
private static final Logger LOGGER = LoggerFactory.getLogger(DeleteJobCmd.class);
private static final long serialVersionUID = 1L;
protected String jobId;
public DeleteJobCmd(String jobId) {
this.jobId = jobId;
}
@Override
public Object execute(CommandContext commandContext) {
JobEntity jobToDelete = getJobToDelete(commandContext);
jobToDelete.delete();
return null;
}
protected JobEntity getJobToDelete(CommandContext commandContext) {
if (jobId == null) {
throw new ActivitiIllegalArgumentException("jobId is null");
}
|
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Deleting job {}", jobId);
}
JobEntity job = commandContext.getJobEntityManager().findJobById(jobId);
if (job == null) {
throw new ActivitiObjectNotFoundException("No job found with id '" + jobId + "'", Job.class);
}
// We need to check if the job was locked, ie acquired by the job acquisition thread
// This happens if the job was already acquired, but not yet executed.
// In that case, we can't allow to delete the job.
if (job.getLockOwner() != null) {
throw new ActivitiException("Cannot delete job when the job is being executed. Try again later.");
}
return job;
}
}
|
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\cmd\DeleteJobCmd.java
| 1
|
请完成以下Java代码
|
public WFProcess closeTarget(
@NonNull final WFProcessId wfProcessId,
final @NotNull UserId callerId)
{
final HUConsolidationJob job = jobService.closeTarget(HUConsolidationJobId.ofWFProcessId(wfProcessId), callerId);
return toWFProcess(job);
}
public void printTargetLabel(
@NonNull final WFProcessId wfProcessId,
@NotNull final UserId callerId)
{
jobService.printTargetLabel(HUConsolidationJobId.ofWFProcessId(wfProcessId), callerId);
}
public WFProcess consolidate(@NonNull final JsonConsolidateRequest request, @NonNull final UserId callerId)
|
{
final HUConsolidationJob job = jobService.consolidate(ConsolidateRequest.builder()
.callerId(callerId)
.jobId(HUConsolidationJobId.ofWFProcessId(request.getWfProcessIdNotNull()))
.fromPickingSlotId(request.getFromPickingSlotId())
.huId(request.getHuId())
.build());
return toWFProcess(job);
}
public JsonHUConsolidationJobPickingSlotContent getPickingSlotContent(final HUConsolidationJobId jobId, final PickingSlotId pickingSlotId)
{
return jobService.getPickingSlotContent(jobId, pickingSlotId);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.hu_consolidation.mobile\src\main\java\de\metas\hu_consolidation\mobile\HUConsolidationApplication.java
| 1
|
请完成以下Java代码
|
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Integer getLevel() {
return level;
}
public void setLevel(Integer level) {
this.level = level;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getIcon() {
return icon;
}
|
public void setIcon(String icon) {
this.icon = icon;
}
public Integer getHidden() {
return hidden;
}
public void setHidden(Integer hidden) {
this.hidden = hidden;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", parentId=").append(parentId);
sb.append(", createTime=").append(createTime);
sb.append(", title=").append(title);
sb.append(", level=").append(level);
sb.append(", sort=").append(sort);
sb.append(", name=").append(name);
sb.append(", icon=").append(icon);
sb.append(", hidden=").append(hidden);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
|
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\UmsMenu.java
| 1
|
请完成以下Java代码
|
public void setReplyToGroupId(String replyToGroupId) {
this.replyToGroupId = replyToGroupId;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + Objects.hash(this.creationTime, this.groupId, this.groupSequence, this.replyToGroupId,
this.subject, this.to);
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
|
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
StreamMessageProperties other = (StreamMessageProperties) obj;
return this.creationTime == other.creationTime && Objects.equals(this.groupId, other.groupId)
&& this.groupSequence == other.groupSequence
&& Objects.equals(this.replyToGroupId, other.replyToGroupId)
&& Objects.equals(this.subject, other.subject) && Objects.equals(this.to, other.to);
}
}
|
repos\spring-amqp-main\spring-rabbit-stream\src\main\java\org\springframework\rabbit\stream\support\StreamMessageProperties.java
| 1
|
请完成以下Java代码
|
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 String getDesc() {
return desc;
}
/**
* Sets the value of the desc property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDesc(String value) {
this.desc = value;
}
/**
* Gets the value of the amt property.
*
* @return
* possible object is
|
* {@link RemittanceAmount3 }
*
*/
public RemittanceAmount3 getAmt() {
return amt;
}
/**
* Sets the value of the amt property.
*
* @param value
* allowed object is
* {@link RemittanceAmount3 }
*
*/
public void setAmt(RemittanceAmount3 value) {
this.amt = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.esr\src\main\java-xjc_camt054_001_06\de\metas\payment\camt054_001_06\DocumentLineInformation1.java
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.