instruction string | input string | output string | source_file string | priority int64 |
|---|---|---|---|---|
请完成以下Java代码 | public void run()
{
clearQuickInputFields(mTab);
}
});
}
/**
* Reset quick input fieldsO
*
* @param mTab
*/
public static void clearQuickInputFields(final GridTab mTab)
{
final I_M_Inventory inventory = InterfaceWrapperHelper.create(mTab, I_M_Inventory.class);
inventory.setQuickInput_Product_ID(-1);
inventory.setQuickInput_QtyInternalGain(null);
// these changes will be propagated to the GUI component
mTab.setValue(I_M_Inventory.COLUMNNAME_QuickInput_Product_ID, null); | mTab.setValue(I_M_Inventory.COLUMNNAME_QuickInput_QtyInternalGain, null);
mTab.dataSave(true);
}
/**
* Refreshes given tab and all included tabs.
*
* @param gridTab
*/
private void refreshTabAndIncludedTabs(final GridTab gridTab)
{
gridTab.dataRefreshRecursively();
for (final GridTab includedTab : gridTab.getIncludedTabs())
{
includedTab.dataRefreshAll();
}
gridTab.dataRefresh();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\adempiere\callout\M_Inventory.java | 1 |
请完成以下Java代码 | 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 int getM_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
@Override
public void setM_Warehouse_ID (final int M_Warehouse_ID)
{
if (M_Warehouse_ID < 1)
set_Value (COLUMNNAME_M_Warehouse_ID, null);
else
set_Value (COLUMNNAME_M_Warehouse_ID, M_Warehouse_ID);
}
@Override
public int getM_Warehouse_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Warehouse_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 setPriceList (final @Nullable java.lang.String PriceList)
{
set_Value (COLUMNNAME_PriceList, PriceList);
}
@Override
public java.lang.String getPriceList()
{
return get_ValueAsString(COLUMNNAME_PriceList);
}
@Override
public void setProcessed (final boolean Processed)
{
set_Value (COLUMNNAME_Processed, Processed);
}
@Override
public boolean isProcessed()
{
return get_ValueAsBoolean(COLUMNNAME_Processed);
}
@Override
public void setProcessing (final boolean Processing)
{
set_Value (COLUMNNAME_Processing, Processing);
}
@Override
public boolean isProcessing()
{
return get_ValueAsBoolean(COLUMNNAME_Processing);
}
@Override
public void setProductValue (final java.lang.String ProductValue)
{
set_Value (COLUMNNAME_ProductValue, ProductValue);
}
@Override
public java.lang.String getProductValue()
{
return get_ValueAsString(COLUMNNAME_ProductValue);
}
@Override
public void setProjectValue (final @Nullable java.lang.String ProjectValue)
{
set_Value (COLUMNNAME_ProjectValue, ProjectValue); | }
@Override
public java.lang.String getProjectValue()
{
return get_ValueAsString(COLUMNNAME_ProjectValue);
}
@Override
public void setQty (final @Nullable BigDecimal Qty)
{
set_Value (COLUMNNAME_Qty, Qty);
}
@Override
public BigDecimal getQty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyCalculated (final @Nullable BigDecimal QtyCalculated)
{
set_Value (COLUMNNAME_QtyCalculated, QtyCalculated);
}
@Override
public BigDecimal getQtyCalculated()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyCalculated);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setUOM (final java.lang.String UOM)
{
set_Value (COLUMNNAME_UOM, UOM);
}
@Override
public java.lang.String getUOM()
{
return get_ValueAsString(COLUMNNAME_UOM);
}
@Override
public void setWarehouseValue (final java.lang.String WarehouseValue)
{
set_Value (COLUMNNAME_WarehouseValue, WarehouseValue);
}
@Override
public java.lang.String getWarehouseValue()
{
return get_ValueAsString(COLUMNNAME_WarehouseValue);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_I_Forecast.java | 1 |
请完成以下Java代码 | public void setProduct_UUID (java.lang.String Product_UUID)
{
set_Value (COLUMNNAME_Product_UUID, Product_UUID);
}
/** Get Produkt UUID.
@return Produkt UUID */
@Override
public java.lang.String getProduct_UUID ()
{
return (java.lang.String)get_Value(COLUMNNAME_Product_UUID);
}
/** Set Zusagbar.
@param QtyPromised Zusagbar */
@Override
public void setQtyPromised (java.math.BigDecimal QtyPromised)
{
set_ValueNoCheck (COLUMNNAME_QtyPromised, QtyPromised);
}
/** Get Zusagbar.
@return Zusagbar */
@Override
public java.math.BigDecimal getQtyPromised ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyPromised);
if (bd == null)
{
return Env.ZERO;
}
return bd;
}
/** Set Old Zusagbar.
@param QtyPromised_Old Old Zusagbar */
@Override
public void setQtyPromised_Old (java.math.BigDecimal QtyPromised_Old)
{
set_Value (COLUMNNAME_QtyPromised_Old, QtyPromised_Old);
}
/** Get Old Zusagbar.
@return Old Zusagbar */
@Override
public java.math.BigDecimal getQtyPromised_Old ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyPromised_Old);
if (bd == null)
{ | return Env.ZERO;
}
return bd;
}
/** Set Zusagbar (TU).
@param QtyPromised_TU Zusagbar (TU) */
@Override
public void setQtyPromised_TU (java.math.BigDecimal QtyPromised_TU)
{
set_ValueNoCheck (COLUMNNAME_QtyPromised_TU, QtyPromised_TU);
}
/** Get Zusagbar (TU).
@return Zusagbar (TU) */
@Override
public java.math.BigDecimal getQtyPromised_TU ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyPromised_TU);
if (bd == null)
{
return Env.ZERO;
}
return bd;
}
/** Set Old Zusagbar (TU).
@param QtyPromised_TU_Old Old Zusagbar (TU) */
@Override
public void setQtyPromised_TU_Old (java.math.BigDecimal QtyPromised_TU_Old)
{
set_Value (COLUMNNAME_QtyPromised_TU_Old, QtyPromised_TU_Old);
}
/** Get Old Zusagbar (TU).
@return Old Zusagbar (TU) */
@Override
public java.math.BigDecimal getQtyPromised_TU_Old ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyPromised_TU_Old);
if (bd == null)
{
return Env.ZERO;
}
return bd;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java-gen\de\metas\procurement\base\model\X_PMM_QtyReport_Event.java | 1 |
请完成以下Java代码 | public void setFileName (final @Nullable String FileName)
{
set_Value (COLUMNNAME_FileName, FileName);
}
@Override
public String getFileName()
{
return get_ValueAsString(COLUMNNAME_FileName);
}
@Override
public void setIsEdiEnabled (final boolean IsEdiEnabled)
{
throw new IllegalArgumentException ("IsEdiEnabled is virtual column"); }
@Override
public boolean isEdiEnabled()
{
return get_ValueAsBoolean(COLUMNNAME_IsEdiEnabled);
}
@Override
public void setIsInvoiceEmailEnabled (final boolean IsInvoiceEmailEnabled)
{
set_Value (COLUMNNAME_IsInvoiceEmailEnabled, IsInvoiceEmailEnabled);
}
@Override
public boolean isInvoiceEmailEnabled()
{
return get_ValueAsBoolean(COLUMNNAME_IsInvoiceEmailEnabled);
}
@Override
public void setPDFCount (final int PDFCount)
{
throw new IllegalArgumentException ("PDFCount is virtual column"); }
@Override
public int getPDFCount()
{
return get_ValueAsInt(COLUMNNAME_PDFCount);
}
@Override
public void setPOReference (final @Nullable String POReference)
{ | set_ValueNoCheck (COLUMNNAME_POReference, POReference);
}
@Override
public String getPOReference()
{
return get_ValueAsString(COLUMNNAME_POReference);
}
@Override
public void setPrintCount (final int PrintCount)
{
throw new IllegalArgumentException ("PrintCount is virtual column"); }
@Override
public int getPrintCount()
{
return get_ValueAsInt(COLUMNNAME_PrintCount);
}
@Override
public void setRecord_ID (final int Record_ID)
{
if (Record_ID < 0)
set_ValueNoCheck (COLUMNNAME_Record_ID, null);
else
set_ValueNoCheck (COLUMNNAME_Record_ID, Record_ID);
}
@Override
public int getRecord_ID()
{
return get_ValueAsInt(COLUMNNAME_Record_ID);
}
@Override
public void setStoreCount (final int StoreCount)
{
throw new IllegalArgumentException ("StoreCount is virtual column"); }
@Override
public int getStoreCount()
{
return get_ValueAsInt(COLUMNNAME_StoreCount);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.document.archive\de.metas.document.archive.base\src\main\java-gen\de\metas\document\archive\model\X_C_Doc_Outbound_Log.java | 1 |
请完成以下Java代码 | public Optional<MobileConfig> getConfig()
{
return cache.getOrLoad(0, this::retrieveConfig);
}
@NonNull
private Optional<MobileConfig> retrieveConfig()
{
return retrieveRecord().map(MobileConfigRepository::ofRecord);
}
@NonNull
private Optional<I_MobileConfiguration> retrieveRecord()
{
return queryBL.createQueryBuilder(I_MobileConfiguration.class)
.addOnlyActiveRecordsFilter()
.create()
.firstOnlyOptional(I_MobileConfiguration.class);
}
public void save(@NonNull final MobileConfig mobileConfig)
{
final I_MobileConfiguration record = retrieveRecord().orElseGet(() -> InterfaceWrapperHelper.newInstance(I_MobileConfiguration.class));
updateRecord(record, mobileConfig); | InterfaceWrapperHelper.saveRecord(record);
}
@NonNull
private static MobileConfig ofRecord(@NonNull final I_MobileConfiguration mobileConfiguration)
{
return MobileConfig.builder()
.defaultAuthMethod(MobileAuthMethod.ofCode(mobileConfiguration.getDefaultAuthenticationMethod()))
.build();
}
private static void updateRecord(@NonNull final I_MobileConfiguration record, @NonNull final MobileConfig from)
{
record.setDefaultAuthenticationMethod(from.getDefaultAuthMethod().getCode());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\mobile\MobileConfigRepository.java | 1 |
请完成以下Java代码 | public void setHelp (String Help)
{
set_Value (COLUMNNAME_Help, Help);
}
/** Get Comment/Help.
@return Comment or Hint
*/
public String getHelp ()
{
return (String)get_Value(COLUMNNAME_Help);
}
/** 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 Time Type.
@param S_TimeType_ID
Type of time recorded
*/
public void setS_TimeType_ID (int S_TimeType_ID)
{
if (S_TimeType_ID < 1)
set_ValueNoCheck (COLUMNNAME_S_TimeType_ID, null);
else
set_ValueNoCheck (COLUMNNAME_S_TimeType_ID, Integer.valueOf(S_TimeType_ID));
}
/** Get Time Type.
@return Type of time recorded
*/
public int getS_TimeType_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_S_TimeType_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_S_TimeType.java | 1 |
请完成以下Java代码 | public void setM_Replenish_ID (final int M_Replenish_ID)
{
if (M_Replenish_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Replenish_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Replenish_ID, M_Replenish_ID);
}
@Override
public int getM_Replenish_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Replenish_ID);
}
@Override
public void setM_Warehouse_ID (final int M_Warehouse_ID)
{
if (M_Warehouse_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Warehouse_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Warehouse_ID, M_Warehouse_ID);
}
@Override
public int getM_Warehouse_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Warehouse_ID);
}
/**
* ReplenishType AD_Reference_ID=164
* Reference name: M_Replenish Type
*/
public static final int REPLENISHTYPE_AD_Reference_ID=164;
/** Maximalbestand beibehalten = 2 */
public static final String REPLENISHTYPE_MaximalbestandBeibehalten = "2";
/** Manuell = 0 */
public static final String REPLENISHTYPE_Manuell = "0";
/** Bei Unterschreitung Minimalbestand = 1 */
public static final String REPLENISHTYPE_BeiUnterschreitungMinimalbestand = "1";
/** Custom = 9 */
public static final String REPLENISHTYPE_Custom = "9";
/** Zuk?nftigen Bestand sichern = 7 */
public static final String REPLENISHTYPE_ZukNftigenBestandSichern = "7";
@Override
public void setReplenishType (final java.lang.String ReplenishType) | {
set_Value (COLUMNNAME_ReplenishType, ReplenishType);
}
@Override
public java.lang.String getReplenishType()
{
return get_ValueAsString(COLUMNNAME_ReplenishType);
}
@Override
public void setTimeToMarket (final int TimeToMarket)
{
set_Value (COLUMNNAME_TimeToMarket, TimeToMarket);
}
@Override
public int getTimeToMarket()
{
return get_ValueAsInt(COLUMNNAME_TimeToMarket);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Replenish.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class ZipkinProperties {
/**
* URL to the Zipkin API.
*/
private String endpoint = "http://localhost:9411/api/v2/spans";
/**
* How to encode the POST body to the Zipkin API.
*/
private Encoding encoding = Encoding.JSON;
/**
* Connection timeout for requests to Zipkin.
*/
private Duration connectTimeout = Duration.ofSeconds(1);
/**
* Read timeout for requests to Zipkin.
*/
private Duration readTimeout = Duration.ofSeconds(10);
public String getEndpoint() {
return this.endpoint;
}
public void setEndpoint(String endpoint) {
this.endpoint = endpoint;
}
public Encoding getEncoding() {
return this.encoding;
}
public void setEncoding(Encoding encoding) {
this.encoding = encoding;
}
public Duration getConnectTimeout() {
return this.connectTimeout;
}
public void setConnectTimeout(Duration connectTimeout) { | this.connectTimeout = connectTimeout;
}
public Duration getReadTimeout() {
return this.readTimeout;
}
public void setReadTimeout(Duration readTimeout) {
this.readTimeout = readTimeout;
}
/**
* Zipkin message encoding.
*/
public enum Encoding {
/**
* JSON.
*/
JSON,
/**
* Protocol Buffers v3.
*/
PROTO3
}
} | repos\spring-boot-4.0.1\module\spring-boot-zipkin\src\main\java\org\springframework\boot\zipkin\autoconfigure\ZipkinProperties.java | 2 |
请完成以下Java代码 | protected DeleteProcessInstanceBatchConfigurationJsonConverter getJsonConverterInstance() {
return DeleteProcessInstanceBatchConfigurationJsonConverter.INSTANCE;
}
@Override
public JobDeclaration<BatchJobContext, MessageEntity> getJobDeclaration() {
return JOB_DECLARATION;
}
@Override
protected DeleteProcessInstanceBatchConfiguration createJobConfiguration(DeleteProcessInstanceBatchConfiguration configuration, List<String> processIdsForJob) {
return new DeleteProcessInstanceBatchConfiguration(
processIdsForJob,
null,
configuration.getDeleteReason(),
configuration.isSkipCustomListeners(),
configuration.isSkipSubprocesses(),
configuration.isFailIfNotExists(),
configuration.isSkipIoMappings()
);
}
@Override
public void executeHandler(DeleteProcessInstanceBatchConfiguration batchConfiguration,
ExecutionEntity execution,
CommandContext commandContext,
String tenantId) {
commandContext.executeWithOperationLogPrevented(
new DeleteProcessInstancesCmd(
batchConfiguration.getIds(),
batchConfiguration.getDeleteReason(),
batchConfiguration.isSkipCustomListeners(),
true,
batchConfiguration.isSkipSubprocesses(), | batchConfiguration.isFailIfNotExists(),
batchConfiguration.isSkipIoMappings()
));
}
@Override
protected void createJobEntities(BatchEntity batch, DeleteProcessInstanceBatchConfiguration configuration, String deploymentId, List<String> processIds,
int invocationsPerBatchJob) {
// handle legacy batch entities (no up-front deployment mapping has been done)
if (deploymentId == null && (configuration.getIdMappings() == null || configuration.getIdMappings().isEmpty())) {
// create deployment mappings for the ids to process
BatchElementConfiguration elementConfiguration = new BatchElementConfiguration();
ProcessInstanceQueryImpl query = new ProcessInstanceQueryImpl();
query.processInstanceIds(new HashSet<>(configuration.getIds()));
elementConfiguration.addDeploymentMappings(query.listDeploymentIdMappings(), configuration.getIds());
// create jobs by deployment id
elementConfiguration.getMappings().forEach(mapping -> super.createJobEntities(batch, configuration, mapping.getDeploymentId(),
mapping.getIds(processIds), invocationsPerBatchJob));
} else {
super.createJobEntities(batch, configuration, deploymentId, processIds, invocationsPerBatchJob);
}
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\batch\deletion\DeleteProcessInstancesJobHandler.java | 1 |
请完成以下Java代码 | private <T extends B> T self() {
return (T) this;
}
// Protected methods for use from build() in subclasses
/**
* Transport-specific subclasses can provide their JSON {@code Encoder} and
* {@code Decoder} for use at the client level, for mapping response data
* to some target entity type.
* @param converter the message converter for JSON payloads
*/
protected void setJsonConverter(HttpMessageConverter<Object> converter) {
this.jsonConverter = converter;
}
/**
* Build the default transport-agnostic client that subclasses can then wrap
* with {@link AbstractDelegatingGraphQlClient}.
* @param transport the GraphQL transport to be used by the client
*/
protected GraphQlClient buildGraphQlClient(SyncGraphQlTransport transport) {
if (jacksonPresent) {
this.jsonConverter = (this.jsonConverter == null) ?
DefaultJacksonConverter.initialize() : this.jsonConverter;
}
else if (jackson2Present) {
this.jsonConverter = (this.jsonConverter == null) ?
DefaultJackson2Converter.initialize() : this.jsonConverter;
}
return new DefaultGraphQlClient(
this.documentSource, createExecuteChain(transport), this.scheduler, this.blockingTimeout);
}
/**
* Return a {@code Consumer} to initialize new builders from "this" builder.
*/
protected Consumer<AbstractGraphQlClientSyncBuilder<?>> getBuilderInitializer() {
return (builder) -> {
builder.interceptors((interceptorList) -> interceptorList.addAll(this.interceptors));
builder.documentSource(this.documentSource);
builder.setJsonConverter(getJsonConverter()); | };
}
private Chain createExecuteChain(SyncGraphQlTransport transport) {
Encoder<?> encoder = HttpMessageConverterDelegate.asEncoder(getJsonConverter());
Decoder<?> decoder = HttpMessageConverterDelegate.asDecoder(getJsonConverter());
Chain chain = (request) -> {
GraphQlResponse response = transport.execute(request);
return new DefaultClientGraphQlResponse(request, response, encoder, decoder);
};
return this.interceptors.stream()
.reduce(SyncGraphQlClientInterceptor::andThen)
.map((i) -> (Chain) (request) -> i.intercept(request, chain))
.orElse(chain);
}
private HttpMessageConverter<Object> getJsonConverter() {
Assert.notNull(this.jsonConverter, "jsonConverter has not been set");
return this.jsonConverter;
}
private static final class DefaultJacksonConverter {
static HttpMessageConverter<Object> initialize() {
JsonMapper jsonMapper = JsonMapper.builder().addModule(new GraphQlJacksonModule()).build();
return new JacksonJsonHttpMessageConverter(jsonMapper);
}
}
@SuppressWarnings("removal")
private static final class DefaultJackson2Converter {
static HttpMessageConverter<Object> initialize() {
com.fasterxml.jackson.databind.ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json()
.modulesToInstall(new GraphQlJackson2Module()).build();
return new MappingJackson2HttpMessageConverter(objectMapper);
}
}
} | repos\spring-graphql-main\spring-graphql\src\main\java\org\springframework\graphql\client\AbstractGraphQlClientSyncBuilder.java | 1 |
请完成以下Java代码 | public ActivityBehaviorFactory getActivityBehaviorFactory() {
return activityBehaviorFactory;
}
public void setActivityBehaviorFactory(ActivityBehaviorFactory activityBehaviorFactory) {
this.activityBehaviorFactory = activityBehaviorFactory;
}
public ListenerFactory getListenerFactory() {
return listenerFactory;
}
public void setListenerFactory(ListenerFactory listenerFactory) {
this.listenerFactory = listenerFactory;
}
public BpmnParseFactory getBpmnParseFactory() {
return bpmnParseFactory;
} | public void setBpmnParseFactory(BpmnParseFactory bpmnParseFactory) {
this.bpmnParseFactory = bpmnParseFactory;
}
public ExpressionManager getExpressionManager() {
return expressionManager;
}
public void setExpressionManager(ExpressionManager expressionManager) {
this.expressionManager = expressionManager;
}
public BpmnParseHandlers getBpmnParserHandlers() {
return bpmnParserHandlers;
}
public void setBpmnParserHandlers(BpmnParseHandlers bpmnParserHandlers) {
this.bpmnParserHandlers = bpmnParserHandlers;
}
} | repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\bpmn\parser\BpmnParser.java | 1 |
请完成以下Java代码 | public boolean supportsReturnType(MethodParameter returnType) {
return Properties.class.equals(returnType.getMethod().getReturnType());
}
@Override
public void handleReturnValue(Object returnValue, MethodParameter returnType, ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception {
Properties properties = (Properties) returnValue;
ServletWebRequest servletWebRequest = (ServletWebRequest) webRequest;
HttpServletResponse response = servletWebRequest.getResponse();
ServletServerHttpResponse servletServerHttpResponse = new ServletServerHttpResponse(response);
// 获取请求头
HttpHeaders headers = servletServerHttpResponse.getHeaders();
MediaType contentType = headers.getContentType();
// 获取编码 | Charset charset = null;
if (contentType != null) {
charset = contentType.getCharset();
}
charset = charset == null ? Charset.forName("UTF-8") : charset;
// 获取请求体
OutputStream body = servletServerHttpResponse.getBody();
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(body, charset);
properties.store(outputStreamWriter, "Serialized by PropertiesHandlerMethodReturnValueHandler#handleReturnValue");
// 告诉 Spring MVC 请求已经处理完毕
mavContainer.setRequestHandled(true);
}
} | repos\SpringAll-master\47.Spring-Boot-Content-Negotiation\src\main\java\com\example\demo\handler\PropertiesHandlerMethodReturnValueHandler.java | 1 |
请完成以下Java代码 | public BigDecimal getApprovalAmt()
{
return BigDecimal.ZERO;
} // getApprovalAmt
/**
* Get C_Currency_ID
*
* @return Accounting Currency
*/
@Override
public int getC_Currency_ID()
{
return Env.getContextAsInt(getCtx(), "$C_Currency_ID");
} // getC_Currency_ID | /**
* Document Status is Complete or Closed
*
* @return true if CO, CL or RE
*/
public boolean isComplete()
{
final String ds = getDocStatus();
return DOCSTATUS_Completed.equals(ds)
|| DOCSTATUS_Closed.equals(ds)
|| DOCSTATUS_Reversed.equals(ds);
} // isComplete
} // MInOut | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MInOut.java | 1 |
请完成以下Java代码 | private void saveLine(
@NonNull final ShipmentDeclarationLine line,
@NonNull final ShipmentDeclarationId shipmentDeclarationId,
final I_M_Shipment_Declaration_Line existingRecord)
{
final I_M_Shipment_Declaration_Line record;
if (existingRecord == null)
{
record = newInstance(I_M_Shipment_Declaration_Line.class);
}
else
{
record = existingRecord;
}
record.setM_Shipment_Declaration_ID(shipmentDeclarationId.getRepoId());
record.setLineNo(line.getLineNo());
final InOutLineId shipmentLineId = line.getShipmentLineId();
record.setM_InOutLine_ID(shipmentLineId.getRepoId());
final OrgId orgId = line.getOrgId();
record.setAD_Org_ID(orgId.getRepoId()); | final Quantity quantity = line.getQuantity();
record.setQty(quantity.toBigDecimal());
record.setC_UOM_ID(quantity.getUOMId());
final ProductId productId = line.getProductId();
record.setM_Product_ID(productId.getRepoId());
record.setPackageSize(line.getPackageSize());
saveRecord(record);
line.setId(ShipmentDeclarationLineId.ofRepoId(record.getM_Shipment_Declaration_ID(), record.getM_Shipment_Declaration_Line_ID()));
}
public boolean existCompletedShipmentDeclarationsForShipmentId(final InOutId shipmentId)
{
return Services.get(IQueryBL.class).createQueryBuilder(I_M_Shipment_Declaration.class)
.addOnlyActiveRecordsFilter()
.addOnlyContextClient()
.addEqualsFilter(I_M_Shipment_Declaration.COLUMN_M_InOut_ID, shipmentId)
.create()
.anyMatch();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\shipment\repo\ShipmentDeclarationRepository.java | 1 |
请完成以下Java代码 | public class SpinReflectUtil {
private final static SpinCoreLogger LOG = SpinCoreLogger.CORE_LOGGER;
/**
* Used by dataformats if they need to load a class
*
* @param classname the name of the
* @param dataFormat
* @return
*/
public static Class<?> loadClass(String classname, DataFormat<?> dataFormat) {
// first try context classoader
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if(cl != null) {
LOG.tryLoadingClass(classname, cl);
try {
return cl.loadClass(classname);
}
catch(Exception e) { | // ignore
}
}
// else try the classloader which loaded the dataformat
cl = dataFormat.getClass().getClassLoader();
try {
LOG.tryLoadingClass(classname, cl);
return cl.loadClass(classname);
}
catch (ClassNotFoundException e) {
throw LOG.classNotFound(classname, e);
}
}
} | repos\camunda-bpm-platform-master\spin\core\src\main\java\org\camunda\spin\impl\util\SpinReflectUtil.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class PPOrderCandidate
{
PPOrderCandidateId ppOrderCandidateId;
boolean simulated;
/**
* USed if this candidate is about a sub-BOM
*/
@With
PPOrderCandidateId parentPPOrderCandidateId;
@With
PPOrderData ppOrderData;
List<PPOrderLineCandidate> lines;
@JsonCreator | @Builder(toBuilder = true)
public PPOrderCandidate(
@JsonProperty("ppOrderCandidateId") final PPOrderCandidateId ppOrderCandidateId,
@JsonProperty("simulated") final boolean simulated,
@JsonProperty("parentPPOrderCandidateId") final PPOrderCandidateId parentPPOrderCandidateId,
@JsonProperty("ppOrderData") @NonNull final PPOrderData ppOrderData,
@JsonProperty("lines") @Nullable final List<PPOrderLineCandidate> lines)
{
this.ppOrderCandidateId = ppOrderCandidateId;
this.simulated = simulated;
this.parentPPOrderCandidateId = parentPPOrderCandidateId;
this.ppOrderData = ppOrderData;
this.lines = lines;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.material\event\src\main\java\de\metas\material\event\pporder\PPOrderCandidate.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class PersonCrudService implements CrudService<Person> {
@Autowired
private TutorialBucketService bucketService;
@Autowired
private PersonDocumentConverter converter;
private Bucket bucket;
@PostConstruct
private void init() {
bucket = bucketService.getBucket();
}
@Override
public void create(Person person) {
if (person.getId() == null) {
person.setId(UUID.randomUUID().toString());
}
JsonDocument document = converter.toDocument(person);
bucket.insert(document);
}
@Override
public Person read(String id) {
JsonDocument doc = bucket.get(id);
return (doc != null ? converter.fromDocument(doc) : null);
}
@Override | public Person readFromReplica(String id) {
List<JsonDocument> docs = bucket.getFromReplica(id, ReplicaMode.FIRST);
return (docs.isEmpty() ? null : converter.fromDocument(docs.get(0)));
}
@Override
public void update(Person person) {
JsonDocument document = converter.toDocument(person);
bucket.upsert(document);
}
@Override
public void delete(String id) {
bucket.remove(id);
}
@Override
public boolean exists(String id) {
return bucket.exists(id);
}
} | repos\tutorials-master\persistence-modules\couchbase\src\main\java\com\baeldung\couchbase\spring\person\PersonCrudService.java | 2 |
请完成以下Java代码 | public String getUsername() {
return username;
}
/**
* 设置 账号.
*
* @param username 账号.
*/
public void setUsername(String username) {
this.username = username;
}
/**
* 获取 名字.
*
* @return 名字.
*/
public String getName() {
return name;
}
/**
* 设置 名字.
*
* @param name 名字.
*/
public void setName(String name) {
this.name = name;
}
/**
* 获取 密码.
*
* @return 密码.
*/
public String getPassword() {
return password;
}
/**
* 设置 密码.
*
* @param password 密码.
*/
public void setPassword(String password) {
this.password = password;
}
/**
* 获取 md5密码盐.
*
* @return md5密码盐.
*/
public String getSalt() {
return salt;
}
/**
* 设置 md5密码盐.
*
* @param salt md5密码盐.
*/
public void setSalt(String salt) {
this.salt = salt;
}
/**
* 获取 联系电话.
*
* @return 联系电话.
*/
public String getPhone() {
return phone;
}
/**
* 设置 联系电话.
*
* @param phone 联系电话.
*/
public void setPhone(String phone) {
this.phone = phone;
}
/**
* 获取 备注.
*
* @return 备注.
*/
public String getTips() {
return tips;
}
/**
* 设置 备注.
*
* @param tips 备注.
*/
public void setTips(String tips) {
this.tips = tips;
}
/**
* 获取 状态 1:正常 2:禁用.
*
* @return 状态 1:正常 2:禁用.
*/
public Integer getState() {
return state;
} | /**
* 设置 状态 1:正常 2:禁用.
*
* @param state 状态 1:正常 2:禁用.
*/
public void setState(Integer state) {
this.state = state;
}
/**
* 获取 创建时间.
*
* @return 创建时间.
*/
public Date getCreatedTime() {
return createdTime;
}
/**
* 设置 创建时间.
*
* @param createdTime 创建时间.
*/
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
/**
* 获取 更新时间.
*
* @return 更新时间.
*/
public Date getUpdatedTime() {
return updatedTime;
}
/**
* 设置 更新时间.
*
* @param updatedTime 更新时间.
*/
public void setUpdatedTime(Date updatedTime) {
this.updatedTime = updatedTime;
}
protected Serializable pkVal() {
return this.id;
}
} | repos\SpringBootBucket-master\springboot-jwt\src\main\java\com\xncoding\jwt\dao\domain\Manager.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void setQty (final BigDecimal Qty)
{
set_Value (COLUMNNAME_Qty, Qty);
}
@Override
public BigDecimal getQty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setScannedBarcode (final @Nullable java.lang.String ScannedBarcode)
{
set_Value (COLUMNNAME_ScannedBarcode, ScannedBarcode);
} | @Override
public java.lang.String getScannedBarcode()
{
return get_ValueAsString(COLUMNNAME_ScannedBarcode);
}
@Override
public void setTaxAmt (final BigDecimal TaxAmt)
{
set_Value (COLUMNNAME_TaxAmt, TaxAmt);
}
@Override
public BigDecimal getTaxAmt()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_TaxAmt);
return bd != null ? bd : BigDecimal.ZERO;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.pos.base\src\main\java-gen\de\metas\pos\repository\model\X_C_POS_OrderLine.java | 2 |
请完成以下Java代码 | protected void serializeContents(Collection<?> value, JsonGenerator jsonGenerator,
SerializerProvider serializerProvider) throws IOException {
jsonGenerator.setCurrentValue(value);
PropertySerializerMap serializers = this._dynamicSerializers;
TypeSerializer typeSerializer = this._valueTypeSerializer;
int index = -1;
try {
for (Object element : CollectionUtils.nullSafeCollection(value)) {
index++;
if (Objects.isNull(element)) {
serializerProvider.defaultSerializeNull(jsonGenerator);
}
else {
Class<?> elementType = element.getClass();
JsonSerializer<Object> serializer = resolveSerializer(serializerProvider, elementType);
if (typeSerializer != null) {
serializer.serializeWithType(element, jsonGenerator, serializerProvider, typeSerializer);
}
else {
serializer.serialize(element, jsonGenerator, serializerProvider);
}
}
}
}
catch(Exception cause) {
wrapAndThrow(serializerProvider, cause, value, index);
}
}
private JavaType constructSpecializedType(SerializerProvider serializerProvider, JavaType baseType, Class<?> subclass) {
return serializerProvider.constructSpecializedType(baseType, subclass);
}
private JsonSerializer<Object> resolveSerializer(SerializerProvider serializerProvider, Class<?> type)
throws JsonMappingException {
JsonSerializer<Object> resolvedSerializer = this._elementSerializer;
if (Objects.isNull(resolvedSerializer)) {
PropertySerializerMap dynamicSerializers = this._dynamicSerializers;
resolvedSerializer = dynamicSerializers.serializerFor(type); | if (Objects.isNull(resolvedSerializer)) {
resolvedSerializer = Objects.nonNull(this._elementType) && this._elementType.hasGenericTypes()
? this._findAndAddDynamic(dynamicSerializers,
constructSpecializedType(serializerProvider, this._elementType, type), serializerProvider)
: this._findAndAddDynamic(dynamicSerializers, type, serializerProvider);
}
}
return resolvedSerializer;
}
@Override
public TypelessCollectionSerializer withResolved(BeanProperty property, TypeSerializer typeSerializer,
JsonSerializer<?> elementSerializer, Boolean unwrapSingle) {
return new TypelessCollectionSerializer(this, property, typeSerializer, elementSerializer);
}
@Override
public TypelessCollectionSerializer _withValueTypeSerializer(TypeSerializer typeSerializer) {
return new TypelessCollectionSerializer(this, this._property, typeSerializer, this._elementSerializer);
}
} | repos\spring-boot-data-geode-main\spring-geode-project\spring-geode\src\main\java\org\springframework\geode\jackson\databind\serializer\TypelessCollectionSerializer.java | 1 |
请完成以下Java代码 | public class SignalEventReceivedBuilderImpl implements SignalEventReceivedBuilder {
private final static CommandLogger LOG = ProcessEngineLogger.CMD_LOGGER;
protected final CommandExecutor commandExecutor;
protected final String signalName;
protected String executionId = null;
protected String tenantId = null;
protected boolean isTenantIdSet = false;
protected VariableMap variables = null;
public SignalEventReceivedBuilderImpl(CommandExecutor commandExecutor, String signalName) {
this.commandExecutor = commandExecutor;
this.signalName = signalName;
}
@Override
public SignalEventReceivedBuilder setVariables(Map<String, Object> variables) {
if (variables != null) {
if (this.variables == null) {
this.variables = new VariableMapImpl();
}
this.variables.putAll(variables);
}
return this;
}
@Override
public SignalEventReceivedBuilder executionId(String executionId) {
ensureNotNull("executionId", executionId);
this.executionId = executionId;
return this;
}
@Override
public SignalEventReceivedBuilder tenantId(String tenantId) {
ensureNotNull(
"The tenant-id cannot be null. Use 'withoutTenantId()' if you want to send the signal to a process definition or an execution which has no tenant-id.",
"tenantId", tenantId);
this.tenantId = tenantId;
isTenantIdSet = true;
return this;
}
@Override
public SignalEventReceivedBuilder withoutTenantId() { | // tenant-id is null
isTenantIdSet = true;
return this;
}
@Override
public void send() {
if (executionId != null && isTenantIdSet) {
throw LOG.exceptionDeliverSignalToSingleExecutionWithTenantId();
}
SignalEventReceivedCmd command = new SignalEventReceivedCmd(this);
commandExecutor.execute(command);
}
public String getSignalName() {
return signalName;
}
public String getExecutionId() {
return executionId;
}
public String getTenantId() {
return tenantId;
}
public boolean isTenantIdSet() {
return isTenantIdSet;
}
public VariableMap getVariables() {
return variables;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\SignalEventReceivedBuilderImpl.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public ResponseEntity<?> statusDelivered(UserPrincipal userPrincipal, OrderResponse orderResponse)
{
Orders orders = orderRepository.findById(orderResponse.getId()).orElse(null);
User user = userRepository.findById(userPrincipal.getId()).orElse(null);
if(user !=null && orders !=null && user.equals(orders.getUser())){
switch (orderResponse.getStatus()){
case "AwaitingPayment/Ожидает оплаты":
orders.setStatus(OrderStatus.awaitingPayment);
break;
case "New/Новый" :
orders.setStatus(OrderStatus.NEW);
break;
case "InProgress/В обработке":
orders.setStatus(OrderStatus.inProgress);
break;
case "Paid/Оплачен":
orders.setStatus(OrderStatus.paid);
break;
case "Canceled/Отменен":
orders.setStatus(OrderStatus.canceled);
break;
case "CourierSearch/Поиск курьера":
orders.setStatus(OrderStatus.courierSearch);
break;
case "FoundCourier/Курьер найден":
orders.setStatus(OrderStatus.courierFound);
break;
case "DeliveryInProgress/Выполняется доставка":
orders.setStatus(OrderStatus.deliveryInProgress);
break;
case "AwaitingConfirmation/Ожидает подтверждения":
orders.setStatus(OrderStatus.awaitingConfirmation);
break;
case "Delivered/Доставлен":
orders.setStatus(OrderStatus.delivered);
break;
}
orderRepository.save(orders);
producer.sendOrderRequest(orders); | return new ResponseEntity(new ApiResponse(true, "Status updated sucessfully/ Статус заказа успешно изменен!", new Date(), orderResponse), HttpStatus.OK);
}
else
{
return new ResponseEntity(new ApiResponse(true, "Error updating process of the status/ При изменении статуса заказа произошла ошибка.", new Date(), orderResponse), HttpStatus.BAD_REQUEST);
}
}
private void validatePageNumberAndSize(int page, int size){
if(page< 0) {
throw new BadRequestException("Number of page cannot be 0. / Номер страницы не может быть меньше нуля.");
}
if(size > AppConstants.MAX_PAGE_SIZE){
throw new BadRequestException("Size of page cannot suitable/ Размер страницы не должен превышать" + AppConstants.MAX_PAGE_SIZE);
}
}
} | repos\SpringBoot-Projects-FullStack-master\Part-9.SpringBoot-React-Projects\Project-2.SpringBoot-React-ShoppingMall\fullstack\backend\src\main\java\com\urunov\service\order\OrderService.java | 2 |
请完成以下Java代码 | public class RoncooHttpClientUtils {
/**
* 调用 API
*
* @param parameters
* @return
*/
@SuppressWarnings({ "resource", "deprecation" })
public static String post(String url, String parameters) {
HttpClient httpClient = new DefaultHttpClient();
HttpPost method = new HttpPost(url);
String body = null;
if (method != null & parameters != null && !"".equals(parameters.trim())) {
try {
// 建立一个NameValuePair数组,用于存储欲传送的参数
method.addHeader("Content-type", "application/json; charset=utf-8");
method.setHeader("Accept", "application/json");
method.setEntity(new StringEntity(parameters, Charset.forName("UTF-8"))); | HttpResponse response = httpClient.execute(method);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != HttpStatus.SC_OK) {
return "1";// 返回1表示请求失败
}
// Read the response body
body = EntityUtils.toString(response.getEntity());
} catch (IOException e) {
// 网络错误
return "2";
} finally {
}
}
return body;
}
} | repos\roncoo-pay-master\roncoo-pay-web-boss\src\main\java\com\roncoo\pay\permission\utils\RoncooHttpClientUtils.java | 1 |
请完成以下Java代码 | private <T> T doExecuteSubject(URI url, String uriTemplate, HttpMethod method, RequestCallback requestCallback,
ResponseExtractor<T> responseExtractor) throws RestClientException {
return super.doExecute(url, uriTemplate, method, requestCallback, responseExtractor);
}
private static final class ClientLoginConfig extends Configuration {
private final String keyTabLocation;
private final String userPrincipal;
private final String password;
private final Map<String, Object> loginOptions;
private ClientLoginConfig(String keyTabLocation, String userPrincipal, String password,
Map<String, Object> loginOptions) {
super();
this.keyTabLocation = keyTabLocation;
this.userPrincipal = userPrincipal;
this.password = password;
this.loginOptions = loginOptions;
}
@Override
public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
Map<String, Object> options = new HashMap<String, Object>();
// if we don't have keytab or principal only option is to rely on
// credentials cache.
if (!StringUtils.hasText(this.keyTabLocation) || !StringUtils.hasText(this.userPrincipal)) {
// cache
options.put("useTicketCache", "true");
}
else {
// keytab
options.put("useKeyTab", "true");
options.put("keyTab", this.keyTabLocation);
options.put("principal", this.userPrincipal);
options.put("storeKey", "true");
}
options.put("doNotPrompt", Boolean.toString(this.password == null));
options.put("isInitiator", "true");
if (this.loginOptions != null) {
options.putAll(this.loginOptions);
}
return new AppConfigurationEntry[] {
new AppConfigurationEntry("com.sun.security.auth.module.Krb5LoginModule",
AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options) };
}
}
private static class NullCredentials implements Credentials {
@Override
public Principal getUserPrincipal() {
return null;
}
@Override | public char[] getPassword() {
return null;
}
}
private static final class CallbackHandlerImpl implements CallbackHandler {
private final String userPrincipal;
private final String password;
private CallbackHandlerImpl(String userPrincipal, String password) {
super();
this.userPrincipal = userPrincipal;
this.password = password;
}
@Override
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
for (Callback callback : callbacks) {
if (callback instanceof NameCallback) {
NameCallback nc = (NameCallback) callback;
nc.setName(this.userPrincipal);
}
else if (callback instanceof PasswordCallback) {
PasswordCallback pc = (PasswordCallback) callback;
pc.setPassword(this.password.toCharArray());
}
else {
throw new UnsupportedCallbackException(callback, "Unknown Callback");
}
}
}
}
} | repos\spring-security-main\kerberos\kerberos-client\src\main\java\org\springframework\security\kerberos\client\KerberosRestTemplate.java | 1 |
请完成以下Java代码 | public void initialize() {
this.groups.clear();
for (String group : this.groupNames) {
this.groups.add(Objects.requireNonNull(this.applicationContext).getBean(group + ".group", ContainerGroup.class));
}
if (!this.groups.isEmpty()) {
this.iterator = this.groups.iterator();
this.currentGroup = this.iterator.next();
this.groups.forEach(grp -> {
Collection<String> ids = grp.getListenerIds();
ids.forEach(id -> {
MessageListenerContainer container = this.registry.getListenerContainer(id);
if (Objects.requireNonNull(container).getContainerProperties().getIdleEventInterval() == null) {
container.getContainerProperties().setIdleEventInterval(this.defaultIdleEventInterval);
container.setAutoStartup(false);
}
});
});
}
LOGGER.debug(() -> "Found: " + this.groups);
} | @Override
public synchronized void stop() {
this.running = false;
if (this.currentGroup != null) {
this.currentGroup.stop();
this.currentGroup = null;
}
}
@Override
public synchronized boolean isRunning() {
return this.running;
}
} | repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\listener\ContainerGroupSequencer.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public String createBook(@Valid @Body Book book) {
@Nullable ObjectId bookId = bookService.save(book);
if (null == bookId) {
return "Book not created";
} else {
return "Book created with id: " + bookId;
}
}
@Put
public String updateBook(@Valid @Body Book book) {
@Nullable ObjectId bookId = bookService.update(book);
if (null == bookId) {
return "Book not updated";
} else {
return "Book updated with id: " + bookId;
}
}
@Delete("/{id}")
public String deleteBook(String id) throws BookNotFoundException {
Long bookId = bookService.deleteById(id);
if (1 == bookId) {
return "Book deleted";
} else {
throw new BookNotFoundException(id);
}
}
@Get("/{id}")
public Book findById(@PathVariable("id") String identifier) throws BookNotFoundException { | Book book = bookService.findById(identifier);
if (null == book) {
throw new BookNotFoundException(identifier);
} else {
return book;
}
}
@Get("/published-after")
public Flux<Book> findByYearGreaterThan(@QueryValue(value = "year") int year) {
return bookService.findByYearGreaterThan(year);
}
@Error(exception = ConstraintViolationException.class)
public MutableHttpResponse<String> onSavedFailed(ConstraintViolationException ex) {
return HttpResponse.badRequest(ex.getConstraintViolations().stream()
.map(cv -> cv.getPropertyPath() + " " + cv.getMessage())
.toList().toString());
}
@Error(exception = BookNotFoundException.class)
public HttpResponse<String> onSavedFailed(BookNotFoundException ex) {
return HttpResponse.notFound(ex.getMessage());
}
} | repos\tutorials-master\microservices-modules\micronaut-reactive\src\main\java\com\baeldung\micronautreactive\controller\BookController.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer.defaultContentTypeStrategy(new CommandLineContentNegotiationStrategy());
}
/**
* A command-line aware {@link ContentNegotiationStrategy} that forces the media type
* to "text/plain" for compatible agents.
*/
private static final class CommandLineContentNegotiationStrategy implements ContentNegotiationStrategy {
private final UrlPathHelper urlPathHelper = new UrlPathHelper();
@Override
public List<MediaType> resolveMediaTypes(NativeWebRequest request) {
String path = this.urlPathHelper
.getPathWithinApplication(request.getNativeRequest(HttpServletRequest.class));
if (!StringUtils.hasText(path) || !path.equals("/")) { // Only care about "/"
return MEDIA_TYPE_ALL_LIST;
} | String userAgent = request.getHeader(HttpHeaders.USER_AGENT);
if (userAgent != null) {
Agent agent = Agent.fromUserAgent(userAgent);
if (agent != null) {
if (AgentId.CURL.equals(agent.getId()) || AgentId.HTTPIE.equals(agent.getId())) {
return Collections.singletonList(MediaType.TEXT_PLAIN);
}
}
}
return Collections.singletonList(MediaType.APPLICATION_JSON);
}
}
} | repos\initializr-main\initializr-web\src\main\java\io\spring\initializr\web\autoconfigure\InitializrWebConfig.java | 2 |
请完成以下Java代码 | public DocFlavor getDocFlavor()
{
return DocFlavor.SERVICE_FORMATTED.PAGEABLE;
} // getDocFlavor
/**
* Get Print Data (Doc Interface)
*
* @return this
* @throws IOException
*/
@Override
public Object getPrintData() throws IOException
{
return this;
} // getPrintData
/**
* Get Document Attributes (Doc Interface)
*
* @return null to obtain all attribute values from the
* job's attribute set.
*/
@Override
public DocAttributeSet getAttributes()
{
return null;
} // getAttributes
/**
* Obtains a reader for extracting character print data from this doc.
* (Doc Interface)
*
* @return null
* @throws IOException
*/
@Override
public Reader getReaderForText() throws IOException
{ | return null;
} // getReaderForText
/**
* Obtains an input stream for extracting byte print data from this doc.
* (Doc Interface)
*
* @return null
* @throws IOException
*/
@Override
public InputStream getStreamForBytes() throws IOException
{
return null;
} // getStreamForBytes
public void setPrintInfo(final ArchiveInfo info)
{
m_PrintInfo = info;
}
/**
* @return PrintInfo
*/
public ArchiveInfo getPrintInfo()
{
return m_PrintInfo;
}
} // LayoutEngine | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\print\layout\LayoutEngine.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class OrderLineDocumentLocationAdapterFactory implements DocumentLocationAdapterFactory
{
public static OrderLineMainLocationAdapter locationAdapter(@NonNull final I_C_OrderLine delegate)
{
return new OrderLineMainLocationAdapter(delegate);
}
@Override
public Optional<IDocumentLocationAdapter> getDocumentLocationAdapterIfHandled(final Object record)
{
return toOrderLine(record).map(OrderLineDocumentLocationAdapterFactory::locationAdapter);
}
@Override
public Optional<IDocumentBillLocationAdapter> getDocumentBillLocationAdapterIfHandled(final Object record)
{
return Optional.empty();
} | @Override
public Optional<IDocumentDeliveryLocationAdapter> getDocumentDeliveryLocationAdapter(final Object record)
{
return Optional.empty();
}
@Override
public Optional<IDocumentHandOverLocationAdapter> getDocumentHandOverLocationAdapter(final Object record)
{
return Optional.empty();
}
private static Optional<I_C_OrderLine> toOrderLine(final Object record)
{
return InterfaceWrapperHelper.isInstanceOf(record, I_C_OrderLine.class)
? Optional.of(InterfaceWrapperHelper.create(record, I_C_OrderLine.class))
: Optional.empty();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\order\location\adapter\OrderLineDocumentLocationAdapterFactory.java | 2 |
请完成以下Java代码 | public int getWindow()
{
return window;
}
public Config setMinCount(int minCount)
{
this.minCount = minCount;
return this;
}
public int getMinCount()
{
return minCount;
}
public Config setNegative(int negative)
{
this.negative = negative;
return this;
}
public int getNegative()
{
return negative;
}
public Config setLayer1Size(int layer1Size)
{
this.layer1Size = layer1Size;
return this;
}
public int getLayer1Size()
{
return layer1Size;
}
public Config setNumThreads(int numThreads)
{
this.numThreads = numThreads;
return this;
}
public int getNumThreads()
{
return numThreads;
}
public Config setUseHierarchicalSoftmax(boolean hs)
{
this.hs = hs;
return this;
}
public boolean useHierarchicalSoftmax()
{
return hs;
}
public Config setUseContinuousBagOfWords(boolean cbow)
{
this.cbow = cbow;
return this;
}
public boolean useContinuousBagOfWords()
{
return cbow;
}
public Config setSample(float sample)
{
this.sample = sample; | return this;
}
public float getSample()
{
return sample;
}
public Config setAlpha(float alpha)
{
this.alpha = alpha;
return this;
}
public float getAlpha()
{
return alpha;
}
public Config setInputFile(String inputFile)
{
this.inputFile = inputFile;
return this;
}
public String getInputFile()
{
return inputFile;
}
public TrainingCallback getCallback()
{
return callback;
}
public void setCallback(TrainingCallback callback)
{
this.callback = callback;
}
} | repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\mining\word2vec\Config.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public Flux<DataBuffer> encode(Publisher<? extends OAuth2Error> error, DataBufferFactory bufferFactory,
ResolvableType elementType, MimeType mimeType, Map<String, Object> hints) {
return Mono.from(error).flatMap((data) -> {
ByteArrayHttpOutputMessage bytes = new ByteArrayHttpOutputMessage();
try {
this.messageConverter.write(data, MediaType.APPLICATION_JSON, bytes);
return Mono.just(bytes.getBody().toByteArray());
}
catch (IOException ex) {
return Mono.error(ex);
}
}).map(bufferFactory::wrap).flux();
}
@NonNull
@Override
public List<MimeType> getEncodableMimeTypes() {
return List.of(MediaType.APPLICATION_JSON);
} | private static class ByteArrayHttpOutputMessage implements HttpOutputMessage {
private final ByteArrayOutputStream body = new ByteArrayOutputStream();
@NonNull
@Override
public ByteArrayOutputStream getBody() {
return this.body;
}
@NonNull
@Override
public HttpHeaders getHeaders() {
return new HttpHeaders();
}
}
} | repos\spring-security-main\config\src\main\java\org\springframework\security\config\web\server\OAuth2ErrorEncoder.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class UserStreamService {
private static final Logger log = LoggerFactory.getLogger(UserStreamService.class);
private KafkaStreams kafkaStreams;
public void start(String bootstrapServer) {
StreamsBuilder builder = new StreamsBuilder();
KStream<String, User> userStream = builder.stream(
"user-topic",
Consumed.with(Serdes.String(), new UserSerde())
);
KTable<String, Long> usersPerCountry = userStream
.filter((key, user) ->
Objects.nonNull(user) && user.country() != null && !user.country().isEmpty())
.groupBy((key, user) -> user.country(), Grouped.with(Serdes.String(),
new UserSerde()))
.count(Materialized.as("users_per_country_store"));
usersPerCountry.toStream()
.peek((country, count) -> log.info("Aggregated for country {} with count {}",country, count))
.to("users_per_country", Produced.with(Serdes.String(), Serdes.Long()));
Properties props = getStreamProperties(bootstrapServer);
kafkaStreams = new KafkaStreams(builder.build(), props);
kafkaStreams.setUncaughtExceptionHandler(new StreamExceptionHandler());
Runtime.getRuntime().addShutdownHook(new Thread(kafkaStreams::close));
kafkaStreams.start();
}
public void stop() {
if (kafkaStreams != null) {
kafkaStreams.close();
}
}
public void cleanUp() {
if (kafkaStreams != null) { | kafkaStreams.cleanUp();
}
}
private static Properties getStreamProperties(String bootstrapServer) {
Properties props = new Properties();
props.put(StreamsConfig.APPLICATION_ID_CONFIG, "user-country-aggregator" + UUID.randomUUID());
props.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServer);
props.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.String().getClass());
props.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.String().getClass());
props.put(StreamsConfig.DEFAULT_DESERIALIZATION_EXCEPTION_HANDLER_CLASS_CONFIG,
LogAndContinueExceptionHandler.class);
props.put(StreamsConfig.PROCESSING_EXCEPTION_HANDLER_CLASS_CONFIG,
CustomProcessingExceptionHandler.class);
props.put(StreamsConfig.DEFAULT_PRODUCTION_EXCEPTION_HANDLER_CLASS_CONFIG,
CustomProductionExceptionHandler.class);
return props;
}
} | repos\tutorials-master\apache-kafka-4\src\main\java\com\baeldung\kafkastreams\UserStreamService.java | 2 |
请完成以下Java代码 | public Optional<GeocodingProvider> getProvider()
{
final GeocodingConfig config = configRepository.getGeocodingConfig().orElse(null);
if (config == null)
{
return Optional.empty();
}
final GeocodingProvider provider = providers.getOrLoad(config, this::createProvider);
return Optional.of(provider);
}
private GeocodingProvider createProvider(@NonNull final GeocodingConfig config)
{
final GeocodingProviderName providerName = config.getProviderName();
if (GeocodingProviderName.GOOGLE_MAPS.equals(providerName))
{
return createGoogleMapsProvider(config.getGoogleMapsConfig());
}
else if (GeocodingProviderName.OPEN_STREET_MAPS.equals(providerName))
{
return createOSMProvider(config.getOpenStreetMapsConfig());
}
else
{
throw new AdempiereException("Unknown provider: " + providerName);
}
}
@NonNull private GoogleMapsGeocodingProviderImpl createGoogleMapsProvider(@NonNull final GoogleMapsConfig config)
{
final String apiKey = config.getApiKey();
final int cacheCapacity = config.getCacheCapacity(); | final GeoApiContext context = new GeoApiContext.Builder()
.apiKey(apiKey)
.build();
return new GoogleMapsGeocodingProviderImpl(context, cacheCapacity);
}
@NonNull private NominatimOSMGeocodingProviderImpl createOSMProvider(@NonNull final OpenStreetMapsConfig config)
{
final String baseURL = config.getBaseURL();
final int cacheCapacity = config.getCacheCapacity();
final long millisBetweenRequests = config.getMillisBetweenRequests();
return new NominatimOSMGeocodingProviderImpl(baseURL, millisBetweenRequests, cacheCapacity);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\location\geocoding\provider\GeocodingProviderFactory.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public final AuthenticationManager createAuthenticationManager() {
LdapAuthenticationProvider ldapAuthenticationProvider = getProvider();
return new ProviderManager(ldapAuthenticationProvider);
}
private LdapAuthenticationProvider getProvider() {
AbstractLdapAuthenticator authenticator = getAuthenticator();
LdapAuthenticationProvider provider;
if (this.ldapAuthoritiesPopulator != null) {
provider = new LdapAuthenticationProvider(authenticator, this.ldapAuthoritiesPopulator);
}
else {
provider = new LdapAuthenticationProvider(authenticator);
}
if (this.authoritiesMapper != null) {
provider.setAuthoritiesMapper(this.authoritiesMapper);
}
if (this.userDetailsContextMapper != null) {
provider.setUserDetailsContextMapper(this.userDetailsContextMapper);
}
return provider;
}
private AbstractLdapAuthenticator getAuthenticator() {
AbstractLdapAuthenticator authenticator = createDefaultLdapAuthenticator(); | if (this.userSearchFilter != null) {
authenticator.setUserSearch(
new FilterBasedLdapUserSearch(this.userSearchBase, this.userSearchFilter, this.contextSource));
}
if (this.userDnPatterns != null && this.userDnPatterns.length > 0) {
authenticator.setUserDnPatterns(this.userDnPatterns);
}
authenticator.afterPropertiesSet();
return authenticator;
}
/**
* Allows subclasses to supply the default {@link AbstractLdapAuthenticator}.
* @return the {@link AbstractLdapAuthenticator} that will be configured for LDAP
* authentication
*/
protected abstract T createDefaultLdapAuthenticator();
} | repos\spring-security-main\config\src\main\java\org\springframework\security\config\ldap\AbstractLdapAuthenticationManagerFactory.java | 2 |
请完成以下Java代码 | public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (getClass() != obj.getClass()) {
return false;
} | return id != null && id.equals(((Book) obj).id);
}
@Override
public int hashCode() {
return 2021;
}
@Override
public String toString() {
return "Book{" + "id=" + id + ", title=" + title + ", isbn=" + isbn + '}';
}
} | repos\Hibernate-SpringBoot-master\HibernateSpringBootOneToManyUnidirectional\src\main\java\com\bookstore\entity\Book.java | 1 |
请完成以下Java代码 | public void setQtyDeliveredInUOM_Catch (final @Nullable BigDecimal QtyDeliveredInUOM_Catch)
{
set_ValueNoCheck (COLUMNNAME_QtyDeliveredInUOM_Catch, QtyDeliveredInUOM_Catch);
}
@Override
public BigDecimal getQtyDeliveredInUOM_Catch()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyDeliveredInUOM_Catch);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyDeliveredInUOM_Nominal (final @Nullable BigDecimal QtyDeliveredInUOM_Nominal)
{
set_Value (COLUMNNAME_QtyDeliveredInUOM_Nominal, QtyDeliveredInUOM_Nominal);
}
@Override
public BigDecimal getQtyDeliveredInUOM_Nominal()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyDeliveredInUOM_Nominal);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyDeliveredInUOM_Override (final @Nullable BigDecimal QtyDeliveredInUOM_Override)
{
set_ValueNoCheck (COLUMNNAME_QtyDeliveredInUOM_Override, QtyDeliveredInUOM_Override);
}
@Override
public BigDecimal getQtyDeliveredInUOM_Override()
{ | final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyDeliveredInUOM_Override);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyInvoiced (final BigDecimal QtyInvoiced)
{
set_Value (COLUMNNAME_QtyInvoiced, QtyInvoiced);
}
@Override
public BigDecimal getQtyInvoiced()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyInvoiced);
return bd != null ? bd : BigDecimal.ZERO;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\de\metas\invoicecandidate\model\X_C_InvoiceCandidate_InOutLine.java | 1 |
请完成以下Java代码 | static boolean shouldRetrieveUserInfo(OidcUserRequest userRequest) {
// Auto-disabled if UserInfo Endpoint URI is not provided
ClientRegistration.ProviderDetails providerDetails = userRequest.getClientRegistration().getProviderDetails();
if (StringUtils.hasLength(providerDetails.getUserInfoEndpoint().getUri())
&& AuthorizationGrantType.AUTHORIZATION_CODE
.equals(userRequest.getClientRegistration().getAuthorizationGrantType())) {
return true;
}
return false;
}
static OidcUser getUser(OidcUserSource userMetadata) {
OidcUserRequest userRequest = userMetadata.getUserRequest();
OidcUserInfo userInfo = userMetadata.getUserInfo();
Set<GrantedAuthority> authorities = new LinkedHashSet<>();
ClientRegistration.ProviderDetails providerDetails = userRequest.getClientRegistration().getProviderDetails();
String userNameAttributeName = providerDetails.getUserInfoEndpoint().getUserNameAttributeName();
if (StringUtils.hasText(userNameAttributeName)) { | authorities.add(new OidcUserAuthority(userRequest.getIdToken(), userInfo, userNameAttributeName));
}
else {
authorities.add(new OidcUserAuthority(userRequest.getIdToken(), userInfo));
}
OAuth2AccessToken token = userRequest.getAccessToken();
for (String scope : token.getScopes()) {
authorities.add(new SimpleGrantedAuthority("SCOPE_" + scope));
}
if (StringUtils.hasText(userNameAttributeName)) {
return new DefaultOidcUser(authorities, userRequest.getIdToken(), userInfo, userNameAttributeName);
}
return new DefaultOidcUser(authorities, userRequest.getIdToken(), userInfo);
}
private OidcUserRequestUtils() {
}
} | repos\spring-security-main\oauth2\oauth2-client\src\main\java\org\springframework\security\oauth2\client\oidc\userinfo\OidcUserRequestUtils.java | 1 |
请完成以下Java代码 | 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);
}
public I_M_InOutLine getM_InOutLine() throws RuntimeException
{
return (I_M_InOutLine)MTable.get(getCtx(), I_M_InOutLine.Table_Name)
.getPO(getM_InOutLine_ID(), get_TrxName()); }
/** Set Shipment/Receipt Line.
@param M_InOutLine_ID
Line on Shipment or Receipt document
*/
public void setM_InOutLine_ID (int M_InOutLine_ID)
{
if (M_InOutLine_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_InOutLine_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_InOutLine_ID, Integer.valueOf(M_InOutLine_ID));
}
/** Get Shipment/Receipt Line.
@return Line on Shipment or Receipt document
*/
public int getM_InOutLine_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_InOutLine_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_M_Package getM_Package() throws RuntimeException
{
return (I_M_Package)MTable.get(getCtx(), I_M_Package.Table_Name)
.getPO(getM_Package_ID(), get_TrxName()); }
/** Set Package.
@param M_Package_ID
Shipment Package
*/
public void setM_Package_ID (int M_Package_ID)
{
if (M_Package_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Package_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Package_ID, Integer.valueOf(M_Package_ID));
}
/** Get Package.
@return Shipment Package
*/
public int getM_Package_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Package_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/ | public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), String.valueOf(getM_Package_ID()));
}
/** Set Package Line.
@param M_PackageLine_ID
The detail content of the Package
*/
public void setM_PackageLine_ID (int M_PackageLine_ID)
{
if (M_PackageLine_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_PackageLine_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_PackageLine_ID, Integer.valueOf(M_PackageLine_ID));
}
/** Get Package Line.
@return The detail content of the Package
*/
public int getM_PackageLine_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_PackageLine_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Quantity.
@param Qty
Quantity
*/
public void setQty (BigDecimal Qty)
{
set_Value (COLUMNNAME_Qty, Qty);
}
/** Get Quantity.
@return Quantity
*/
public BigDecimal getQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty);
if (bd == null)
return Env.ZERO;
return bd;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_PackageLine.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class ServicesComponent implements ServicesApiDelegate {
private static final Logger LOG = LoggerFactory.getLogger(ServicesComponent.class);
private final UserService userService;
public ServicesComponent(@Autowired UserService userService) {
this.userService = userService;
}
@Override
public ResponseEntity<List<User>> servicesUsersGet() {
LOG.info("get users");
return ResponseEntity.ok(userService.getUsers());
} | @Override
public ResponseEntity<User> servicesUserPost(CreateUser createUser) {
LOG.info("create user");
return ResponseEntity.ok(userService.createUser(createUser.getName(), createUser.getEmail(), createUser.getEnabled()));
}
@Override
public ResponseEntity<Void> servicesUsersUserIdDelete(String userId) {
LOG.info("delete user");
userService.delete(userId);
return ResponseEntity.ok().build();
}
} | repos\spring-examples-java-17\spring-api-first\src\main\java\itx\examples\apifirst\component\ServicesComponent.java | 2 |
请完成以下Java代码 | protected void options() {
this.algorithm = option(Arrays.asList("algorithm", "a"),
"The algorithm to use. Supported algorithms: "
+ StringUtils.collectionToDelimitedString(ENCODERS.keySet(), ", ")
+ ". The default algorithm uses bcrypt")
.withRequiredArg()
.defaultsTo("default");
}
@Override
protected ExitStatus run(OptionSet options) {
if (options.nonOptionArguments().size() != 1) {
Log.error("A single password option must be provided");
return ExitStatus.ERROR;
} | String algorithm = options.valueOf(this.algorithm);
String password = (String) options.nonOptionArguments().get(0);
Supplier<PasswordEncoder> encoder = ENCODERS.get(algorithm);
if (encoder == null) {
Log.error("Unknown algorithm, valid options are: "
+ StringUtils.collectionToCommaDelimitedString(ENCODERS.keySet()));
return ExitStatus.ERROR;
}
Log.info(encoder.get().encode(password));
return ExitStatus.OK;
}
}
} | repos\spring-boot-4.0.1\cli\spring-boot-cli\src\main\java\org\springframework\boot\cli\command\encodepassword\EncodePasswordCommand.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public String getParentDeploymentId() {
return parentDeploymentId;
}
public void setParentDeploymentId(String parentDeploymentId) {
this.parentDeploymentId = parentDeploymentId;
} | public List<EngineRestVariable> getInputVariables() {
return inputVariables;
}
public void setInputVariables(List<EngineRestVariable> variables) {
this.inputVariables = variables;
}
public boolean isDisableHistory() {
return disableHistory;
}
public void setDisableHistory(boolean disableHistory) {
this.disableHistory = disableHistory;
}
} | repos\flowable-engine-main\modules\flowable-dmn-rest\src\main\java\org\flowable\dmn\rest\service\api\decision\DmnRuleServiceRequest.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class LoginOptionsController {
private final List<LoginOptionDto> loginOptions;
public LoginOptionsController(OAuth2ClientProperties clientProps, SpringAddonsOidcProperties addonsProperties) {
final var clientAuthority = addonsProperties.getClient()
.getClientUri()
.getAuthority();
this.loginOptions = clientProps.getRegistration()
.entrySet()
.stream()
.filter(e -> "authorization_code".equals(e.getValue()
.getAuthorizationGrantType()))
.map(e -> {
final var label = e.getValue()
.getProvider();
final var loginUri = "%s/oauth2/authorization/%s".formatted(addonsProperties.getClient()
.getClientUri(), e.getKey());
final var providerId = clientProps.getRegistration()
.get(e.getKey()) | .getProvider();
final var providerIssuerAuthority = URI.create(clientProps.getProvider()
.get(providerId)
.getIssuerUri())
.getAuthority();
return new LoginOptionDto(label, loginUri, Objects.equals(clientAuthority, providerIssuerAuthority));
})
.toList();
}
@GetMapping(path = "/login-options", produces = MediaType.APPLICATION_JSON_VALUE)
public Mono<List<LoginOptionDto>> getLoginOptions() throws URISyntaxException {
return Mono.just(this.loginOptions);
}
public static record LoginOptionDto(@NotEmpty String label, @NotEmpty String loginUri, boolean isSameAuthority) {
}
} | repos\tutorials-master\spring-security-modules\spring-security-oauth2-bff\backend\bff\src\main\java\com\baeldung\bff\LoginOptionsController.java | 2 |
请完成以下Java代码 | private DocumentIdsSelection getSelectedInvoiceRowIds()
{
return getChildViewSelectedRowIds();
}
//
//
//
protected final ImmutableList<PaymentRow> getPaymentRowsSelectedForAllocation()
{
ImmutableList<PaymentRow> paymentRowsSelectedForAllocation = this._paymentRowsSelectedForAllocation;
if (paymentRowsSelectedForAllocation == null)
{
paymentRowsSelectedForAllocation = this._paymentRowsSelectedForAllocation = computePaymentRowsSelectedForAllocation();
}
return paymentRowsSelectedForAllocation;
}
private ImmutableList<PaymentRow> computePaymentRowsSelectedForAllocation()
{
final DocumentIdsSelection selectedPaymentRowIds = getSelectedPaymentRowIdsIncludingDefaultRow();
return getPaymentsView().streamByIds(selectedPaymentRowIds)
.filter(row -> !row.equals(PaymentRow.DEFAULT_PAYMENT_ROW))
.collect(ImmutableList.toImmutableList());
}
protected final ImmutableList<InvoiceRow> getInvoiceRowsSelectedForAllocation()
{
ImmutableList<InvoiceRow> invoiceRowsSelectedForAllocation = this._invoiceRowsSelectedForAllocation;
if (invoiceRowsSelectedForAllocation == null)
{
invoiceRowsSelectedForAllocation = this._invoiceRowsSelectedForAllocation = computeInvoiceRowsSelectedForAllocation();
}
return invoiceRowsSelectedForAllocation;
} | private ImmutableList<InvoiceRow> computeInvoiceRowsSelectedForAllocation()
{
final InvoicesView invoicesView = getInvoicesView();
if (InvoicesViewFactory.isEnablePreparedForAllocationFlag())
{
return invoicesView
.streamByIds(DocumentIdsSelection.ALL)
.filter(InvoiceRow::isPreparedForAllocation)
.collect(ImmutableList.toImmutableList());
}
else
{
return invoicesView
.streamByIds(getSelectedInvoiceRowIds())
.collect(ImmutableList.toImmutableList());
}
}
protected final void invalidatePaymentsAndInvoicesViews()
{
final InvoicesView invoicesView = getInvoicesView();
invoicesView.unmarkPreparedForAllocation(DocumentIdsSelection.ALL);
invalidateView(invoicesView);
invalidateView(getPaymentsView());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\payment_allocation\process\PaymentsViewBasedProcess.java | 1 |
请完成以下Spring Boot application配置 | bael:
root-level-property: defaultRootLevelValue
spring:
profiles:
# Multiple profiles for MultipleYamlApplication first example
# include:
# - teachers
# - students
group:
multidocument-integration: multidocument-integration-extension
---
spring:
config:
activate:
on-profile: multidocument-staging
datasource:
password: 'password'
url: jdbc:h2:staging
username: SA
bael:
property: stagingValue
stagingProperty: stagingPropertyValue
---
application:
servers:
- ip: '127.0.0.1'
path: '/path1'
- ip: '127.0.0.2'
path: '/path2'
- ip: '127.0.0.3'
path: '/path3'
t-shirt-size:
simple-mapping:
XS: 6
S: 8
M: 10
L: 12
XL: 14
| complex-mapping:
XS:
uk: 6
fr: 34
us: 2
S:
uk: 8
fr: 36
us: 4
M:
uk: 10
fr: 38
us: 6
L:
uk: 12
fr: 40
us: 8
XL:
uk: 14
fr: 42
us: 10
---
management:
endpoints:
web:
exposure:
include: env, health | repos\tutorials-master\spring-boot-modules\spring-boot-properties-3\src\main\resources\application.yml | 2 |
请完成以下Java代码 | public final class ClientSecretPostAuthenticationConverter implements AuthenticationConverter {
@Nullable
@Override
public Authentication convert(HttpServletRequest request) {
MultiValueMap<String, String> parameters = OAuth2EndpointUtils.getFormParameters(request);
// client_id (REQUIRED)
String clientId = parameters.getFirst(OAuth2ParameterNames.CLIENT_ID);
if (!StringUtils.hasText(clientId)) {
return null;
}
if (parameters.get(OAuth2ParameterNames.CLIENT_ID).size() != 1) {
throw new OAuth2AuthenticationException(OAuth2ErrorCodes.INVALID_REQUEST);
}
// client_secret (REQUIRED)
String clientSecret = parameters.getFirst(OAuth2ParameterNames.CLIENT_SECRET);
if (!StringUtils.hasText(clientSecret)) {
return null; | }
if (parameters.get(OAuth2ParameterNames.CLIENT_SECRET).size() != 1) {
throw new OAuth2AuthenticationException(OAuth2ErrorCodes.INVALID_REQUEST);
}
Map<String, Object> additionalParameters = OAuth2EndpointUtils
.getParametersIfMatchesAuthorizationCodeGrantRequest(request, OAuth2ParameterNames.CLIENT_ID,
OAuth2ParameterNames.CLIENT_SECRET);
return new OAuth2ClientAuthenticationToken(clientId, ClientAuthenticationMethod.CLIENT_SECRET_POST,
clientSecret, additionalParameters);
}
} | repos\spring-security-main\oauth2\oauth2-authorization-server\src\main\java\org\springframework\security\oauth2\server\authorization\web\authentication\ClientSecretPostAuthenticationConverter.java | 1 |
请完成以下Java代码 | protected final Object getRecord()
{
return record;
}
private Properties getCtx()
{
return InterfaceWrapperHelper.getCtx(getRecord());
}
@SuppressWarnings("OptionalAssignedToNull")
private Optional<DocOutboundConfig> getDocOutboundConfig()
{
if (_docOutboundConfig == null)
{
_docOutboundConfig = retrieveDocOutboundConfig();
}
return _docOutboundConfig;
}
private Optional<DocOutboundConfig> retrieveDocOutboundConfig()
{
final DocOutboundConfig docOutboundConfig = docOutboundConfigService.retrieveConfigForModel(getRecord());
logger.debug("Using config: {}", docOutboundConfig);
return Optional.ofNullable(docOutboundConfig);
} | private Optional<PrintFormatId> getPrintFormatId()
{
// Favor the Report Process if any
if (reportProcessId != null)
{
return Optional.empty();
}
// Then check the print format
else if (printFormatId != null)
{
return Optional.of(printFormatId);
}
// Else, fallback to doc outbound config
else
{
return getDocOutboundConfig().map(DocOutboundConfig::getPrintFormatId);
}
}
@NonNull
private Optional<String> getCCPath()
{
return getDocOutboundConfig().map(DocOutboundConfig::getCcPath);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.document.archive\de.metas.document.archive.base\src\main\java\de\metas\document\archive\spi\impl\DefaultModelArchiver.java | 1 |
请在Spring Boot框架中完成以下Java代码 | static class VerboseDisabled {
}
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(name = "spring.cloud.gateway.server.webflux.enabled", matchIfMissing = true)
@ConditionalOnClass({ OAuth2AuthorizedClient.class, SecurityWebFilterChain.class, SecurityProperties.class })
@ConditionalOnEnabledFilter(TokenRelayGatewayFilterFactory.class)
protected static class TokenRelayConfiguration {
@Bean
public TokenRelayGatewayFilterFactory tokenRelayGatewayFilterFactory(
ObjectProvider<ReactiveOAuth2AuthorizedClientManager> clientManager) {
return new TokenRelayGatewayFilterFactory(clientManager);
}
}
}
class GatewayHints implements RuntimeHintsRegistrar { | @Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
if (!ClassUtils.isPresent("org.springframework.cloud.gateway.route.RouteLocator", classLoader)) {
return;
}
hints.reflection()
.registerType(TypeReference.of(FilterDefinition.class),
hint -> hint.withMembers(MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_DECLARED_METHODS,
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS))
.registerType(TypeReference.of(PredicateDefinition.class),
hint -> hint.withMembers(MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_DECLARED_METHODS,
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS))
.registerType(TypeReference.of(AbstractNameValueGatewayFilterFactory.NameValueConfig.class),
hint -> hint.withMembers(MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_DECLARED_METHODS,
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS))
.registerType(TypeReference
.of("org.springframework.cloud.gateway.discovery.DiscoveryClientRouteDefinitionLocator$DelegatingServiceInstance"),
hint -> hint.withMembers(MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_DECLARED_METHODS,
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS));
}
} | repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webflux\src\main\java\org\springframework\cloud\gateway\config\GatewayAutoConfiguration.java | 2 |
请完成以下Java代码 | public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public LocalDate getDob() {
return dob;
}
public void setDob(LocalDate dob) {
this.dob = dob;
}
public Long getAge() {
return age;
}
public void setAge(Long age) {
this.age = age;
} | public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("[");
sb.append(this.name);
sb.append(",");
sb.append(this.dob.format(DateTimeFormatter.ofPattern("MM/dd/yyyy")));
if (this.age != null) {
sb.append(",");
sb.append(this.age);
}
sb.append("]");
return sb.toString();
}
} | repos\tutorials-master\spring-batch\src\main\java\com\baeldung\taskletsvschunks\model\Line.java | 1 |
请完成以下Java代码 | public java.lang.String getDocumentNo ()
{
return (java.lang.String)get_Value(COLUMNNAME_DocumentNo);
}
/** Set Verarbeitet.
@param Processed
Checkbox sagt aus, ob der Beleg verarbeitet wurde.
*/
@Override
public void setProcessed (boolean Processed)
{
set_ValueNoCheck (COLUMNNAME_Processed, Boolean.valueOf(Processed));
}
/** Get Verarbeitet.
@return Checkbox sagt aus, ob der Beleg verarbeitet wurde.
*/
@Override
public boolean isProcessed ()
{
Object oo = get_Value(COLUMNNAME_Processed);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Process Now.
@param Processing Process Now */
@Override
public void setProcessing (boolean Processing)
{ | set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
}
/** Get Process Now.
@return Process Now */
@Override
public boolean isProcessing ()
{
Object oo = get_Value(COLUMNNAME_Processing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Customs_Invoice.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class ExternalSystemLeichMehlConfigId implements IExternalSystemChildConfigId
{
int repoId;
@JsonCreator
@NonNull
public static ExternalSystemLeichMehlConfigId ofRepoId(final int repoId)
{
return new ExternalSystemLeichMehlConfigId(repoId);
}
@Nullable
public static ExternalSystemLeichMehlConfigId ofRepoIdOrNull(@Nullable final Integer repoId)
{
return repoId != null && repoId > 0 ? new ExternalSystemLeichMehlConfigId(repoId) : null;
}
public static ExternalSystemLeichMehlConfigId cast(@NonNull final IExternalSystemChildConfigId id)
{
return (ExternalSystemLeichMehlConfigId)id; | }
@JsonValue
public int toJson()
{
return getRepoId();
}
private ExternalSystemLeichMehlConfigId(final int repoId)
{
this.repoId = Check.assumeGreaterThanZero(repoId, I_ExternalSystem_Config_LeichMehl.COLUMNNAME_ExternalSystem_Config_LeichMehl_ID);
}
@Override
public ExternalSystemType getType()
{
return ExternalSystemType.LeichUndMehl;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java\de\metas\externalsystem\leichmehl\ExternalSystemLeichMehlConfigId.java | 2 |
请完成以下Java代码 | protected void persistDefinition(CaseDefinitionEntity definition) {
getCaseDefinitionManager().insertCaseDefinition(definition);
}
@Override
protected void addDefinitionToDeploymentCache(DeploymentCache deploymentCache, CaseDefinitionEntity definition) {
deploymentCache.addCaseDefinition(definition);
}
// context ///////////////////////////////////////////////////////////////////////////////////////////
protected CaseDefinitionManager getCaseDefinitionManager() {
return getCommandContext().getCaseDefinitionManager();
}
// getters/setters ///////////////////////////////////////////////////////////////////////////////////
public ExpressionManager getExpressionManager() {
return expressionManager; | }
public void setExpressionManager(ExpressionManager expressionManager) {
this.expressionManager = expressionManager;
}
public CmmnTransformer getTransformer() {
return transformer;
}
public void setTransformer(CmmnTransformer transformer) {
this.transformer = transformer;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmmn\deployer\CmmnDeployer.java | 1 |
请完成以下Java代码 | private ImmutableSet<LocationId> retrieveLocationIdsToUpdate(final int limit)
{
return Services.get(IQueryBL.class)
.createQueryBuilderOutOfTrx(I_C_Location.class)
//
.addOnlyActiveRecordsFilter()
.addInArrayOrAllFilter(I_C_Location.COLUMN_GeocodingStatus, Arrays.asList(X_C_Location.GEOCODINGSTATUS_Error, X_C_Location.GEOCODINGSTATUS_NotChecked))
//
.addCompareFilter(I_C_Location.COLUMN_C_Location_ID, Operator.GREATER, LocationId.toRepoIdOr(maxLocationIdScheduled, 0))
.orderBy(I_C_Location.COLUMN_C_Location_ID)
//
.setLimit(limit)
//
.create()
.idsAsSet(LocationId::ofRepoId);
}
private void scheduleUpdates(@NonNull final Set<LocationId> locationIds)
{
locationIds.forEach(this::scheduleUpdate);
} | private void scheduleUpdate(@NonNull final LocationId locationId)
{
eventBus.enqueueObject(LocationGeocodeEventRequest.of(locationId));
countScheduled++;
if (maxLocationIdScheduled == null)
{
maxLocationIdScheduled = locationId;
}
else
{
maxLocationIdScheduled = Collections.max(Arrays.asList(maxLocationIdScheduled, locationId));
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\location\geocoding\process\C_Location_Geocoding_ScheduleUpdate.java | 1 |
请完成以下Java代码 | public static int getDefault_UOM_ID(Properties ctx)
{
String sql = "SELECT C_UOM_ID "
+ "FROM C_UOM "
+ "WHERE AD_Client_ID IN (0,?) "
+ "ORDER BY IsDefault DESC, AD_Client_ID DESC, C_UOM_ID";
return DB.getSQLValue(null, sql, Env.getAD_Client_ID(ctx));
} // getDefault_UOM_ID
/*************************************************************************/
/** UOM Cache */
private static CCache<Integer, MUOM> s_cache = new CCache<>(Table_Name, 30);
/**
* Get UOM from Cache
*
* @param ctx context
* @param C_UOM_ID ID
* @return UOM
*/
@Deprecated
public static MUOM get(Properties ctx, int C_UOM_ID)
{
if (s_cache.size() == 0)
{
loadUOMs(ctx);
}
//
MUOM uom = s_cache.get(C_UOM_ID);
if (uom != null)
{
return uom;
}
//
uom = new MUOM(ctx, C_UOM_ID, null);
s_cache.put(C_UOM_ID, uom);
return uom;
} // get
/**
* Get Precision
*
* @param ctx context
* @param C_UOM_ID ID
* @return Precision
*/
@Deprecated
public static int getPrecision(Properties ctx, int C_UOM_ID)
{
if(C_UOM_ID <= 0)
{
return 2;
}
return Services.get(IUOMDAO.class)
.getStandardPrecision(UomId.ofRepoId(C_UOM_ID))
.toInt();
} // getPrecision
/**
* Load All UOMs
* | * @param ctx context
*/
private static void loadUOMs(Properties ctx)
{
List<MUOM> list = new Query(ctx, Table_Name, "IsActive='Y'", null)
.setRequiredAccess(Access.READ)
.list(MUOM.class);
//
for (MUOM uom : list)
{
s_cache.put(uom.get_ID(), uom);
}
} // loadUOMs
public MUOM(Properties ctx, int C_UOM_ID, String trxName)
{
super(ctx, C_UOM_ID, trxName);
if (is_new())
{
// setName (null);
// setX12DE355 (null);
setIsDefault(false);
setStdPrecision(2);
setCostingPrecision(6);
}
} // UOM
public MUOM(Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
} // UOM
} // MUOM | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MUOM.java | 1 |
请完成以下Java代码 | public String getFormInstanceId() {
return formInstanceId;
}
public void setFormInstanceId(String formInstanceId) {
this.formInstanceId = formInstanceId;
}
public String getSubmittedBy() {
return submittedBy;
}
public void setSubmittedBy(String submittedBy) {
this.submittedBy = submittedBy;
}
public Date getSubmittedDate() {
return submittedDate;
}
public void setSubmittedDate(Date submittedDate) {
this.submittedDate = submittedDate;
}
public String getSelectedOutcome() {
return selectedOutcome;
}
public void setSelectedOutcome(String selectedOutcome) {
this.selectedOutcome = selectedOutcome;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public void setProcessDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
}
public String getScopeId() { | return scopeId;
}
public void setScopeId(String scopeId) {
this.scopeId = scopeId;
}
public String getScopeType() {
return scopeType;
}
public void setScopeType(String scopeType) {
this.scopeType = scopeType;
}
public String getScopeDefinitionId() {
return scopeDefinitionId;
}
public void setScopeDefinitionId(String scopeDefinitionId) {
this.scopeDefinitionId = scopeDefinitionId;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
} | repos\flowable-engine-main\modules\flowable-form-api\src\main\java\org\flowable\form\api\FormInstanceInfo.java | 1 |
请完成以下Java代码 | public boolean isForCompensation() {
return isForCompensationAttribute.getValue(this);
}
public void setForCompensation(boolean isForCompensation) {
isForCompensationAttribute.setValue(this, isForCompensation);
}
public int getStartQuantity() {
return startQuantityAttribute.getValue(this);
}
public void setStartQuantity(int startQuantity) {
startQuantityAttribute.setValue(this, startQuantity);
}
public int getCompletionQuantity() {
return completionQuantityAttribute.getValue(this);
}
public void setCompletionQuantity(int completionQuantity) {
completionQuantityAttribute.setValue(this, completionQuantity);
}
public SequenceFlow getDefault() {
return defaultAttribute.getReferenceTargetElement(this);
}
public void setDefault(SequenceFlow defaultFlow) {
defaultAttribute.setReferenceTargetElement(this, defaultFlow);
}
public IoSpecification getIoSpecification() {
return ioSpecificationChild.getChild(this);
}
public void setIoSpecification(IoSpecification ioSpecification) {
ioSpecificationChild.setChild(this, ioSpecification);
}
public Collection<Property> getProperties() {
return propertyCollection.get(this);
} | public Collection<DataInputAssociation> getDataInputAssociations() {
return dataInputAssociationCollection.get(this);
}
public Collection<DataOutputAssociation> getDataOutputAssociations() {
return dataOutputAssociationCollection.get(this);
}
public Collection<ResourceRole> getResourceRoles() {
return resourceRoleCollection.get(this);
}
public LoopCharacteristics getLoopCharacteristics() {
return loopCharacteristicsChild.getChild(this);
}
public void setLoopCharacteristics(LoopCharacteristics loopCharacteristics) {
loopCharacteristicsChild.setChild(this, loopCharacteristics);
}
} | repos\camunda-bpm-platform-master\model-api\bpmn-model\src\main\java\org\camunda\bpm\model\bpmn\impl\instance\ActivityImpl.java | 1 |
请完成以下Java代码 | public String toString()
{
return MoreObjects.toStringHelper(this)
.add("asiDescriptorId", asiDescriptorId)
.add("caption", caption)
.add("elements-count", elementBuilders.size())
.toString();
}
public Builder setASIDescriptorId(final DocumentId asiDescriptorId)
{
this.asiDescriptorId = asiDescriptorId;
return this;
}
public Builder setCaption(final ITranslatableString caption)
{
this.caption = caption; | return this;
}
public Builder setDescription(final ITranslatableString description)
{
this.description = description;
return this;
}
public Builder addElement(final DocumentLayoutElementDescriptor.Builder elementBuilder)
{
Check.assumeNotNull(elementBuilder, "Parameter elementBuilder is not null");
elementBuilders.add(elementBuilder);
return this;
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\pattribute\ASILayout.java | 1 |
请完成以下Java代码 | private Optional<Resource> retrieveResource() {
Resource resource = resourceLoader.getResource(projectManifestFilePath);
if (resource.exists()) {
return Optional.of(resource);
} else {
return Optional.empty();
}
}
private ProjectManifest read(InputStream inputStream) throws IOException {
return objectMapper.readValue(inputStream, ProjectManifest.class);
}
public boolean isRollbackDeployment() {
return isRollbackDeployment;
}
public ProjectManifest loadProjectManifest() throws IOException {
Optional<Resource> resourceOptional = retrieveResource();
return read(
resourceOptional | .orElseThrow(() -> new FileNotFoundException("'" + projectManifestFilePath + "' manifest not found."))
.getInputStream()
);
}
public boolean hasProjectManifest() {
return retrieveResource().isPresent();
}
public boolean hasEnforcedAppVersion() {
return this.enforcedAppVersion > 0;
}
public Integer getEnforcedAppVersion() {
return this.enforcedAppVersion;
}
} | repos\Activiti-develop\activiti-core-common\activiti-spring-project\src\main\java\org\activiti\core\common\spring\project\ApplicationUpgradeContextService.java | 1 |
请完成以下Java代码 | public AttributeListValue generateAttributeValue(final Properties ctx, final int tableId, final int recordId, final boolean isSOTrx, final String trxName)
{
final IContextAware context = new PlainContextAware(ctx, trxName);
final ITableRecordReference record = TableRecordReference.of(tableId, recordId);
final I_C_BPartner partner = record.getModel(context, I_C_BPartner.class);
Check.assumeNotNull(partner, "partner not null");
final I_M_Attribute adrAttribute = Services.get(IADRAttributeDAO.class).retrieveADRAttribute(partner);
if (adrAttribute == null)
{
// ADR Attribute was not configured, nothing to do
return null;
}
final String adrRegionValue = Services.get(IADRAttributeBL.class).getADRForBPartner(partner, isSOTrx);
if (Check.isEmpty(adrRegionValue, true))
{
return null;
} | //
// Fetched AD_Ref_List record
final ADRefListItem adRefList = ADReferenceService.get().retrieveListItemOrNull(I_C_BPartner.ADRZertifizierung_L_AD_Reference_ID, adrRegionValue);
Check.assumeNotNull(adRefList, "adRefList not null");
final String adrRegionName = adRefList.getName().getDefaultValue();
return Services.get(IAttributeDAO.class).createAttributeValue(AttributeListValueCreateRequest.builder()
.attributeId(AttributeId.ofRepoId(adrAttribute.getM_Attribute_ID()))
.value(adrRegionValue)
.name(adrRegionName)
.build());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.fresh\de.metas.fresh.base\src\main\java\org\adempiere\mm\attributes\spi\impl\ADRAttributeGenerator.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public List<Person> q1(String address) {
List<Person> people = personRepository.findByAddress(address);
return people;
}
/**
* 测试findByNameAndAddress
*/
@RequestMapping("/q2")
public Person q2(String name, String address) {
Person people = personRepository.findByNameAndAddress(name, address);
return people;
}
/**
* 测试withNameAndAddressQuery
*/
@RequestMapping("/q3")
public Person q3(String name, String address) {
Person p = personRepository.withNameAndAddressQuery(name, address);
return p;
}
/**
* 测试withNameAndAddressNamedQuery
*/
@RequestMapping("/q4")
public Person q4(String name, String address) {
Person p = personRepository.withNameAndAddressNamedQuery(name, address);
return p; | }
/**
* 测试排序
*/
@RequestMapping("/sort")
public List<Person> sort() {
List<Person> people = personRepository.findAll(new Sort(Direction.ASC, "age"));
return people;
}
/**
* 测试分页
*/
@RequestMapping("/page")
public Page<Person> page(@RequestParam("pageNo") int pageNo, @RequestParam("pageSize") int pageSize) {
Page<Person> pagePeople = personRepository.findAll(new PageRequest(pageNo, pageSize));
return pagePeople;
}
} | repos\spring-boot-student-master\spring-boot-student-data-jpa\src\main\java\com\xiaolyuh\controller\DataController.java | 2 |
请完成以下Java代码 | public void setDocumentFlavor (final java.lang.String DocumentFlavor)
{
set_Value (COLUMNNAME_DocumentFlavor, DocumentFlavor);
}
@Override
public java.lang.String getDocumentFlavor()
{
return get_ValueAsString(COLUMNNAME_DocumentFlavor);
}
@Override
public void setPRINTER_OPTS_IsPrintLogo (final boolean PRINTER_OPTS_IsPrintLogo)
{
set_Value (COLUMNNAME_PRINTER_OPTS_IsPrintLogo, PRINTER_OPTS_IsPrintLogo);
}
@Override
public boolean isPRINTER_OPTS_IsPrintLogo() | {
return get_ValueAsBoolean(COLUMNNAME_PRINTER_OPTS_IsPrintLogo);
}
@Override
public void setPRINTER_OPTS_IsPrintTotals (final boolean PRINTER_OPTS_IsPrintTotals)
{
set_Value (COLUMNNAME_PRINTER_OPTS_IsPrintTotals, PRINTER_OPTS_IsPrintTotals);
}
@Override
public boolean isPRINTER_OPTS_IsPrintTotals()
{
return get_ValueAsBoolean(COLUMNNAME_PRINTER_OPTS_IsPrintTotals);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_DocType_PrintOptions.java | 1 |
请完成以下Java代码 | public String getScriptFormat() {
return scriptFormat;
}
public void setScriptFormat(String scriptFormat) {
this.scriptFormat = scriptFormat;
}
public String getScript() {
return script;
}
public void setScript(String script) {
this.script = script;
}
public String getResultVariable() {
return resultVariable;
}
public void setResultVariable(String resultVariable) {
this.resultVariable = resultVariable;
}
public String getSkipExpression() {
return skipExpression;
}
public void setSkipExpression(String skipExpression) {
this.skipExpression = skipExpression;
}
public boolean isAutoStoreVariables() {
return autoStoreVariables;
}
public void setAutoStoreVariables(boolean autoStoreVariables) {
this.autoStoreVariables = autoStoreVariables;
}
public boolean isDoNotIncludeVariables() {
return doNotIncludeVariables;
}
public void setDoNotIncludeVariables(boolean doNotIncludeVariables) { | this.doNotIncludeVariables = doNotIncludeVariables;
}
@Override
public List<IOParameter> getInParameters() {
return inParameters;
}
@Override
public void addInParameter(IOParameter inParameter) {
if (inParameters == null) {
inParameters = new ArrayList<>();
}
inParameters.add(inParameter);
}
@Override
public void setInParameters(List<IOParameter> inParameters) {
this.inParameters = inParameters;
}
@Override
public ScriptTask clone() {
ScriptTask clone = new ScriptTask();
clone.setValues(this);
return clone;
}
public void setValues(ScriptTask otherElement) {
super.setValues(otherElement);
setScriptFormat(otherElement.getScriptFormat());
setScript(otherElement.getScript());
setResultVariable(otherElement.getResultVariable());
setSkipExpression(otherElement.getSkipExpression());
setAutoStoreVariables(otherElement.isAutoStoreVariables());
setDoNotIncludeVariables(otherElement.isDoNotIncludeVariables());
inParameters = null;
if (otherElement.getInParameters() != null && !otherElement.getInParameters().isEmpty()) {
inParameters = new ArrayList<>();
for (IOParameter parameter : otherElement.getInParameters()) {
inParameters.add(parameter.clone());
}
}
}
} | repos\flowable-engine-main\modules\flowable-bpmn-model\src\main\java\org\flowable\bpmn\model\ScriptTask.java | 1 |
请在Spring Boot框架中完成以下Java代码 | private Map<PickingJobId, Boolean> computePickingJobHasLocks(@NonNull final Set<PickingJobId> pickingJobIds)
{
if (pickingJobIds.isEmpty())
{
return ImmutableMap.of();
}
final ImmutableSetMultimap<PickingJobId, ShipmentScheduleAndJobScheduleId> scheduleIdsByPickingJobId = getScheduleIds(pickingJobIds);
final ShipmentScheduleAndJobScheduleIdSet scheduleIds = ShipmentScheduleAndJobScheduleIdSet.ofCollection(scheduleIdsByPickingJobId.values());
final ScheduledPackageableLocks existingLocks = loadingSupportingServices.getLocks(scheduleIds);
final ImmutableMap.Builder<PickingJobId, Boolean> result = ImmutableMap.builder();
for (final PickingJobId pickingJobId : pickingJobIds)
{
final boolean hasLocks = existingLocks.isLockedAnyOf(scheduleIdsByPickingJobId.get(pickingJobId));
result.put(pickingJobId, hasLocks);
}
return result.build();
}
private OptionalBoolean getShipmentSchedulesIsLocked(@NonNull final PickingJobId pickingJobId)
{ | return OptionalBoolean.ofNullableBoolean(hasLocks.get(pickingJobId));
}
private PickingUnit computePickingUnit(@Nullable final UomId catchUomId, @NonNull final HUPIItemProduct packingInfo, @NonNull final PickingJobOptions options)
{
// If catch weight, always pick at CU level because user has to weight the products
if (!options.isCatchWeightTUPickingEnabled() && catchUomId != null)
{
return PickingUnit.CU;
}
return packingInfo.isFiniteTU() ? PickingUnit.TU : PickingUnit.CU;
}
private PickingJobOptions getPickingJobOptions(@Nullable final BPartnerId customerId)
{
return loadingSupportingServices.getPickingJobOptions(customerId);
}
private PickingJobOptions getPickingJobOptions(@Nullable final BPartnerLocationId deliveryLocationId)
{
return loadingSupportingServices.getPickingJobOptions(deliveryLocationId != null ? deliveryLocationId.getBpartnerId() : null);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\job\repository\PickingJobLoaderAndSaver.java | 2 |
请完成以下Java代码 | public static BPSupplierApprovalId ofRepoId(final int repoId)
{
return new BPSupplierApprovalId(repoId);
}
@Nullable
public static BPSupplierApprovalId ofRepoIdOrNull(@Nullable final Integer repoId)
{
return repoId != null && repoId > 0 ? new BPSupplierApprovalId(repoId) : null;
}
@Nullable
public static BPSupplierApprovalId ofRepoIdOrNull(final int repoId)
{
return repoId > 0 ? new BPSupplierApprovalId(repoId) : null;
}
public static Optional<BPSupplierApprovalId> optionalOfRepoId(final int repoId)
{
return Optional.ofNullable(ofRepoIdOrNull(repoId));
} | public static int toRepoId(@Nullable final BPSupplierApprovalId bpSupplierApprovalId)
{
return toRepoIdOr(bpSupplierApprovalId, -1);
}
public static int toRepoIdOr(@Nullable final BPSupplierApprovalId bpSupplierApprovalId, final int defaultValue)
{
return bpSupplierApprovalId != null ? bpSupplierApprovalId.getRepoId() : defaultValue;
}
private BPSupplierApprovalId(final int repoId)
{
this.repoId = Check.assumeGreaterThanZero(repoId, "C_BP_SupplierApproval_ID");
}
@JsonValue
public int toJson()
{
return getRepoId();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\bpartner\BPSupplierApprovalId.java | 1 |
请完成以下Java代码 | public void exitAddSub(LabeledExprParser.AddSubContext ctx) {
int left = values.get(ctx.expr(0));
int right = values.get(ctx.expr(1));
if (ctx.op.getType() == LabeledExprParser.ADD) {
values.put(ctx, left + right);
} else {
values.put(ctx, left - right);
}
}
@Override
public void exitInt(LabeledExprParser.IntContext ctx) {
int value = Integer.parseInt(ctx.INT().getText());
values.put(ctx, value);
} | @Override
public void exitId(LabeledExprParser.IdContext ctx) {
String id = ctx.ID().getText();
if (memory.containsKey(id)) {
values.put(ctx, memory.get(id));
} else {
values.put(ctx, 0); // default value if the variable is not found
}
}
@Override
public void exitParens(LabeledExprParser.ParensContext ctx) {
values.put(ctx, values.get(ctx.expr()));
}
} | repos\springboot-demo-master\ANTLR\src\main\java\com\et\antlr\EvalListener.java | 1 |
请完成以下Java代码 | private boolean isBlockFinished(String line) {
return StringUtils.isBlank(line) || line.equals("\\.");
}
private boolean isBlockStarted(String line) {
return line.startsWith("COPY public.key_dictionary (");
}
private void parseDictionaryDump(LineIterator iterator) throws IOException {
try {
String tempLine;
while (iterator.hasNext()) {
tempLine = iterator.nextLine();
if (isBlockStarted(tempLine)) {
processBlock(iterator);
}
} | } finally {
iterator.close();
}
}
private void processBlock(LineIterator lineIterator) {
String tempLine;
String[] lineSplited;
while(lineIterator.hasNext()) {
tempLine = lineIterator.nextLine();
if(isBlockFinished(tempLine)) {
return;
}
lineSplited = tempLine.split("\t");
dictionaryParsed.put(lineSplited[1], lineSplited[0]);
}
}
} | repos\thingsboard-master\tools\src\main\java\org\thingsboard\client\tools\migrator\DictionaryParser.java | 1 |
请完成以下Java代码 | protected boolean isSystemPropertySet(@Nullable String propertyName) {
return StringUtils.hasText(propertyName) && StringUtils.hasText(System.getProperty(propertyName));
}
protected boolean isSystemPropertyNotSet(@Nullable String propertyName) {
return !isSystemPropertySet(propertyName);
}
protected void setSystemProperty(@NonNull String propertyName, @Nullable String propertyValue) {
Assert.hasText(propertyName, () -> String.format("PropertyName [%s] is required", propertyName));
if (StringUtils.hasText(propertyValue)) {
System.setProperty(propertyName, propertyValue);
} | }
@Override
public boolean supportsEventType(@NonNull ResolvableType eventType) {
Class<?> rawType = eventType.getRawClass();
return rawType != null && Arrays.stream(EVENT_TYPES).anyMatch(it -> it.isAssignableFrom(rawType));
}
@Override
public boolean supportsSourceType(@Nullable Class<?> sourceType) {
return sourceType != null && Arrays.stream(SOURCE_TYPES).anyMatch(it -> it.isAssignableFrom(sourceType));
}
} | repos\spring-boot-data-geode-main\spring-geode-project\spring-geode\src\main\java\org\springframework\geode\context\logging\GeodeLoggingApplicationListener.java | 1 |
请完成以下Java代码 | public class MessageParser implements BpmnXMLConstants {
public void parse(XMLStreamReader xtr, BpmnModel model) throws Exception {
if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_ID))) {
String messageId = xtr.getAttributeValue(null, ATTRIBUTE_ID);
String messageName = xtr.getAttributeValue(null, ATTRIBUTE_NAME);
String itemRef = parseItemRef(xtr.getAttributeValue(null, ATTRIBUTE_ITEM_REF), model);
Message message = new Message(messageId, messageName, itemRef);
BpmnXMLUtil.addXMLLocation(message, xtr);
BpmnXMLUtil.parseChildElements(ELEMENT_MESSAGE, message, xtr, model);
model.addMessage(message);
}
}
protected String parseItemRef(String itemRef, BpmnModel model) { | String result = null;
if (StringUtils.isNotEmpty(itemRef)) {
int indexOfP = itemRef.indexOf(':');
if (indexOfP != -1) {
String prefix = itemRef.substring(0, indexOfP);
String resolvedNamespace = model.getNamespace(prefix);
result = resolvedNamespace + ":" + itemRef.substring(indexOfP + 1);
} else {
String resolvedNamespace = model.getTargetNamespace();
result = resolvedNamespace + ":" + itemRef;
}
}
return result;
}
} | repos\Activiti-develop\activiti-core\activiti-bpmn-converter\src\main\java\org\activiti\bpmn\converter\parser\MessageParser.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public T findById(final long id) {
return getDao().findById(id).orElse(null);
}
// read - all
@Override
@Transactional(readOnly = true)
public List<T> findAll() {
return Lists.newArrayList(getDao().findAll());
}
// write
@Override
public T create(final T entity) {
return getDao().save(entity);
}
@Override
public T update(final T entity) {
return getDao().save(entity); | }
@Override
public void delete(final T entity) {
getDao().delete(entity);
}
@Override
public void deleteById(final long entityId) {
getDao().deleteById(entityId);
}
protected abstract JpaRepository<T, Long> getDao();
} | repos\tutorials-master\spring-web-modules\spring-boot-rest-2\src\main\java\com\baeldung\hateoas\persistence\service\common\AbstractService.java | 2 |
请完成以下Java代码 | public class OrderAttachmentView extends AbstractCustomView<OrderAttachmentRow> implements IEditableView
{
private final AttachmentEntryService attachmentEntryService;
@Builder
public OrderAttachmentView(
@NonNull final AttachmentEntryService attachmentEntryService,
@NonNull final ViewId viewId,
@Nullable final ITranslatableString description,
@NonNull final OrderAttachmentRows rows)
{
super(viewId, description, rows, NullDocumentFilterDescriptorsProvider.instance);
this.attachmentEntryService = attachmentEntryService;
}
@Nullable
@Override
public String getTableNameOrNull(@Nullable final DocumentId documentId)
{
return null;
}
@Override | public void close(final ViewCloseAction closeAction)
{
if (closeAction.isDone())
{
saveChanges();
}
}
@Override
protected OrderAttachmentRows getRowsData()
{
return OrderAttachmentRows.cast(super.getRowsData());
}
private void saveChanges()
{
getRowsData().createAttachmentLinksRequestList()
.ifPresent(userChanges -> userChanges.forEach(attachmentEntryService::handleAttachmentLinks));
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\order\attachmenteditor\OrderAttachmentView.java | 1 |
请完成以下Java代码 | public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age; | }
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
} | repos\spring-boot-student-master\spring-boot-student-drools\src\main\java\com\xiaolyuh\domain\model\Person.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class ArticleController {
@Autowired
private ArticleService articleService;
/**
* 列表
*/
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result list(@RequestParam Map<String, Object> params) {
if (StringUtils.isEmpty(params.get("page")) || StringUtils.isEmpty(params.get("limit"))) {
return ResultGenerator.genErrorResult(Constants.RESULT_CODE_PARAM_ERROR, "参数异常!");
}
//查询列表数据
PageUtil pageUtil = new PageUtil(params);
return ResultGenerator.genSuccessResult(articleService.getArticlePage(pageUtil));
}
/**
* 详情
*/
@RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
public Result info(@PathVariable("id") Integer id) {
Article article = articleService.queryObject(id);
return ResultGenerator.genSuccessResult(article);
}
/**
* 保存
*/
@RequestMapping(value = "/save", method = RequestMethod.POST)
public Result save(@RequestBody Article article, @TokenToUser AdminUser loginUser) {
if (article.getAddName()==null){
return ResultGenerator.genErrorResult(Constants.RESULT_CODE_PARAM_ERROR, "作者不能为空!");
}
if (loginUser == null) {
return ResultGenerator.genErrorResult(Constants.RESULT_CODE_NOT_LOGIN, "未登录!");
}
if (articleService.save(article) > 0) {
return ResultGenerator.genSuccessResult();
} else { | return ResultGenerator.genFailResult("添加失败");
}
}
/**
* 修改
*/
@RequestMapping(value = "/update", method = RequestMethod.PUT)
public Result update(@RequestBody Article article, @TokenToUser AdminUser loginUser) {
if (loginUser == null) {
return ResultGenerator.genErrorResult(Constants.RESULT_CODE_NOT_LOGIN, "未登录!");
}
if (articleService.update(article) > 0) {
return ResultGenerator.genSuccessResult();
} else {
return ResultGenerator.genFailResult("修改失败");
}
}
/**
* 删除
*/
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
public Result delete(@RequestBody Integer[] ids, @TokenToUser AdminUser loginUser) {
if (loginUser == null) {
return ResultGenerator.genErrorResult(Constants.RESULT_CODE_NOT_LOGIN, "未登录!");
}
if (ids.length < 1) {
return ResultGenerator.genErrorResult(Constants.RESULT_CODE_PARAM_ERROR, "参数异常!");
}
if (articleService.deleteBatch(ids) > 0) {
return ResultGenerator.genSuccessResult();
} else {
return ResultGenerator.genFailResult("删除失败");
}
}
} | repos\spring-boot-projects-main\SpringBoot前后端分离实战项目源码\spring-boot-project-front-end&back-end\src\main\java\cn\lanqiao\springboot3\controller\ArticleController.java | 2 |
请完成以下Java代码 | public void setProxyAddress (java.lang.String ProxyAddress)
{
set_Value (COLUMNNAME_ProxyAddress, ProxyAddress);
}
/** Get Proxy address.
@return Address of your proxy server
*/
@Override
public java.lang.String getProxyAddress ()
{
return (java.lang.String)get_Value(COLUMNNAME_ProxyAddress);
}
/** Set Proxy logon.
@param ProxyLogon
Logon of your proxy server
*/
@Override
public void setProxyLogon (java.lang.String ProxyLogon)
{
set_Value (COLUMNNAME_ProxyLogon, ProxyLogon);
}
/** Get Proxy logon.
@return Logon of your proxy server
*/
@Override
public java.lang.String getProxyLogon ()
{
return (java.lang.String)get_Value(COLUMNNAME_ProxyLogon);
}
/** Set Proxy-Passwort.
@param ProxyPassword
Password of your proxy server
*/
@Override
public void setProxyPassword (java.lang.String ProxyPassword)
{
set_Value (COLUMNNAME_ProxyPassword, ProxyPassword);
}
/** Get Proxy-Passwort.
@return Password of your proxy server
*/
@Override
public java.lang.String getProxyPassword ()
{
return (java.lang.String)get_Value(COLUMNNAME_ProxyPassword);
}
/** Set Proxy port.
@param ProxyPort
Port of your proxy server
*/
@Override
public void setProxyPort (int ProxyPort)
{
set_Value (COLUMNNAME_ProxyPort, Integer.valueOf(ProxyPort));
}
/** Get Proxy port.
@return Port of your proxy server
*/
@Override
public int getProxyPort ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_ProxyPort);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Require CreditCard Verification Code.
@param RequireVV
Require 3/4 digit Credit Verification Code
*/
@Override
public void setRequireVV (boolean RequireVV)
{
set_Value (COLUMNNAME_RequireVV, Boolean.valueOf(RequireVV));
} | /** Get Require CreditCard Verification Code.
@return Require 3/4 digit Credit Verification Code
*/
@Override
public boolean isRequireVV ()
{
Object oo = get_Value(COLUMNNAME_RequireVV);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set User ID.
@param UserID
User ID or account number
*/
@Override
public void setUserID (java.lang.String UserID)
{
set_Value (COLUMNNAME_UserID, UserID);
}
/** Get User ID.
@return User ID or account number
*/
@Override
public java.lang.String getUserID ()
{
return (java.lang.String)get_Value(COLUMNNAME_UserID);
}
/** Set Vendor ID.
@param VendorID
Vendor ID for the Payment Processor
*/
@Override
public void setVendorID (java.lang.String VendorID)
{
set_Value (COLUMNNAME_VendorID, VendorID);
}
/** Get Vendor ID.
@return Vendor ID for the Payment Processor
*/
@Override
public java.lang.String getVendorID ()
{
return (java.lang.String)get_Value(COLUMNNAME_VendorID);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_PaymentProcessor.java | 1 |
请完成以下Java代码 | protected void prepare()
{
// nothing
}
@Override
protected String doIt()
{
final I_DD_Order ddOrder = getDD_Order();
ddOrderLowLevelService.completeForwardAndBackwardDDOrders(ddOrder);
return MSG_OK;
}
private I_DD_Order getDD_Order()
{
if (p_ddOrder != null)
{
return p_ddOrder; | }
if (I_DD_Order.Table_Name.equals(getTableName()) && getRecord_ID() > 0)
{
p_ddOrder = InterfaceWrapperHelper.create(getCtx(), getRecord_ID(), I_DD_Order.class, get_TrxName());
}
if (p_ddOrder == null || p_ddOrder.getDD_Order_ID() <= 0)
{
throw new FillMandatoryException(I_DD_Order.COLUMNNAME_DD_Order_ID);
}
return p_ddOrder;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\process\DD_Order_CompleteForwardBackward.java | 1 |
请完成以下Java代码 | private LookupValue extractSalesOrder(@NonNull final I_M_ShipmentSchedule record)
{
final OrderId salesOrderId = OrderId.ofRepoIdOrNull(record.getC_Order_ID());
return salesOrderId != null
? salesOrdersLookup.findById(salesOrderId)
: null;
}
private LookupValue extractCustomer(@NonNull final I_M_ShipmentSchedule record)
{
final BPartnerId customerId = shipmentScheduleBL.getBPartnerId(record);
return customersLookup.findById(customerId);
}
private LookupValue extractWarehouse(@NonNull final I_M_ShipmentSchedule record)
{
final WarehouseId warehouseId = shipmentScheduleBL.getWarehouseId(record);
return warehousesLookup.findById(warehouseId);
}
private LookupValue extractProduct(@NonNull final I_M_ShipmentSchedule record)
{
final ProductId productId = ProductId.ofRepoId(record.getM_Product_ID());
return productsLookup.findById(productId);
}
@VisibleForTesting
static PackingInfo extractPackingInfo(@NonNull final I_M_ShipmentSchedule record)
{
final BigDecimal qtyCUsPerTU = record.getQtyItemCapacity();
if (qtyCUsPerTU == null || qtyCUsPerTU.signum() <= 0)
{
return PackingInfo.NONE;
}
else
{
return PackingInfo.builder()
.qtyCUsPerTU(qtyCUsPerTU)
.description(record.getPackDescription())
.build();
}
}
private LookupValue extractCatchUOM(@NonNull final I_M_ShipmentSchedule record)
{
final UomId catchUomId = UomId.ofRepoIdOrNull(record.getCatch_UOM_ID());
return catchUomId != null
? catchUOMsLookup.findById(catchUomId)
: null;
}
private LookupValue toLookupValue(@NonNull final AttributeSetInstanceId asiId)
{
return asiId.isRegular()
? asiLookup.findById(asiId)
: IntegerLookupValue.of(asiId.getRepoId(), "");
}
private ZonedDateTime extractPreparationTime(@NonNull final I_M_ShipmentSchedule record)
{
return shipmentScheduleBL.getPreparationDate(record);
} | private Quantity extractQtyCUToDeliver(@NonNull final I_M_ShipmentSchedule record)
{
return shipmentScheduleBL.getQtyToDeliver(record);
}
private BigDecimal extractQtyToDeliverCatchOverride(@NonNull final I_M_ShipmentSchedule record)
{
return shipmentScheduleBL
.getCatchQtyOverride(record)
.map(qty -> qty.toBigDecimal())
.orElse(null);
}
private int extractSalesOrderLineNo(final I_M_ShipmentSchedule record)
{
final OrderAndLineId salesOrderAndLineId = extractSalesOrderAndLineId(record);
if (salesOrderAndLineId == null)
{
return 0;
}
final I_C_OrderLine salesOrderLine = salesOrderLines.get(salesOrderAndLineId);
if (salesOrderLine == null)
{
return 0;
}
return salesOrderLine.getLine();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\shipment_candidates_editor\ShipmentCandidateRowsLoader.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void setDiscountAmount(BigDecimal value) {
this.discountAmount = value;
}
/**
* Gets the value of the taxableAmount property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getTaxableAmount() {
return taxableAmount;
}
/**
* Sets the value of the taxableAmount property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setTaxableAmount(BigDecimal value) {
this.taxableAmount = value;
}
/**
* Gets the value of the taxRate property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getTaxRate() {
return taxRate;
}
/**
* Sets the value of the taxRate property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setTaxRate(BigDecimal value) {
this.taxRate = value;
} | /**
* Gets the value of the taxAmount property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getTaxAmount() {
return taxAmount;
}
/**
* Sets the value of the taxAmount property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setTaxAmount(BigDecimal value) {
this.taxAmount = value;
}
/**
* Gets the value of the invoiceAmount property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getInvoiceAmount() {
return invoiceAmount;
}
/**
* Sets the value of the invoiceAmount property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setInvoiceAmount(BigDecimal value) {
this.invoiceAmount = value;
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\extensions\edifact\InvoiceFooterType.java | 2 |
请完成以下Java代码 | private void assertLastHUTrxWasThisInventory(final I_M_Inventory inventoryRecord)
{
final Inventory inventory = inventoryService.toInventory(inventoryRecord);
inventory.getLines().forEach(this::assertLastHUTrxWasThisInventoryLine);
}
private void assertLastHUTrxWasThisInventoryLine(@NonNull final InventoryLine line)
{
line.getInventoryLineHUs().forEach(hu -> assertLastHUTrxWasThisInventoryLine(line, hu));
}
private void assertLastHUTrxWasThisInventoryLine(@NonNull final InventoryLine line, @NonNull final InventoryLineHU lineHU)
{
final HuId huId = Objects.requireNonNull(lineHU.getHuId());
final InventoryLineId lineId = Objects.requireNonNull(line.getId());
if (!huTransactionBL.isLatestHUTrx(huId, TableRecordReference.of(I_M_InventoryLine.Table_Name, lineId)))
{
throw new HUException("@InventoryReverseError@")
.setParameter("line", line)
.setParameter("lineHU", lineHU);
}
}
@DocValidate(timings = ModelValidator.TIMING_AFTER_REVERSECORRECT)
public void afterReverseCorrect(final I_M_Inventory inventory)
{
if (inventoryService.isMaterialDisposal(inventory))
{
restoreHUsFromSnapshots(inventory);
reverseEmptiesMovements(inventory);
}
}
private void restoreHUsFromSnapshots(final I_M_Inventory inventory)
{
final String snapshotId = inventory.getSnapshot_UUID();
if (Check.isBlank(snapshotId))
{ | throw new HUException("@NotFound@ @Snapshot_UUID@ (" + inventory + ")");
}
final InventoryId inventoryId = InventoryId.ofRepoId(inventory.getM_Inventory_ID());
final List<Integer> topLevelHUIds = inventoryDAO.retrieveLinesForInventoryId(inventoryId, I_M_InventoryLine.class)
.stream()
.map(I_M_InventoryLine::getM_HU_ID)
.collect(ImmutableList.toImmutableList());
huSnapshotDAO.restoreHUs()
.setContext(PlainContextAware.newWithThreadInheritedTrx())
.setSnapshotId(snapshotId)
.setDateTrx(inventory.getMovementDate())
.addModelIds(topLevelHUIds)
.setReferencedModel(inventory)
.restoreFromSnapshot();
}
private void reverseEmptiesMovements(final I_M_Inventory inventory)
{
final InventoryId inventoryId = InventoryId.ofRepoId(inventory.getM_Inventory_ID());
movementDAO.retrieveMovementsForInventoryQuery(inventoryId)
.addEqualsFilter(I_M_Inventory.COLUMNNAME_DocStatus, X_M_Inventory.DOCSTATUS_Completed)
.create()
.stream()
.forEach(emptiesMovement -> documentBL.processEx(emptiesMovement, X_M_Movement.DOCACTION_Reverse_Correct, X_M_Movement.DOCSTATUS_Reversed));
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\inventory\interceptor\M_Inventory.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class BookService {
@Autowired
private BookRepository bookRepository;
public List<Book> findAll() {
// convert to List
/*Iterable<Book> booksIterable = bookRepository.findAll();
List<Book> booksList = new ArrayList<>();
booksIterable.forEach(booksList::add);*/
return bookRepository.findAll();
}
public Optional<Book> findById(Long id) { | return bookRepository.findById(id);
}
public Book save(Book book) {
return bookRepository.save(book);
}
public void deleteById(Long id) {
bookRepository.deleteById(id);
}
public List<Book> findByPublishedDateAfter(LocalDate date) {
return bookRepository.findByPublishedDateAfter(date);
}
} | repos\spring-boot-master\spring-data-jpa\src\main\java\com\mkyong\BookService.java | 2 |
请完成以下Java代码 | public static PickFrom ofPickingOrderId(@NonNull final PPOrderId pickingOrderId)
{
return builder().pickingOrderId(pickingOrderId).build();
}
@Nullable
HuId huId;
@Nullable
PPOrderId pickingOrderId;
@Builder
private PickFrom(
@Nullable HuId huId,
@Nullable PPOrderId pickingOrderId) | {
this.pickingOrderId = pickingOrderId;
this.huId = huId;
}
public boolean isPickFromHU()
{
return getHuId() != null;
}
public boolean isPickFromPickingOrder()
{
return getPickingOrderId() != null;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\PickFrom.java | 1 |
请完成以下Java代码 | public String getColumnName()
{
return this.ColumnName;
}
public AdColumnId getAD_Column_ID()
{
return this.AD_Column_ID;
}
boolean isTranslated()
{
return this.IsTranslated;
}
public String getColumnSQL()
{
return this.ColumnSQL;
}
public boolean isVirtualColumn()
{
return this.virtualColumn;
}
public String getColumnSqlForSelect()
{
return sqlColumnForSelect;
}
public ReferenceId getAD_Reference_Value_ID()
{
return AD_Reference_Value_ID;
}
public boolean isSelectionColumn()
{
return IsSelectionColumn;
}
public boolean isMandatory()
{
return IsMandatory;
}
public boolean isKey()
{
return IsKey;
}
public boolean isParent()
{
return IsParent;
}
public boolean isStaleable()
{
return IsStaleable;
}
public boolean isLookup()
{ | return org.compiere.util.DisplayType.isLookup(displayType);
}
public int getAD_Sequence_ID()
{
return AD_Sequence_ID;
}
public boolean isIdentifier()
{
return IsIdentifier;
}
@Nullable
public String getReferencedTableNameOrNull()
{
return _referencedTableName.orElse(null);
}
private static Optional<String> computeReferencedTableName(
final int displayType,
@Nullable final TableName adReferenceValueTableName)
{
// Special lookups (Location, Locator etc)
final String refTableName = DisplayType.getTableName(displayType);
if (refTableName != null)
{
return Optional.of(refTableName);
}
if (DisplayType.isLookup(displayType) && adReferenceValueTableName != null)
{
return Optional.of(adReferenceValueTableName.getAsString());
}
return Optional.empty();
}
public boolean isPasswordColumn()
{
return DisplayType.isPassword(ColumnName, displayType);
}
} // POInfoColumn | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\POInfoColumn.java | 1 |
请完成以下Java代码 | public class CmsPrefrenceArea implements Serializable {
private Long id;
private String name;
private String subTitle;
private Integer sort;
private Integer showStatus;
@ApiModelProperty(value = "展示图片")
private byte[] pic;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSubTitle() {
return subTitle;
}
public void setSubTitle(String subTitle) {
this.subTitle = subTitle;
}
public Integer getSort() { | return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Integer getShowStatus() {
return showStatus;
}
public void setShowStatus(Integer showStatus) {
this.showStatus = showStatus;
}
public byte[] getPic() {
return pic;
}
public void setPic(byte[] pic) {
this.pic = pic;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", name=").append(name);
sb.append(", subTitle=").append(subTitle);
sb.append(", sort=").append(sort);
sb.append(", showStatus=").append(showStatus);
sb.append(", pic=").append(pic);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\CmsPrefrenceArea.java | 1 |
请完成以下Java代码 | public int getM_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
/**
* PostingSign AD_Reference_ID=541699
* Reference name: PostingSign
*/
public static final int POSTINGSIGN_AD_Reference_ID=541699;
/** DR = D */
public static final String POSTINGSIGN_DR = "D";
/** CR = C */
public static final String POSTINGSIGN_CR = "C";
@Override
public void setPostingSign (final java.lang.String PostingSign)
{
set_Value (COLUMNNAME_PostingSign, PostingSign);
}
@Override
public java.lang.String getPostingSign()
{ | return get_ValueAsString(COLUMNNAME_PostingSign);
}
@Override
public void setUserElementString1 (final @Nullable java.lang.String UserElementString1)
{
set_Value (COLUMNNAME_UserElementString1, UserElementString1);
}
@Override
public java.lang.String getUserElementString1()
{
return get_ValueAsString(COLUMNNAME_UserElementString1);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java-gen\de\metas\acct\model\X_Fact_Acct_UserChange.java | 1 |
请完成以下Java代码 | /* package */ final class DocumentFieldAsProcessDefaultParameter implements IProcessDefaultParameter
{
public static final DocumentFieldAsProcessDefaultParameter of(final int windowNo, final IDocumentFieldView field)
{
return new DocumentFieldAsProcessDefaultParameter(windowNo, field);
}
private final int windowNo;
private final IDocumentFieldView field;
private DocumentFieldAsProcessDefaultParameter(final int windowNo, final IDocumentFieldView field)
{
super();
this.windowNo = windowNo;
this.field = field;
}
@Override
public String toString()
{
return MoreObjects.toStringHelper(this) | .add("windowNo", windowNo)
.addValue(field)
.toString();
}
@Override
public String getColumnName()
{
return field.getFieldName();
}
@Override
public int getContextAsInt(final String name)
{
return Env.getContextAsInt(Env.getCtx(), windowNo, name);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\process\adprocess\DocumentFieldAsProcessDefaultParameter.java | 1 |
请完成以下Java代码 | public void setAD_Role(org.compiere.model.I_AD_Role AD_Role)
{
set_ValueFromPO(COLUMNNAME_AD_Role_ID, org.compiere.model.I_AD_Role.class, AD_Role);
}
/** Set Rolle.
@param AD_Role_ID
Responsibility Role
*/
@Override
public void setAD_Role_ID (int AD_Role_ID)
{
if (AD_Role_ID < 0)
set_Value (COLUMNNAME_AD_Role_ID, null);
else
set_Value (COLUMNNAME_AD_Role_ID, Integer.valueOf(AD_Role_ID));
}
/** Get Rolle.
@return Responsibility Role
*/
@Override
public int getAD_Role_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Role_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set User Authentication Token .
@param AD_User_AuthToken_ID User Authentication Token */
@Override
public void setAD_User_AuthToken_ID (int AD_User_AuthToken_ID)
{
if (AD_User_AuthToken_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_User_AuthToken_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_User_AuthToken_ID, Integer.valueOf(AD_User_AuthToken_ID));
}
/** Get User Authentication Token .
@return User Authentication Token */
@Override
public int getAD_User_AuthToken_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_AuthToken_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public org.compiere.model.I_AD_User getAD_User() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_AD_User_ID, org.compiere.model.I_AD_User.class);
}
@Override
public void setAD_User(org.compiere.model.I_AD_User AD_User)
{
set_ValueFromPO(COLUMNNAME_AD_User_ID, org.compiere.model.I_AD_User.class, AD_User);
}
/** Set Ansprechpartner.
@param AD_User_ID
User within the system - Internal or Business Partner Contact
*/
@Override
public void setAD_User_ID (int AD_User_ID)
{
if (AD_User_ID < 0)
set_Value (COLUMNNAME_AD_User_ID, null);
else
set_Value (COLUMNNAME_AD_User_ID, Integer.valueOf(AD_User_ID));
} | /** Get Ansprechpartner.
@return User within the system - Internal or Business Partner Contact
*/
@Override
public int getAD_User_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Authentication Token.
@param AuthToken Authentication Token */
@Override
public void setAuthToken (java.lang.String AuthToken)
{
set_Value (COLUMNNAME_AuthToken, AuthToken);
}
/** Get Authentication Token.
@return Authentication Token */
@Override
public java.lang.String getAuthToken ()
{
return (java.lang.String)get_Value(COLUMNNAME_AuthToken);
}
/** Set Beschreibung.
@param Description Beschreibung */
@Override
public void setDescription (java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Beschreibung.
@return Beschreibung */
@Override
public java.lang.String getDescription ()
{
return (java.lang.String)get_Value(COLUMNNAME_Description);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_User_AuthToken.java | 1 |
请完成以下Java代码 | public void setM_DosageForm_ID (int M_DosageForm_ID)
{
if (M_DosageForm_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_DosageForm_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_DosageForm_ID, Integer.valueOf(M_DosageForm_ID));
}
/** Get Dosage Form.
@return Dosage Form */
@Override
public int getM_DosageForm_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_DosageForm_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Name.
@param Name | Alphanumeric identifier of the entity
*/
@Override
public void setName (java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
@Override
public java.lang.String getName ()
{
return (java.lang.String)get_Value(COLUMNNAME_Name);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma\src\main\java-gen\de\metas\vertical\pharma\model\X_M_DosageForm.java | 1 |
请完成以下Java代码 | public void setDerefLinkFlag(boolean deref) {
this.searchControls.setDerefLinkFlag(deref);
}
/**
* If true then searches the entire subtree as identified by context, if false (the
* default) then only searches the level identified by the context.
* @param searchSubtree true the underlying search controls should be set to
* SearchControls.SUBTREE_SCOPE rather than SearchControls.ONELEVEL_SCOPE.
*/
public void setSearchSubtree(boolean searchSubtree) {
this.searchControls
.setSearchScope(searchSubtree ? SearchControls.SUBTREE_SCOPE : SearchControls.ONELEVEL_SCOPE);
}
/**
* The time to wait before the search fails; the default is zero, meaning forever.
* @param searchTimeLimit the time limit for the search (in milliseconds).
*/
public void setSearchTimeLimit(int searchTimeLimit) {
this.searchControls.setTimeLimit(searchTimeLimit);
}
/**
* Specifies the attributes that will be returned as part of the search. | * <p>
* null indicates that all attributes will be returned. An empty array indicates no
* attributes are returned.
* @param attrs An array of attribute names identifying the attributes that will be
* returned. Can be null.
*/
public void setReturningAttributes(String[] attrs) {
this.searchControls.setReturningAttributes(attrs);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName()).append(" [");
sb.append("searchFilter=").append(this.searchFilter).append("; ");
sb.append("searchBase=").append(this.searchBase).append("; ");
sb.append("scope=")
.append((this.searchControls.getSearchScope() != SearchControls.SUBTREE_SCOPE) ? "single-level" : "subtree")
.append("; ");
sb.append("searchTimeLimit=").append(this.searchControls.getTimeLimit()).append("; ");
sb.append("derefLinkFlag=").append(this.searchControls.getDerefLinkFlag()).append(" ]");
return sb.toString();
}
} | repos\spring-security-main\ldap\src\main\java\org\springframework\security\ldap\search\FilterBasedLdapUserSearch.java | 1 |
请完成以下Java代码 | public IHUTransactionCandidate createLUTransactionForAttributeTransfer(
@NonNull final I_M_HU luHU,
@NonNull final I_M_HU_PI_Item luItemPI,
@NonNull final IAllocationRequest request)
{
final IHandlingUnitsDAO handlingUnitsDAO = Services.get(IHandlingUnitsDAO.class);
final I_M_HU_Item luItem = handlingUnitsDAO.retrieveItemIfExists(luHU, luItemPI).orElse(null);
return HUTransactionCandidate.builder()
.model(AllocationUtils.getReferencedModel(request))
.huItem(luItem)
.vhuItem(null)
.productId(request.getProductId())
.quantity(request.getQuantity().toZero())
.date(request.getDate())
.build();
}
@Override
public boolean isLatestHUTrx(@NonNull final HuId huId, @NonNull final TableRecordReference tableRecordReference)
{
final TableRecordReference recordRefOfLastTrx = getRecordRefOfLastTrx(huId).orElse(null);
return TableRecordReference.equals(tableRecordReference, recordRefOfLastTrx);
}
private Optional<TableRecordReference> getRecordRefOfLastTrx(final @NonNull HuId huId) | {
final I_M_HU_Trx_Line lastQtyChangeHUTrx = queryBL
.createQueryBuilder(I_M_HU_Trx_Line.class)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_M_HU_Trx_Line.COLUMNNAME_M_HU_ID, huId)
.addNotEqualsFilter(I_M_HU_Trx_Line.COLUMNNAME_Qty, 0)
.orderByDescending(I_M_HU_Trx_Line.COLUMN_M_HU_Trx_Line_ID)
.create()
.first();
if (lastQtyChangeHUTrx == null)
{
return Optional.empty();
}
final int counterpartTrxLineId = lastQtyChangeHUTrx.getParent_HU_Trx_Line_ID();
if (counterpartTrxLineId <= 0)
{
// those are some very old trx
return Optional.empty();
}
final I_M_HU_Trx_Line counterpartTrxLine = InterfaceWrapperHelper.load(counterpartTrxLineId, I_M_HU_Trx_Line.class);
final TableRecordReference recordRef = TableRecordReference.ofOrNull(counterpartTrxLine.getAD_Table_ID(), counterpartTrxLine.getRecord_ID());
return Optional.ofNullable(recordRef);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\hutransaction\impl\HUTransactionBL.java | 1 |
请完成以下Java代码 | public void prepareNewDBCopy()
{
logger.info("Going to create a new database {} from the original/template database {}", copyDbName, orgiginalDbName);
// in accordance with the command line parameters, we now create a new database
// before actually applying any migration script
final CreateDBFromTemplateScript createDBFromTemplateScript = CreateDBFromTemplateScript.builder()
.templateDBName(orgiginalDbName)
.newDBName(copyDbName)
.newOwner(copyDbOwner)
.build();
final AbstractScriptsApplierTemplate prepareNewDBCopy = createDummyScriptsApplier(dbConnection, createDBFromTemplateScript);
prepareNewDBCopy.run();
}
private AbstractScriptsApplierTemplate createDummyScriptsApplier(final IDatabase db, final CreateDBFromTemplateScript dbScript)
{
final AbstractScriptsApplierTemplate prepareNewDBCopy = new AbstractScriptsApplierTemplate()
{
@Override
protected IScriptFactory createScriptFactory()
{
return new RolloutDirScriptFactory();
}
@Override
protected void configureScriptExecutorFactory(final IScriptExecutorFactory scriptExecutorFactory)
{
scriptExecutorFactory.setDryRunMode(false); | }
@Override
protected IScriptScanner createScriptScanner(final IScriptScannerFactory scriptScannerFactory)
{
final IScriptScanner result = new SingletonScriptScanner(dbScript);
return result;
}
@Override
protected IScriptsApplierListener createScriptsApplierListener()
{
return NullScriptsApplierListener.instance;
}
@Override
protected IDatabase createDatabase()
{
return db;
};
};
return prepareNewDBCopy;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.migration\de.metas.migration.cli\src\main\java\de\metas\migration\cli\rollout_migrate\DBCopyMaker.java | 1 |
请完成以下Java代码 | public void onAfterWindowSave_WhenElementIdChanged(final I_AD_Window window)
{
updateTranslationsForElement(window);
recreateElementLinkForWindow(window);
}
@ModelChange(timings = { ModelValidator.TYPE_AFTER_NEW, ModelValidator.TYPE_AFTER_CHANGE })
public void onAfterWindowSave_AssertNoCyclesInWindowCustomizationsChain(@NonNull final I_AD_Window window)
{
customizedWindowInfoMapRepository.assertNoCycles(AdWindowId.ofRepoId(window.getAD_Window_ID()));
}
private void updateWindowFromElement(final I_AD_Window window)
{
// do not copy translations from element to window
if (!IElementTranslationBL.DYNATTR_AD_Window_UpdateTranslations.getValue(window, true))
{
return;
}
final I_AD_Element windowElement = adElementDAO.getById(window.getAD_Element_ID());
if (windowElement == null)
{
// nothing to do. It was not yet set
return;
}
window.setName(windowElement.getName());
window.setDescription(windowElement.getDescription());
window.setHelp(windowElement.getHelp());
}
private void updateTranslationsForElement(final I_AD_Window window)
{ | final AdElementId windowElementId = AdElementId.ofRepoIdOrNull(window.getAD_Element_ID());
if (windowElementId == null)
{
// nothing to do. It was not yet set
return;
}
elementTranslationBL.updateWindowTranslationsFromElement(windowElementId);
}
private void recreateElementLinkForWindow(final I_AD_Window window)
{
final AdWindowId adWindowId = AdWindowId.ofRepoIdOrNull(window.getAD_Window_ID());
if (adWindowId != null)
{
final IElementLinkBL elementLinksService = Services.get(IElementLinkBL.class);
elementLinksService.recreateADElementLinkForWindowId(adWindowId);
}
}
@ModelChange(timings = { ModelValidator.TYPE_BEFORE_DELETE })
public void onBeforeWindowDelete(final I_AD_Window window)
{
final AdWindowId adWindowId = AdWindowId.ofRepoId(window.getAD_Window_ID());
final IElementLinkBL elementLinksService = Services.get(IElementLinkBL.class);
elementLinksService.deleteExistingADElementLinkForWindowId(adWindowId);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\window\model\interceptor\AD_Window.java | 1 |
请完成以下Java代码 | public <T> T get(Object key, Callable<T> valueLoader) {
T value = null;
if (usedFirstCache) {
// 查询一级缓存,如果一级缓存没有值则调用getForSecondaryCache(k, valueLoader)查询二级缓存
value = (T) caffeineCache.getNativeCache().get(key, k -> getForSecondaryCache(k, valueLoader));
} else {
// 直接查询二级缓存
value = (T) getForSecondaryCache(key, valueLoader);
}
if (value instanceof NullValue) {
return null;
}
return value;
}
@Override
public void put(Object key, Object value) {
if (usedFirstCache) {
caffeineCache.put(key, value);
}
redisCache.put(key, value);
}
@Override
public ValueWrapper putIfAbsent(Object key, Object value) {
if (usedFirstCache) {
caffeineCache.putIfAbsent(key, value);
}
return redisCache.putIfAbsent(key, value);
}
@Override
public void evict(Object key) {
// 删除的时候要先删除二级缓存再删除一级缓存,否则有并发问题
redisCache.evict(key);
if (usedFirstCache) {
// 删除一级缓存需要用到redis的Pub/Sub(订阅/发布)模式,否则集群中其他服服务器节点的一级缓存数据无法删除
Map<String, Object> message = new HashMap<>();
message.put("cacheName", name);
message.put("key", key);
// 创建redis发布者
RedisPublisher redisPublisher = new RedisPublisher(redisOperations, ChannelTopicEnum.REDIS_CACHE_DELETE_TOPIC.getChannelTopic());
// 发布消息
redisPublisher.publisher(message);
} | }
@Override
public void clear() {
redisCache.clear();
if (usedFirstCache) {
// 清除一级缓存需要用到redis的订阅/发布模式,否则集群中其他服服务器节点的一级缓存数据无法删除
Map<String, Object> message = new HashMap<>();
message.put("cacheName", name);
// 创建redis发布者
RedisPublisher redisPublisher = new RedisPublisher(redisOperations, ChannelTopicEnum.REDIS_CACHE_CLEAR_TOPIC.getChannelTopic());
// 发布消息
redisPublisher.publisher(message);
}
}
@Override
protected Object lookup(Object key) {
Object value = null;
if (usedFirstCache) {
value = caffeineCache.get(key);
logger.debug("查询一级缓存 key:{},返回值是:{}", key, JSON.toJSONString(value));
}
if (value == null) {
value = redisCache.get(key);
logger.debug("查询二级缓存 key:{},返回值是:{}", key, JSON.toJSONString(value));
}
return value;
}
/**
* 查询二级缓存
*
* @param key
* @param valueLoader
* @return
*/
private <T> Object getForSecondaryCache(Object key, Callable<T> valueLoader) {
T value = redisCache.get(key, valueLoader);
logger.debug("查询二级缓存 key:{},返回值是:{}", key, JSON.toJSONString(value));
return toStoreValue(value);
}
} | repos\spring-boot-student-master\spring-boot-student-cache-redis-caffeine\src\main\java\com\xiaolyuh\cache\layering\LayeringCache.java | 1 |
请完成以下Java代码 | private final Document getSingleDocumentOrNull()
{
return singleDocument;
}
private final void setSingleDocument(@NonNull final Document document)
{
singleDocument = document;
}
@Override
public void updateStatusFromParent()
{
// nothing
}
@Override
public void assertNewDocumentAllowed()
{
throw new InvalidDocumentStateException(parentDocument, RESULT_TabSingleRowDetail.getName());
}
@Override
public LogicExpressionResult getAllowCreateNewDocument()
{
return RESULT_TabSingleRowDetail;
}
@Override
public LogicExpressionResult getAllowDeleteDocument()
{
return RESULT_TabSingleRowDetail;
}
@Override
public Document createNewDocument()
{
throw new InvalidDocumentStateException(parentDocument, RESULT_TabSingleRowDetail.getName());
}
@Override
public void deleteDocuments(DocumentIdsSelection documentIds)
{
throw new InvalidDocumentStateException(parentDocument, RESULT_TabSingleRowDetail.getName());
}
@Override
public DocumentValidStatus checkAndGetValidStatus(OnValidStatusChanged onValidStatusChanged)
{
if (singleDocument != null)
{
final DocumentValidStatus validState = singleDocument.checkAndGetValidStatus(onValidStatusChanged);
if (!validState.isValid())
{
logger.trace("Considering included document as invalid for saving because it is not valid; validState={}; document={}",
validState, singleDocument);
return validState;
}
}
return DocumentValidStatus.documentValid();
}
@Override
public boolean hasChangesRecursivelly()
{
if (singleDocument == null)
{
return false;
}
return singleDocument.hasChangesRecursivelly();
}
@Override
public void saveIfHasChanges()
{
if (singleDocument != null) | {
final DocumentSaveStatus saveStatus = singleDocument.saveIfHasChanges();
if (saveStatus.isSaved())
{
forgetSingleDocument();
}
else if (saveStatus.isDeleted())
{
singleDocument.markAsDeleted();
forgetSingleDocument();
}
}
}
private final void forgetSingleDocument()
{
singleDocument = null;
}
@Override
public void markStaleAll()
{
staled = true;
parentDocument.getChangesCollector().collectStaleDetailId(parentDocumentPath, getDetailId());
}
@Override
public void markStale(final DocumentIdsSelection rowIds)
{
markStaleAll();
}
@Override
public boolean isStale()
{
return staled;
}
@Override
public int getNextLineNo()
{
return 0;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\model\SingleRowDetailIncludedDocumentsCollection.java | 1 |
请完成以下Java代码 | public long getGlobalSequenceNumber() {
return globalSequenceNumber;
}
public void setGlobalSequenceNumber(long globalSequenceNumber) {
this.globalSequenceNumber = globalSequenceNumber;
}
@Override
public int compareTo(UserEvent other) {
return Long.compare(this.globalSequenceNumber, other.globalSequenceNumber);
}
@Override
public boolean equals(Object obj) {
if (this == obj) { | return true;
}
if (!(obj instanceof UserEvent)) {
return false;
}
UserEvent userEvent = (UserEvent) obj;
return this.globalSequenceNumber == userEvent.globalSequenceNumber;
}
@Override
public int hashCode() {
return Objects.hash(globalSequenceNumber);
}
} | repos\tutorials-master\apache-kafka\src\main\java\com\baeldung\kafka\message\ordering\payload\UserEvent.java | 1 |
请完成以下Java代码 | public ResourceOptionsDto availableOperations(UriInfo context) {
ResourceOptionsDto dto = new ResourceOptionsDto();
// add links if operations are authorized
URI uri = context.getBaseUriBuilder()
.path(rootResourcePath)
.path(GroupRestService.PATH)
.path(resourceId)
.build();
dto.addReflexiveLink(uri, HttpMethod.GET, "self");
if(!identityService.isReadOnly() && isAuthorized(DELETE)) {
dto.addReflexiveLink(uri, HttpMethod.DELETE, "delete");
}
if(!identityService.isReadOnly() && isAuthorized(UPDATE)) {
dto.addReflexiveLink(uri, HttpMethod.PUT, "update");
}
return dto;
}
public void updateGroup(GroupDto group) {
ensureNotReadOnly();
Group dbGroup = findGroupObject();
if(dbGroup == null) {
throw new InvalidRequestException(Status.NOT_FOUND, "Group with id " + resourceId + " does not exist");
}
group.update(dbGroup);
identityService.saveGroup(dbGroup); | }
public void deleteGroup() {
ensureNotReadOnly();
identityService.deleteGroup(resourceId);
}
public GroupMembersResource getGroupMembersResource() {
return new GroupMembersResourceImpl(getProcessEngine().getName(), resourceId, rootResourcePath, getObjectMapper());
}
protected Group findGroupObject() {
try {
return identityService.createGroupQuery()
.groupId(resourceId)
.singleResult();
} catch(ProcessEngineException e) {
throw new InvalidRequestException(Status.INTERNAL_SERVER_ERROR, "Exception while performing group query: "+e.getMessage());
}
}
} | repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\sub\identity\impl\GroupResourceImpl.java | 1 |
请完成以下Java代码 | public Builder groupingBinding(final SqlViewGroupingBinding groupingBinding)
{
this.groupingBinding = groupingBinding;
return this;
}
public Builder filterConverterDecorator(@NonNull final SqlDocumentFilterConverterDecorator sqlDocumentFilterConverterDecorator)
{
this.sqlDocumentFilterConverterDecorator = sqlDocumentFilterConverterDecorator;
return this;
}
public Builder rowCustomizer(final ViewRowCustomizer rowCustomizer)
{
this.rowCustomizer = rowCustomizer;
return this;
}
private ViewRowCustomizer getRowCustomizer()
{
return rowCustomizer;
}
public Builder viewInvalidationAdvisor(@NonNull final IViewInvalidationAdvisor viewInvalidationAdvisor)
{
this.viewInvalidationAdvisor = viewInvalidationAdvisor;
return this;
}
private IViewInvalidationAdvisor getViewInvalidationAdvisor() | {
return viewInvalidationAdvisor;
}
public Builder refreshViewOnChangeEvents(final boolean refreshViewOnChangeEvents)
{
this.refreshViewOnChangeEvents = refreshViewOnChangeEvents;
return this;
}
public Builder queryIfNoFilters(final boolean queryIfNoFilters)
{
this.queryIfNoFilters = queryIfNoFilters;
return this;
}
public Builder includedEntitiesDescriptors(final Map<DetailId, SqlDocumentEntityDataBindingDescriptor> includedEntitiesDescriptors)
{
this.includedEntitiesDescriptors = includedEntitiesDescriptors;
return this;
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\view\descriptor\SqlViewBinding.java | 1 |
请完成以下Java代码 | public de.metas.vertical.pharma.vendor.gateway.msv3.model.I_MSV3_Bestellung getMSV3_Bestellung() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_MSV3_Bestellung_ID, de.metas.vertical.pharma.vendor.gateway.msv3.model.I_MSV3_Bestellung.class);
}
@Override
public void setMSV3_Bestellung(de.metas.vertical.pharma.vendor.gateway.msv3.model.I_MSV3_Bestellung MSV3_Bestellung)
{
set_ValueFromPO(COLUMNNAME_MSV3_Bestellung_ID, de.metas.vertical.pharma.vendor.gateway.msv3.model.I_MSV3_Bestellung.class, MSV3_Bestellung);
}
/** Set MSV3_Bestellung.
@param MSV3_Bestellung_ID MSV3_Bestellung */
@Override
public void setMSV3_Bestellung_ID (int MSV3_Bestellung_ID)
{
if (MSV3_Bestellung_ID < 1)
set_ValueNoCheck (COLUMNNAME_MSV3_Bestellung_ID, null);
else
set_ValueNoCheck (COLUMNNAME_MSV3_Bestellung_ID, Integer.valueOf(MSV3_Bestellung_ID));
}
/** Get MSV3_Bestellung.
@return MSV3_Bestellung */
@Override
public int getMSV3_Bestellung_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_MSV3_Bestellung_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set MSV3_BestellungAuftrag.
@param MSV3_BestellungAuftrag_ID MSV3_BestellungAuftrag */
@Override
public void setMSV3_BestellungAuftrag_ID (int MSV3_BestellungAuftrag_ID)
{
if (MSV3_BestellungAuftrag_ID < 1)
set_ValueNoCheck (COLUMNNAME_MSV3_BestellungAuftrag_ID, null);
else
set_ValueNoCheck (COLUMNNAME_MSV3_BestellungAuftrag_ID, Integer.valueOf(MSV3_BestellungAuftrag_ID));
}
/** Get MSV3_BestellungAuftrag.
@return MSV3_BestellungAuftrag */
@Override | public int getMSV3_BestellungAuftrag_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_MSV3_BestellungAuftrag_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set GebindeId.
@param MSV3_GebindeId GebindeId */
@Override
public void setMSV3_GebindeId (java.lang.String MSV3_GebindeId)
{
set_Value (COLUMNNAME_MSV3_GebindeId, MSV3_GebindeId);
}
/** Get GebindeId.
@return GebindeId */
@Override
public java.lang.String getMSV3_GebindeId ()
{
return (java.lang.String)get_Value(COLUMNNAME_MSV3_GebindeId);
}
/** Set Id.
@param MSV3_Id Id */
@Override
public void setMSV3_Id (java.lang.String MSV3_Id)
{
set_Value (COLUMNNAME_MSV3_Id, MSV3_Id);
}
/** Get Id.
@return Id */
@Override
public java.lang.String getMSV3_Id ()
{
return (java.lang.String)get_Value(COLUMNNAME_MSV3_Id);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.vendor.gateway.msv3\src\main\java-gen\de\metas\vertical\pharma\vendor\gateway\msv3\model\X_MSV3_BestellungAuftrag.java | 1 |
请完成以下Java代码 | public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Player other = (Player) obj;
if (firstName == null) {
if (other.firstName != null) {
return false;
}
} else if (!firstName.equals(other.firstName)) {
return false;
}
if (lastName == null) {
if (other.lastName != null) { | return false;
}
} else if (!lastName.equals(other.lastName)) {
return false;
}
if (position == null) {
if (other.position != null) {
return false;
}
} else if (!position.equals(other.position)) {
return false;
}
return true;
}
} | repos\tutorials-master\core-java-modules\core-java-lang-3\src\main\java\com\baeldung\hash\Player.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class Employee {
@Id
private long id;
private double salary;
public Employee() {
}
public Employee(long id, double salary) {
this.id = id;
this.salary = salary;
}
public long getId() { | return id;
}
public void setId(long id) {
this.id = id;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
} | repos\tutorials-master\spring-boot-modules\spring-boot-basic-customization-2\src\main\java\com\baeldung\typeconversion\entity\Employee.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class X_S_PostgREST_Config extends PO implements I_S_PostgREST_Config, I_Persistent
{
private static final long serialVersionUID = -27386281L;
/** Standard Constructor */
public X_S_PostgREST_Config (final Properties ctx, final int S_PostgREST_Config_ID, @Nullable final String trxName)
{
super (ctx, S_PostgREST_Config_ID, trxName);
}
/** Load Constructor */
public X_S_PostgREST_Config (final Properties ctx, final ResultSet rs, @Nullable final String trxName)
{
super (ctx, rs, trxName);
}
/** Load Meta Data */
@Override
protected POInfo initPO(final Properties ctx)
{
return POInfo.getPOInfo(Table_Name);
}
@Override
public void setBase_url (final String Base_url)
{
set_Value (COLUMNNAME_Base_url, Base_url);
}
@Override
public String getBase_url()
{
return get_ValueAsString(COLUMNNAME_Base_url);
}
@Override
public void setConnection_timeout (final int Connection_timeout)
{
set_Value (COLUMNNAME_Connection_timeout, Connection_timeout);
}
@Override
public int getConnection_timeout()
{
return get_ValueAsInt(COLUMNNAME_Connection_timeout);
} | @Override
public void setPostgREST_ResultDirectory (final String PostgREST_ResultDirectory)
{
set_Value (COLUMNNAME_PostgREST_ResultDirectory, PostgREST_ResultDirectory);
}
@Override
public String getPostgREST_ResultDirectory()
{
return get_ValueAsString(COLUMNNAME_PostgREST_ResultDirectory);
}
@Override
public void setRead_timeout (final int Read_timeout)
{
set_Value (COLUMNNAME_Read_timeout, Read_timeout);
}
@Override
public int getRead_timeout()
{
return get_ValueAsInt(COLUMNNAME_Read_timeout);
}
@Override
public void setS_PostgREST_Config_ID (final int S_PostgREST_Config_ID)
{
if (S_PostgREST_Config_ID < 1)
set_ValueNoCheck (COLUMNNAME_S_PostgREST_Config_ID, null);
else
set_ValueNoCheck (COLUMNNAME_S_PostgREST_Config_ID, S_PostgREST_Config_ID);
}
@Override
public int getS_PostgREST_Config_ID()
{
return get_ValueAsInt(COLUMNNAME_S_PostgREST_Config_ID);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_S_PostgREST_Config.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public List<MediaType> getStreamingMediaTypes() {
return streamingMediaTypes;
}
public void setStreamingMediaTypes(List<MediaType> streamingMediaTypes) {
this.streamingMediaTypes = streamingMediaTypes;
}
public boolean isFailOnRouteDefinitionError() {
return failOnRouteDefinitionError;
}
public void setFailOnRouteDefinitionError(boolean failOnRouteDefinitionError) {
this.failOnRouteDefinitionError = failOnRouteDefinitionError;
}
public String getTrustedProxies() {
return trustedProxies;
} | public void setTrustedProxies(String trustedProxies) {
this.trustedProxies = trustedProxies;
}
@Override
public String toString() {
return new ToStringCreator(this).append("routes", routes)
.append("defaultFilters", defaultFilters)
.append("streamingMediaTypes", streamingMediaTypes)
.append("failOnRouteDefinitionError", failOnRouteDefinitionError)
.append("routeFilterCacheEnabled", routeFilterCacheEnabled)
.append("trustedProxies", trustedProxies)
.toString();
}
} | repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webflux\src\main\java\org\springframework\cloud\gateway\config\GatewayProperties.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public @Nullable String getPageParamName() {
return this.pageParamName;
}
public void setPageParamName(@Nullable String pageParamName) {
this.pageParamName = pageParamName;
}
public @Nullable String getLimitParamName() {
return this.limitParamName;
}
public void setLimitParamName(@Nullable String limitParamName) {
this.limitParamName = limitParamName;
}
public @Nullable String getSortParamName() {
return this.sortParamName;
}
public void setSortParamName(@Nullable String sortParamName) {
this.sortParamName = sortParamName;
}
public RepositoryDetectionStrategies getDetectionStrategy() {
return this.detectionStrategy;
}
public void setDetectionStrategy(RepositoryDetectionStrategies detectionStrategy) {
this.detectionStrategy = detectionStrategy;
}
public @Nullable MediaType getDefaultMediaType() {
return this.defaultMediaType;
}
public void setDefaultMediaType(@Nullable MediaType defaultMediaType) {
this.defaultMediaType = defaultMediaType;
}
public @Nullable Boolean getReturnBodyOnCreate() {
return this.returnBodyOnCreate;
}
public void setReturnBodyOnCreate(@Nullable Boolean returnBodyOnCreate) {
this.returnBodyOnCreate = returnBodyOnCreate;
} | public @Nullable Boolean getReturnBodyOnUpdate() {
return this.returnBodyOnUpdate;
}
public void setReturnBodyOnUpdate(@Nullable Boolean returnBodyOnUpdate) {
this.returnBodyOnUpdate = returnBodyOnUpdate;
}
public @Nullable Boolean getEnableEnumTranslation() {
return this.enableEnumTranslation;
}
public void setEnableEnumTranslation(@Nullable Boolean enableEnumTranslation) {
this.enableEnumTranslation = enableEnumTranslation;
}
public void applyTo(RepositoryRestConfiguration rest) {
PropertyMapper map = PropertyMapper.get();
map.from(this::getBasePath).to(rest::setBasePath);
map.from(this::getDefaultPageSize).to(rest::setDefaultPageSize);
map.from(this::getMaxPageSize).to(rest::setMaxPageSize);
map.from(this::getPageParamName).to(rest::setPageParamName);
map.from(this::getLimitParamName).to(rest::setLimitParamName);
map.from(this::getSortParamName).to(rest::setSortParamName);
map.from(this::getDetectionStrategy).to(rest::setRepositoryDetectionStrategy);
map.from(this::getDefaultMediaType).to(rest::setDefaultMediaType);
map.from(this::getReturnBodyOnCreate).to(rest::setReturnBodyOnCreate);
map.from(this::getReturnBodyOnUpdate).to(rest::setReturnBodyOnUpdate);
map.from(this::getEnableEnumTranslation).to(rest::setEnableEnumTranslation);
}
} | repos\spring-boot-4.0.1\module\spring-boot-data-rest\src\main\java\org\springframework\boot\data\rest\autoconfigure\DataRestProperties.java | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.