instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请完成以下Java代码
|
public void setDate(LocalDate date) {
this.date = date;
}
public Double getAmount() {
return amount;
}
public void setAmount(Double amount) {
this.amount = amount;
}
public Expense getExpense() {
return expense;
}
public void setExpense(Expense expense) {
this.expense = expense;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
|
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
}
|
repos\tutorials-master\spring-boot-modules\jmix\src\main\java\com\baeldung\jmix\expensetracker\entity\UserExpense.java
| 1
|
请完成以下Java代码
|
public BigDecimal getQtySpent ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtySpent);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Result.
@param Result
Result of the action taken
*/
public void setResult (String Result)
{
set_ValueNoCheck (COLUMNNAME_Result, Result);
}
/** Get Result.
@return Result of the action taken
*/
public String getResult ()
{
return (String)get_Value(COLUMNNAME_Result);
}
public I_R_Request getR_Request() throws RuntimeException
{
return (I_R_Request)MTable.get(getCtx(), I_R_Request.Table_Name)
.getPO(getR_Request_ID(), get_TrxName()); }
/** Set Request.
@param R_Request_ID
Request from a Business Partner or Prospect
*/
public void setR_Request_ID (int R_Request_ID)
{
if (R_Request_ID < 1)
set_ValueNoCheck (COLUMNNAME_R_Request_ID, null);
else
set_ValueNoCheck (COLUMNNAME_R_Request_ID, Integer.valueOf(R_Request_ID));
}
/** Get Request.
@return Request from a Business Partner or Prospect
*/
public int getR_Request_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_R_Request_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Request Update.
@param R_RequestUpdate_ID
Request Updates
*/
public void setR_RequestUpdate_ID (int R_RequestUpdate_ID)
{
if (R_RequestUpdate_ID < 1)
set_ValueNoCheck (COLUMNNAME_R_RequestUpdate_ID, null);
else
set_ValueNoCheck (COLUMNNAME_R_RequestUpdate_ID, Integer.valueOf(R_RequestUpdate_ID));
}
/** Get Request Update.
@return Request Updates
*/
public int getR_RequestUpdate_ID ()
|
{
Integer ii = (Integer)get_Value(COLUMNNAME_R_RequestUpdate_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(getR_RequestUpdate_ID()));
}
/** Set Start Time.
@param StartTime
Time started
*/
public void setStartTime (Timestamp StartTime)
{
set_Value (COLUMNNAME_StartTime, StartTime);
}
/** Get Start Time.
@return Time started
*/
public Timestamp getStartTime ()
{
return (Timestamp)get_Value(COLUMNNAME_StartTime);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_R_RequestUpdate.java
| 1
|
请完成以下Java代码
|
public Integer getHistoryTimeToLive() {
throw new UnsupportedOperationException("history time to live not supported for Camunda Forms");
}
@Override
public void setHistoryTimeToLive(Integer historyTimeToLive) {
throw new UnsupportedOperationException("history time to live not supported for Camunda Forms");
}
@Override
public Object getPersistentState() {
// properties of this entity are immutable
return CamundaFormDefinitionEntity.class;
}
|
@Override
public void updateModifiableFieldsFromEntity(CamundaFormDefinitionEntity updatingDefinition) {
throw new UnsupportedOperationException("properties of Camunda Form Definitions are immutable");
}
@Override
public String getName() {
throw new UnsupportedOperationException("name property not supported for Camunda Forms");
}
@Override
public void setName(String name) {
throw new UnsupportedOperationException("name property not supported for Camunda Forms");
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\CamundaFormDefinitionEntity.java
| 1
|
请完成以下Java代码
|
public static String listFolderStructure(String username, String password, String host, int port, String command) throws Exception {
Session session = null;
ChannelExec channel = null;
String response = null;
try {
session = new JSch().getSession(username, host, port);
session.setPassword(password);
session.setConfig("StrictHostKeyChecking", "no");
session.connect();
channel = (ChannelExec) session.openChannel("exec");
channel.setCommand(command);
ByteArrayOutputStream responseStream = new ByteArrayOutputStream();
ByteArrayOutputStream errorResponseStream = new ByteArrayOutputStream();
channel.setOutputStream(responseStream);
channel.setErrStream(errorResponseStream);
channel.connect();
while (channel.isConnected()) {
Thread.sleep(100);
}
|
String errorResponse = new String(errorResponseStream.toByteArray());
response = new String(responseStream.toByteArray());
if(!errorResponse.isEmpty()) {
throw new Exception(errorResponse);
}
} finally {
if (session != null) {
session.disconnect();
}
if (channel != null) {
channel.disconnect();
}
}
return response;
}
}
|
repos\tutorials-master\libraries-security\src\main\java\com\baeldung\ssh\jsch\JschDemo.java
| 1
|
请完成以下Java代码
|
public void validateMandatoryBOMVersionsAndWarehouseId(final I_PP_Product_Planning productPlanningRecord)
{
final ProductPlanning productPlanning = ProductPlanningDAO.fromRecord(productPlanningRecord);
if (!productPlanning.isMatured())
{
return;
}
if (productPlanning.getBomVersionsId() == null)
{
throw new FillMandatoryException(I_PP_Product_Planning.COLUMNNAME_PP_Product_BOMVersions_ID);
}
if (productPlanning.getWarehouseId() == null)
{
throw new FillMandatoryException(I_PP_Product_Planning.COLUMNNAME_M_Warehouse_ID);
|
}
}
@CalloutMethod(columnNames = I_PP_Product_Planning.COLUMNNAME_PP_Product_BOMVersions_ID)
public void onBOMVersionsChanged(@NonNull final I_PP_Product_Planning productPlanningRecord)
{
final ProductBOMVersionsId bomVersionsId = ProductBOMVersionsId.ofRepoIdOrNull(productPlanningRecord.getPP_Product_BOMVersions_ID());
if (bomVersionsId == null)
{
return;
}
final I_PP_Product_BOMVersions bomVersions = bomVersionsDAO.getBOMVersions(bomVersionsId);
final ProductId productId = ProductId.ofRepoId(bomVersions.getM_Product_ID());
productPlanningRecord.setM_Product_ID(productId.getRepoId());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\callout\PP_Product_Planning.java
| 1
|
请完成以下Java代码
|
static DocumentId convertPaymentIdToDocumentId(final PaymentId paymentId)
{
return DocumentId.of(paymentId);
}
static PaymentId convertDocumentIdToPaymentId(final DocumentId rowId)
{
return rowId.toId(PaymentId::ofRepoId);
}
@Override
public DocumentId getId()
{
return rowId;
}
@Override
public boolean isProcessed()
{
return false;
}
@Override
public DocumentPath getDocumentPath()
{
return null;
}
@Override
public Set<String> getFieldNames()
{
return values.getFieldNames();
}
@Override
public ViewRowFieldNameAndJsonValues getFieldNameAndJsonValues()
{
|
return values.get(this);
}
public BPartnerId getBPartnerId()
{
return bpartner.getIdAs(BPartnerId::ofRepoId);
}
@Override
public boolean isSingleColumn()
{
return DEFAULT_PAYMENT_ROW.equals(this);
}
@Override
public ITranslatableString getSingleColumnCaption()
{
return msgBL.getTranslatableMsgText(MSG_NO_PAYMENTS_AVAILABLE);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\payment_allocation\PaymentRow.java
| 1
|
请完成以下Java代码
|
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Profile.
@param ProfileInfo
Information to help profiling the system for solving support issues
*/
public void setProfileInfo (String ProfileInfo)
{
set_Value (COLUMNNAME_ProfileInfo, ProfileInfo);
}
/** Get Profile.
@return Information to help profiling the system for solving support issues
*/
public String getProfileInfo ()
{
return (String)get_Value(COLUMNNAME_ProfileInfo);
}
/** Set Issue Project.
@param R_IssueProject_ID
Implementation Projects
*/
public void setR_IssueProject_ID (int R_IssueProject_ID)
{
if (R_IssueProject_ID < 1)
set_ValueNoCheck (COLUMNNAME_R_IssueProject_ID, null);
else
set_ValueNoCheck (COLUMNNAME_R_IssueProject_ID, Integer.valueOf(R_IssueProject_ID));
}
/** Get Issue Project.
@return Implementation Projects
*/
public int getR_IssueProject_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_R_IssueProject_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Statistics.
@param StatisticsInfo
Information to help profiling the system for solving support issues
*/
public void setStatisticsInfo (String StatisticsInfo)
{
set_Value (COLUMNNAME_StatisticsInfo, StatisticsInfo);
}
/** Get Statistics.
@return Information to help profiling the system for solving support issues
*/
public String getStatisticsInfo ()
{
|
return (String)get_Value(COLUMNNAME_StatisticsInfo);
}
/** SystemStatus AD_Reference_ID=374 */
public static final int SYSTEMSTATUS_AD_Reference_ID=374;
/** Evaluation = E */
public static final String SYSTEMSTATUS_Evaluation = "E";
/** Implementation = I */
public static final String SYSTEMSTATUS_Implementation = "I";
/** Production = P */
public static final String SYSTEMSTATUS_Production = "P";
/** Set System Status.
@param SystemStatus
Status of the system - Support priority depends on system status
*/
public void setSystemStatus (String SystemStatus)
{
set_Value (COLUMNNAME_SystemStatus, SystemStatus);
}
/** Get System Status.
@return Status of the system - Support priority depends on system status
*/
public String getSystemStatus ()
{
return (String)get_Value(COLUMNNAME_SystemStatus);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_R_IssueProject.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class WFNodeId implements RepoIdAware
{
@JsonCreator
public static WFNodeId ofRepoId(final int repoId)
{
return new WFNodeId(repoId);
}
public static WFNodeId ofRepoIdOrNull(final int repoId)
{
return repoId > 0 ? new WFNodeId(repoId) : null;
}
int repoId;
private WFNodeId(final int repoId)
{
this.repoId = Check.assumeGreaterThanZero(repoId, "AD_WF_Node_ID");
}
@JsonValue
@Override
public int getRepoId()
|
{
return repoId;
}
public static int toRepoId(@Nullable final WFNodeId id)
{
return id != null ? id.getRepoId() : -1;
}
public static boolean equals(@Nullable final WFNodeId id1, @Nullable final WFNodeId id2)
{
return Objects.equals(id1, id2);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\workflow\WFNodeId.java
| 2
|
请完成以下Java代码
|
public <T extends Spin<?>> T createSpin(Object parameter, String dataFormatName) {
ensureNotNull("dataFormatName", dataFormatName);
DataFormat<T> dataFormat = (DataFormat<T>) DataFormats.getDataFormat(dataFormatName);
return createSpin(parameter, dataFormat);
}
/**
*
* @throws SpinDataFormatException in case the parameter cannot be read using this data format
* @throws IllegalArgumentException in case the parameter is null or dd:
*/
public <T extends Spin<?>> T createSpinFromSpin(T parameter) {
ensureNotNull("parameter", parameter);
return parameter;
}
public <T extends Spin<?>> T createSpinFromString(String parameter) {
ensureNotNull("parameter", parameter);
Reader input = SpinIoUtil.stringAsReader(parameter);
return createSpin(input);
}
@SuppressWarnings("unchecked")
public <T extends Spin<?>> T createSpinFromReader(Reader parameter) {
ensureNotNull("parameter", parameter);
RewindableReader rewindableReader = new RewindableReader(parameter, READ_SIZE);
DataFormat<T> matchingDataFormat = null;
for (DataFormat<?> format : DataFormats.getAvailableDataFormats()) {
if (format.getReader().canRead(rewindableReader, rewindableReader.getRewindBufferSize())) {
matchingDataFormat = (DataFormat<T>) format;
}
try {
rewindableReader.rewind();
} catch (IOException e) {
throw LOG.unableToReadFromReader(e);
}
}
if (matchingDataFormat == null) {
throw LOG.unrecognizableDataFormatException();
}
|
return createSpin(rewindableReader, matchingDataFormat);
}
/**
*
* @throws SpinDataFormatException in case the parameter cannot be read using this data format
* @throws IllegalArgumentException in case the parameter is null or dd:
*/
public <T extends Spin<?>> T createSpinFromSpin(T parameter, DataFormat<T> format) {
ensureNotNull("parameter", parameter);
return parameter;
}
public <T extends Spin<?>> T createSpinFromString(String parameter, DataFormat<T> format) {
ensureNotNull("parameter", parameter);
Reader input = SpinIoUtil.stringAsReader(parameter);
return createSpin(input, format);
}
public <T extends Spin<?>> T createSpinFromReader(Reader parameter, DataFormat<T> format) {
ensureNotNull("parameter", parameter);
DataFormatReader reader = format.getReader();
Object dataFormatInput = reader.readInput(parameter);
return format.createWrapperInstance(dataFormatInput);
}
public <T extends Spin<?>> T createSpinFromObject(Object parameter, DataFormat<T> format) {
ensureNotNull("parameter", parameter);
DataFormatMapper mapper = format.getMapper();
Object dataFormatInput = mapper.mapJavaToInternal(parameter);
return format.createWrapperInstance(dataFormatInput);
}
}
|
repos\camunda-bpm-platform-master\spin\core\src\main\java\org\camunda\spin\impl\SpinFactoryImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class BPartnerCreditLimitId implements RepoIdAware
{
int repoId;
@NonNull BPartnerId bpartnerId;
public static BPartnerCreditLimitId ofRepoId(@NonNull final BPartnerId bpartnerId, final int bPartnerCreditLimitId)
{
return new BPartnerCreditLimitId(bpartnerId, bPartnerCreditLimitId);
}
public static BPartnerCreditLimitId ofRepoId(final int bpartnerId, final int bPartnerCreditLimitId)
{
return new BPartnerCreditLimitId(BPartnerId.ofRepoId(bpartnerId), bPartnerCreditLimitId);
}
@Nullable
public static BPartnerCreditLimitId ofRepoIdOrNull(
@Nullable final Integer bpartnerId,
@Nullable final Integer bPartnerCreditLimitId)
{
return bpartnerId != null && bpartnerId > 0 && bPartnerCreditLimitId != null && bPartnerCreditLimitId > 0
? ofRepoId(bpartnerId, bPartnerCreditLimitId)
: null;
}
public static Optional<BPartnerCreditLimitId> optionalOfRepoId(
@Nullable final Integer bpartnerId,
@Nullable final Integer bPartnerCreditLimitId)
{
return Optional.ofNullable(ofRepoIdOrNull(bpartnerId, bPartnerCreditLimitId));
}
@Nullable
public static BPartnerCreditLimitId ofRepoIdOrNull(
@Nullable final BPartnerId bpartnerId,
@Nullable final Integer bPartnerCreditLimitId)
|
{
return bpartnerId != null && bPartnerCreditLimitId != null && bPartnerCreditLimitId > 0 ? ofRepoId(bpartnerId, bPartnerCreditLimitId) : null;
}
@Jacksonized
@Builder
private BPartnerCreditLimitId(@NonNull final BPartnerId bpartnerId, final int bPartnerCreditLimitId)
{
this.bpartnerId = bpartnerId;
this.repoId = Check.assumeGreaterThanZero(bPartnerCreditLimitId, "C_BPartner_CreditLimit_ID");
}
public static int toRepoId(@Nullable final BPartnerCreditLimitId bPartnerCreditLimitId)
{
return bPartnerCreditLimitId != null ? bPartnerCreditLimitId.getRepoId() : -1;
}
public static boolean equals(final @Nullable BPartnerCreditLimitId id1, final @Nullable BPartnerCreditLimitId id2)
{
return Objects.equals(id1, id2);
}
@JsonValue
public int toJson()
{
return getRepoId();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\bpartner\service\BPartnerCreditLimitId.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public boolean isEnableHistoryCleaning() {
return enableHistoryCleaning;
}
public void setEnableHistoryCleaning(boolean enableHistoryCleaning) {
this.enableHistoryCleaning = enableHistoryCleaning;
}
public String getHistoryCleaningCycle() {
return historyCleaningCycle;
}
public void setHistoryCleaningCycle(String historyCleaningCycle) {
this.historyCleaningCycle = historyCleaningCycle;
}
@Deprecated
@DeprecatedConfigurationProperty(replacement = "flowable.history-cleaning-after", reason = "Switched to using a Duration that allows more flexible configuration")
public void setHistoryCleaningAfterDays(int historyCleaningAfterDays) {
this.historyCleaningAfter = Duration.ofDays(historyCleaningAfterDays);
}
public Duration getHistoryCleaningAfter() {
return historyCleaningAfter;
}
public void setHistoryCleaningAfter(Duration historyCleaningAfter) {
|
this.historyCleaningAfter = historyCleaningAfter;
}
public int getHistoryCleaningBatchSize() {
return historyCleaningBatchSize;
}
public void setHistoryCleaningBatchSize(int historyCleaningBatchSize) {
this.historyCleaningBatchSize = historyCleaningBatchSize;
}
public String getVariableJsonMapper() {
return variableJsonMapper;
}
public void setVariableJsonMapper(String variableJsonMapper) {
this.variableJsonMapper = variableJsonMapper;
}
}
|
repos\flowable-engine-main\modules\flowable-spring-boot\flowable-spring-boot-starters\flowable-spring-boot-autoconfigure\src\main\java\org\flowable\spring\boot\FlowableProperties.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public ApiResponse<DeviceMapping> putDeviceWithHttpInfo(String albertaApiKey, String _id, DeviceToCreate body) throws ApiException {
com.squareup.okhttp.Call call = putDeviceValidateBeforeCall(albertaApiKey, _id, body, null, null);
Type localVarReturnType = new TypeToken<DeviceMapping>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Gerätedaten in Alberta ändern (asynchronously)
* ändert Geräte in Alberta
* @param albertaApiKey (required)
* @param _id (required)
* @param body device to create (optional)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call putDeviceAsync(String albertaApiKey, String _id, DeviceToCreate body, final ApiCallback<DeviceMapping> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
|
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = putDeviceValidateBeforeCall(albertaApiKey, _id, body, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<DeviceMapping>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\alberta\alberta-article-api\src\main\java\io\swagger\client\api\DeviceApi.java
| 2
|
请完成以下Java代码
|
public meta setScheme (String scheme)
{
addAttribute ("scheme", scheme);
return this;
}
/**
* Sets the http-equiv="" attribute.
*
* @param content
* the value that should go into the http-equiv attribute
*/
public meta setHttpEquiv (String http_equiv)
{
addAttribute ("http-equiv", http_equiv);
return this;
}
/**
* Sets the http-equiv="" attribute.
*
* @param content
* the value that should go into the http-equiv attribute
*/
public meta setHttpEquiv (String http_equiv, String content)
{
addAttribute ("content", content);
addAttribute ("http-equiv", http_equiv);
return this;
}
/**
* Sets the lang="" and xml:lang="" attributes
*
* @param lang
* the lang="" and xml:lang="" attributes
*/
public Element setLang (String lang)
{
addAttribute ("lang", lang);
addAttribute ("xml:lang", lang);
return this;
}
/**
* Adds an Element to the element.
*
* @param hashcode
* name of element for hash table
* @param element
* Adds an Element to the element.
*/
public meta addElement (String hashcode, Element element)
{
addElementToRegistry (hashcode, element);
return (this);
}
/**
* Adds an Element to the element.
*
* @param hashcode
* name of element for hash table
* @param element
* Adds an Element to the element.
*/
public meta addElement (String hashcode, String element)
{
addElementToRegistry (hashcode, element);
return (this);
}
/**
* Adds an Element to the element.
|
*
* @param element
* Adds an Element to the element.
*/
public meta addElement (Element element)
{
addElementToRegistry (element);
return (this);
}
/**
* Adds an Element to the element.
*
* @param element
* Adds an Element to the element.
*/
public meta addElement (String element)
{
addElementToRegistry (element);
return (this);
}
/**
* Removes an Element from the element.
*
* @param hashcode
* the name of the element to be removed.
*/
public meta removeElement (String hashcode)
{
removeElementFromRegistry (hashcode);
return (this);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\tools\src\main\java-legacy\org\apache\ecs\xhtml\meta.java
| 1
|
请完成以下Java代码
|
public class BsonProductMapper {
private final ObjectMapper objectMapper;
public BsonProductMapper() {
this.objectMapper = new ObjectMapper(new BsonFactory());
}
public byte[] toBytes(Product product) throws JsonProcessingException {
return objectMapper.writeValueAsBytes(product);
}
public Product fromBytes(byte[] bson) throws IOException {
return objectMapper.readValue(bson, Product.class);
}
public Document toDocument(Product product) throws IOException {
|
byte[] bytes = toBytes(product);
RawBsonDocument bsonDoc = new RawBsonDocument(bytes);
return Document.parse(bsonDoc.toJson());
}
public Product fromDocument(Document document) throws IOException {
BsonDocument bsonDoc = document.toBsonDocument();
BasicOutputBuffer buffer = new BasicOutputBuffer();
new BsonDocumentCodec().encode(
new BsonBinaryWriter(buffer),
bsonDoc, EncoderContext
.builder()
.build()
);
return fromBytes(buffer.toByteArray());
}
}
|
repos\tutorials-master\jackson-modules\jackson-conversions-3\src\main\java\com\baeldung\jackson\pojomapping\BsonProductMapper.java
| 1
|
请完成以下Java代码
|
public Date getDeliveryDate()
{
return deliveryDate;
}
@Override
public void setDeliveryDate(final Date deliveryDate)
{
this.deliveryDate = deliveryDate;
}
@Override
public Boolean getProcessed()
{
return processed;
}
@Override
public void setProcessed(Boolean processed)
{
this.processed = processed;
}
@Override
public Boolean getGenericTourInstance()
{
return genericTourInstance;
}
|
@Override
public void setGenericTourInstance(Boolean genericTourInstance)
{
this.genericTourInstance = genericTourInstance;
}
@Override
public int getM_ShipperTransportation_ID()
{
return shipperTransportationId;
}
@Override
public void setM_ShipperTransportation_ID(final int shipperTransportationId)
{
this.shipperTransportationId = shipperTransportationId;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\tourplanning\api\impl\PlainTourInstanceQueryParams.java
| 1
|
请完成以下Java代码
|
protected Set<Entry<Resources, Supplier<HistoryEvent>>> getHistoricInstanceResources(
CommandContext commandContext) {
Map<Resources, Supplier<HistoryEvent>> resources = new HashMap<>();
resources.put(Resources.HISTORIC_PROCESS_INSTANCE, () ->
getHistoricProcessInstance(commandContext));
resources.put(Resources.HISTORIC_TASK, () -> getHistoricTaskInstance(commandContext));
return resources.entrySet();
}
protected void provideRemovalTime(HistoryEvent historicInstance) {
if (historicInstance != null) {
String rootProcessInstanceId = historicInstance.getRootProcessInstanceId();
authorization.setRootProcessInstanceId(rootProcessInstanceId);
Date removalTime = historicInstance.getRemovalTime();
authorization.setRemovalTime(removalTime);
} else { // reset
authorization.setRootProcessInstanceId(null);
authorization.setRemovalTime(null);
}
}
protected HistoryEvent getHistoricProcessInstance(CommandContext commandContext) {
String historicProcessInstanceId = authorization.getResourceId();
if (isNullOrAny(historicProcessInstanceId)) {
|
return null;
}
return commandContext.getHistoricProcessInstanceManager()
.findHistoricProcessInstance(historicProcessInstanceId);
}
protected HistoryEvent getHistoricTaskInstance(CommandContext commandContext) {
String historicTaskInstanceId = authorization.getResourceId();
if (isNullOrAny(historicTaskInstanceId)) {
return null;
}
return commandContext.getHistoricTaskInstanceManager()
.findHistoricTaskInstanceById(historicTaskInstanceId);
}
protected boolean isNullOrAny(String resourceId) {
return resourceId == null || isAny(resourceId);
}
protected boolean isAny(String resourceId) {
return Objects.equals(Authorization.ANY, resourceId);
}
protected boolean isResourceEqualTo(Resources resource) {
return Objects.equals(resource.resourceType(), authorization.getResource());
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmd\SaveAuthorizationCmd.java
| 1
|
请完成以下Java代码
|
public HuIdsFilterList huQuery(@NonNull final IHUQueryBuilder initialHUQueryCopy, @NonNull final Set<HuId> alwaysIncludeHUIds, @NonNull final Set<HuId> excludeHUIds)
{
return null; // cannot compute
}
});
}
public boolean isPossibleHighVolume(final int highVolumeThreshold)
{
final Integer estimatedSize = estimateSize();
return estimatedSize == null || estimatedSize > highVolumeThreshold;
}
@Nullable
private Integer estimateSize()
{
return getFixedHUIds().map(HuIdsFilterList::estimateSize).orElse(null);
}
interface CaseConverter<T>
{
T acceptAll();
T acceptAllBut(@NonNull Set<HuId> alwaysIncludeHUIds, @NonNull Set<HuId> excludeHUIds);
T acceptNone();
T acceptOnly(@NonNull HuIdsFilterList fixedHUIds, @NonNull Set<HuId> alwaysIncludeHUIds);
T huQuery(@NonNull IHUQueryBuilder initialHUQueryCopy, @NonNull Set<HuId> alwaysIncludeHUIds, @NonNull Set<HuId> excludeHUIds);
}
public synchronized <T> T convert(@NonNull final CaseConverter<T> converter)
{
if (initialHUQuery == null)
{
if (initialHUIds == null)
{
throw new IllegalStateException("initialHUIds shall not be null for " + this);
}
else if (initialHUIds.isAll())
{
if (mustHUIds.isEmpty() && shallNotHUIds.isEmpty())
{
|
return converter.acceptAll();
}
else
{
return converter.acceptAllBut(ImmutableSet.copyOf(mustHUIds), ImmutableSet.copyOf(shallNotHUIds));
}
}
else
{
final ImmutableSet<HuId> fixedHUIds = Stream.concat(
initialHUIds.stream(),
mustHUIds.stream())
.distinct()
.filter(huId -> !shallNotHUIds.contains(huId)) // not excluded
.collect(ImmutableSet.toImmutableSet());
if (fixedHUIds.isEmpty())
{
return converter.acceptNone();
}
else
{
return converter.acceptOnly(HuIdsFilterList.of(fixedHUIds), ImmutableSet.copyOf(mustHUIds));
}
}
}
else
{
return converter.huQuery(initialHUQuery.copy(), ImmutableSet.copyOf(mustHUIds), ImmutableSet.copyOf(shallNotHUIds));
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\filter\HUIdsFilterData.java
| 1
|
请完成以下Java代码
|
public class Employee implements Serializable {
private static final long serialVersionUID = 3077867088762010705L;
private Long id;
private String title;
private String name;
public Employee(Long id, String title, String name) {
super();
this.id = id;
this.title = title;
this.name = name;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
|
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
|
repos\tutorials-master\web-modules\ratpack\src\main\java\com\baeldung\model\Employee.java
| 1
|
请完成以下Java代码
|
public HistoricCaseInstanceResource getHistoricCaseInstance(String caseInstanceId) {
return new HistoricCaseInstanceResourceImpl(processEngine, caseInstanceId);
}
@Override
public List<HistoricCaseInstanceDto> getHistoricCaseInstances(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
HistoricCaseInstanceQueryDto queryHistoricCaseInstanceDto = new HistoricCaseInstanceQueryDto(objectMapper, uriInfo.getQueryParameters());
return queryHistoricCaseInstances(queryHistoricCaseInstanceDto, firstResult, maxResults);
}
@Override
public List<HistoricCaseInstanceDto> queryHistoricCaseInstances(HistoricCaseInstanceQueryDto queryDto, Integer firstResult, Integer maxResults) {
HistoricCaseInstanceQuery query = queryDto.toQuery(processEngine);
List<HistoricCaseInstance> matchingHistoricCaseInstances = QueryUtil.list(query, firstResult, maxResults);
List<HistoricCaseInstanceDto> historicCaseInstanceDtoResults = new ArrayList<HistoricCaseInstanceDto>();
for (HistoricCaseInstance historicCaseInstance : matchingHistoricCaseInstances) {
HistoricCaseInstanceDto resultHistoricCaseInstanceDto = HistoricCaseInstanceDto.fromHistoricCaseInstance(historicCaseInstance);
historicCaseInstanceDtoResults.add(resultHistoricCaseInstanceDto);
}
|
return historicCaseInstanceDtoResults;
}
@Override
public CountResultDto getHistoricCaseInstancesCount(UriInfo uriInfo) {
HistoricCaseInstanceQueryDto queryDto = new HistoricCaseInstanceQueryDto(objectMapper, uriInfo.getQueryParameters());
return queryHistoricCaseInstancesCount(queryDto);
}
@Override
public CountResultDto queryHistoricCaseInstancesCount(HistoricCaseInstanceQueryDto queryDto) {
HistoricCaseInstanceQuery query = queryDto.toQuery(processEngine);
long count = query.count();
return new CountResultDto(count);
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\impl\history\HistoricCaseInstanceRestServiceImpl.java
| 1
|
请完成以下Java代码
|
public Integer getUseType() {
return useType;
}
public void setUseType(Integer useType) {
this.useType = useType;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public Integer getPublishCount() {
return publishCount;
}
public void setPublishCount(Integer publishCount) {
this.publishCount = publishCount;
}
public Integer getUseCount() {
return useCount;
}
public void setUseCount(Integer useCount) {
this.useCount = useCount;
}
public Integer getReceiveCount() {
return receiveCount;
}
public void setReceiveCount(Integer receiveCount) {
this.receiveCount = receiveCount;
}
public Date getEnableTime() {
return enableTime;
}
public void setEnableTime(Date enableTime) {
this.enableTime = enableTime;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Integer getMemberLevel() {
return memberLevel;
}
public void setMemberLevel(Integer memberLevel) {
|
this.memberLevel = memberLevel;
}
@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(", type=").append(type);
sb.append(", name=").append(name);
sb.append(", platform=").append(platform);
sb.append(", count=").append(count);
sb.append(", amount=").append(amount);
sb.append(", perLimit=").append(perLimit);
sb.append(", minPoint=").append(minPoint);
sb.append(", startTime=").append(startTime);
sb.append(", endTime=").append(endTime);
sb.append(", useType=").append(useType);
sb.append(", note=").append(note);
sb.append(", publishCount=").append(publishCount);
sb.append(", useCount=").append(useCount);
sb.append(", receiveCount=").append(receiveCount);
sb.append(", enableTime=").append(enableTime);
sb.append(", code=").append(code);
sb.append(", memberLevel=").append(memberLevel);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
|
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\SmsCoupon.java
| 1
|
请完成以下Java代码
|
public class CommentMutation {
private ArticleRepository articleRepository;
private CommentRepository commentRepository;
private CommentQueryService commentQueryService;
@DgsData(parentType = MUTATION.TYPE_NAME, field = MUTATION.AddComment)
public DataFetcherResult<CommentPayload> createComment(
@InputArgument("slug") String slug, @InputArgument("body") String body) {
User user = SecurityUtil.getCurrentUser().orElseThrow(AuthenticationException::new);
Article article =
articleRepository.findBySlug(slug).orElseThrow(ResourceNotFoundException::new);
Comment comment = new Comment(body, user.getId(), article.getId());
commentRepository.save(comment);
CommentData commentData =
commentQueryService
.findById(comment.getId(), user)
.orElseThrow(ResourceNotFoundException::new);
return DataFetcherResult.<CommentPayload>newResult()
.localContext(commentData)
.data(CommentPayload.newBuilder().build())
.build();
}
@DgsData(parentType = MUTATION.TYPE_NAME, field = MUTATION.DeleteComment)
public DeletionStatus removeComment(
@InputArgument("slug") String slug, @InputArgument("id") String commentId) {
|
User user = SecurityUtil.getCurrentUser().orElseThrow(AuthenticationException::new);
Article article =
articleRepository.findBySlug(slug).orElseThrow(ResourceNotFoundException::new);
return commentRepository
.findById(article.getId(), commentId)
.map(
comment -> {
if (!AuthorizationService.canWriteComment(user, article, comment)) {
throw new NoAuthorizationException();
}
commentRepository.remove(comment);
return DeletionStatus.newBuilder().success(true).build();
})
.orElseThrow(ResourceNotFoundException::new);
}
}
|
repos\spring-boot-realworld-example-app-master\src\main\java\io\spring\graphql\CommentMutation.java
| 1
|
请完成以下Java代码
|
private static class ImportTableRelatedProcess
{
@Getter
private final String name;
@Getter
private AdProcessId processId;
private final HashSet<String> registeredOnTableNames = new HashSet<>();
public ImportTableRelatedProcess(@NonNull final String name)
{
this.name = name;
}
public void setProcessId(@NonNull final AdProcessId processId)
{
if (this.processId != null && !Objects.equals(this.processId, processId))
{
throw new AdempiereException("Changing process from " + this.processId + " to " + processId + " is not allowed.");
|
}
this.processId = processId;
}
public boolean hasTableName(@NonNull final String tableName)
{
return registeredOnTableNames.contains(tableName);
}
public void addTableName(@NonNull final String tableName)
{
registeredOnTableNames.add(tableName);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\impexp\processing\impl\ImportTablesRelatedProcessesRegistry.java
| 1
|
请完成以下Java代码
|
public String getName() {
// used for save a byte value
return clauseId;
}
@Override
public String getTextValue() {
return textValue;
}
@Override
public void setTextValue(String textValue) {
this.textValue = textValue;
}
@Override
public String getTextValue2() {
return textValue2;
}
@Override
public void setTextValue2(String textValue2) {
this.textValue2 = textValue2;
}
@Override
public Long getLongValue() {
return longValue;
}
@Override
public void setLongValue(Long longValue) {
this.longValue = longValue;
}
@Override
public Double getDoubleValue() {
return doubleValue;
}
@Override
public void setDoubleValue(Double doubleValue) {
this.doubleValue = doubleValue;
}
public String getByteArrayValueId() {
return byteArrayField.getByteArrayId();
}
public void setByteArrayValueId(String byteArrayId) {
byteArrayField.setByteArrayId(byteArrayId);
}
@Override
public byte[] getByteArrayValue() {
return byteArrayField.getByteArrayValue();
}
@Override
public void setByteArrayValue(byte[] bytes) {
byteArrayField.setByteArrayValue(bytes);
}
public void setValue(TypedValue typedValue) {
typedValueField.setValue(typedValue);
}
|
public String getSerializerName() {
return typedValueField.getSerializerName();
}
public void setSerializerName(String serializerName) {
typedValueField.setSerializerName(serializerName);
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getRootProcessInstanceId() {
return rootProcessInstanceId;
}
public void setRootProcessInstanceId(String rootProcessInstanceId) {
this.rootProcessInstanceId = rootProcessInstanceId;
}
public void delete() {
byteArrayField.deleteByteArrayValue();
Context
.getCommandContext()
.getDbEntityManager()
.delete(this);
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\history\event\HistoricDecisionInputInstanceEntity.java
| 1
|
请完成以下Java代码
|
public void validate(Object submittedValue, VariableMap submittedValues, FormFieldHandler formFieldHandler, VariableScope variableScope) {
try {
FormFieldValidatorContext context = new DefaultFormFieldValidatorContext(variableScope, config, submittedValues, formFieldHandler);
if(!validator.validate(submittedValue, context)) {
throw new FormFieldValidatorException(formFieldHandler.getId(), name, config, submittedValue, "Invalid value submitted for form field '"+formFieldHandler.getId()+"': validation of "+this+" failed.");
}
} catch(FormFieldValidationException e) {
throw new FormFieldValidatorException(formFieldHandler.getId(), name, config, submittedValue, "Invalid value submitted for form field '"+formFieldHandler.getId()+"': validation of "+this+" failed.", e);
}
}
// getter / setter ////////////////////////
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void setConfig(String config) {
this.config = config;
}
public String getConfig() {
return config;
|
}
public void setValidator(FormFieldValidator validator) {
this.validator = validator;
}
public FormFieldValidator getValidator() {
return validator;
}
public String toString() {
return name + (config != null ? ("("+config+")") : "");
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\form\handler\FormFieldValidationConstraintHandler.java
| 1
|
请完成以下Java代码
|
public HistoricActivityStatisticsQuery finishedBefore(Date date) {
finishedBefore = date;
return this;
}
@Override
public HistoricActivityStatisticsQuery processInstanceIdIn(String... processInstanceIds) {
ensureNotNull("processInstanceIds", (Object[]) processInstanceIds);
this.processInstanceIds = processInstanceIds;
return this;
}
public HistoricActivityStatisticsQuery orderByActivityId() {
return orderBy(HistoricActivityStatisticsQueryProperty.ACTIVITY_ID_);
}
public long executeCount(CommandContext commandContext) {
checkQueryOk();
return
commandContext
.getHistoricStatisticsManager()
.getHistoricStatisticsCountGroupedByActivity(this);
}
public List<HistoricActivityStatistics> executeList(CommandContext commandContext, Page page) {
checkQueryOk();
return
commandContext
.getHistoricStatisticsManager()
.getHistoricStatisticsGroupedByActivity(this, page);
}
protected void checkQueryOk() {
super.checkQueryOk();
|
ensureNotNull("No valid process definition id supplied", "processDefinitionId", processDefinitionId);
}
// getters /////////////////////////////////////////////////
public String getProcessDefinitionId() {
return processDefinitionId;
}
public boolean isIncludeFinished() {
return includeFinished;
}
public boolean isIncludeCanceled() {
return includeCanceled;
}
public boolean isIncludeCompleteScope() {
return includeCompleteScope;
}
public String[] getProcessInstanceIds() {
return processInstanceIds;
}
public boolean isIncludeIncidents() {
return includeIncidents;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\HistoricActivityStatisticsQueryImpl.java
| 1
|
请完成以下Java代码
|
public String getCd() {
return cd;
}
/**
* Sets the value of the cd property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCd(String value) {
this.cd = value;
}
/**
* Gets the value of the amt property.
*
* @return
* possible object is
* {@link ActiveOrHistoricCurrencyAndAmount }
*
*/
public ActiveOrHistoricCurrencyAndAmount getAmt() {
return amt;
}
/**
* Sets the value of the amt property.
*
* @param value
* allowed object is
* {@link ActiveOrHistoricCurrencyAndAmount }
*
*/
public void setAmt(ActiveOrHistoricCurrencyAndAmount value) {
this.amt = value;
}
/**
* Gets the value of the inf property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the inf property.
*
|
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getInf().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link String }
*
*
*/
public List<String> getInf() {
if (inf == null) {
inf = new ArrayList<String>();
}
return this.inf;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.sepa\schema-pain_001_01_03_ch_02\src\main\java-xjc\de\metas\payment\sepa\jaxb\sct\pain_001_001_03_ch_02\StructuredRegulatoryReporting3.java
| 1
|
请完成以下Java代码
|
public boolean isEnabledOrNotSilent()
{
try (final MDCCloseable ignored = TableRecordMDC.putTableRecordReference(I_AD_Process.Table_Name, processId == null ? null : processId.toAdProcessIdOrNull()))
{
final ProcessPreconditionsResolution preconditionsResolution = getPreconditionsResolution();
return preconditionsResolution.isAccepted() || !preconditionsResolution.isInternal();
}
}
public boolean isInternal()
{
final ProcessPreconditionsResolution preconditionsResolution = getPreconditionsResolution();
return preconditionsResolution.isInternal();
}
public String getDisabledReason(final String adLanguage)
{
return getPreconditionsResolution().getRejectReason().translate(adLanguage);
}
public Map<String, Object> getDebugProperties()
{
final ImmutableMap.Builder<String, Object> debugProperties = ImmutableMap.builder();
if (debugProcessClassname != null)
{
debugProperties.put("debug-classname", debugProcessClassname);
}
return debugProperties.build();
}
public boolean isDisplayedOn(@NonNull final DisplayPlace displayPlace)
{
return getDisplayPlaces().contains(displayPlace);
}
@Value
private static class ValueAndDuration<T>
|
{
public static <T> ValueAndDuration<T> fromSupplier(final Supplier<T> supplier)
{
final Stopwatch stopwatch = Stopwatch.createStarted();
final T value = supplier.get();
final Duration duration = Duration.ofNanos(stopwatch.stop().elapsed(TimeUnit.NANOSECONDS));
return new ValueAndDuration<>(value, duration);
}
T value;
Duration duration;
private ValueAndDuration(final T value, final Duration duration)
{
this.value = value;
this.duration = duration;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\process\descriptor\WebuiRelatedProcessDescriptor.java
| 1
|
请完成以下Java代码
|
public void setC_AcctSchema_ID (int C_AcctSchema_ID)
{
if (C_AcctSchema_ID < 1)
set_Value (COLUMNNAME_C_AcctSchema_ID, null);
else
set_Value (COLUMNNAME_C_AcctSchema_ID, Integer.valueOf(C_AcctSchema_ID));
}
/** Get Accounting Schema.
@return Rules for accounting
*/
public int getC_AcctSchema_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_AcctSchema_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set Comment/Help.
@param Help
Comment or Hint
*/
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 Ratio.
@param PA_Ratio_ID
Performace Ratio
*/
public void setPA_Ratio_ID (int PA_Ratio_ID)
{
if (PA_Ratio_ID < 1)
set_ValueNoCheck (COLUMNNAME_PA_Ratio_ID, null);
else
set_ValueNoCheck (COLUMNNAME_PA_Ratio_ID, Integer.valueOf(PA_Ratio_ID));
}
/** Get Ratio.
@return Performace Ratio
*/
public int getPA_Ratio_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_PA_Ratio_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_PA_Ratio.java
| 1
|
请完成以下Java代码
|
public java.lang.String getValueMin()
{
return get_ValueAsString(COLUMNNAME_ValueMin);
}
@Override
public void setVersion (final BigDecimal Version)
{
set_Value (COLUMNNAME_Version, Version);
}
@Override
public BigDecimal getVersion()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Version);
|
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setVFormat (final @Nullable java.lang.String VFormat)
{
set_Value (COLUMNNAME_VFormat, VFormat);
}
@Override
public java.lang.String getVFormat()
{
return get_ValueAsString(COLUMNNAME_VFormat);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Column.java
| 1
|
请完成以下Java代码
|
private OrderResponsePackageItem createOrderResponsePackageItem(final JpaOrderPackageItem jpaOrderPackageItem)
{
return OrderResponsePackageItem.builder()
.requestId(OrderCreateRequestPackageItemId.of(jpaOrderPackageItem.getUuid()))
.pzn(PZN.of(jpaOrderPackageItem.getPzn()))
.qty(Quantity.of(jpaOrderPackageItem.getQty()))
.deliverySpecifications(jpaOrderPackageItem.getDeliverySpecifications())
.build();
}
public OrderStatusResponse getOrderStatus(@NonNull final Id orderId, @NonNull final BPartnerId bpartnerId)
{
final JpaOrder jpaOrder = getJpaOrder(orderId, bpartnerId);
return createOrderStatusResponse(jpaOrder);
}
private JpaOrder getJpaOrder(@NonNull final Id orderId, @NonNull final BPartnerId bpartnerId)
{
final JpaOrder jpaOrder = jpaOrdersRepo.findByDocumentNoAndMfBpartnerId(orderId.getValueAsString(), bpartnerId.getBpartnerId());
if (jpaOrder == null)
{
throw new RuntimeException("No order found for id='" + orderId + "' and bpartnerId='" + bpartnerId + "'");
}
|
return jpaOrder;
}
private OrderStatusResponse createOrderStatusResponse(final JpaOrder jpaOrder)
{
return OrderStatusResponse.builder()
.orderId(Id.of(jpaOrder.getDocumentNo()))
.supportId(SupportIDType.of(jpaOrder.getSupportId()))
.orderStatus(jpaOrder.getOrderStatus())
.orderPackages(jpaOrder.getOrderPackages().stream()
.map(this::createOrderResponsePackage)
.collect(ImmutableList.toImmutableList()))
.build();
}
public List<OrderResponse> getOrders()
{
return jpaOrdersRepo.findAll()
.stream()
.map(this::createOrderResponse)
.collect(ImmutableList.toImmutableList());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.msv3.server\src\main\java\de\metas\vertical\pharma\msv3\server\order\OrderService.java
| 1
|
请完成以下Java代码
|
private boolean isReversal(@NonNull final ReportEntry8 ntry)
{
return ntry.isRvslInd() != null && ntry.isRvslInd();
}
/**
* Verifies that the currency is consistent.
* iterateTransactionDetails for version 6 <code>BankToCustomerDebitCreditNotificationV06</code>
*/
private void verifyTransactionCurrency(
@NonNull final EntryTransaction8 txDtls,
@NonNull final ESRTransactionBuilder trxBuilder)
{
if (bankAccountCurrencyCode == null)
{
return; // nothing to do
}
// TODO: this does not really belong into the loader! move it to the matcher code.
final ActiveOrHistoricCurrencyAndAmount transactionDetailAmt = txDtls.getAmt();
final String bankAccountCurrencyCode3L = bankAccountCurrencyCode.toThreeLetterCode();
if (!bankAccountCurrencyCode3L.equalsIgnoreCase(transactionDetailAmt.getCcy()))
{
trxBuilder.errorMsg(getErrorMsg(ESRDataImporterCamt54.MSG_BANK_ACCOUNT_MISMATCH_2P, bankAccountCurrencyCode3L, transactionDetailAmt.getCcy()));
}
}
public static BankToCustomerDebitCreditNotificationV06 loadXML(@NonNull final MultiVersionStreamReaderDelegate xsr)
{
final Document document;
try
{
final JAXBContext context = JAXBContext.newInstance(Document.class);
final Unmarshaller unmarshaller = context.createUnmarshaller();
// https://github.com/metasfresh/metasfresh/issues/1903
// use a delegate to make sure that the unmarshaller won't refuse camt.054.001.02 , camt.054.001.04 and amt.054.001.05
@SuppressWarnings("unchecked")
final JAXBElement<Document> e = (JAXBElement<Document>)unmarshaller.unmarshal(xsr);
document = e.getValue();
}
catch (final JAXBException e)
{
throw AdempiereException.wrapIfNeeded(e);
}
return document.getBkToCstmrDbtCdtNtfctn();
}
private String getErrorMsg(@NonNull final AdMessageKey adMessage, @Nullable final Object... params)
{
return msgBL.getTranslatableMsgText(adMessage, params).translate(adLanguage);
}
|
/**
* Marshals the given {@code} into an XML string and return that as the "key".
* mkTrxKey for version 6 <code>BankToCustomerDebitCreditNotificationV06</code>
*/
private static String mkTrxKey(@NonNull final EntryTransaction8 txDtl)
{
final ByteArrayOutputStream transactionKey = new ByteArrayOutputStream();
JAXB.marshal(txDtl, transactionKey);
try
{
return transactionKey.toString("UTF-8");
}
catch (UnsupportedEncodingException e)
{
// won't happen because UTF-8 is supported
throw AdempiereException.wrapIfNeeded(e);
}
}
/**
* asTimestamp for version 6 <code>BankToCustomerDebitCreditNotificationV06</code>
*/
private static Timestamp asTimestamp(@NonNull final DateAndDateTimeChoice valDt)
{
return new Timestamp(valDt.getDt().toGregorianCalendar().getTimeInMillis());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.esr\src\main\java\de\metas\payment\esr\dataimporter\impl\camt54\ESRDataImporterCamt54v06.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@ApiModelProperty(example = "http://localhost:8182/management/batch-parts/8")
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
@ApiModelProperty(example = "4")
public String getBatchId() {
return batchId;
}
public void setBatchId(String batchId) {
this.batchId = batchId;
}
@ApiModelProperty(example = "http://localhost:8182/management/batch/4")
public String getBatchUrl() {
return batchUrl;
}
public void setBatchUrl(String batchUrl) {
this.batchUrl = batchUrl;
}
@ApiModelProperty(example = "processMigration")
public String getBatchType() {
return batchType;
}
public void setBatchType(String batchType) {
this.batchType = batchType;
}
@ApiModelProperty(example = "1:22:MP")
public String getSearchKey() {
return searchKey;
}
public void setSearchKey(String searchKey) {
this.searchKey = searchKey;
}
@ApiModelProperty(example = "1:24:MP")
public String getSearchKey2() {
return searchKey2;
}
public void setSearchKey2(String searchKey2) {
this.searchKey2 = searchKey2;
}
@ApiModelProperty(example = "1")
public String getScopeId() {
return scopeId;
}
public void setScopeId(String scopeId) {
this.scopeId = scopeId;
}
@ApiModelProperty(example = "2")
public String getSubScopeId() {
return subScopeId;
}
public void setSubScopeId(String subScopeId) {
this.subScopeId = subScopeId;
}
@ApiModelProperty(example = "bpmn")
public String getScopeType() {
return scopeType;
|
}
public void setScopeType(String scopeType) {
this.scopeType = scopeType;
}
@ApiModelProperty(example = "2020-06-03T22:05:05.474+0000")
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@ApiModelProperty(example = "2020-06-03T22:05:05.474+0000")
public Date getCompleteTime() {
return completeTime;
}
public void setCompleteTime(Date completeTime) {
this.completeTime = completeTime;
}
@ApiModelProperty(example = "completed")
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
@ApiModelProperty(example = "null")
public String getTenantId() {
return tenantId;
}
}
|
repos\flowable-engine-main\modules\flowable-rest\src\main\java\org\flowable\rest\service\api\management\BatchPartResponse.java
| 2
|
请完成以下Java代码
|
public java.sql.Timestamp getValidTo()
{
return get_ValueAsTimestamp(COLUMNNAME_ValidTo);
}
@Override
public void setValue (final java.lang.String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
@Override
public java.lang.String getValue()
{
return get_ValueAsString(COLUMNNAME_Value);
}
@Override
public void setWaitingTime (final int WaitingTime)
{
set_Value (COLUMNNAME_WaitingTime, WaitingTime);
}
@Override
public int getWaitingTime()
{
return get_ValueAsInt(COLUMNNAME_WaitingTime);
}
@Override
public void setWaitTime (final int WaitTime)
{
set_Value (COLUMNNAME_WaitTime, WaitTime);
}
@Override
public int getWaitTime()
{
return get_ValueAsInt(COLUMNNAME_WaitTime);
}
@Override
public void setWorkflow_ID (final int Workflow_ID)
{
if (Workflow_ID < 1)
set_Value (COLUMNNAME_Workflow_ID, null);
else
set_Value (COLUMNNAME_Workflow_ID, Workflow_ID);
}
@Override
public int getWorkflow_ID()
{
return get_ValueAsInt(COLUMNNAME_Workflow_ID);
}
@Override
public void setWorkingTime (final int WorkingTime)
{
set_Value (COLUMNNAME_WorkingTime, WorkingTime);
|
}
@Override
public int getWorkingTime()
{
return get_ValueAsInt(COLUMNNAME_WorkingTime);
}
@Override
public void setXPosition (final int XPosition)
{
set_Value (COLUMNNAME_XPosition, XPosition);
}
@Override
public int getXPosition()
{
return get_ValueAsInt(COLUMNNAME_XPosition);
}
@Override
public void setYield (final int Yield)
{
set_Value (COLUMNNAME_Yield, Yield);
}
@Override
public int getYield()
{
return get_ValueAsInt(COLUMNNAME_Yield);
}
@Override
public void setYPosition (final int YPosition)
{
set_Value (COLUMNNAME_YPosition, YPosition);
}
@Override
public int getYPosition()
{
return get_ValueAsInt(COLUMNNAME_YPosition);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_WF_Node.java
| 1
|
请完成以下Java代码
|
public java.math.BigDecimal getPriceLimit ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PriceLimit);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Auszeichnungspreis.
@param PriceList
Auszeichnungspreis
*/
@Override
public void setPriceList (java.math.BigDecimal PriceList)
{
set_Value (COLUMNNAME_PriceList, PriceList);
}
/** Get Auszeichnungspreis.
@return Auszeichnungspreis
*/
@Override
public java.math.BigDecimal getPriceList ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PriceList);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Standardpreis.
@param PriceStd
Standardpreis
*/
@Override
public void setPriceStd (java.math.BigDecimal PriceStd)
{
set_Value (COLUMNNAME_PriceStd, PriceStd);
}
/** Get Standardpreis.
@return Standardpreis
*/
@Override
public java.math.BigDecimal getPriceStd ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PriceStd);
|
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Menge.
@param Qty
Menge
*/
@Override
public void setQty (java.math.BigDecimal Qty)
{
set_Value (COLUMNNAME_Qty, Qty);
}
/** Get Menge.
@return Menge
*/
@Override
public java.math.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\adempiere\model\X_M_ProductScalePrice.java
| 1
|
请完成以下Java代码
|
public HUAttributeQueryFilterVO addValue(final Object value)
{
setMatchingType(AttributeValueMatchingType.ValuesList);
final boolean added = _values.add(value);
if (added)
{
_valuesAndSubstitutes = null;
}
return this;
}
public HUAttributeQueryFilterVO addValues(final Collection<? extends Object> values)
{
setMatchingType(AttributeValueMatchingType.ValuesList);
final boolean added = _values.addAll(values);
if (added)
{
_valuesAndSubstitutes = null;
}
return this;
}
private AttributeId getAttributeId()
{
return attributeId;
}
/**
* @return attribute; never return <code>null</code>
*/
private I_M_Attribute getM_Attribute()
{
return attribute;
}
public HUAttributeQueryFilterVO assertAttributeValueType(@NonNull final String attributeValueType)
{
Check.assume(
Objects.equals(this.attributeValueType, attributeValueType),
"Invalid attributeValueType for {}. Expected: {}",
this, attributeValueType);
return this;
}
private ModelColumn<I_M_HU_Attribute, Object> getHUAttributeValueColumn()
{
return huAttributeValueColumn;
}
|
private Set<Object> getValues()
{
return _values;
}
private Set<Object> getValuesAndSubstitutes()
{
if (_valuesAndSubstitutes != null)
{
return _valuesAndSubstitutes;
}
final ModelColumn<I_M_HU_Attribute, Object> valueColumn = getHUAttributeValueColumn();
final boolean isStringValueColumn = I_M_HU_Attribute.COLUMNNAME_Value.equals(valueColumn.getColumnName());
final Set<Object> valuesAndSubstitutes = new HashSet<>();
//
// Iterate current values
for (final Object value : getValues())
{
// Append current value to result
valuesAndSubstitutes.add(value);
// Search and append it's substitutes too, if found
if (isStringValueColumn && value instanceof String)
{
final String valueStr = value.toString();
final I_M_Attribute attribute = getM_Attribute();
final Set<String> valueSubstitutes = attributeDAO.retrieveAttributeValueSubstitutes(attribute, valueStr);
valuesAndSubstitutes.addAll(valueSubstitutes);
}
}
_valuesAndSubstitutes = valuesAndSubstitutes;
return _valuesAndSubstitutes;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\impl\HUAttributeQueryFilterVO.java
| 1
|
请完成以下Java代码
|
public FlowableEventListener createClassDelegateEventListener(EventListener eventListener) {
return new DelegateActivitiEventListener(eventListener.getImplementation(), getEntityType(eventListener.getEntityType()));
}
@Override
public FlowableEventListener createDelegateExpressionEventListener(EventListener eventListener) {
return new DelegateExpressionActivitiEventListener(expressionManager.createExpression(
eventListener.getImplementation()), getEntityType(eventListener.getEntityType()));
}
@Override
public FlowableEventListener createEventThrowingEventListener(EventListener eventListener) {
BaseDelegateEventListener result = null;
if (ImplementationType.IMPLEMENTATION_TYPE_THROW_SIGNAL_EVENT.equals(eventListener.getImplementationType())) {
result = new SignalThrowingEventListener();
((SignalThrowingEventListener) result).setSignalName(eventListener.getImplementation());
((SignalThrowingEventListener) result).setProcessInstanceScope(true);
} else if (ImplementationType.IMPLEMENTATION_TYPE_THROW_GLOBAL_SIGNAL_EVENT.equals(eventListener.getImplementationType())) {
result = new SignalThrowingEventListener();
((SignalThrowingEventListener) result).setSignalName(eventListener.getImplementation());
((SignalThrowingEventListener) result).setProcessInstanceScope(false);
} else if (ImplementationType.IMPLEMENTATION_TYPE_THROW_MESSAGE_EVENT.equals(eventListener.getImplementationType())) {
result = new MessageThrowingEventListener();
((MessageThrowingEventListener) result).setMessageName(eventListener.getImplementation());
} else if (ImplementationType.IMPLEMENTATION_TYPE_THROW_ERROR_EVENT.equals(eventListener.getImplementationType())) {
result = new ErrorThrowingEventListener();
((ErrorThrowingEventListener) result).setErrorCode(eventListener.getImplementation());
}
|
if (result == null) {
throw new ActivitiIllegalArgumentException("Cannot create an event-throwing event-listener, unknown implementation type: "
+ eventListener.getImplementationType());
}
result.setEntityClass(getEntityType(eventListener.getEntityType()));
return result;
}
/**
* @param entityType the name of the entity
* @return
* @throws ActivitiIllegalArgumentException when the given entity name
*/
protected Class<?> getEntityType(String entityType) {
if (entityType != null) {
Class<?> entityClass = ENTITY_MAPPING.get(entityType.trim());
if (entityClass == null) {
throw new ActivitiIllegalArgumentException("Unsupported entity-type for an ActivitiEventListener: " + entityType);
}
return entityClass;
}
return null;
}
}
|
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\bpmn\parser\factory\DefaultListenerFactory.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
static class Exporters {
@Bean
@ConditionalOnProperty(name = "management.opentelemetry.tracing.export.otlp.transport", havingValue = "http",
matchIfMissing = true)
OtlpHttpSpanExporter otlpHttpSpanExporter(OtlpTracingProperties properties,
OtlpTracingConnectionDetails connectionDetails, ObjectProvider<MeterProvider> meterProvider,
ObjectProvider<OtlpHttpSpanExporterBuilderCustomizer> customizers) {
OtlpHttpSpanExporterBuilder builder = OtlpHttpSpanExporter.builder()
.setEndpoint(connectionDetails.getUrl(Transport.HTTP))
.setTimeout(properties.getTimeout())
.setConnectTimeout(properties.getConnectTimeout())
.setCompression(properties.getCompression().name().toLowerCase(Locale.ROOT));
properties.getHeaders().forEach(builder::addHeader);
meterProvider.ifAvailable(builder::setMeterProvider);
customizers.orderedStream().forEach((customizer) -> customizer.customize(builder));
return builder.build();
}
@Bean
@ConditionalOnProperty(name = "management.opentelemetry.tracing.export.otlp.transport", havingValue = "grpc")
OtlpGrpcSpanExporter otlpGrpcSpanExporter(OtlpTracingProperties properties,
|
OtlpTracingConnectionDetails connectionDetails, ObjectProvider<MeterProvider> meterProvider,
ObjectProvider<OtlpGrpcSpanExporterBuilderCustomizer> customizers) {
OtlpGrpcSpanExporterBuilder builder = OtlpGrpcSpanExporter.builder()
.setEndpoint(connectionDetails.getUrl(Transport.GRPC))
.setTimeout(properties.getTimeout())
.setConnectTimeout(properties.getConnectTimeout())
.setCompression(properties.getCompression().name().toLowerCase(Locale.ROOT));
properties.getHeaders().forEach(builder::addHeader);
meterProvider.ifAvailable(builder::setMeterProvider);
customizers.orderedStream().forEach((customizer) -> customizer.customize(builder));
return builder.build();
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-micrometer-tracing-opentelemetry\src\main\java\org\springframework\boot\micrometer\tracing\opentelemetry\autoconfigure\otlp\OtlpTracingConfigurations.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public void expiryToken(@NonNull final Object token)
{
restApiAuthToken.remove(String.valueOf(token));
}
public int getNumberOfAuthenticatedTokens(@NonNull final String authority)
{
final SimpleGrantedAuthority grantedAuthority = new SimpleGrantedAuthority(authority);
return (int)restApiAuthToken.values()
.stream()
.map(Authentication::getAuthorities)
.filter(item -> item.contains(grantedAuthority))
.count();
}
@PostConstruct
|
private void registerPreAuthenticatedIdentities()
{
for (final PreAuthenticatedIdentity preAuthenticatedIdentity : preAuthenticatedIdentities)
{
final Optional<PreAuthenticatedAuthenticationToken> preAuthenticatedAuthenticationToken = preAuthenticatedIdentity.getPreAuthenticatedToken();
if (preAuthenticatedAuthenticationToken.isEmpty())
{
logger.warning(preAuthenticatedIdentity.getClass().getName() + ": not configured!");
continue;
}
restApiAuthToken.put((String)preAuthenticatedAuthenticationToken.get().getPrincipal(), preAuthenticatedAuthenticationToken.get());
}
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\core\src\main\java\de\metas\camel\externalsystems\core\restapi\auth\TokenBasedAuthService.java
| 2
|
请完成以下Java代码
|
public static Path findUsingNIOApi(String sdir) throws IOException {
Path dir = Paths.get(sdir);
if (Files.isDirectory(dir)) {
Optional<Path> opPath = Files.list(dir)
.filter(p -> !Files.isDirectory(p))
.sorted((p1, p2) -> Long.valueOf(p2.toFile().lastModified())
.compareTo(p1.toFile().lastModified()))
.findFirst();
if (opPath.isPresent()) {
return opPath.get();
}
}
return null;
}
|
public static File findUsingCommonsIO(String sdir) {
File dir = new File(sdir);
if (dir.isDirectory()) {
File[] dirFiles = dir.listFiles((FileFilter) FileFilterUtils.fileFileFilter());
if (dirFiles != null && dirFiles.length > 0) {
Arrays.sort(dirFiles, LastModifiedFileComparator.LASTMODIFIED_REVERSE);
return dirFiles[0];
}
}
return null;
}
}
|
repos\tutorials-master\core-java-modules\core-java-io-3\src\main\java\com\baeldung\lastmodifiedfile\LastModifiedFileApp.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class HttpBasicAuth implements Authentication {
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
|
public void setPassword(String password) {
this.password = password;
}
@Override
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
if (username == null && password == null) {
return;
}
headerParams.put("Authorization", Credentials.basic(
username == null ? "" : username,
password == null ? "" : password));
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\alberta\alberta-article-api\src\main\java\io\swagger\client\auth\HttpBasicAuth.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class MainController {
@GetMapping("/register")
public String showForm(Model model) {
User user = new User();
model.addAttribute("user", user);
List<String> listProfession = Arrays.asList("Developer", "Tester", "Architect");
model.addAttribute("listProfession", listProfession);
return "register_form";
}
@PostMapping("/register")
public String submitForm(@Valid @ModelAttribute("user") User user,
|
BindingResult bindingResult, Model model) {
System.out.println(user);
if (bindingResult.hasErrors()) {
List<String> listProfession = Arrays.asList("Developer", "Tester", "Architect");
model.addAttribute("listProfession", listProfession);
return "register_form";
} else {
return "register_success";
}
}
}
|
repos\SpringBoot-Projects-FullStack-master\Part-5 Spring Boot Web Application\SpringBootThymeleafFormValidation\src\main\java\spting\validation\controller\MainController.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public InsuranceContractMaxPermanentPrescriptionPeriod amount(BigDecimal amount) {
this.amount = amount;
return this;
}
/**
* Anzahl der Tage, Wochen, Monate
* @return amount
**/
@Schema(example = "1", description = "Anzahl der Tage, Wochen, Monate")
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public InsuranceContractMaxPermanentPrescriptionPeriod timePeriod(BigDecimal timePeriod) {
this.timePeriod = timePeriod;
return this;
}
/**
* Zeitintervall (Unbekannt = 0, Minute = 1, Stunde = 2, Tag = 3, Woche = 4, Monat = 5, Quartal = 6, Halbjahr = 7, Jahr = 8)
* @return timePeriod
**/
@Schema(example = "6", description = "Zeitintervall (Unbekannt = 0, Minute = 1, Stunde = 2, Tag = 3, Woche = 4, Monat = 5, Quartal = 6, Halbjahr = 7, Jahr = 8)")
public BigDecimal getTimePeriod() {
return timePeriod;
}
public void setTimePeriod(BigDecimal timePeriod) {
this.timePeriod = timePeriod;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
InsuranceContractMaxPermanentPrescriptionPeriod insuranceContractMaxPermanentPrescriptionPeriod = (InsuranceContractMaxPermanentPrescriptionPeriod) o;
return Objects.equals(this.amount, insuranceContractMaxPermanentPrescriptionPeriod.amount) &&
|
Objects.equals(this.timePeriod, insuranceContractMaxPermanentPrescriptionPeriod.timePeriod);
}
@Override
public int hashCode() {
return Objects.hash(amount, timePeriod);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class InsuranceContractMaxPermanentPrescriptionPeriod {\n");
sb.append(" amount: ").append(toIndentedString(amount)).append("\n");
sb.append(" timePeriod: ").append(toIndentedString(timePeriod)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\alberta\alberta-article-api\src\main\java\io\swagger\client\model\InsuranceContractMaxPermanentPrescriptionPeriod.java
| 2
|
请完成以下Java代码
|
private int createGLCategory (String Name, String CategoryType, boolean isDefault)
{
MGLCategory cat = new MGLCategory (Env.getCtx() , 0, trxname);
cat.setName(Name);
cat.setCategoryType(CategoryType);
cat.setIsDefault(isDefault);
if (!cat.save())
{
log.error("GL Category NOT created - " + Name);
return 0;
}
//
return cat.getGL_Category_ID();
} // createGLCategory
/**
* Create Document Types with Sequence
* @param Name name
* @param PrintName print name
* @param DocBaseType document base type
* @param DocSubType sales order sub type
* @param C_DocTypeShipment_ID shipment doc
* @param C_DocTypeInvoice_ID invoice doc
* @param StartNo start doc no
* @param GL_Category_ID gl category
* @return C_DocType_ID doc type or 0 for error
*/
private int createDocType (String Name, String PrintName,
String DocBaseType, String DocSubType,
int C_DocTypeShipment_ID, int C_DocTypeInvoice_ID,
int StartNo, int GL_Category_ID)
{
log.debug("In createDocType");
log.debug("docBaseType: " + DocBaseType);
log.debug("GL_Category_ID: " + GL_Category_ID);
MSequence sequence = null;
if (StartNo != 0)
{
sequence = new MSequence(Env.getCtx(), getAD_Client_ID(), Name, StartNo, trxname);
if (!sequence.save())
{
log.error("Sequence NOT created - " + Name);
return 0;
}
}
//MDocType dt = new MDocType (Env.getCtx(), DocBaseType, Name, trxname);
MDocType dt = new MDocType (Env.getCtx(),0 , trxname);
dt.setAD_Org_ID(0);
dt.set_CustomColumn("DocBaseType", (Object) DocBaseType);
dt.setName (Name);
dt.setPrintName (Name);
|
if (DocSubType != null)
dt.setDocSubType(DocSubType);
if (C_DocTypeShipment_ID != 0)
dt.setC_DocTypeShipment_ID(C_DocTypeShipment_ID);
if (C_DocTypeInvoice_ID != 0)
dt.setC_DocTypeInvoice_ID(C_DocTypeInvoice_ID);
if (GL_Category_ID != 0)
dt.setGL_Category_ID(GL_Category_ID);
if (sequence == null)
dt.setIsDocNoControlled(false);
else
{
dt.setIsDocNoControlled(true);
dt.setDocNoSequence_ID(sequence.getAD_Sequence_ID());
}
dt.setIsSOTrx(false);
if (!dt.save())
{
log.error("DocType NOT created - " + Name);
return 0;
}
//
return dt.getC_DocType_ID();
} // createDocType
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\process\CreateDocType.java
| 1
|
请完成以下Java代码
|
public boolean matches(@NonNull final AttributesKey attributesKey)
{
for (final AttributesKeyPartPattern partPattern : partPatterns)
{
boolean partPatternMatched = false;
if (AttributesKey.NONE.getAsString().equals(attributesKey.getAsString()))
{
partPatternMatched = partPattern.matches(AttributesKeyPart.NONE);
}
else
{
for (final AttributesKeyPart part : attributesKey.getParts())
{
if (partPattern.matches(part))
{
partPatternMatched = true;
|
break;
}
}
}
if (!partPatternMatched)
{
return false;
}
}
return true;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\org\adempiere\mm\attributes\keys\AttributesKeyPattern.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void setBasePath(String basePath) {
Assert.isTrue(basePath.isEmpty() || basePath.startsWith("/"), "'basePath' must start with '/' or be empty");
this.basePath = cleanBasePath(basePath);
}
private String cleanBasePath(String basePath) {
if (StringUtils.hasText(basePath) && basePath.endsWith("/")) {
return basePath.substring(0, basePath.length() - 1);
}
return basePath;
}
public Map<String, String> getPathMapping() {
return this.pathMapping;
}
public Discovery getDiscovery() {
return this.discovery;
}
public static class Exposure {
/**
* Endpoint IDs that should be included or '*' for all.
*/
private Set<String> include = new LinkedHashSet<>();
/**
* Endpoint IDs that should be excluded or '*' for all.
*/
private Set<String> exclude = new LinkedHashSet<>();
public Set<String> getInclude() {
return this.include;
}
|
public void setInclude(Set<String> include) {
this.include = include;
}
public Set<String> getExclude() {
return this.exclude;
}
public void setExclude(Set<String> exclude) {
this.exclude = exclude;
}
}
public static class Discovery {
/**
* Whether the discovery page is enabled.
*/
private boolean enabled = true;
public boolean isEnabled() {
return this.enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-actuator-autoconfigure\src\main\java\org\springframework\boot\actuate\autoconfigure\endpoint\web\WebEndpointProperties.java
| 2
|
请完成以下Java代码
|
public class GraphiQlHandler {
private final String graphQlPath;
private final @Nullable String graphQlWsPath;
private final Resource htmlResource;
/**
* Constructor that serves the default {@code graphiql/index.html} included
* in the {@code spring-graphql} module.
* @param graphQlPath the path to the GraphQL endpoint
* @param graphQlWsPath optional path to the GraphQL WebSocket endpoint
*/
public GraphiQlHandler(String graphQlPath, @Nullable String graphQlWsPath) {
this(graphQlPath, graphQlWsPath, new ClassPathResource("graphiql/index.html"));
}
/**
* Constructor with the HTML page to serve.
* @param graphQlPath the path to the GraphQL endpoint
* @param graphQlWsPath optional path to the GraphQL WebSocket endpoint
* @param htmlResource the GraphiQL page to serve
*/
public GraphiQlHandler(String graphQlPath, @Nullable String graphQlWsPath, Resource htmlResource) {
Assert.hasText(graphQlPath, "graphQlPath should not be empty");
Assert.notNull(htmlResource, "HtmlResource is required");
this.graphQlPath = graphQlPath;
this.graphQlWsPath = graphQlWsPath;
this.htmlResource = htmlResource;
}
/**
|
* Render the GraphiQL page as "text/html", or if the "path" query parameter
* is missing, add it and redirect back to the same URL.
* @param request the HTTP server request
*/
public Mono<ServerResponse> handleRequest(ServerRequest request) {
return (request.queryParam("path").isPresent() ?
ServerResponse.ok().contentType(MediaType.TEXT_HTML).bodyValue(this.htmlResource) :
ServerResponse.temporaryRedirect(getRedirectUrl(request)).build());
}
private URI getRedirectUrl(ServerRequest request) {
UriBuilder builder = request.uriBuilder();
String pathQueryParam = applyContextPath(request, this.graphQlPath);
builder.queryParam("path", pathQueryParam);
if (StringUtils.hasText(this.graphQlWsPath)) {
String wsPathQueryParam = applyContextPath(request, this.graphQlWsPath);
builder.queryParam("wsPath", wsPathQueryParam);
}
return builder.build(request.pathVariables());
}
private String applyContextPath(ServerRequest request, String path) {
String contextPath = request.requestPath().contextPath().toString();
return StringUtils.hasText(contextPath) ? contextPath + path : path;
}
}
|
repos\spring-graphql-main\spring-graphql\src\main\java\org\springframework\graphql\server\webflux\GraphiQlHandler.java
| 1
|
请完成以下Java代码
|
public int getMarginTop ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_MarginTop);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Process Now.
@param Processing Process Now */
public void setProcessing (boolean Processing)
{
set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
}
/** Get Process Now.
@return Process Now */
public boolean isProcessing ()
{
Object oo = get_Value(COLUMNNAME_Processing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Size X.
@param SizeX
X (horizontal) dimension size
*/
public void setSizeX (BigDecimal SizeX)
{
set_Value (COLUMNNAME_SizeX, SizeX);
}
|
/** Get Size X.
@return X (horizontal) dimension size
*/
public BigDecimal getSizeX ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_SizeX);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Size Y.
@param SizeY
Y (vertical) dimension size
*/
public void setSizeY (BigDecimal SizeY)
{
set_Value (COLUMNNAME_SizeY, SizeY);
}
/** Get Size Y.
@return Y (vertical) dimension size
*/
public BigDecimal getSizeY ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_SizeY);
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_AD_PrintPaper.java
| 1
|
请完成以下Java代码
|
public boolean processLine (boolean isSOTrx, String confirmType)
{
MInOutLine line = getLine();
// Customer
if (MInOutConfirm.CONFIRMTYPE_CustomerConfirmation.equals(confirmType))
{
line.setConfirmedQty(getConfirmedQty());
}
// Drop Ship
else if (MInOutConfirm.CONFIRMTYPE_DropShipConfirm.equals(confirmType))
{
}
// Pick or QA
else if (MInOutConfirm.CONFIRMTYPE_PickQAConfirm.equals(confirmType))
{
line.setTargetQty(getTargetQty());
line.setMovementQty(getConfirmedQty()); // Entered NOT changed
line.setPickedQty(getConfirmedQty());
//
line.setScrappedQty(getScrappedQty());
}
// Ship or Receipt
else if (MInOutConfirm.CONFIRMTYPE_ShipReceiptConfirm.equals(confirmType))
{
line.setTargetQty(getTargetQty());
BigDecimal qty = getConfirmedQty();
if (!isSOTrx) // In PO, we have the responsibility for scapped
qty = qty.add(getScrappedQty());
line.setMovementQty(qty); // Entered NOT changed
//
line.setScrappedQty(getScrappedQty());
}
// Vendor
else if (MInOutConfirm.CONFIRMTYPE_VendorConfirmation.equals(confirmType))
{
line.setConfirmedQty(getConfirmedQty());
}
return line.save(get_TrxName());
} // processConfirmation
/**
* Is Fully Confirmed
* @return true if Target = Confirmed qty
*/
public boolean isFullyConfirmed()
{
return getTargetQty().compareTo(getConfirmedQty()) == 0;
} // isFullyConfirmed
|
/**
* Before Delete - do not delete
* @return false
*/
@Override
protected boolean beforeDelete ()
{
throw new AdempiereException("@CannotDelete@");
} // beforeDelete
/**
* Before Save
* @param newRecord new
* @return true
*/
@Override
protected boolean beforeSave (boolean newRecord)
{
// Calculate Difference = Target - Confirmed - Scrapped
BigDecimal difference = getTargetQty();
difference = difference.subtract(getConfirmedQty());
difference = difference.subtract(getScrappedQty());
setDifferenceQty(difference);
//
return true;
} // beforeSave
} // MInOutLineConfirm
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MInOutLineConfirm.java
| 1
|
请完成以下Java代码
|
protected void initializeVariables(ExecutionEntity subProcessInstance, Map<String, Object> variables) {
subProcessInstance.setVariables(variables);
}
protected Map<String, Object> calculateInboundVariables(
DelegateExecution execution,
ProcessDefinition processDefinition
) {
return new HashMap<String, Object>();
}
protected Map<String, Object> copyProcessVariables(
DelegateExecution execution,
ExpressionManager expressionManager,
CallActivity callActivity,
Map<String, Object> variables
) {
for (IOParameter ioParameter : callActivity.getInParameters()) {
Object value = null;
if (StringUtils.isNotEmpty(ioParameter.getSourceExpression())) {
Expression expression = expressionManager.createExpression(ioParameter.getSourceExpression().trim());
value = expression.getValue(execution);
} else {
value = execution.getVariable(ioParameter.getSource());
}
variables.put(ioParameter.getTarget(), value);
}
return variables;
}
|
protected DelegateExecution copyOutParameters(DelegateExecution execution, DelegateExecution subProcessInstance) {
ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager();
ExecutionEntity executionEntity = (ExecutionEntity) execution;
CallActivity callActivity = (CallActivity) executionEntity.getCurrentFlowElement();
for (IOParameter ioParameter : callActivity.getOutParameters()) {
Object value = null;
if (StringUtils.isNotEmpty(ioParameter.getSourceExpression())) {
Expression expression = expressionManager.createExpression(ioParameter.getSourceExpression().trim());
value = expression.getValue(subProcessInstance);
} else {
value = subProcessInstance.getVariable(ioParameter.getSource());
}
execution.setVariable(ioParameter.getTarget(), value);
}
return execution;
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\bpmn\behavior\CallActivityBehavior.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class DistanceBetweenPointsService {
public double calculateDistanceBetweenPoints(
double x1,
double y1,
double x2,
double y2) {
return Math.sqrt((y2 - y1) * (y2 - y1) + (x2 - x1) * (x2 - x1));
}
public double calculateDistanceBetweenPointsWithHypot(
double x1,
double y1,
double x2,
double y2) {
|
double ac = Math.abs(y2 - y1);
double cb = Math.abs(x2 - x1);
return Math.hypot(ac, cb);
}
public double calculateDistanceBetweenPointsWithPoint2D(
double x1,
double y1,
double x2,
double y2) {
return Point2D.distance(x1, y1, x2, y2);
}
}
|
repos\tutorials-master\core-java-modules\core-java-lang-math\src\main\java\com\baeldung\algorithms\distancebetweenpoints\DistanceBetweenPointsService.java
| 2
|
请完成以下Java代码
|
public class EventDefinitionQueryProperty implements QueryProperty {
private static final long serialVersionUID = 1L;
private static final Map<String, EventDefinitionQueryProperty> properties = new HashMap<>();
public static final EventDefinitionQueryProperty KEY = new EventDefinitionQueryProperty("RES.KEY_");
public static final EventDefinitionQueryProperty CATEGORY = new EventDefinitionQueryProperty("RES.CATEGORY_");
public static final EventDefinitionQueryProperty ID = new EventDefinitionQueryProperty("RES.ID_");
public static final EventDefinitionQueryProperty NAME = new EventDefinitionQueryProperty("RES.NAME_");
public static final EventDefinitionQueryProperty DEPLOYMENT_ID = new EventDefinitionQueryProperty("RES.DEPLOYMENT_ID_");
public static final EventDefinitionQueryProperty TENANT_ID = new EventDefinitionQueryProperty("RES.TENANT_ID_");
private String name;
|
public EventDefinitionQueryProperty(String name) {
this.name = name;
properties.put(name, this);
}
@Override
public String getName() {
return name;
}
public static EventDefinitionQueryProperty findByName(String propertyName) {
return properties.get(propertyName);
}
}
|
repos\flowable-engine-main\modules\flowable-event-registry\src\main\java\org\flowable\eventregistry\impl\EventDefinitionQueryProperty.java
| 1
|
请完成以下Java代码
|
public class CertUtils {
private CertUtils() {
}
private static KeyStore loadKeyStore(Path path, String password) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException {
KeyStore store = KeyStore.getInstance(path.toFile(), password.toCharArray());
try (InputStream stream = Files.newInputStream(path)) {
store.load(stream, password.toCharArray());
}
return store;
}
public static X509KeyManager loadKeyManager(Path path, String password) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, UnrecoverableKeyException {
KeyStore store = loadKeyStore(path, password);
KeyManagerFactory factory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
factory.init(store, password.toCharArray());
|
return (X509KeyManager) Stream.of(factory.getKeyManagers())
.filter(X509KeyManager.class::isInstance)
.findAny()
.orElseThrow(() -> new IllegalStateException("no appropriate manager found"));
}
public static X509TrustManager loadTrustManager(Path path, String password) throws IOException, NoSuchAlgorithmException, CertificateException, KeyStoreException {
KeyStore store = loadKeyStore(path, password);
TrustManagerFactory factory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
factory.init(store);
return (X509TrustManager) Stream.of(factory.getTrustManagers())
.filter(X509TrustManager.class::isInstance)
.findAny()
.orElseThrow(() -> new IllegalStateException("no appropriate manager found"));
}
}
|
repos\tutorials-master\core-java-modules\core-java-networking-6\src\main\java\com\baeldung\multiplecerts\CertUtils.java
| 1
|
请完成以下Spring Boot application配置
|
spring.cassandra.keyspace-name=${CASSANDRA_KEYSPACE_NAME}
spring.cassandra.contact-points=${CASSANDRA_CONTACT_POINTS}
spring.cassandra.port=${
|
CASSANDRA_PORT}
spring.cassandra.local-datacenter=datacenter1
|
repos\tutorials-master\persistence-modules\spring-data-cassandra-2\src\main\resources\application.properties
| 2
|
请完成以下Java代码
|
public ColumnDefinitions getColumnDefinitions() {
return columnDefinitions;
}
@NonNull
@Override
public List<ExecutionInfo> getExecutionInfos() {
return executionInfos;
}
@Override
public boolean isFullyFetched() {
return iterator.isFullyFetched();
}
@Override
public int getAvailableWithoutFetching() {
return iterator.remaining();
}
@NonNull
@Override
public Iterator<Row> iterator() {
return iterator;
}
@Override
public boolean wasApplied() {
return iterator.wasApplied();
}
private class RowIterator extends CountingIterator<Row> {
private GuavaSession session;
private Statement statement;
private AsyncResultSet currentPage;
private Iterator<Row> currentRows;
private RowIterator(GuavaSession session, Statement statement, AsyncResultSet firstPage) {
super(firstPage.remaining());
this.session = session;
this.statement = statement;
this.currentPage = firstPage;
this.currentRows = firstPage.currentPage().iterator();
}
@Override
protected Row computeNext() {
maybeMoveToNextPage();
return currentRows.hasNext() ? currentRows.next() : endOfData();
}
private void maybeMoveToNextPage() {
if (!currentRows.hasNext() && currentPage.hasMorePages()) {
|
BlockingOperation.checkNotDriverThread();
ByteBuffer nextPagingState = currentPage.getExecutionInfo().getPagingState();
this.statement = this.statement.setPagingState(nextPagingState);
AsyncResultSet nextPage = GuavaSession.getSafe(this.session.executeAsync(this.statement));
currentPage = nextPage;
remaining += nextPage.remaining();
currentRows = nextPage.currentPage().iterator();
executionInfos.add(nextPage.getExecutionInfo());
// The definitions can change from page to page if this result set was built from a bound
// 'SELECT *', and the schema was altered.
columnDefinitions = nextPage.getColumnDefinitions();
}
}
private boolean isFullyFetched() {
return !currentPage.hasMorePages();
}
private boolean wasApplied() {
return currentPage.wasApplied();
}
}
}
|
repos\thingsboard-master\common\dao-api\src\main\java\org\thingsboard\server\dao\cassandra\guava\GuavaMultiPageResultSet.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Integer getMaxPacketLength() {
return this.maxPacketLength;
}
public void setMaxPacketLength(Integer maxPacketLength) {
this.maxPacketLength = maxPacketLength;
}
public Duration getPollingFrequency() {
return this.pollingFrequency;
}
public void setPollingFrequency(Duration pollingFrequency) {
this.pollingFrequency = pollingFrequency;
}
public Duration getStep() {
return this.step;
}
public void setStep(Duration step) {
|
this.step = step;
}
public boolean isPublishUnchangedMeters() {
return this.publishUnchangedMeters;
}
public void setPublishUnchangedMeters(boolean publishUnchangedMeters) {
this.publishUnchangedMeters = publishUnchangedMeters;
}
public boolean isBuffered() {
return this.buffered;
}
public void setBuffered(boolean buffered) {
this.buffered = buffered;
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\export\statsd\StatsdProperties.java
| 2
|
请完成以下Java代码
|
public int getC_ReferenceNo_Type_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_ReferenceNo_Type_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Java-Klasse.
@param Classname Java-Klasse */
@Override
public void setClassname (java.lang.String Classname)
{
set_Value (COLUMNNAME_Classname, Classname);
}
/** Get Java-Klasse.
@return Java-Klasse */
@Override
public java.lang.String getClassname ()
{
return (java.lang.String)get_Value(COLUMNNAME_Classname);
}
/** Set Beschreibung.
@param Description Beschreibung */
@Override
public void setDescription (java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Beschreibung.
@return Beschreibung */
@Override
public java.lang.String getDescription ()
{
return (java.lang.String)get_Value(COLUMNNAME_Description);
}
/**
* EntityType AD_Reference_ID=389
* Reference name: _EntityTypeNew
*/
public static final int ENTITYTYPE_AD_Reference_ID=389;
/** Set Entitäts-Art.
@param EntityType
Dictionary Entity Type; Determines ownership and synchronization
*/
@Override
public void setEntityType (java.lang.String EntityType)
{
set_Value (COLUMNNAME_EntityType, EntityType);
}
/** Get Entitäts-Art.
@return Dictionary Entity Type; Determines ownership and synchronization
*/
@Override
public java.lang.String getEntityType ()
{
return (java.lang.String)get_Value(COLUMNNAME_EntityType);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
@Override
public void setName (java.lang.String Name)
{
|
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
@Override
public java.lang.String getName ()
{
return (java.lang.String)get_Value(COLUMNNAME_Name);
}
/** Set Suchschlüssel.
@param Value
Suchschlüssel für den Eintrag im erforderlichen Format - muss eindeutig sein
*/
@Override
public void setValue (java.lang.String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
/** Get Suchschlüssel.
@return Suchschlüssel für den Eintrag im erforderlichen Format - muss eindeutig sein
*/
@Override
public java.lang.String getValue ()
{
return (java.lang.String)get_Value(COLUMNNAME_Value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.document.refid\src\main\java-gen\de\metas\document\refid\model\X_C_ReferenceNo_Type.java
| 1
|
请完成以下Java代码
|
public de.metas.elasticsearch.model.I_ES_FTS_Config getES_FTS_Config()
{
return get_ValueAsPO(COLUMNNAME_ES_FTS_Config_ID, de.metas.elasticsearch.model.I_ES_FTS_Config.class);
}
@Override
public void setES_FTS_Config(final de.metas.elasticsearch.model.I_ES_FTS_Config ES_FTS_Config)
{
set_ValueFromPO(COLUMNNAME_ES_FTS_Config_ID, de.metas.elasticsearch.model.I_ES_FTS_Config.class, ES_FTS_Config);
}
@Override
public void setES_FTS_Config_ID (final int ES_FTS_Config_ID)
{
if (ES_FTS_Config_ID < 1)
set_Value (COLUMNNAME_ES_FTS_Config_ID, null);
else
set_Value (COLUMNNAME_ES_FTS_Config_ID, ES_FTS_Config_ID);
}
@Override
public int getES_FTS_Config_ID()
{
return get_ValueAsInt(COLUMNNAME_ES_FTS_Config_ID);
}
|
@Override
public void setES_FTS_Filter_ID (final int ES_FTS_Filter_ID)
{
if (ES_FTS_Filter_ID < 1)
set_ValueNoCheck (COLUMNNAME_ES_FTS_Filter_ID, null);
else
set_ValueNoCheck (COLUMNNAME_ES_FTS_Filter_ID, ES_FTS_Filter_ID);
}
@Override
public int getES_FTS_Filter_ID()
{
return get_ValueAsInt(COLUMNNAME_ES_FTS_Filter_ID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.elasticsearch\src\main\java-gen\de\metas\elasticsearch\model\X_ES_FTS_Filter.java
| 1
|
请完成以下Java代码
|
public Integer getPort() {
return port;
}
public void setPort(Integer port) {
this.port = port;
}
@Override
public Long getId() {
return id;
}
@Override
public void setId(Long id) {
this.id = id;
}
@Override
public String getApp() {
return app;
}
public void setApp(String app) {
this.app = app;
}
public String getResource() {
return resource;
}
public void setResource(String resource) {
this.resource = resource;
}
public String getLimitApp() {
return limitApp;
}
public void setLimitApp(String limitApp) {
this.limitApp = limitApp;
}
public Double getCount() {
return count;
}
public void setCount(Double count) {
this.count = count;
|
}
public Integer getTimeWindow() {
return timeWindow;
}
public void setTimeWindow(Integer timeWindow) {
this.timeWindow = timeWindow;
}
public Integer getGrade() {
return grade;
}
public void setGrade(Integer grade) {
this.grade = grade;
}
@Override
public Date getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
public Date getGmtModified() {
return gmtModified;
}
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
@Override
public DegradeRule toRule() {
DegradeRule rule = new DegradeRule();
rule.setResource(resource);
rule.setLimitApp(limitApp);
rule.setCount(count);
rule.setTimeWindow(timeWindow);
rule.setGrade(grade);
return rule;
}
}
|
repos\spring-boot-student-master\spring-boot-student-sentinel-dashboard\src\main\java\com\alibaba\csp\sentinel\dashboard\datasource\entity\rule\DegradeRuleEntity.java
| 1
|
请完成以下Java代码
|
default IWorkPackageBuilder setCorrelationId(@Nullable final UUID correlationId)
{
final String uuidStr = correlationId != null ? correlationId.toString() : null;
parameter(Async_Constants.ASYNC_PARAM_CORRELATION_UUID, uuidStr);
return this;
}
/**
* Sets the workpackage queue priority. If no particular priority is set, the system will use {@link IWorkPackageQueue#PRIORITY_AUTO}.
*/
IWorkPackageBuilder setPriority(IWorkpackagePrioStrategy priority);
/**
* Sets the async batch (optional).
* <p>
* If the async batch it's not set, it will be inherited.
*/
IWorkPackageBuilder setC_Async_Batch(@Nullable I_C_Async_Batch asyncBatch);
/**
* Sets workpackage user in charge.
* This will be the user which will be notified in case the workpackage processing fails.
*/
IWorkPackageBuilder setUserInChargeId(@Nullable UserId userInChargeId);
/**
* Adds given model to workpackage elements.
* If a locker is already set (see {@link #setElementsLocker(ILockCommand)}) this model will be also added to locker.
*
* @param model model or {@link ITableRecordReference}.
*/
IWorkPackageBuilder addElement(Object model);
/**
* Convenient method to add a collection of models.
*
* @see #addElement(Object)
*/
IWorkPackageBuilder addElements(Iterable<?> models);
IWorkPackageBuilder addElements(TableRecordReferenceSet recordRefs);
/**
* Ask the builder to "bind" the new workpackage to given transaction.
* As a consequence, the workpackage will be marked as "ready for processing" when this transaction is committed.
* <p>
* If the transaction is null, the workpackage will be marked as ready immediately, on build.
*/
IWorkPackageBuilder bindToTrxName(@Nullable String trxName);
|
/**
* Ask the builder to "bind" the new workpackage to current thread inherited transaction.
* As a consequence, the workpackage will be marked as "ready for processing" when this transaction is committed.
* <p>
* If there is no thread inherited transaction, the workpackage will be marked as ready immediately, on build.
*/
default IWorkPackageBuilder bindToThreadInheritedTrx()
{
return bindToTrxName(ITrx.TRXNAME_ThreadInherited);
}
/**
* Sets locker to be used to lock enqueued elements.
* The elements are unlocked right after the WP was processed.
*/
IWorkPackageBuilder setElementsLocker(ILockCommand elementsLocker);
/**
* Overloading set async batch, to enable setting async batch also by id (optional).
* If the asyncBatchId is not set, it will be inherited.
*/
IWorkPackageBuilder setAsyncBatchId(@Nullable AsyncBatchId asyncBatchId);
I_C_Queue_WorkPackage buildWithPackageProcessor();
IWorkPackageBuilder setAD_PInstance_ID(final PInstanceId adPInstanceId);
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java\de\metas\async\api\IWorkPackageBuilder.java
| 1
|
请完成以下Java代码
|
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public User userStatus(Integer userStatus) {
this.userStatus = userStatus;
return this;
}
/**
* User Status
* @return userStatus
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "User Status")
@JsonProperty(JSON_PROPERTY_USER_STATUS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Integer getUserStatus() {
return userStatus;
}
public void setUserStatus(Integer userStatus) {
this.userStatus = userStatus;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
User user = (User) o;
return Objects.equals(this.id, user.id) &&
Objects.equals(this.username, user.username) &&
Objects.equals(this.firstName, user.firstName) &&
Objects.equals(this.lastName, user.lastName) &&
Objects.equals(this.email, user.email) &&
Objects.equals(this.password, user.password) &&
Objects.equals(this.phone, user.phone) &&
|
Objects.equals(this.userStatus, user.userStatus);
}
@Override
public int hashCode() {
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class User {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" username: ").append(toIndentedString(username)).append("\n");
sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n");
sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n");
sb.append(" email: ").append(toIndentedString(email)).append("\n");
sb.append(" password: ").append(toIndentedString(password)).append("\n");
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
|
repos\tutorials-master\spring-swagger-codegen-modules\spring-openapi-generator-api-client\src\main\java\com\baeldung\petstore\client\model\User.java
| 1
|
请完成以下Java代码
|
public boolean isProcessed()
{
return get_ValueAsBoolean(COLUMNNAME_Processed);
}
@Override
public void setQtyEntered (final BigDecimal QtyEntered)
{
set_Value (COLUMNNAME_QtyEntered, QtyEntered);
}
@Override
public BigDecimal getQtyEntered()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyEntered);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyEnteredTU (final @Nullable BigDecimal QtyEnteredTU)
{
set_Value (COLUMNNAME_QtyEnteredTU, QtyEnteredTU);
}
@Override
public BigDecimal getQtyEnteredTU()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyEnteredTU);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyOrdered (final 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 setQtyProcessed (final BigDecimal QtyProcessed)
{
set_Value (COLUMNNAME_QtyProcessed, QtyProcessed);
}
|
@Override
public BigDecimal getQtyProcessed()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyProcessed);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyToProcess (final BigDecimal QtyToProcess)
{
set_Value (COLUMNNAME_QtyToProcess, QtyToProcess);
}
@Override
public BigDecimal getQtyToProcess()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyToProcess);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setSupplyDate (final java.sql.Timestamp SupplyDate)
{
set_Value (COLUMNNAME_SupplyDate, SupplyDate);
}
@Override
public java.sql.Timestamp getSupplyDate()
{
return get_ValueAsTimestamp(COLUMNNAME_SupplyDate);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_DD_Order_Candidate.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public @Nullable HandlerExecutionChain getHandler(HttpServletRequest request) throws Exception {
for (HandlerMapping mapping : getMappings()) {
HandlerExecutionChain handler = mapping.getHandler(request);
if (handler != null) {
return handler;
}
}
return null;
}
@Override
public boolean usesPathPatterns() {
for (HandlerMapping mapping : getMappings()) {
if (mapping.usesPathPatterns()) {
return true;
}
}
return false;
}
|
private List<HandlerMapping> getMappings() {
if (this.mappings == null) {
this.mappings = extractMappings();
}
return this.mappings;
}
private List<HandlerMapping> extractMappings() {
List<HandlerMapping> list = new ArrayList<>(this.beanFactory.getBeansOfType(HandlerMapping.class).values());
list.remove(this);
AnnotationAwareOrderComparator.sort(list);
return list;
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-webmvc\src\main\java\org\springframework\boot\webmvc\autoconfigure\actuate\web\CompositeHandlerMapping.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public long getExpiry() {
return getRequired(this.claims, "exp", Integer.class).longValue();
}
@SuppressWarnings("unchecked")
public List<String> getScope() {
return getRequired(this.claims, "scope", List.class);
}
public String getKeyId() {
return getRequired(this.header, "kid", String.class);
}
@SuppressWarnings("unchecked")
private <T> T getRequired(Map<String, Object> map, String key, Class<T> type) {
Object value = map.get(key);
if (value == null) {
|
throw new CloudFoundryAuthorizationException(Reason.INVALID_TOKEN, "Unable to get value from key " + key);
}
if (!type.isInstance(value)) {
throw new CloudFoundryAuthorizationException(Reason.INVALID_TOKEN,
"Unexpected value type from key " + key + " value " + value);
}
return (T) value;
}
@Override
public String toString() {
return this.encoded;
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-cloudfoundry\src\main\java\org\springframework\boot\cloudfoundry\autoconfigure\actuate\endpoint\Token.java
| 2
|
请完成以下Java代码
|
private MaterialEvent createEventForInventoryLine(
@NonNull final TransactionDescriptor transaction,
final boolean deleted)
{
final boolean directMovementWarehouse = isDirectMovementWarehouse(transaction.getWarehouseId());
final I_M_InventoryLine inventoryLineRecord = inventoryDAO.getLineById(transaction.getInventoryLineId());
final boolean internalUseInventory = inventoryBL.isInternalUseInventory(inventoryLineRecord);
final BigDecimal deltaQty;
if (internalUseInventory)
{
deltaQty = inventoryLineRecord.getQtyInternalUse().negate();
}
else
{
deltaQty = inventoryLineRecord.getQtyCount().subtract(inventoryLineRecord.getQtyBook());
}
final MaterialDescriptor materialDescriptor = MaterialDescriptor.builder()
.productDescriptor(modelProductDescriptorExtractor.createProductDescriptor(inventoryLineRecord))
.warehouseId(transaction.getWarehouseId())
.locatorId(transaction.getLocatorId())
.date(transaction.getTransactionDate())
.quantity(deltaQty)
.build();
final List<HUDescriptor> huDescriptors = huDescriptorsViaInventoryLineService.createHuDescriptorsForInventoryLine(inventoryLineRecord, deleted);
final AbstractTransactionEvent event;
if (deleted)
{
event = TransactionDeletedEvent.builder()
.eventDescriptor(transaction.getEventDescriptor())
.inventoryId(inventoryLineRecord.getM_Inventory_ID())
.inventoryLineId(transaction.getInventoryLineId().getRepoId())
.transactionId(transaction.getTransactionId())
.materialDescriptor(materialDescriptor)
.directMovementWarehouse(directMovementWarehouse)
.huOnHandQtyChangeDescriptors(huDescriptors)
.build();
}
else
|
{
final MinMaxDescriptor minMaxDescriptor = replenishInfoRepository.getBy(materialDescriptor).toMinMaxDescriptor();
event = TransactionCreatedEvent.builder()
.eventDescriptor(transaction.getEventDescriptor())
.inventoryId(inventoryLineRecord.getM_Inventory_ID())
.inventoryLineId(transaction.getInventoryLineId().getRepoId())
.transactionId(transaction.getTransactionId())
.materialDescriptor(materialDescriptor)
.directMovementWarehouse(directMovementWarehouse)
.minMaxDescriptor(minMaxDescriptor)
.huOnHandQtyChangeDescriptors(huDescriptors)
.build();
}
return event;
}
private boolean isDirectMovementWarehouse(final WarehouseId warehouseId)
{
if (warehouseId == null)
{
return false;
}
final int intValue = sysConfigBL.getIntValue(IHUMovementBL.SYSCONFIG_DirectMove_Warehouse_ID, -1);
return intValue == warehouseId.getRepoId();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\material\interceptor\transactionevent\TransactionEventFactory.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Tracing tracing(@Value("${spring.application.name}") String serviceName) {
return Tracing.newBuilder()
.localServiceName(serviceName) // 应用名
.spanReporter(this.spanReporter()).build();
}
/**
* Allows someone to add tags to a span if a trace is in progress
*/
@Bean
public SpanCustomizer spanCustomizer(Tracing tracing) {
return CurrentSpanCustomizer.create(tracing);
}
// ==================== HTTP 相关 ====================
/**
* Decides how to name and tag spans. By default they are named the same as the http method
*/
@Bean
public HttpTracing httpTracing(Tracing tracing) {
return HttpTracing.create(tracing);
}
/**
* Creates server spans for http requests
*/
@Bean
public Filter tracingFilter(HttpTracing httpTracing) { // 拦截请求,记录 HTTP 请求的链路信息
return TracingFilter.create(httpTracing);
}
// ==================== SpringMVC 相关 ====================
// @see SpringMvcConfiguration 类上的,@Import(SpanCustomizingAsyncHandlerInterceptor.class) 。因为 SpanCustomizingAsyncHandlerInterceptor 未提供 public 构造方法
// ==================== RabbitMQ 相关 ====================
@Bean
public JmsTracing jmsTracing(Tracing tracing) {
return JmsTracing.newBuilder(tracing)
.remoteServiceName("demo-mq-activemq") // 远程 ActiveMQ 服务名,可自定义
.build();
|
}
@Bean
public BeanPostProcessor activeMQBeanPostProcessor(JmsTracing jmsTracing) {
return new BeanPostProcessor() {
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
return bean;
}
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
// 如果是 ConnectionFactory ,针对 ActiveMQ Producer 和 Consumer
if (bean instanceof ConnectionFactory) {
return jmsTracing.connectionFactory((ConnectionFactory) bean);
}
return bean;
}
};
}
}
|
repos\SpringBoot-Labs-master\lab-40\lab-40-activemq\src\main\java\cn\iocoder\springboot\lab40\zipkindemo\config\ZipkinConfiguration.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public String getId() {
return id;
}
public String getType() {
return type;
}
public String getBatchId() {
return batchId;
}
public String getSearchKey() {
return searchKey;
}
public String getSearchKey2() {
return searchKey2;
}
public String getBatchType() {
return batchType;
}
public String getBatchSearchKey() {
return batchSearchKey;
}
public String getBatchSearchKey2() {
return batchSearchKey2;
}
public String getStatus() {
return status;
}
public String getScopeId() {
return scopeId;
}
public String getSubScopeId() {
return subScopeId;
}
|
public String getScopeType() {
return scopeType;
}
public String getTenantId() {
return tenantId;
}
public String getTenantIdLike() {
return tenantIdLike;
}
public boolean isWithoutTenantId() {
return withoutTenantId;
}
public boolean isCompleted() {
return completed;
}
}
|
repos\flowable-engine-main\modules\flowable-batch-service\src\main\java\org\flowable\batch\service\impl\BatchPartQueryImpl.java
| 2
|
请完成以下Java代码
|
public String getContentType()
{
if (m_textPane != null)
return m_textPane.getContentType();
return null;
}
private void setHyperlinkListener()
{
if (hyperlinkListenerClass == null)
{
return;
}
try
{
final HyperlinkListener listener = (HyperlinkListener)hyperlinkListenerClass.newInstance();
m_textPane.addHyperlinkListener(listener);
}
catch (Exception e)
{
log.warn("Cannot instantiate hyperlink listener - " + hyperlinkListenerClass, e);
}
}
|
private static Class<?> hyperlinkListenerClass;
static
{
final String hyperlinkListenerClassname = "de.metas.adempiere.gui.ADHyperlinkHandler";
try
{
hyperlinkListenerClass = Thread.currentThread().getContextClassLoader().loadClass(hyperlinkListenerClassname);
}
catch (Exception e)
{
log.warn("Cannot instantiate hyperlink listener - " + hyperlinkListenerClassname, e);
}
}
@Override
public final ICopyPasteSupportEditor getCopyPasteSupport()
{
return copyPasteSupport;
}
// metas: end
} // CTextPane
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\swing\CTextPane.java
| 1
|
请完成以下Java代码
|
public class MyInputRecord implements Serializable {
private int id;
public MyInputRecord(int id) {
this.id = id;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
|
return false;
MyInputRecord that = (MyInputRecord) o;
return id == that.id;
}
@Override
public int hashCode() {
return id;
}
@Override
public String toString() {
return "MyInputRecord: " + id;
}
}
|
repos\tutorials-master\web-modules\jee-7\src\main\java\com\baeldung\batch\understanding\exception\MyInputRecord.java
| 1
|
请完成以下Java代码
|
public int getM_Product_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Process Now.
@param Processing Process Now */
|
public void setProcessing (boolean Processing)
{
set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
}
/** Get Process Now.
@return Process Now */
public boolean isProcessing ()
{
Object oo = get_Value(COLUMNNAME_Processing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_BOM.java
| 1
|
请完成以下Java代码
|
public String getMake() {
return make;
}
public void setMake(String make) {
this.make = make;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
}
@JsonIgnoreProperties({ "model", "seatingCapacity" })
public static abstract class Car extends Vehicle {
private int seatingCapacity;
@JsonIgnore
private double topSpeed;
protected Car() {
}
protected Car(String make, String model, int seatingCapacity, double topSpeed) {
super(make, model);
this.seatingCapacity = seatingCapacity;
this.topSpeed = topSpeed;
}
public int getSeatingCapacity() {
return seatingCapacity;
}
public void setSeatingCapacity(int seatingCapacity) {
this.seatingCapacity = seatingCapacity;
}
public double getTopSpeed() {
return topSpeed;
}
public void setTopSpeed(double topSpeed) {
this.topSpeed = topSpeed;
}
}
public static class Sedan extends Car {
public Sedan() {
|
}
public Sedan(String make, String model, int seatingCapacity, double topSpeed) {
super(make, model, seatingCapacity, topSpeed);
}
}
public static class Crossover extends Car {
private double towingCapacity;
public Crossover() {
}
public Crossover(String make, String model, int seatingCapacity, double topSpeed, double towingCapacity) {
super(make, model, seatingCapacity, topSpeed);
this.towingCapacity = towingCapacity;
}
public double getTowingCapacity() {
return towingCapacity;
}
public void setTowingCapacity(double towingCapacity) {
this.towingCapacity = towingCapacity;
}
}
}
|
repos\tutorials-master\jackson-modules\jackson-core\src\main\java\com\baeldung\jackson\inheritance\IgnoranceAnnotationStructure.java
| 1
|
请完成以下Java代码
|
public void setLastDeleted (int LastDeleted)
{
set_Value (COLUMNNAME_LastDeleted, Integer.valueOf(LastDeleted));
}
/** Get Last Deleted.
@return Last Deleted */
public int getLastDeleted ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_LastDeleted);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Last Run.
@param LastRun Last Run */
public void setLastRun (Timestamp LastRun)
{
set_Value (COLUMNNAME_LastRun, LastRun);
}
/** Get Last Run.
@return Last Run */
public Timestamp getLastRun ()
{
return (Timestamp)get_Value(COLUMNNAME_LastRun);
}
/** 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 Process Now.
@param Processing Process Now */
public void setProcessing (boolean Processing)
{
set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
}
/** Get Process Now.
@return Process Now */
public boolean isProcessing ()
|
{
Object oo = get_Value(COLUMNNAME_Processing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Search Key.
@param Value
Search key for the record in the format required - must be unique
*/
public void setValue (String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
/** Get Search Key.
@return Search key for the record in the format required - must be unique
*/
public String getValue ()
{
return (String)get_Value(COLUMNNAME_Value);
}
/** Set Sql WHERE.
@param WhereClause
Fully qualified SQL WHERE clause
*/
public void setWhereClause (String WhereClause)
{
set_Value (COLUMNNAME_WhereClause, WhereClause);
}
/** Get Sql WHERE.
@return Fully qualified SQL WHERE clause
*/
public String getWhereClause ()
{
return (String)get_Value(COLUMNNAME_WhereClause);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_HouseKeeping.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getTaskUrl() {
return taskUrl;
}
public void setTaskUrl(String taskUrl) {
this.taskUrl = taskUrl;
}
public String getProcessInstanceUrl() {
return processInstanceUrl;
}
public void setProcessInstanceUrl(String processInstanceUrl) {
this.processInstanceUrl = processInstanceUrl;
}
@ApiModelProperty(value = "contentUrl:In case the attachment is a link to an external resource, the externalUrl contains the URL to the external content. If the attachment content is present in the Flowable engine, the contentUrl will contain an URL where the binary content can be streamed from.")
|
public String getExternalUrl() {
return externalUrl;
}
public void setExternalUrl(String externalUrl) {
this.externalUrl = externalUrl;
}
public String getContentUrl() {
return contentUrl;
}
public void setContentUrl(String contentUrl) {
this.contentUrl = contentUrl;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
}
|
repos\flowable-engine-main\modules\flowable-rest\src\main\java\org\flowable\rest\service\api\engine\AttachmentResponse.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class GridFieldDefaultFilterDescriptor
{
boolean defaultFilter;
int defaultFilterSeqNo;
String operator;
boolean showFilterIncrementButtons;
boolean showFilterInline;
String defaultValue;
@Nullable AdValRuleId adValRuleId;
boolean facetFilter;
int facetFilterSeqNo;
OptionalInt maxFacetsToFetch;
@Builder
public GridFieldDefaultFilterDescriptor(
final boolean defaultFilter,
final int defaultFilterSeqNo,
final String operator,
final boolean showFilterIncrementButtons,
final boolean showFilterInline,
final String defaultValue,
@Nullable AdValRuleId adValRuleId,
//
final boolean facetFilter,
final int facetFilterSeqNo,
final int maxFacetsToFetch)
{
if (!defaultFilter && !facetFilter)
{
throw new AdempiereException("defaultFilter or facetFilter shall be true");
}
//
// Default filter
if (defaultFilter)
{
this.defaultFilter = true;
this.defaultFilterSeqNo = defaultFilterSeqNo;
this.operator = operator;
this.showFilterIncrementButtons = showFilterIncrementButtons;
this.showFilterInline = showFilterInline;
this.defaultValue = defaultValue;
this.adValRuleId = adValRuleId;
|
}
else
{
this.defaultFilter = false;
this.defaultFilterSeqNo = 0;
this.operator = null; // default
this.showFilterIncrementButtons = false;
this.showFilterInline = false;
this.defaultValue = null;
this.adValRuleId = null;
}
//
// Facet filter
if (facetFilter)
{
this.facetFilter = true;
this.facetFilterSeqNo = facetFilterSeqNo;
this.maxFacetsToFetch = maxFacetsToFetch > 0 ? OptionalInt.of(maxFacetsToFetch) : OptionalInt.empty();
}
else
{
this.facetFilter = false;
this.facetFilterSeqNo = 0;
this.maxFacetsToFetch = OptionalInt.empty();
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\GridFieldDefaultFilterDescriptor.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class categoryDao {
@Autowired
private SessionFactory sessionFactory;
public void setSessionFactory(SessionFactory sf) {
this.sessionFactory = sf;
}
@Transactional
public Category addCategory(String name) {
Category category = new Category();
category.setName(name);
this.sessionFactory.getCurrentSession().saveOrUpdate(category);
return category;
}
@Transactional
public List<Category> getCategories() {
return this.sessionFactory.getCurrentSession().createQuery("from CATEGORY").list();
}
@Transactional
public Boolean deletCategory(int id) {
Session session = this.sessionFactory.getCurrentSession();
Object persistanceInstance = session.load(Category.class, id);
if (persistanceInstance != null) {
session.delete(persistanceInstance);
return true;
}
return false;
|
}
@Transactional
public Category updateCategory(int id, String name) {
Category category = this.sessionFactory.getCurrentSession().get(Category.class, id);
category.setName(name);
this.sessionFactory.getCurrentSession().update(category);
return category;
}
@Transactional
public Category getCategory(int id) {
return this.sessionFactory.getCurrentSession().get(Category.class,id);
}
}
|
repos\E-commerce-project-springBoot-master2\JtProject\src\main\java\com\jtspringproject\JtSpringProject\dao\categoryDao.java
| 2
|
请完成以下Java代码
|
public class HUSplitDefinition implements IHUSplitDefinition
{
private final I_M_HU_PI_Item luPIItem;
private final I_M_HU_PI_Item tuPIItem;
private final ProductId cuProductId;
private final I_C_UOM cuUOM;
private final BigDecimal cuPerTU;
private final BigDecimal tuPerLU;
private final BigDecimal maxLUToAllocate;
public HUSplitDefinition(final I_M_HU_PI_Item luPIItem,
final I_M_HU_PI_Item tuPIItem,
final ProductId cuProductId,
final I_C_UOM cuUOM,
final BigDecimal cuPerTU,
final BigDecimal tuPerLU,
final BigDecimal maxLUToAllocate)
{
super();
Check.assumeNotNull(luPIItem, "luPIItem not null");
this.luPIItem = luPIItem;
Check.assumeNotNull(tuPIItem, "tuPIItem not null");
this.tuPIItem = tuPIItem;
Check.assumeNotNull(cuProductId, "cuProduct not null");
this.cuProductId = cuProductId;
Check.assumeNotNull(cuUOM, "cuUOM not null");
this.cuUOM = cuUOM;
Check.assumeNotNull(cuPerTU, "cuPerTU not null");
Check.assumeNotNull(cuPerTU.signum() > 0, "cuPerTU > 0 but it was {}", cuPerTU);
this.cuPerTU = cuPerTU;
Check.assumeNotNull(tuPerLU, "tuPerLU not null");
Check.assumeNotNull(tuPerLU.signum() > 0, "tuPerLU > 0 but it was {}", tuPerLU);
this.tuPerLU = tuPerLU;
Check.assumeNotNull(maxLUToAllocate, "maxLUToAllocate not null");
// MaxLUToAllocate can be 0, if, and only if, we only want products allocated to TUs
Check.assume(maxLUToAllocate.signum() >= 0, "maxLUToAllocate >= 0 but it was {}", maxLUToAllocate);
this.maxLUToAllocate = maxLUToAllocate;
}
@Override
public I_M_HU_PI getTuPI()
{
return tuPIItem.getM_HU_PI_Version().getM_HU_PI();
}
@Override
public I_M_HU_PI_Item getLuPIItem()
{
return luPIItem;
}
@Override
public I_M_HU_PI getLuPI()
{
return luPIItem.getM_HU_PI_Version().getM_HU_PI();
}
|
@Override
public ProductId getCuProductId()
{
return cuProductId;
}
@Override
public I_C_UOM getCuUOM()
{
return cuUOM;
}
@Override
public BigDecimal getCuPerTU()
{
return cuPerTU;
}
@Override
public BigDecimal getTuPerLU()
{
return tuPerLU;
}
@Override
public BigDecimal getMaxLUToAllocate()
{
return maxLUToAllocate;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\allocation\transfer\impl\HUSplitDefinition.java
| 1
|
请完成以下Java代码
|
public class SingleEntityQueryProcessor extends AbstractSingleEntityTypeQueryProcessor<SingleEntityFilter> {
private final EntityType entityType;
private final UUID entityId;
public SingleEntityQueryProcessor(TenantRepo repo, QueryContext ctx, EdqsQuery query) {
super(repo, ctx, query, (SingleEntityFilter) query.getEntityFilter());
this.entityType = filter.getSingleEntity().getEntityType();
this.entityId = filter.getSingleEntity().getId();
}
@Override
protected void processCustomerQuery(UUID customerId, Consumer<EntityData<?>> processor) {
processAll(ed -> {
if (checkCustomerId(customerId, ed)) {
processor.accept(ed);
}
|
});
}
@Override
protected void processAll(Consumer<EntityData<?>> processor) {
EntityData ed = repository.getEntityMap(entityType).get(entityId);
if (matches(ed)) {
processor.accept(ed);
}
}
@Override
protected int getProbableResultSize() {
return 1;
}
}
|
repos\thingsboard-master\common\edqs\src\main\java\org\thingsboard\server\edqs\query\processor\SingleEntityQueryProcessor.java
| 1
|
请完成以下Java代码
|
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 afterPropertiesSet()
{
if (clearQuerySelectionsRateInSeconds > 0)
{
final ScheduledExecutorService scheduledExecutor = Executors.newScheduledThreadPool(
1, // corePoolSize
CustomizableThreadFactory.builder()
.setDaemon(true)
.setThreadNamePrefix("cleanup-" + I_T_Query_Selection.Table_Name)
.build());
// note: "If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute."
scheduledExecutor.scheduleAtFixedRate(
QuerySelectionToDeleteHelper::deleteScheduledSelectionsNoFail, // command, don't fail because on failure the task won't be re-scheduled so it's game over
clearQuerySelectionsRateInSeconds, // initialDelay
|
clearQuerySelectionsRateInSeconds, // period
TimeUnit.SECONDS // timeUnit
);
logger.info("Clearing query selection tables each {} seconds", clearQuerySelectionsRateInSeconds);
}
}
private static void setDefaultProperties()
{
if (Check.isBlank(System.getProperty(SYSTEM_PROPERTY_APP_NAME)))
{
System.setProperty(SYSTEM_PROPERTY_APP_NAME, ServerBoot.class.getSimpleName());
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\serverRoot\de.metas.adempiere.adempiere.serverRoot.base\src\main\java\de\metas\ServerBoot.java
| 1
|
请完成以下Java代码
|
public final Timestamp getStartTime()
{
final long startTimeMillis = this.serverStartTimeMillis;
return startTimeMillis > 0 ? new Timestamp(startTimeMillis) : null;
}
public final AdempiereProcessorLog[] getLogs()
{
return p_model.getLogs();
}
/**
* Set the initial nap/sleep when server starts.
*
* Mainly this method is used by tests.
*
* @param initialNapSeconds
*/
|
public final void setInitialNapSeconds(final int initialNapSeconds)
{
Check.assume(initialNapSeconds >= 0, "initialNapSeconds >= 0");
this.m_initialNapSecs = initialNapSeconds;
}
protected final int getRunCount()
{
return p_runCount;
}
protected final Timestamp getStartWork()
{
return new Timestamp(workStartTimeMillis);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\serverRoot\de.metas.adempiere.adempiere.serverRoot.base\src\main\java-legacy\org\compiere\server\AdempiereServer.java
| 1
|
请完成以下Java代码
|
public ZonedDateTime getMinNotificationTime()
{
if (reminders.isEmpty())
{
return null;
}
return reminders.first().getNotificationTime();
}
}
@lombok.Value
@lombok.Builder
private static class NextDispatch
{
public static NextDispatch schedule(final Runnable task, final ZonedDateTime date, final TaskScheduler taskScheduler)
{
final ScheduledFuture<?> scheduledFuture = taskScheduler.schedule(task, TimeUtil.asDate(date));
return builder()
.task(task)
.scheduledFuture(scheduledFuture)
.notificationTime(date)
.build();
}
Runnable task;
ScheduledFuture<?> scheduledFuture;
ZonedDateTime notificationTime;
public void cancel()
|
{
final boolean canceled = scheduledFuture.cancel(false);
logger.trace("Cancel requested for {} (result was: {})", this, canceled);
}
public NextDispatch rescheduleIfAfter(final ZonedDateTime date, final TaskScheduler taskScheduler)
{
if (!notificationTime.isAfter(date) && !scheduledFuture.isDone())
{
logger.trace("Skip rescheduling {} because it's not after {}", date);
return this;
}
cancel();
final ScheduledFuture<?> nextScheduledFuture = taskScheduler.schedule(task, TimeUtil.asTimestamp(date));
NextDispatch nextDispatch = NextDispatch.builder()
.task(task)
.scheduledFuture(nextScheduledFuture)
.notificationTime(date)
.build();
logger.trace("Rescheduled {} to {}", this, nextDispatch);
return nextDispatch;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\purchasecandidate\reminder\PurchaseCandidateReminderScheduler.java
| 1
|
请完成以下Java代码
|
public int getC_UOM_ID()
{
return get_ValueAsInt(COLUMNNAME_C_UOM_ID);
}
@Override
public org.eevolution.model.I_DD_OrderLine getDD_OrderLine()
{
return get_ValueAsPO(COLUMNNAME_DD_OrderLine_ID, org.eevolution.model.I_DD_OrderLine.class);
}
@Override
public void setDD_OrderLine(final org.eevolution.model.I_DD_OrderLine DD_OrderLine)
{
set_ValueFromPO(COLUMNNAME_DD_OrderLine_ID, org.eevolution.model.I_DD_OrderLine.class, DD_OrderLine);
}
@Override
public void setDD_OrderLine_ID (final int DD_OrderLine_ID)
{
if (DD_OrderLine_ID < 1)
set_Value (COLUMNNAME_DD_OrderLine_ID, null);
else
set_Value (COLUMNNAME_DD_OrderLine_ID, DD_OrderLine_ID);
}
@Override
public int getDD_OrderLine_ID()
{
return get_ValueAsInt(COLUMNNAME_DD_OrderLine_ID);
}
@Override
public void setM_HU_Reservation_ID (final int M_HU_Reservation_ID)
{
if (M_HU_Reservation_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_HU_Reservation_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_HU_Reservation_ID, M_HU_Reservation_ID);
}
@Override
public int getM_HU_Reservation_ID()
{
return get_ValueAsInt(COLUMNNAME_M_HU_Reservation_ID);
}
@Override
public de.metas.handlingunits.model.I_M_Picking_Job_Step getM_Picking_Job_Step()
{
return get_ValueAsPO(COLUMNNAME_M_Picking_Job_Step_ID, de.metas.handlingunits.model.I_M_Picking_Job_Step.class);
}
@Override
public void setM_Picking_Job_Step(final de.metas.handlingunits.model.I_M_Picking_Job_Step M_Picking_Job_Step)
{
set_ValueFromPO(COLUMNNAME_M_Picking_Job_Step_ID, de.metas.handlingunits.model.I_M_Picking_Job_Step.class, M_Picking_Job_Step);
}
|
@Override
public void setM_Picking_Job_Step_ID (final int M_Picking_Job_Step_ID)
{
if (M_Picking_Job_Step_ID < 1)
set_Value (COLUMNNAME_M_Picking_Job_Step_ID, null);
else
set_Value (COLUMNNAME_M_Picking_Job_Step_ID, M_Picking_Job_Step_ID);
}
@Override
public int getM_Picking_Job_Step_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Picking_Job_Step_ID);
}
@Override
public void setQtyReserved (final BigDecimal QtyReserved)
{
set_Value (COLUMNNAME_QtyReserved, QtyReserved);
}
@Override
public BigDecimal getQtyReserved()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyReserved);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public de.metas.handlingunits.model.I_M_HU getVHU()
{
return get_ValueAsPO(COLUMNNAME_VHU_ID, de.metas.handlingunits.model.I_M_HU.class);
}
@Override
public void setVHU(final de.metas.handlingunits.model.I_M_HU VHU)
{
set_ValueFromPO(COLUMNNAME_VHU_ID, de.metas.handlingunits.model.I_M_HU.class, VHU);
}
@Override
public void setVHU_ID (final int VHU_ID)
{
if (VHU_ID < 1)
set_Value (COLUMNNAME_VHU_ID, null);
else
set_Value (COLUMNNAME_VHU_ID, VHU_ID);
}
@Override
public int getVHU_ID()
{
return get_ValueAsInt(COLUMNNAME_VHU_ID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java-gen\de\metas\handlingunits\model\X_M_HU_Reservation.java
| 1
|
请完成以下Java代码
|
public void updateSuspensionState(JobDefinitionSuspensionStateDto dto) {
try {
dto.setJobDefinitionId(jobDefinitionId);
dto.updateSuspensionState(engine);
} catch (IllegalArgumentException e) {
String message = String.format("The suspension state of Job Definition with id %s could not be updated due to: %s", jobDefinitionId, e.getMessage());
throw new InvalidRequestException(Status.BAD_REQUEST, e, message);
}
}
public void setJobRetries(RetriesDto dto) {
try {
SetJobRetriesBuilder builder = engine.getManagementService()
.setJobRetries(dto.getRetries())
.jobDefinitionId(jobDefinitionId);
if (dto.isDueDateSet()) {
builder.dueDate(dto.getDueDate());
}
builder.execute();
} catch (AuthorizationException e) {
throw e;
} catch (ProcessEngineException e) {
throw new InvalidRequestException(Status.INTERNAL_SERVER_ERROR, e.getMessage());
}
}
@Override
public void setJobPriority(JobDefinitionPriorityDto dto) {
try {
ManagementService managementService = engine.getManagementService();
if (dto.getPriority() != null) {
managementService.setOverridingJobPriorityForJobDefinition(jobDefinitionId, dto.getPriority(), dto.isIncludeJobs());
}
|
else {
if (dto.isIncludeJobs()) {
throw new InvalidRequestException(Status.BAD_REQUEST,
"Cannot reset priority for job definition " + jobDefinitionId + " with includeJobs=true");
}
managementService.clearOverridingJobPriorityForJobDefinition(jobDefinitionId);
}
} catch (AuthorizationException e) {
throw e;
} catch (NotFoundException e) {
throw new InvalidRequestException(Status.NOT_FOUND, e.getMessage());
} catch (ProcessEngineException e) {
throw new RestException(Status.INTERNAL_SERVER_ERROR, e.getMessage());
}
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\sub\management\JobDefinitionResourceImpl.java
| 1
|
请完成以下Java代码
|
public void setR_AuthCode (String R_AuthCode)
{
set_Value (COLUMNNAME_R_AuthCode, R_AuthCode);
}
/** Get Authorization Code.
@return Authorization Code returned
*/
@Override
public String getR_AuthCode ()
{
return (String)get_Value(COLUMNNAME_R_AuthCode);
}
// /** TenderType AD_Reference_ID=214 */
// public static final int TENDERTYPE_AD_Reference_ID=214;
// /** Kreditkarte = C */
// public static final String TENDERTYPE_Kreditkarte = "C";
// /** Scheck = K */
// public static final String TENDERTYPE_Scheck = "K";
// /** ueberweisung = A */
// public static final String TENDERTYPE_ueberweisung = "A";
// /** Bankeinzug = D */
// public static final String TENDERTYPE_Bankeinzug = "D";
// /** Account = T */
// public static final String TENDERTYPE_Account = "T";
// /** Bar = X */
// public static final String TENDERTYPE_Bar = "X";
/** Set Tender type.
@param TenderType
Method of Payment
*/
@Override
public void setTenderType (String TenderType)
{
set_Value (COLUMNNAME_TenderType, TenderType);
}
/** Get Tender type.
@return Method of Payment
*/
@Override
public String getTenderType ()
{
return (String)get_Value(COLUMNNAME_TenderType);
}
// /** TrxType AD_Reference_ID=215 */
// public static final int TRXTYPE_AD_Reference_ID=215;
|
// /** Verkauf = S */
// public static final String TRXTYPE_Verkauf = "S";
// /** Delayed Capture = D */
// public static final String TRXTYPE_DelayedCapture = "D";
// /** Kredit (Zahlung) = C */
// public static final String TRXTYPE_KreditZahlung = "C";
// /** Voice Authorization = F */
// public static final String TRXTYPE_VoiceAuthorization = "F";
// /** Autorisierung = A */
// public static final String TRXTYPE_Autorisierung = "A";
// /** Loeschen = V */
// public static final String TRXTYPE_Loeschen = "V";
// /** Rueckzahlung = R */
// public static final String TRXTYPE_Rueckzahlung = "R";
/** Set Transaction Type.
@param TrxType
Type of credit card transaction
*/
@Override
public void setTrxType (String TrxType)
{
set_Value (COLUMNNAME_TrxType, TrxType);
}
/** Get Transaction Type.
@return Type of credit card transaction
*/
@Override
public String getTrxType ()
{
return (String)get_Value(COLUMNNAME_TrxType);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.base\src\main\java\de\schaeffer\pay\model\X_Pay_OnlinePaymentHistory.java
| 1
|
请完成以下Java代码
|
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public Integer getPublishCount() {
return publishCount;
}
public void setPublishCount(Integer publishCount) {
this.publishCount = publishCount;
}
public Integer getUseCount() {
return useCount;
}
public void setUseCount(Integer useCount) {
this.useCount = useCount;
}
public Integer getReceiveCount() {
return receiveCount;
}
public void setReceiveCount(Integer receiveCount) {
this.receiveCount = receiveCount;
}
public Date getEnableTime() {
return enableTime;
}
public void setEnableTime(Date enableTime) {
this.enableTime = enableTime;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
|
}
public Integer getMemberLevel() {
return memberLevel;
}
public void setMemberLevel(Integer memberLevel) {
this.memberLevel = memberLevel;
}
@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(", type=").append(type);
sb.append(", name=").append(name);
sb.append(", platform=").append(platform);
sb.append(", count=").append(count);
sb.append(", amount=").append(amount);
sb.append(", perLimit=").append(perLimit);
sb.append(", minPoint=").append(minPoint);
sb.append(", startTime=").append(startTime);
sb.append(", endTime=").append(endTime);
sb.append(", useType=").append(useType);
sb.append(", note=").append(note);
sb.append(", publishCount=").append(publishCount);
sb.append(", useCount=").append(useCount);
sb.append(", receiveCount=").append(receiveCount);
sb.append(", enableTime=").append(enableTime);
sb.append(", code=").append(code);
sb.append(", memberLevel=").append(memberLevel);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
|
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\SmsCoupon.java
| 1
|
请完成以下Java代码
|
public int getRevisionNext() {
return revision + 1;
}
// getters and setters //////////////////////////////////////////////////////
@Override
public String getId() {
return id;
}
@Override
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDeploymentId() {
return deploymentId;
}
public void setDeploymentId(String deploymentId) {
this.deploymentId = deploymentId;
}
public void setBytes(byte[] bytes) {
this.bytes = bytes;
}
@Override
public int getRevision() {
return revision;
}
@Override
public void setRevision(int revision) {
this.revision = revision;
}
@Override
public String toString() {
return "ByteArrayEntity[id=" + id + ", name=" + name + ", size=" + (bytes != null ? bytes.length : 0) + "]";
}
// Wrapper for a byte array, needed to do byte array comparisons
// See https://activiti.atlassian.net/browse/ACT-1524
private static class PersistentState {
private final String name;
|
private final byte[] bytes;
public PersistentState(String name, byte[] bytes) {
this.name = name;
this.bytes = bytes;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof PersistentState) {
PersistentState other = (PersistentState) obj;
return Objects.equals(this.name, other.name)
&& Arrays.equals(this.bytes, other.bytes);
}
return false;
}
@Override
public int hashCode() {
throw new UnsupportedOperationException();
}
}
}
|
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\persistence\entity\ByteArrayEntity.java
| 1
|
请完成以下Java代码
|
public class InMemoryIdentityStore4Authentication implements IdentityStore {
private Map<String, String> users = new HashMap<>();
public InMemoryIdentityStore4Authentication() {
//Init users
// from a file or hardcoded
init();
}
private void init() {
//user1
users.put("user", "pass0");
//user2
users.put("admin", "pass1");
}
@Override
|
public int priority() {
return 70;
}
@Override
public Set<ValidationType> validationTypes() {
return EnumSet.of(ValidationType.VALIDATE);
}
public CredentialValidationResult validate(UsernamePasswordCredential credential) {
String password = users.get(credential.getCaller());
if (password != null && password.equals(credential.getPasswordAsString())) {
return new CredentialValidationResult(credential.getCaller());
}
return INVALID_RESULT;
}
}
|
repos\tutorials-master\security-modules\java-ee-8-security-api\app-auth-custom-form-store-custom\src\main\java\com\baeldung\javaee\security\InMemoryIdentityStore4Authentication.java
| 1
|
请完成以下Java代码
|
public void execute()
{
final List<I_M_InOutLine> inoutLines = inoutBL.getLines(inoutId);
final ImmutableSet<OrderLineId> orderLineIds = inoutLines.stream()
.map(inoutLine -> OrderLineId.ofRepoIdOrNull(inoutLine.getC_OrderLine_ID()))
.filter(Objects::nonNull)
.collect(ImmutableSet.toImmutableSet());
final List<OrderCost> orderCostsList = orderCostRepository.getByOrderLineIds(orderLineIds);
if (orderCostsList.isEmpty())
{
return;
}
for (final I_M_InOutLine inoutLine : inoutLines)
{
final OrderLineId orderLineId = OrderLineId.ofRepoIdOrNull(inoutLine.getC_OrderLine_ID());
if (orderLineId == null)
{
continue;
}
final StockQtyAndUOMQty inoutQty = inoutBL.getStockQtyAndCatchQty(inoutLine);
for (final OrderCost orderCost : orderCostsList)
{
final OrderCostDetail detail = orderCost.getDetailByOrderLineIdIfExists(orderLineId).orElse(null);
if (detail == null)
{
continue;
}
|
final Quantity inoutQtyConv = inoutQty.getQtyInUOM(detail.getUomId(), uomConversionBL);
final CurrencyPrecision precision = moneyService.getStdPrecision(orderCost.getCurrencyId());
final Money inoutCostAmount = orderCost.computeInOutCostAmountForQty(orderLineId, inoutQtyConv, precision);
final OrderCostAddInOutResult addResult = orderCost.addInOutCost(
OrderCostAddInOutRequest.builder()
.orderLineId(orderLineId)
.qty(inoutQtyConv)
.costAmount(inoutCostAmount)
.build());
inOutCostRepository.create(InOutCostCreateRequest.builder()
.orgId(OrgId.ofRepoId(inoutLine.getAD_Org_ID()))
.orderCostDetailId(addResult.getOrderCostDetailId())
.orderAndLineId(OrderAndLineId.of(orderCost.getOrderId(), orderLineId))
.inoutAndLineId(InOutAndLineId.ofRepoId(inoutLine.getM_InOut_ID(), inoutLine.getM_InOutLine_ID()))
.soTrx(orderCost.getSoTrx())
.bpartnerId(orderCost.getBpartnerId())
.costTypeId(orderCost.getCostTypeId())
.costElementId(orderCost.getCostElementId())
.qty(addResult.getQty())
.costAmount(addResult.getCostAmount())
.build());
}
}
orderCostRepository.saveAll(orderCostsList);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\order\costs\inout\InOutCostCreateCommand.java
| 1
|
请完成以下Java代码
|
public String getXMLElementName() {
return CmmnXmlConstants.ELEMENT_GENERIC_EVENT_LISTENER;
}
@Override
protected BaseElement convert(XMLStreamReader xtr, ConversionHelper conversionHelper) {
String listenerType = xtr.getAttributeValue(null, CmmnXmlConstants.ATTRIBUTE_EVENT_LISTENER_TYPE);
if ("signal".equals(listenerType)) {
SignalEventListener signalEventListener = new SignalEventListener();
signalEventListener.setSignalRef(xtr.getAttributeValue(null, CmmnXmlConstants.ATTRIBUTE_EVENT_LISTENER_SIGNAL_REF));
return convertCommonAttributes(xtr, signalEventListener);
} else if ("variable".equals(listenerType)) {
VariableEventListener variableEventListener = new VariableEventListener();
variableEventListener.setVariableName(xtr.getAttributeValue(null, CmmnXmlConstants.ATTRIBUTE_EVENT_LISTENER_VARIABLE_NAME));
variableEventListener.setVariableChangeType(xtr.getAttributeValue(null, CmmnXmlConstants.ATTRIBUTE_EVENT_LISTENER_VARIABLE_CHANGE_TYPE));
return convertCommonAttributes(xtr, variableEventListener);
} else if ("intent".equals(listenerType)) {
IntentEventListener intentEventListener = new IntentEventListener();
|
return convertCommonAttributes(xtr, intentEventListener);
} else if ("reactivate".equals(listenerType)) {
ReactivateEventListener reactivateEventListener = new ReactivateEventListener();
return convertCommonAttributes(xtr, reactivateEventListener);
} else {
GenericEventListener genericEventListener = new GenericEventListener();
return convertCommonAttributes(xtr, genericEventListener);
}
}
protected EventListener convertCommonAttributes(XMLStreamReader xtr, EventListener listener) {
listener.setName(xtr.getAttributeValue(null, CmmnXmlConstants.ATTRIBUTE_NAME));
listener.setAvailableConditionExpression(xtr.getAttributeValue(CmmnXmlConstants.FLOWABLE_EXTENSIONS_NAMESPACE,
CmmnXmlConstants.ATTRIBUTE_EVENT_LISTENER_AVAILABLE_CONDITION));
return listener;
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-converter\src\main\java\org\flowable\cmmn\converter\GenericEventListenerXmlConverter.java
| 1
|
请完成以下Java代码
|
public void setWF_Initial_User_ID (final int WF_Initial_User_ID)
{
if (WF_Initial_User_ID < 1)
set_Value (COLUMNNAME_WF_Initial_User_ID, null);
else
set_Value (COLUMNNAME_WF_Initial_User_ID, WF_Initial_User_ID);
}
@Override
public int getWF_Initial_User_ID()
{
return get_ValueAsInt(COLUMNNAME_WF_Initial_User_ID);
}
/**
* WFState AD_Reference_ID=305
* Reference name: WF_Instance State
*/
public static final int WFSTATE_AD_Reference_ID=305;
/** NotStarted = ON */
public static final String WFSTATE_NotStarted = "ON";
/** Running = OR */
public static final String WFSTATE_Running = "OR";
/** Suspended = OS */
public static final String WFSTATE_Suspended = "OS";
/** Completed = CC */
public static final String WFSTATE_Completed = "CC";
/** Aborted = CA */
|
public static final String WFSTATE_Aborted = "CA";
/** Terminated = CT */
public static final String WFSTATE_Terminated = "CT";
@Override
public void setWFState (final java.lang.String WFState)
{
set_Value (COLUMNNAME_WFState, WFState);
}
@Override
public java.lang.String getWFState()
{
return get_ValueAsString(COLUMNNAME_WFState);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_WF_Process.java
| 1
|
请完成以下Java代码
|
public static HistoricActivityInstanceEntityManager getHistoricActivityInstanceEntityManager(CommandContext commandContext) {
return getProcessEngineConfiguration(commandContext).getHistoricActivityInstanceEntityManager();
}
public static HistoryManager getHistoryManager(CommandContext commandContext) {
return getProcessEngineConfiguration(commandContext).getHistoryManager();
}
public static HistoricDetailEntityManager getHistoricDetailEntityManager() {
return getHistoricDetailEntityManager(getCommandContext());
}
public static HistoricDetailEntityManager getHistoricDetailEntityManager(CommandContext commandContext) {
return getProcessEngineConfiguration(commandContext).getHistoricDetailEntityManager();
}
public static AttachmentEntityManager getAttachmentEntityManager() {
return getAttachmentEntityManager(getCommandContext());
}
public static AttachmentEntityManager getAttachmentEntityManager(CommandContext commandContext) {
return getProcessEngineConfiguration(commandContext).getAttachmentEntityManager();
}
public static EventLogEntryEntityManager getEventLogEntryEntityManager() {
return getEventLogEntryEntityManager(getCommandContext());
}
public static EventLogEntryEntityManager getEventLogEntryEntityManager(CommandContext commandContext) {
return getProcessEngineConfiguration(commandContext).getEventLogEntryEntityManager();
}
public static FlowableEventDispatcher getEventDispatcher() {
return getEventDispatcher(getCommandContext());
}
public static FlowableEventDispatcher getEventDispatcher(CommandContext commandContext) {
return getProcessEngineConfiguration(commandContext).getEventDispatcher();
}
public static FailedJobCommandFactory getFailedJobCommandFactory() {
return getFailedJobCommandFactory(getCommandContext());
|
}
public static FailedJobCommandFactory getFailedJobCommandFactory(CommandContext commandContext) {
return getProcessEngineConfiguration(commandContext).getFailedJobCommandFactory();
}
public static ProcessInstanceHelper getProcessInstanceHelper() {
return getProcessInstanceHelper(getCommandContext());
}
public static ProcessInstanceHelper getProcessInstanceHelper(CommandContext commandContext) {
return getProcessEngineConfiguration(commandContext).getProcessInstanceHelper();
}
public static CommandContext getCommandContext() {
return Context.getCommandContext();
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\util\CommandContextUtil.java
| 1
|
请完成以下Java代码
|
public boolean isOnlySubProcessExecutions() {
return onlySubProcessExecutions;
}
public Date getStartedBefore() {
return startedBefore;
}
public void setStartedBefore(Date startedBefore) {
this.startedBefore = startedBefore;
}
public Date getStartedAfter() {
return startedAfter;
}
public void setStartedAfter(Date startedAfter) {
this.startedAfter = startedAfter;
}
public String getStartedBy() {
return startedBy;
}
public void setStartedBy(String startedBy) {
this.startedBy = startedBy;
}
public boolean isWithJobException() {
return withJobException;
}
public String getLocale() {
return locale;
}
public boolean isNeedsProcessDefinitionOuterJoin() {
|
if (isNeedsPaging()) {
if (AbstractEngineConfiguration.DATABASE_TYPE_ORACLE.equals(databaseType)
|| AbstractEngineConfiguration.DATABASE_TYPE_DB2.equals(databaseType)
|| AbstractEngineConfiguration.DATABASE_TYPE_MSSQL.equals(databaseType)) {
// When using oracle, db2 or mssql we don't need outer join for the process definition join.
// It is not needed because the outer join order by is done by the row number instead
return false;
}
}
return hasOrderByForColumn(ProcessInstanceQueryProperty.PROCESS_DEFINITION_KEY.getName());
}
public List<List<String>> getSafeProcessInstanceIds() {
return safeProcessInstanceIds;
}
public void setSafeProcessInstanceIds(List<List<String>> safeProcessInstanceIds) {
this.safeProcessInstanceIds = safeProcessInstanceIds;
}
public List<List<String>> getSafeInvolvedGroups() {
return safeInvolvedGroups;
}
public void setSafeInvolvedGroups(List<List<String>> safeInvolvedGroups) {
this.safeInvolvedGroups = safeInvolvedGroups;
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\ProcessInstanceQueryImpl.java
| 1
|
请完成以下Java代码
|
public static Message ofTextTipAndErrorCode(
@NonNull final AdMessageId adMessageId,
@NonNull final AdMessageKey adMessage,
@NonNull final ImmutableTranslatableString msgText,
@NonNull final ImmutableTranslatableString msgTip,
@Nullable final String errorCode)
{
return new Message(adMessageId, adMessage, msgText, msgTip, false, errorCode);
}
public static Message ofMissingADMessage(@Nullable final String text)
{
final String textNorm = StringUtils.trimBlankToNull(text);
if (textNorm == null)
{
return EMPTY;
}
return new Message(
null,
AdMessageKey.of(textNorm),
ImmutableTranslatableString.ofDefaultValue(text),
null,
true,
null);
}
@Nullable @Getter private final AdMessageId adMessageId;
@NonNull @Getter private final AdMessageKey adMessage;
@NonNull private final ITranslatableString msgText;
@Nullable private final ITranslatableString msgTip;
@NonNull private final ITranslatableString msgTextAndTip;
@Getter private final boolean missing;
@Getter @Nullable private String errorCode;
private Message(
@Nullable final AdMessageId adMessageId,
@NonNull final AdMessageKey adMessage,
@NonNull final ImmutableTranslatableString msgText,
@Nullable final ImmutableTranslatableString msgTip,
final boolean missing,
@Nullable final String errorCode)
{
this.adMessageId = adMessageId;
this.adMessage = adMessage;
this.msgText = msgText;
this.msgTip = msgTip;
|
if (!TranslatableStrings.isBlank(this.msgTip)) // messageTip on next line, if exists
{
this.msgTextAndTip = TranslatableStrings.builder()
.append(this.msgText)
.append(SEPARATOR)
.append(this.msgTip)
.build();
}
else
{
this.msgTextAndTip = msgText;
}
this.missing = missing;
this.errorCode = errorCode;
}
private Message()
{
this.adMessageId = null;
this.adMessage = EMPTY_AD_Message;
this.msgText = TranslatableStrings.empty();
this.msgTip = null;
this.msgTextAndTip = this.msgText;
this.missing = true;
}
public String getMsgText(@NonNull final String adLanguage)
{
return msgText.translate(adLanguage);
}
public String getMsgTip(@NonNull final String adLanguage)
{
return msgTip != null ? msgTip.translate(adLanguage) : "";
}
public String getMsgTextAndTip(@NonNull final String adLanguage)
{
return msgTextAndTip.translate(adLanguage);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\i18n\Message.java
| 1
|
请完成以下Java代码
|
public int getM_Shipper_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Shipper_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/**
* PaperFormat AD_Reference_ID=541073
* Reference name: DpdPaperFormat
*/
public static final int PAPERFORMAT_AD_Reference_ID=541073;
/** A6 = A6 */
public static final String PAPERFORMAT_A6 = "A6";
/** A5 = A5 */
public static final String PAPERFORMAT_A5 = "A5";
/** A4 = A4 */
public static final String PAPERFORMAT_A4 = "A4";
/** Set Papierformat.
@param PaperFormat Papierformat */
@Override
public void setPaperFormat (java.lang.String PaperFormat)
{
set_Value (COLUMNNAME_PaperFormat, PaperFormat);
}
/** Get Papierformat.
@return Papierformat */
@Override
public java.lang.String getPaperFormat ()
{
return (java.lang.String)get_Value(COLUMNNAME_PaperFormat);
}
/** Set URL Api Shipment Service.
@param ShipmentServiceApiUrl URL Api Shipment Service */
@Override
public void setShipmentServiceApiUrl (java.lang.String ShipmentServiceApiUrl)
{
set_Value (COLUMNNAME_ShipmentServiceApiUrl, ShipmentServiceApiUrl);
}
/** Get URL Api Shipment Service.
@return URL Api Shipment Service */
|
@Override
public java.lang.String getShipmentServiceApiUrl ()
{
return (java.lang.String)get_Value(COLUMNNAME_ShipmentServiceApiUrl);
}
/** Set Shipper Product.
@param ShipperProduct Shipper Product */
@Override
public void setShipperProduct (java.lang.String ShipperProduct)
{
set_Value (COLUMNNAME_ShipperProduct, ShipperProduct);
}
/** Get Shipper Product.
@return Shipper Product */
@Override
public java.lang.String getShipperProduct ()
{
return (java.lang.String)get_Value(COLUMNNAME_ShipperProduct);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.dpd\src\main\java-gen\de\metas\shipper\gateway\dpd\model\X_DPD_Shipper_Config.java
| 1
|
请完成以下Java代码
|
static class ArgumentValueSerializer extends ReferenceTypeSerializer<ArgumentValue<?>> {
@Serial
private static final long serialVersionUID = 1L;
ArgumentValueSerializer(final ReferenceType fullType, final boolean staticTyping,
final @Nullable TypeSerializer vts, final JsonSerializer<Object> ser) {
super(fullType, staticTyping, vts, ser);
}
ArgumentValueSerializer(final ArgumentValueSerializer base, final BeanProperty property,
final TypeSerializer vts, final JsonSerializer<?> valueSer,
final NameTransformer unwrapper, final Object suppressableValue,
final boolean suppressNulls) {
super(base, property, vts, valueSer, unwrapper, suppressableValue, suppressNulls);
}
@Override
protected ReferenceTypeSerializer<ArgumentValue<?>> withResolved(final BeanProperty prop, final TypeSerializer vts,
final JsonSerializer<?> valueSer, final NameTransformer unwrapper) {
return new ArgumentValueSerializer(this, prop, vts, valueSer, unwrapper, _suppressableValue, _suppressNulls);
}
@Override
|
public ReferenceTypeSerializer<ArgumentValue<?>> withContentInclusion(final Object suppressableValue, final boolean suppressNulls) {
return new ArgumentValueSerializer(this, _property, _valueTypeSerializer,
_valueSerializer, _unwrapper, suppressableValue, suppressNulls);
}
@Override
protected boolean _isValuePresent(final ArgumentValue<?> value) {
return !value.isOmitted();
}
@Override
protected @Nullable Object _getReferenced(final ArgumentValue<?> value) {
return value.value();
}
@Override
protected @Nullable Object _getReferencedIfPresent(final ArgumentValue<?> value) {
return value.value();
}
}
}
|
repos\spring-graphql-main\spring-graphql\src\main\java\org\springframework\graphql\client\json\GraphQlJackson2Module.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class ZipkinConfiguration {
// ==================== 通用配置 ====================
/**
* Configuration for how to send spans to Zipkin
*/
@Bean
public Sender sender() {
return OkHttpSender.create("http://127.0.0.1:9411/api/v2/spans");
}
/**
* Configuration for how to buffer spans into messages for Zipkin
*/
@Bean
public AsyncReporter<Span> spanReporter() {
return AsyncReporter.create(sender());
}
/**
* Controls aspects of tracing such as the service name that shows up in the UI
*/
@Bean
public Tracing tracing(@Value("${spring.application.name}") String serviceName) {
return Tracing.newBuilder()
.localServiceName(serviceName)
// .currentTraceContext(ThreadLocalCurrentTraceContext.newBuilder()
// .addScopeDecorator(MDCScopeDecorator.create()) // puts trace IDs into logs
// .build()
// )
.spanReporter(spanReporter()).build();
}
/**
* Allows someone to add tags to a span if a trace is in progress
*/
@Bean
public SpanCustomizer spanCustomizer(Tracing tracing) {
return CurrentSpanCustomizer.create(tracing);
}
// ==================== HTTP 相关 ====================
/**
* Decides how to name and tag spans. By default they are named the same as the http method
*/
@Bean
public HttpTracing httpTracing(Tracing tracing) {
return HttpTracing.create(tracing);
}
/**
* Creates server spans for http requests
|
*/
@Bean
public Filter tracingFilter(HttpTracing httpTracing) {
return TracingFilter.create(httpTracing);
}
// ==================== SpringMVC 相关 ====================
// @see SpringMvcConfiguration 类上的,@Import(SpanCustomizingAsyncHandlerInterceptor.class)
// ==================== HttpClient 相关 ====================
@Bean
public RestTemplateCustomizer useTracedHttpClient(HttpTracing httpTracing) {
// 创建 CloseableHttpClient 对象,内置 HttpTracing 进行 HTTP 链路追踪。
final CloseableHttpClient httpClient = TracingHttpClientBuilder.create(httpTracing).build();
// 创建 RestTemplateCustomizer 对象
return new RestTemplateCustomizer() {
@Override
public void customize(RestTemplate restTemplate) {
restTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory(httpClient));
}
};
}
}
|
repos\SpringBoot-Labs-master\lab-40\lab-40-demo\src\main\java\cn\iocoder\springboot\lab40\zipkindemo\config\ZipkinConfiguration.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class PaymentsView_PaymentWriteOff extends PaymentsViewBasedProcess implements IProcessPrecondition
{
private final IPaymentBL paymentBL = Services.get(IPaymentBL.class);
private final MoneyService moneyService = SpringContextHolder.instance.getBean(MoneyService.class);
@Param(parameterName = "DateTrx", mandatory = true)
private LocalDate p_DateTrx;
@Override
protected ProcessPreconditionsResolution checkPreconditionsApplicable()
{
if (!getInvoiceRowsSelectedForAllocation().isEmpty())
{
return ProcessPreconditionsResolution.rejectWithInternalReason("No invoices shall be selected");
}
return creatPlan()
.resolve(plan -> ProcessPreconditionsResolution.accept().deriveWithCaptionOverride(computeCaption(plan.getAmountToWriteOff())),
ProcessPreconditionsResolution::rejectWithInternalReason);
}
private ExplainedOptional<Plan> creatPlan()
{
return createPlan(getPaymentRowsSelectedForAllocation());
}
private static ITranslatableString computeCaption(final Amount writeOffAmt)
{
return TranslatableStrings.builder()
.appendADElement("PaymentWriteOffAmt").append(": ").append(writeOffAmt)
.build();
}
@Override
protected String doIt()
{
final Plan plan = creatPlan().orElseThrow();
final PaymentAmtMultiplier amtMultiplier = plan.getAmtMultiplier();
final Amount amountToWriteOff = amtMultiplier.convertToRealValue(plan.getAmountToWriteOff());
paymentBL.paymentWriteOff(
plan.getPaymentId(),
amountToWriteOff.toMoney(moneyService::getCurrencyIdByCurrencyCode),
p_DateTrx.atStartOfDay(SystemTime.zoneId()).toInstant(),
null);
return MSG_OK;
}
|
//
//
//
private static ExplainedOptional<Plan> createPlan(@NonNull final ImmutableList<PaymentRow> paymentRows)
{
if (paymentRows.size() != 1)
{
return ExplainedOptional.emptyBecause("Only one payment row can be selected for write-off");
}
final PaymentRow paymentRow = CollectionUtils.singleElement(paymentRows);
final Amount openAmt = paymentRow.getOpenAmt();
if (openAmt.signum() == 0)
{
return ExplainedOptional.emptyBecause("Zero open amount. Nothing to write-off");
}
return ExplainedOptional.of(
Plan.builder()
.paymentId(paymentRow.getPaymentId())
.amtMultiplier(paymentRow.getPaymentAmtMultiplier())
.amountToWriteOff(openAmt)
.build());
}
@Value
@Builder
private static class Plan
{
@NonNull PaymentId paymentId;
@NonNull PaymentAmtMultiplier amtMultiplier;
@NonNull Amount amountToWriteOff;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\payment_allocation\process\PaymentsView_PaymentWriteOff.java
| 2
|
请完成以下Java代码
|
public String getJobLevel() {
return jobLevel;
}
public String getName() {
return name;
}
public Boolean getAgreement() {
return agreement;
}
public Date getPassportExpiryDate() {
return passportExpiryDate;
}
public void setAgreement(Boolean agreement) {
this.agreement = agreement;
}
|
public void setName(String name) {
this.name = name;
}
public void setJobLevel(String jobLevel) {
this.jobLevel = jobLevel;
}
public void setPassportExpiryDate(Date passportExpiryDate) {
this.passportExpiryDate = passportExpiryDate;
}
public Integer getExperience() {
return experience;
}
public void setExperience(Integer experience) {
this.experience = experience;
}
}
|
repos\tutorials-master\javaxval-2\src\main\java\com\baeldung\javaxval\listvalidation\JobAspirant.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class WebSocketController {
@Autowired
private WebSocketService ws;
@Autowired
private SimpMessagingTemplate messagingTemplate;
@RequestMapping(value = "/login")
public String login(){
return "login";
}
@RequestMapping(value = "/ws")
public String ws(){
return "ws";
}
@RequestMapping(value = "/chat")
public String chat(){
return "chat";
}
//http://localhost:8080/ws
@MessageMapping("/welcome")//浏览器发送请求通过@messageMapping 映射/welcome 这个地址。
@SendTo("/topic/getResponse")//服务器端有消息时,会订阅@SendTo 中的路径的浏览器发送消息。
public Response say(Message message) throws Exception {
Thread.sleep(1000);
return new Response("Welcome, " + message.getName() + "!");
}
//http://localhost:8080/Welcome1
@RequestMapping("/Welcome1")
@ResponseBody
public String say2()throws Exception
{
ws.sendMessage();
return "is ok";
}
|
@MessageMapping("/chat")
//在springmvc 中可以直接获得principal,principal 中包含当前用户的信息
public void handleChat(Principal principal, Message message) {
/**
* 此处是一段硬编码。如果发送人是wyf 则发送给 wisely 如果发送人是wisely 就发送给 wyf。
* 通过当前用户,然后查找消息,如果查找到未读消息,则发送给当前用户。
*/
if (principal.getName().equals("admin")) {
//通过convertAndSendToUser 向用户发送信息,
// 第一个参数是接收消息的用户,第二个参数是浏览器订阅的地址,第三个参数是消息本身
messagingTemplate.convertAndSendToUser("abel",
"/queue/notifications", principal.getName() + "-send:"
+ message.getName());
/**
* 72 行操作相等于
* messagingTemplate.convertAndSend("/user/abel/queue/notifications",principal.getName() + "-send:"
+ message.getName());
*/
} else {
messagingTemplate.convertAndSendToUser("admin",
"/queue/notifications", principal.getName() + "-send:"
+ message.getName());
}
}
}
|
repos\springBoot-master\springWebSocket\src\main\java\com\us\example\controller\WebSocketController.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class BookstoreService {
private final AuthorGoodRepository authorGoodRepository;
private final AuthorBadRepository authorBadRepository;
public BookstoreService(AuthorGoodRepository authorGoodRepository, AuthorBadRepository authorBadRepository) {
this.authorGoodRepository = authorGoodRepository;
this.authorBadRepository = authorBadRepository;
}
public void persistGoodAuthor() {
AuthorGood good = new AuthorGood();
good.setName("Joana Nimar");
good.setAge(34);
|
good.setGenre("History");
authorGoodRepository.save(good);
}
public void persistBadAuthor() {
AuthorBad bad = new AuthorBad();
bad.setName("Alicia Tom");
bad.setAge(38);
bad.setGenre("Anthology");
authorBadRepository.save(bad);
}
}
|
repos\Hibernate-SpringBoot-master\HibernateSpringBootAutoGeneratorType\src\main\java\com\bookstore\service\BookstoreService.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public String bean() {
System.err.println("ConditionalOnBean is exist");
return "";
}
@ConditionalOnMissingBean(DynamicAttrConfig.class)
@Bean
public String missBean() {
System.err.println("ConditionalOnBean is missing");
return "";
}
/**
* 表达式为true时
* spel http://itmyhome.com/spring/expressions.html
*/
@ConditionalOnExpression(value = "2 > 1")
@Bean
public String expresssion() {
System.err.println("expresssion is true");
return "";
}
/**
* 配置文件属性是否为true
*/
|
@ConditionalOnProperty(value = {"spring.activemq.switch"}, matchIfMissing = false)
@Bean
public String property() {
System.err.println("property is true");
return "";
}
/**
* 打印容器里的所有bean name (box name 为方法名)
* @param appContext
* @return
*/
@Bean
public CommandLineRunner run(ApplicationContext appContext) {
return args -> {
String[] beans = appContext.getBeanDefinitionNames();
Arrays.stream(beans).sorted().forEach(System.out::println);
};
}
}
|
repos\spring-boot-quick-master\quick-dynamic-bean\src\main\java\com\dynamic\bean\config\ConditionConfig.java
| 2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.