instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请完成以下Java代码
|
public java.math.BigDecimal getDK_ParcelWidth ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_DK_ParcelWidth);
if (bd == null)
return BigDecimal.ZERO;
return bd;
}
/** Set Referenz.
@param DK_Reference Referenz */
@Override
public void setDK_Reference (java.lang.String DK_Reference)
{
set_Value (COLUMNNAME_DK_Reference, DK_Reference);
}
/** Get Referenz.
@return Referenz */
@Override
public java.lang.String getDK_Reference ()
{
return (java.lang.String)get_Value(COLUMNNAME_DK_Reference);
}
/** Set Zeile Nr..
@param Line
Einzelne Zeile in dem Dokument
*/
|
@Override
public void setLine (int Line)
{
set_Value (COLUMNNAME_Line, Integer.valueOf(Line));
}
/** Get Zeile Nr..
@return Einzelne Zeile in dem Dokument
*/
@Override
public int getLine ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Line);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.derkurier\src\main\java-gen\de\metas\shipper\gateway\derkurier\model\X_DerKurier_DeliveryOrderLine.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class WSOperation implements OperationImplementation {
protected String id;
protected String name;
protected WSService service;
public WSOperation(String id, String operationName, WSService service) {
this.id = id;
this.name = operationName;
this.service = service;
}
@Override
public String getId() {
return this.id;
}
@Override
public String getName() {
return this.name;
}
@Override
public MessageInstance sendFor(MessageInstance message, Operation operation, ConcurrentMap<QName, URL> overridenEndpointAddresses) throws Exception {
Object[] inArguments = this.getInArguments(message);
Object[] outArguments = this.getOutArguments(operation);
// For each out parameters, a value 'null' must be set in arguments passed to the Apache CXF API to invoke
// web-service operation
Object[] arguments = new Object[inArguments.length + outArguments.length];
System.arraycopy(inArguments, 0, arguments, 0, inArguments.length);
Object[] results = this.safeSend(arguments, overridenEndpointAddresses);
return this.createResponseMessage(results, operation);
}
private Object[] getInArguments(MessageInstance message) {
return message.getStructureInstance().toArray();
}
private Object[] getOutArguments(Operation operation) {
MessageDefinition outMessage = operation.getOutMessage();
if (outMessage != null) {
return outMessage.createInstance().getStructureInstance().toArray();
} else {
|
return new Object[] {};
}
}
private Object[] safeSend(Object[] arguments, ConcurrentMap<QName, URL> overridenEndpointAddresses) throws Exception {
Object[] results = null;
results = this.service.getClient().send(this.name, arguments, overridenEndpointAddresses);
if (results == null) {
results = new Object[] {};
}
return results;
}
private MessageInstance createResponseMessage(Object[] results, Operation operation) {
MessageInstance message = null;
MessageDefinition outMessage = operation.getOutMessage();
if (outMessage != null) {
message = outMessage.createInstance();
message.getStructureInstance().loadFrom(results);
}
return message;
}
public WSService getService() {
return this.service;
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\webservice\WSOperation.java
| 2
|
请完成以下Java代码
|
public WebSocketGraphQlClient build() {
setJsonCodecs(
CodecDelegate.findJsonEncoder(this.codecConfigurer),
CodecDelegate.findJsonDecoder(this.codecConfigurer));
WebSocketGraphQlTransport transport = new WebSocketGraphQlTransport(
this.url, this.headers, this.webSocketClient, this.codecConfigurer, getInterceptor(), this.keepAlive);
GraphQlClient graphQlClient = super.buildGraphQlClient(transport);
return new DefaultWebSocketGraphQlClient(graphQlClient, transport, getBuilderInitializer());
}
private WebSocketGraphQlClientInterceptor getInterceptor() {
List<WebSocketGraphQlClientInterceptor> interceptors = getInterceptors().stream()
.filter((interceptor) -> interceptor instanceof WebSocketGraphQlClientInterceptor)
.map((interceptor) -> (WebSocketGraphQlClientInterceptor) interceptor)
.toList();
Assert.state(interceptors.size() <= 1,
"Only a single interceptor of type WebSocketGraphQlClientInterceptor may be configured");
return (!interceptors.isEmpty() ? interceptors.get(0) : new WebSocketGraphQlClientInterceptor() { });
}
/**
* Default {@link WebSocketGraphQlClient} implementation.
*/
private static class DefaultWebSocketGraphQlClient extends AbstractDelegatingGraphQlClient implements WebSocketGraphQlClient {
private final WebSocketGraphQlTransport transport;
private final Consumer<AbstractGraphQlClientBuilder<?>> builderInitializer;
DefaultWebSocketGraphQlClient(GraphQlClient delegate, WebSocketGraphQlTransport transport,
Consumer<AbstractGraphQlClientBuilder<?>> builderInitializer) {
super(delegate);
Assert.notNull(transport, "WebSocketGraphQlTransport is required");
Assert.notNull(builderInitializer, "`builderInitializer` is required");
this.transport = transport;
this.builderInitializer = builderInitializer;
|
}
@Override
public Mono<Void> start() {
return this.transport.start();
}
@Override
public Mono<Void> stop() {
return this.transport.stop();
}
@Override
public DefaultWebSocketGraphQlClientBuilder mutate() {
DefaultWebSocketGraphQlClientBuilder builder = new DefaultWebSocketGraphQlClientBuilder(this.transport);
this.builderInitializer.accept(builder);
return builder;
}
}
}
|
repos\spring-graphql-main\spring-graphql\src\main\java\org\springframework\graphql\client\DefaultWebSocketGraphQlClientBuilder.java
| 1
|
请完成以下Java代码
|
public int getVisitCount() {
return visitCount;
}
public void setVisitCount(int visitCount) {
this.visitCount = visitCount;
}
double getWinScore() {
return winScore;
}
void setWinScore(double winScore) {
this.winScore = winScore;
}
public List<State> getAllPossibleStates() {
List<State> possibleStates = new ArrayList<>();
List<Position> availablePositions = this.board.getEmptyPositions();
availablePositions.forEach(p -> {
State newState = new State(this.board);
newState.setPlayerNo(3 - this.playerNo);
newState.getBoard().performMove(newState.getPlayerNo(), p);
possibleStates.add(newState);
});
return possibleStates;
}
|
void incrementVisit() {
this.visitCount++;
}
void addScore(double score) {
if (this.winScore != Integer.MIN_VALUE)
this.winScore += score;
}
void randomPlay() {
List<Position> availablePositions = this.board.getEmptyPositions();
int totalPossibilities = availablePositions.size();
int selectRandom = (int) (Math.random() * totalPossibilities);
this.board.performMove(this.playerNo, availablePositions.get(selectRandom));
}
void togglePlayer() {
this.playerNo = 3 - this.playerNo;
}
}
|
repos\tutorials-master\algorithms-modules\algorithms-searching\src\main\java\com\baeldung\algorithms\mcts\montecarlo\State.java
| 1
|
请完成以下Java代码
|
public static void backIterable2(BinTreeNode<String> root, List<String> list) {
Stack<BinTreeNode<String>> stack = new Stack<>();
BinTreeNode<String> prev = null, curr = root;
while (curr != null || !stack.isEmpty()) {
while (curr != null) {
// 添加根节点
stack.push(curr);
// 递归添加左节点
curr = curr.left;
}
// 已经访问到最左节点了
curr = stack.peek();
// 是否存在右节点或者右节点已经访问过的情况下,访问根节点
if (curr.right == null || curr.right == prev) {
stack.pop();
list.add(curr.data);
prev = curr;
// 不重复访问自己
curr = null;
} else {
// 右节点还没有访问过就先访问右节点
curr = curr.right;
}
}
}
/**
* 层序遍历
*
* @param root
* @return
*/
public static void layerIterable2(BinTreeNode<String> root, List<String> list) {
LinkedList<BinTreeNode<String>> queue = new LinkedList<>();
if (root == null) {
return;
}
queue.addLast(root);
while (!queue.isEmpty()) {
BinTreeNode<String> p = queue.poll();
list.add(p.data);
if (p.left != null) {
queue.addLast(p.left);
}
|
if (p.right != null) {
queue.addLast(p.right);
}
}
}
static class BinTreeNode<T> {
/**
* 数据
*/
T data;
/**
* 左节点
*/
BinTreeNode<T> left;
/**
* 右节点
*/
BinTreeNode<T> right;
public BinTreeNode(T data, BinTreeNode left, BinTreeNode right) {
this.data = data;
this.left = left;
this.right = right;
}
@Override
public String toString() {
return data.toString();
}
}
}
|
repos\spring-boot-student-master\spring-boot-student-concurrent\src\main\java\com\xiaolyuh\BinTreeIterable.java
| 1
|
请完成以下Java代码
|
public Object aggregate(final I_M_Attribute ignored, final Object valueOld, final Object valueDelta)
{
final BigDecimal valueOldBD = coerceToBigDecimal(valueOld);
final BigDecimal valueDeltaBD = coerceToBigDecimal(valueDelta);
final BigDecimal valueNewBD = valueOldBD.add(valueDeltaBD);
return valueNewBD;
}
private BigDecimal coerceToBigDecimal(final Object value)
{
final BigDecimal convertedValue;
if (value == null)
{
convertedValue = BigDecimal.ZERO;
|
}
else
{
try
{
convertedValue = new BigDecimal(value.toString());
}
catch (final Exception e)
{
throw new AdempiereException("Could not create BigDecimal from object: " + value, e);
}
}
return convertedValue;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\attribute\strategy\impl\SumAggregationStrategy.java
| 1
|
请完成以下Java代码
|
private I_M_ShipmentSchedule getM_ShipmentScheduleFromVHU(final I_M_HU_Trx_Line trxLine)
{
//
// Get VHU Item from trxLine
// If there is no VHU item on this transaction line, there is nothing to do
final int vhuItemId = trxLine.getVHU_Item_ID();
if (vhuItemId <= 0)
{
return null;
}
//
// Get VHU Item from counterpart trxLine
final I_M_HU_Trx_Line trxLineCounterpart = trxLine.getParent_HU_Trx_Line();
Check.assumeNotNull(trxLineCounterpart, "trxLineCounterpart not null");
final int counterpart_vhuItemId = trxLineCounterpart.getVHU_Item_ID();
if (counterpart_vhuItemId <= 0)
{
return null;
}
//
// Figure out which is the old VHU and which is the new VHU
// NOTE: we do that by comparing the IDs
final I_M_HU_Item vhuItemFrom;
if (vhuItemId == counterpart_vhuItemId)
{
// transferring from VHU to same VHU... that shall not be possible
// wtf?? shall not happen
return null;
}
else if (vhuItemId < counterpart_vhuItemId)
{
vhuItemFrom = trxLine.getVHU_Item();
}
else
// if (vhuItemId > counterpart_vhuItemId)
{
vhuItemFrom = trxLineCounterpart.getVHU_Item();
}
final I_M_HU vhuFrom = vhuItemFrom.getM_HU();
//
// Optimization: if the HU Status is not Picked then it's not about shipment schedules, so we don't care
if (!X_M_HU.HUSTATUS_Picked.equals(vhuFrom.getHUStatus()))
{
return null;
}
//
// Retrieve M_ShipmentSchedule from M_ShipmentSchedule_QtyPicked which is linking to our VHU
// NOTE: we assume that a VHU can be assigned to ONLY one Shipment Schedule
final IHUShipmentScheduleDAO huShipmentScheduleDAO = Services.get(IHUShipmentScheduleDAO.class);
|
return huShipmentScheduleDAO.retrieveSchedsQtyPickedForVHUQuery(vhuFrom)
.andCollect(de.metas.inoutcandidate.model.I_M_ShipmentSchedule_QtyPicked.COLUMN_M_ShipmentSchedule_ID)
.create()
.firstOnly(I_M_ShipmentSchedule.class);
}
/**
* Move all assignments to shipment schedules, from given TU to it's new top level LU
*/
@Override
public void huParentChanged(final I_M_HU hu, final I_M_HU_Item parentHUItemOld)
{
final IHandlingUnitsBL handlingUnitsBL = Services.get(IHandlingUnitsBL.class);
final IHUShipmentScheduleBL huShipmentScheduleBL = Services.get(IHUShipmentScheduleBL.class);
if (isUpdateAllocationLUAndTUForCU() && handlingUnitsBL.isPureVirtual(hu))
{
huShipmentScheduleBL.updateAllocationLUAndTUForCU(hu);
}
else if (handlingUnitsBL.isTransportUnitOrVirtual(hu))
{
huShipmentScheduleBL.updateAllocationLUForTU(hu);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\shipmentschedule\api\impl\ShipmentScheduleHUTrxListener.java
| 1
|
请完成以下Java代码
|
public class SpinVariableSerializers {
public static List<TypedValueSerializer<?>> createObjectValueSerializers(DataFormats dataFormats) {
List<TypedValueSerializer<?>> serializers = new ArrayList<TypedValueSerializer<?>>();
Set<DataFormat<?>> availableDataFormats = dataFormats.getAllAvailableDataFormats();
for (DataFormat<?> dataFormat : availableDataFormats) {
serializers.add(new SpinObjectValueSerializer("spin://"+dataFormat.getName(), dataFormat));
}
return serializers;
}
public static List<TypedValueSerializer<?>> createSpinValueSerializers(DataFormats dataFormats) {
List<TypedValueSerializer<?>> serializers = new ArrayList<TypedValueSerializer<?>>();
|
if(dataFormats.getDataFormatByName(DataFormats.JSON_DATAFORMAT_NAME) != null) {
DataFormat<SpinJsonNode> jsonDataFormat =
(DataFormat<SpinJsonNode>) dataFormats.getDataFormatByName(DataFormats.JSON_DATAFORMAT_NAME);
serializers.add(new JsonValueSerializer(jsonDataFormat));
}
if(dataFormats.getDataFormatByName(DataFormats.XML_DATAFORMAT_NAME) != null){
DataFormat<SpinXmlElement> xmlDataFormat =
(DataFormat<SpinXmlElement>) dataFormats.getDataFormatByName(DataFormats.XML_DATAFORMAT_NAME);
serializers.add(new XmlValueSerializer(xmlDataFormat));
}
return serializers;
}
}
|
repos\camunda-bpm-platform-master\engine-plugins\spin-plugin\src\main\java\org\camunda\spin\plugin\impl\SpinVariableSerializers.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class OrderProperties {
/**
* 订单支付超时时长,单位:秒。
*/
private Integer payTimeoutSeconds;
/**
* 订单创建频率,单位:秒
*/
private Integer createFrequencySeconds;
// /**
// * 配置描述
// */
// private String desc;
public Integer getPayTimeoutSeconds() {
return payTimeoutSeconds;
}
public OrderProperties setPayTimeoutSeconds(Integer payTimeoutSeconds) {
this.payTimeoutSeconds = payTimeoutSeconds;
return this;
}
public Integer getCreateFrequencySeconds() {
return createFrequencySeconds;
}
|
public OrderProperties setCreateFrequencySeconds(Integer createFrequencySeconds) {
this.createFrequencySeconds = createFrequencySeconds;
return this;
}
// public String getDesc() {
// return desc;
// }
//
// public OrderProperties setDesc(String desc) {
// this.desc = desc;
// return this;
// }
}
|
repos\SpringBoot-Labs-master\lab-43\lab-43-demo\src\main\java\cn\iocoder\springboot\lab43\propertydemo\OrderProperties.java
| 2
|
请完成以下Java代码
|
public final class ModelColumnNameValue<T>
{
public static <ModelType> ModelColumnNameValue<ModelType> forColumn(@NonNull final ModelColumn<ModelType, ?> column)
{
return new ModelColumnNameValue<>(column.getColumnName());
}
public static <ModelType> ModelColumnNameValue<ModelType> forColumnName(final String columnName)
{
return new ModelColumnNameValue<>(columnName);
}
/**
* Creates a fully qualified column name
*/
public static <ModelType> ModelColumnNameValue<ModelType> forColumnName(final String tableName, final String columnName)
{
Check.assumeNotEmpty(tableName, "tableName not empty");
Check.assumeNotEmpty(columnName, "columnName not empty");
final String columnNameFQ = tableName + "." + columnName;
return new ModelColumnNameValue<>(columnNameFQ);
}
@Getter
private final String columnName;
|
private ModelColumnNameValue(final String columnName)
{
Check.assumeNotEmpty(columnName, "columnName not empty");
this.columnName = columnName;
}
/**
* <b>Might return <code>null</code>!</b>
*
* @param model
* @return
*/
public Object getValue(@NonNull final T model)
{
final String columnName = getColumnName();
if (InterfaceWrapperHelper.isNull(model, columnName))
{
return null;
}
return InterfaceWrapperHelper.getValue(model, columnName).orElse(null);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\dao\impl\ModelColumnNameValue.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public @Nullable Duration getFixedRate() {
return this.fixedRate;
}
public void setFixedRate(@Nullable Duration fixedRate) {
this.fixedRate = fixedRate;
}
public @Nullable Duration getInitialDelay() {
return this.initialDelay;
}
public void setInitialDelay(@Nullable Duration initialDelay) {
this.initialDelay = initialDelay;
}
public @Nullable String getCron() {
return this.cron;
}
public void setCron(@Nullable String cron) {
this.cron = cron;
}
}
public static class Management {
/**
* Whether Spring Integration components should perform logging in the main
* message flow. When disabled, such logging will be skipped without checking the
* logging level. When enabled, such logging is controlled as normal by the
* logging system's log level configuration.
*/
|
private boolean defaultLoggingEnabled = true;
/**
* List of simple patterns to match against the names of Spring Integration
* components. When matched, observation instrumentation will be performed for the
* component. Please refer to the javadoc of the smartMatch method of Spring
* Integration's PatternMatchUtils for details of the pattern syntax.
*/
private List<String> observationPatterns = new ArrayList<>();
public boolean isDefaultLoggingEnabled() {
return this.defaultLoggingEnabled;
}
public void setDefaultLoggingEnabled(boolean defaultLoggingEnabled) {
this.defaultLoggingEnabled = defaultLoggingEnabled;
}
public List<String> getObservationPatterns() {
return this.observationPatterns;
}
public void setObservationPatterns(List<String> observationPatterns) {
this.observationPatterns = observationPatterns;
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-integration\src\main\java\org\springframework\boot\integration\autoconfigure\IntegrationProperties.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class ApiResponseAuditRepository
{
private final IQueryBL queryBL = Services.get(IQueryBL.class);
@NonNull
public ApiResponseAudit save(@NonNull final ApiResponseAudit apiResponseAudit)
{
final I_API_Response_Audit record = InterfaceWrapperHelper.loadOrNew(apiResponseAudit.getApiResponseAuditId(), I_API_Response_Audit.class);
record.setAD_Org_ID(apiResponseAudit.getOrgId().getRepoId());
record.setAPI_Request_Audit_ID(apiResponseAudit.getApiRequestAuditId().getRepoId());
record.setBody(apiResponseAudit.getBody());
record.setHttpCode(apiResponseAudit.getHttpCode());
record.setTime(TimeUtil.asTimestamp(apiResponseAudit.getTime()));
record.setHttpHeaders(apiResponseAudit.getHttpHeaders());
saveRecord(record);
return recordToResponseAudit(record);
}
@NonNull
public ApiResponseAudit getById(@NonNull final ApiResponseAuditId apiResponseAuditId)
{
final I_API_Response_Audit record = InterfaceWrapperHelper.load(apiResponseAuditId, I_API_Response_Audit.class);
return recordToResponseAudit(record);
}
@NonNull
public List<ApiResponseAudit> getByRequestId(@NonNull final ApiRequestAuditId apiRequestAuditId)
{
return queryBL.createQueryBuilder(I_API_Response_Audit.class)
.addEqualsFilter(I_API_Response_Audit.COLUMNNAME_API_Request_Audit_ID, apiRequestAuditId.getRepoId())
.create()
.stream()
.map(this::recordToResponseAudit)
.collect(ImmutableList.toImmutableList());
}
@NonNull
public Optional<ApiResponseAudit> getLatestByRequestId(@NonNull final ApiRequestAuditId apiRequestAuditId)
{
|
return queryBL.createQueryBuilder(I_API_Response_Audit.class)
.addEqualsFilter(I_API_Response_Audit.COLUMNNAME_API_Request_Audit_ID, apiRequestAuditId.getRepoId())
.orderByDescending(I_API_Response_Audit.COLUMN_API_Response_Audit_ID)
.create()
.firstOptional()
.map(this::recordToResponseAudit);
}
public void delete(@NonNull final ApiResponseAuditId apiResponseAuditId)
{
final I_API_Response_Audit record = InterfaceWrapperHelper.load(apiResponseAuditId, I_API_Response_Audit.class);
InterfaceWrapperHelper.deleteRecord(record);
}
@NonNull
private ApiResponseAudit recordToResponseAudit(@NonNull final I_API_Response_Audit record)
{
return ApiResponseAudit.builder()
.orgId(OrgId.ofRepoId(record.getAD_Org_ID()))
.apiRequestAuditId(ApiRequestAuditId.ofRepoId(record.getAPI_Request_Audit_ID()))
.apiResponseAuditId(ApiResponseAuditId.ofRepoId(record.getAPI_Response_Audit_ID()))
.body(record.getBody())
.httpCode(record.getHttpCode())
.time(TimeUtil.asInstant(record.getTime()))
.httpHeaders(record.getHttpHeaders())
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\audit\apirequest\response\ApiResponseAuditRepository.java
| 2
|
请完成以下Java代码
|
public void collectAllowNew(final DocumentPath rootDocumentPath, final DetailId detailId, final LogicExpressionResult allowNew)
{
rootDocumentChanges(rootDocumentPath)
.includedDetailInfo(detailId)
.setAllowNew(allowNew);
}
@Override
public void collectAllowDelete(final DocumentPath rootDocumentPath, final DetailId detailId, final LogicExpressionResult allowDelete)
{
rootDocumentChanges(rootDocumentPath)
.includedDetailInfo(detailId)
.setAllowDelete(allowDelete);
}
private boolean isStaleDocumentChanges(final DocumentChanges documentChanges)
{
final DocumentPath documentPath = documentChanges.getDocumentPath();
if (!documentPath.isSingleIncludedDocument())
{
return false;
}
|
final DocumentPath rootDocumentPath = documentPath.getRootDocumentPath();
final DetailId detailId = documentPath.getDetailId();
return documentChangesIfExists(rootDocumentPath)
.flatMap(rootDocumentChanges -> rootDocumentChanges.includedDetailInfoIfExists(detailId))
.map(IncludedDetailInfo::isStale)
.orElse(false);
}
@Override
public void collectEvent(final IDocumentFieldChangedEvent event)
{
documentChanges(event.getDocumentPath())
.collectEvent(event);
}
@Override
public void collectFieldWarning(final IDocumentFieldView documentField, final DocumentFieldWarning fieldWarning)
{
documentChanges(documentField)
.collectFieldWarning(documentField, fieldWarning);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\model\DocumentChangesCollector.java
| 1
|
请完成以下Java代码
|
public boolean isMoveToSubProcessInstance() {
return moveToSubProcessInstance;
}
public void setMoveToSubProcessInstance(boolean moveToSubProcessInstance) {
this.moveToSubProcessInstance = moveToSubProcessInstance;
}
public String getCallActivityId() {
return callActivityId;
}
public void setCallActivityId(String callActivityId) {
this.callActivityId = callActivityId;
}
|
public Integer getCallActivitySubProcessVersion() {
return callActivitySubProcessVersion;
}
public void setCallActivitySubProcessVersion(Integer callActivitySubProcessVersion) {
this.callActivitySubProcessVersion = callActivitySubProcessVersion;
}
public Optional<String> getNewAssigneeId() {
return Optional.ofNullable(newAssigneeId);
}
public Optional<String> getNewOwnerId() {
return Optional.ofNullable(newOwnerId);
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\runtime\MoveActivityIdContainer.java
| 1
|
请完成以下Java代码
|
public final class MethodNameCalloutInstance implements ICalloutInstance
{
public static Supplier<ICalloutInstance> supplier(final String methodNameFQ)
{
Check.assumeNotEmpty(methodNameFQ, "methodNameFQ not empty");
final String classname;
final String methodName;
final int methodStartIdx = methodNameFQ.lastIndexOf('.');
if (methodStartIdx != -1) // no class
{
classname = methodNameFQ.substring(0, methodStartIdx);
methodName = methodNameFQ.substring(methodStartIdx + 1);
}
else
{
throw new CalloutInitException("Invalid callout: " + methodNameFQ);
}
if (Check.isEmpty(classname, true))
{
throw new CalloutInitException("Invalid classname for " + methodNameFQ);
}
if (Check.isEmpty(methodName, true))
{
throw new CalloutInitException("Invalid methodName for " + methodNameFQ);
}
final String id = MethodNameCalloutInstance.class.getSimpleName() + "-" + methodNameFQ.trim();
return () -> {
try
{
final org.compiere.model.Callout legacyCallout = Util.getInstance(org.compiere.model.Callout.class, classname);
return new MethodNameCalloutInstance(id, legacyCallout, methodName);
}
catch (final Exception e)
{
throw new CalloutInitException("Cannot load callout class for " + methodNameFQ, e);
}
};
}
private final String id;
private final org.compiere.model.Callout legacyCallout;
private final String methodName;
private MethodNameCalloutInstance(final String id, final org.compiere.model.Callout legacyCallout, final String methodName)
{
super();
this.id = id;
Check.assumeNotNull(legacyCallout, "Parameter legacyCallout is not null");
this.legacyCallout = legacyCallout;
Check.assumeNotNull(methodName, "Parameter methodName is not null");
this.methodName = methodName;
}
@Override
public String getId()
{
return id;
}
@Override
public String toString()
{
return MoreObjects.toStringHelper(this)
.add("id", id)
.toString();
}
@Override
public int hashCode()
{
return Objects.hash(id);
}
|
@Override
public boolean equals(final Object obj)
{
if (this == obj)
{
return true;
}
final MethodNameCalloutInstance other = EqualsBuilder.getOther(this, obj);
if (other == null)
{
return false;
}
return id.equals(other.id);
}
@Override
public void execute(final ICalloutExecutor executor, final ICalloutField field)
{
try
{
legacyCallout.start(methodName, field);
}
catch (final CalloutException e)
{
throw e.setCalloutExecutor(executor)
.setCalloutInstance(this)
.setField(field);
}
catch (final Exception e)
{
throw CalloutExecutionException.wrapIfNeeded(e)
.setCalloutExecutor(executor)
.setCalloutInstance(this)
.setField(field);
}
}
@VisibleForTesting
public org.compiere.model.Callout getLegacyCallout()
{
return legacyCallout;
}
public String getMethodName()
{
return methodName;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\callout\api\impl\MethodNameCalloutInstance.java
| 1
|
请完成以下Java代码
|
public static void writeFileInRandomUsingFileChannel() {
ByteBuffer buffer1 = ByteBuffer.wrap(data1);
ByteBuffer buffer2 = ByteBuffer.wrap(data2);
try (FileChannel fileChannel = FileChannel.open(Path.of("output.txt"), StandardOpenOption.WRITE, StandardOpenOption.CREATE)) {
fileChannel.write(buffer1);
fileChannel.position(10);
fileChannel.write(buffer2);
} catch (IOException e) {
e.printStackTrace();
}
}
private static void writeToFile(String fileName, byte[] data) {
synchronized (lock) {
try (FileOutputStream outputStream = new FileOutputStream(fileName, true)) {
outputStream.write(data);
log.info("Data written by " + Thread.currentThread()
.getName());
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static void writeFileWithMultThreadUsingFileOutputStream() {
Thread thread1 = new Thread(() -> writeToFile(outputFile, data1));
Thread thread2 = new Thread(() -> writeToFile(outputFile, data2));
thread1.start();
thread2.start();
}
private static void writeToFileWithLock(String fileName, ByteBuffer buffer, int position) {
try (FileChannel fileChannel = FileChannel.open(Path.of(fileName), StandardOpenOption.WRITE, StandardOpenOption.CREATE)) {
try (FileLock lock = fileChannel.lock(position, buffer.remaining(), false)) {
fileChannel.position(position);
fileChannel.write(buffer);
log.info("Data written by " + Thread.currentThread()
.getName() + " at position " + position);
} catch (IOException e) {
e.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static void writeFileWithMultiThreadUsingFileChannel() {
ByteBuffer buffer1 = ByteBuffer.wrap(data1);
|
ByteBuffer buffer2 = ByteBuffer.wrap(data2);
Thread thread1 = new Thread(() -> writeToFileWithLock(outputFile, buffer1, 0));
Thread thread2 = new Thread(() -> writeToFileWithLock(outputFile, buffer2, 20));
thread1.start();
thread2.start();
}
public static void performanceComparisonUsingJMH() throws RunnerException {
Options opt = new OptionsBuilder()
.include(FileIOBenchmark.class.getSimpleName())
.forks(1)
.build();
new Runner(opt).run();
}
public static void main(String [] args) throws RunnerException {
performanceComparisonUsingJMH();
}
}
|
repos\tutorials-master\core-java-modules\core-java-io-6\src\main\java\com\baeldung\fileoutputstreamvsfilechannel\FileOutputStreamVSFileChannel.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
class OnEnabledResourceChainCondition extends SpringBootCondition {
private static final String WEBJAR_ASSET_LOCATOR = "org.webjars.WebJarAssetLocator";
private static final String WEBJAR_VERSION_LOCATOR = "org.webjars.WebJarVersionLocator";
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
ConfigurableEnvironment environment = (ConfigurableEnvironment) context.getEnvironment();
boolean fixed = getEnabledProperty(environment, "strategy.fixed.", false);
boolean content = getEnabledProperty(environment, "strategy.content.", false);
Boolean chain = getEnabledProperty(environment, "", null);
Boolean match = Chain.getEnabled(fixed, content, chain);
ConditionMessage.Builder message = ConditionMessage.forCondition(ConditionalOnEnabledResourceChain.class);
if (match == null) {
if (ClassUtils.isPresent(WEBJAR_VERSION_LOCATOR, getClass().getClassLoader())) {
return ConditionOutcome.match(message.found("class").items(WEBJAR_VERSION_LOCATOR));
}
if (ClassUtils.isPresent(WEBJAR_ASSET_LOCATOR, getClass().getClassLoader())) {
return ConditionOutcome.match(message.found("class").items(WEBJAR_ASSET_LOCATOR));
}
|
return ConditionOutcome.noMatch(message.didNotFind("class").items(WEBJAR_VERSION_LOCATOR));
}
if (match) {
return ConditionOutcome.match(message.because("enabled"));
}
return ConditionOutcome.noMatch(message.because("disabled"));
}
@Contract("_, _, !null -> !null")
private @Nullable Boolean getEnabledProperty(ConfigurableEnvironment environment, String key,
@Nullable Boolean defaultValue) {
String name = "spring.web.resources.chain." + key + "enabled";
if (defaultValue == null) {
return environment.getProperty(name, Boolean.class);
}
return environment.getProperty(name, Boolean.class, defaultValue);
}
}
|
repos\spring-boot-4.0.1\core\spring-boot-autoconfigure\src\main\java\org\springframework\boot\autoconfigure\web\OnEnabledResourceChainCondition.java
| 2
|
请完成以下Java代码
|
public synchronized ProcessInstanceResult getExecutionResult()
{
return lastExecutionResult;
}
@Override
public Collection<IProcessInstanceParameter> getParameters()
{
return parameters.getFieldViews()
.stream()
.map(DocumentFieldAsProcessInstanceParameter::of)
.collect(ImmutableList.toImmutableList());
}
@Override
public LookupValuesList getParameterLookupValues(final String parameterName)
{
return parameters.getFieldLookupValues(parameterName);
}
@Override
public LookupValuesPage getParameterLookupValuesForQuery(final String parameterName, final String query)
{
return parameters.getFieldLookupValuesForQuery(parameterName, query);
}
@Override
public void processParameterValueChanges(final List<JSONDocumentChangedEvent> events, final ReasonSupplier reason)
{
parameters.processValueChanges(events, reason);
}
public void setCopies(final int copies)
{
parameters.processValueChange(PARAM_Copies, copies, ReasonSupplier.NONE, DocumentFieldLogicExpressionResultRevaluator.ALWAYS_RETURN_FALSE);
}
public PrintCopies getCopies()
{
return PrintCopies.ofInt(parameters.getFieldView(PARAM_Copies).getValueAsInt(0));
}
public AdProcessId getJasperProcess_ID()
|
{
final IDocumentFieldView field = parameters.getFieldViewOrNull(PARAM_AD_Process_ID);
if (field != null)
{
final int processId = field.getValueAsInt(0);
if (processId > 0)
{
return AdProcessId.ofRepoId(processId);
}
}
return null;
}
public boolean isPrintPreview()
{
final IDocumentFieldView field = parameters.getFieldViewOrNull(PARAM_IsPrintPreview);
if (field != null)
{
return field.getValueAsBoolean();
}
return true;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\report\HUReportProcessInstance.java
| 1
|
请完成以下Java代码
|
public boolean isLatest() {
return latest;
}
public String getCategory() {
return category;
}
public String getCategoryLike() {
return categoryLike;
}
public String getResourceName() {
return resourceName;
}
public String getResourceNameLike() {
return resourceNameLike;
}
public SuspensionState getSuspensionState() {
return suspensionState;
}
public void setSuspensionState(SuspensionState suspensionState) {
this.suspensionState = suspensionState;
}
public String getIncidentId() {
return incidentId;
}
public String getIncidentType() {
return incidentType;
}
public String getIncidentMessage() {
return incidentMessage;
}
public String getIncidentMessageLike() {
return incidentMessageLike;
}
public String getVersionTag() {
return versionTag;
}
public boolean isStartableInTasklist() {
return isStartableInTasklist;
}
|
public boolean isNotStartableInTasklist() {
return isNotStartableInTasklist;
}
public boolean isStartablePermissionCheck() {
return startablePermissionCheck;
}
public void setProcessDefinitionCreatePermissionChecks(List<PermissionCheck> processDefinitionCreatePermissionChecks) {
this.processDefinitionCreatePermissionChecks = processDefinitionCreatePermissionChecks;
}
public List<PermissionCheck> getProcessDefinitionCreatePermissionChecks() {
return processDefinitionCreatePermissionChecks;
}
public boolean isShouldJoinDeploymentTable() {
return shouldJoinDeploymentTable;
}
public void addProcessDefinitionCreatePermissionCheck(CompositePermissionCheck processDefinitionCreatePermissionCheck) {
processDefinitionCreatePermissionChecks.addAll(processDefinitionCreatePermissionCheck.getAllPermissionChecks());
}
public List<String> getCandidateGroups() {
if (cachedCandidateGroups != null) {
return cachedCandidateGroups;
}
if(authorizationUserId != null) {
List<Group> groups = Context.getCommandContext()
.getReadOnlyIdentityProvider()
.createGroupQuery()
.groupMember(authorizationUserId)
.list();
cachedCandidateGroups = groups.stream().map(Group::getId).collect(Collectors.toList());
}
return cachedCandidateGroups;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\ProcessDefinitionQueryImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public ExternalWorkerJobAcquireBuilder onlyBpmn() {
if (ScopeTypes.CMMN.equals(scopeType)) {
throw new FlowableIllegalArgumentException("Cannot combine onlyCmmn() with onlyBpmn() in the same query");
}
if (scopeType != null) {
throw new FlowableIllegalArgumentException("Cannot combine scopeType(String) with onlyBpmn() in the same query");
}
return scopeType(ScopeTypes.BPMN);
}
@Override
public ExternalWorkerJobAcquireBuilder onlyCmmn() {
if (ScopeTypes.BPMN.equals(scopeType)) {
throw new FlowableIllegalArgumentException("Cannot combine onlyBpmn() with onlyCmmn() in the same query");
}
if (scopeType != null) {
throw new FlowableIllegalArgumentException("Cannot combine scopeType(String) with onlyCmmn() in the same query");
}
return scopeType(ScopeTypes.CMMN);
}
@Override
public ExternalWorkerJobAcquireBuilder scopeType(String scopeType) {
this.scopeType = scopeType;
return this;
}
@Override
public ExternalWorkerJobAcquireBuilder tenantId(String tenantId) {
this.tenantId = tenantId;
return this;
}
@Override
public ExternalWorkerJobAcquireBuilder forUserOrGroups(String userId, Collection<String> groups) {
if (userId == null && (groups == null || groups.isEmpty())) {
throw new FlowableIllegalArgumentException("at least one of userId or groups must be provided");
}
this.authorizedUser = userId;
this.authorizedGroups = groups;
return this;
}
@Override
public List<AcquiredExternalWorkerJob> acquireAndLock(int numberOfTasks, String workerId, int numberOfRetries) {
while (numberOfRetries > 0) {
|
try {
return commandExecutor.execute(new AcquireExternalWorkerJobsCmd(workerId, numberOfTasks, this, jobServiceConfiguration));
} catch (FlowableOptimisticLockingException ignored) {
// Query for jobs until there is no FlowableOptimisticLockingException
// It is potentially possible multiple workers to query in the exact same time
numberOfRetries--;
}
}
return Collections.emptyList();
}
public String getTopic() {
return topic;
}
public Duration getLockDuration() {
return lockDuration;
}
public String getScopeType() {
return scopeType;
}
public String getTenantId() {
return tenantId;
}
public String getAuthorizedUser() {
return authorizedUser;
}
public Collection<String> getAuthorizedGroups() {
return authorizedGroups;
}
}
|
repos\flowable-engine-main\modules\flowable-job-service\src\main\java\org\flowable\job\service\impl\ExternalWorkerJobAcquireBuilderImpl.java
| 2
|
请完成以下Java代码
|
public int getC_OLCandAggAndOrder_ID()
{
return get_ValueAsInt(COLUMNNAME_C_OLCandAggAndOrder_ID);
}
@Override
public de.metas.ordercandidate.model.I_C_OLCandProcessor getC_OLCandProcessor()
{
return get_ValueAsPO(COLUMNNAME_C_OLCandProcessor_ID, de.metas.ordercandidate.model.I_C_OLCandProcessor.class);
}
@Override
public void setC_OLCandProcessor(final de.metas.ordercandidate.model.I_C_OLCandProcessor C_OLCandProcessor)
{
set_ValueFromPO(COLUMNNAME_C_OLCandProcessor_ID, de.metas.ordercandidate.model.I_C_OLCandProcessor.class, C_OLCandProcessor);
}
@Override
public void setC_OLCandProcessor_ID (final int C_OLCandProcessor_ID)
{
if (C_OLCandProcessor_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_OLCandProcessor_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_OLCandProcessor_ID, C_OLCandProcessor_ID);
}
@Override
public int getC_OLCandProcessor_ID()
{
return get_ValueAsInt(COLUMNNAME_C_OLCandProcessor_ID);
}
@Override
public void setDescription (final @Nullable java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
@Override
public java.lang.String getDescription()
{
return get_ValueAsString(COLUMNNAME_Description);
}
/**
* Granularity AD_Reference_ID=540141
* Reference name: Granularity OLCandAggAndOrder
*/
public static final int GRANULARITY_AD_Reference_ID=540141;
/** Tag = D */
public static final String GRANULARITY_Tag = "D";
/** Woche = W */
public static final String GRANULARITY_Woche = "W";
/** Monat = M */
public static final String GRANULARITY_Monat = "M";
@Override
public void setGranularity (final @Nullable java.lang.String Granularity)
{
set_Value (COLUMNNAME_Granularity, Granularity);
|
}
@Override
public java.lang.String getGranularity()
{
return get_ValueAsString(COLUMNNAME_Granularity);
}
@Override
public void setGroupBy (final boolean GroupBy)
{
set_Value (COLUMNNAME_GroupBy, GroupBy);
}
@Override
public boolean isGroupBy()
{
return get_ValueAsBoolean(COLUMNNAME_GroupBy);
}
@Override
public void setOrderBySeqNo (final int OrderBySeqNo)
{
set_Value (COLUMNNAME_OrderBySeqNo, OrderBySeqNo);
}
@Override
public int getOrderBySeqNo()
{
return get_ValueAsInt(COLUMNNAME_OrderBySeqNo);
}
@Override
public void setSplitOrder (final boolean SplitOrder)
{
set_Value (COLUMNNAME_SplitOrder, SplitOrder);
}
@Override
public boolean isSplitOrder()
{
return get_ValueAsBoolean(COLUMNNAME_SplitOrder);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.salescandidate.base\src\main\java-gen\de\metas\ordercandidate\model\X_C_OLCandAggAndOrder.java
| 1
|
请完成以下Java代码
|
public final class RabbitConstants {
/**
* 死性队列EXCHANGE名称
*/
public static final String MQ_EXCHANGE_DEAD_QUEUE = "test-dead-queue-exchange";
/**
* 死性队列名称
*/
public static final String QUEUE_NAME_DEAD_QUEUE = "test-dead-queue";
/**
* 死性队列路由名称
*/
public static final String MQ_ROUTING_KEY_DEAD_QUEUE = "test-routing-key-dead-queue";
|
/**
* 发放奖励EXCHANGE名称
*/
public static final String MQ_EXCHANGE_SEND_AWARD = "test-send-award-exchange";
/**
* 发放优惠券队列名称
*/
public static final String QUEUE_NAME_SEND_COUPON = "test-send-coupon-queue";
/**
* 发放优惠券路由key
*/
public static final String MQ_ROUTING_KEY_SEND_COUPON = "test-routing-key-send-coupon";
}
|
repos\spring-boot-student-master\spring-boot-student-rabbitmq\src\main\java\com\xiaolyuh\constants\RabbitConstants.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class ConditionsId implements RepoIdAware
{
int repoId;
@JsonCreator
public static ConditionsId ofRepoId(final int repoId)
{
return new ConditionsId(repoId);
}
@Nullable
public static ConditionsId ofRepoIdOrNull(final int repoId)
{
return repoId > 0 ? ofRepoId(repoId) : null;
}
public static Optional<ConditionsId> optionalOfRepoId(final int repoId)
{
return Optional.ofNullable(ofRepoIdOrNull(repoId));
}
private ConditionsId(final int repoId)
{
this.repoId = Check.assumeGreaterThanZero(repoId, "C_Flatrate_Conditions_ID");
|
}
@Override
@JsonValue
public int getRepoId()
{
return repoId;
}
public static boolean equals(@Nullable final ConditionsId id1, @Nullable final ConditionsId id2)
{
return Objects.equals(id1, id2);
}
public static int toRepoId(@Nullable final ConditionsId id) { return id != null ? id.getRepoId() : -1; }
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\contracts\ConditionsId.java
| 2
|
请完成以下Java代码
|
protected class QueryProcessInstancesCmd implements Command<List<ProcessInstanceDto>> {
protected ProcessInstanceQueryDto queryParameter;
protected Integer firstResult;
protected Integer maxResults;
public QueryProcessInstancesCmd(ProcessInstanceQueryDto queryParameter, Integer firstResult, Integer maxResults) {
this.queryParameter = queryParameter;
this.firstResult = firstResult;
this.maxResults = maxResults;
}
@Override
public List<ProcessInstanceDto> execute(CommandContext commandContext) {
injectObjectMapper(queryParameter);
injectEngineConfig(queryParameter);
paginate(queryParameter, firstResult, maxResults);
configureExecutionQuery(queryParameter);
return getQueryService().executeQuery("selectRunningProcessInstancesIncludingIncidents", queryParameter);
}
}
protected class QueryProcessInstancesCountCmd implements Command<CountResultDto> {
|
protected ProcessInstanceQueryDto queryParameter;
public QueryProcessInstancesCountCmd(ProcessInstanceQueryDto queryParameter) {
this.queryParameter = queryParameter;
}
@Override
public CountResultDto execute(CommandContext commandContext) {
injectEngineConfig(queryParameter);
configureExecutionQuery(queryParameter);
long result = getQueryService().executeQueryRowCount("selectRunningProcessInstancesCount", queryParameter);
return new CountResultDto(result);
}
}
}
|
repos\camunda-bpm-platform-master\webapps\assembly\src\main\java\org\camunda\bpm\cockpit\impl\plugin\resources\ProcessInstanceRestService.java
| 1
|
请完成以下Java代码
|
public class ActivitiProcessStartedEventImpl
extends ActivitiEntityWithVariablesEventImpl
implements ActivitiProcessStartedEvent {
protected final String nestedProcessInstanceId;
protected final String nestedProcessDefinitionId;
protected final String linkedProcessInstanceId;
protected final String linkedProcessInstanceType;
public ActivitiProcessStartedEventImpl(final Object entity, final Map variables, final boolean localScope) {
this(entity, variables, localScope, null, null);
}
/**
* Constructor with link attributes
*/
public ActivitiProcessStartedEventImpl(
final Object entity,
final Map variables,
final boolean localScope,
final String linkedProcessInstanceId,
final String linkedProcessInstanceType
) {
super(entity, variables, localScope, ActivitiEventType.PROCESS_STARTED);
if (entity instanceof ExecutionEntity) {
ExecutionEntity executionEntity = (ExecutionEntity) entity;
if (!executionEntity.isProcessInstanceType()) {
executionEntity = executionEntity.getParent();
}
final ExecutionEntity superExecution = executionEntity.getSuperExecution();
if (superExecution != null) {
this.nestedProcessDefinitionId = superExecution.getProcessDefinitionId();
this.nestedProcessInstanceId = superExecution.getProcessInstanceId();
} else {
this.nestedProcessDefinitionId = null;
|
this.nestedProcessInstanceId = null;
}
} else {
this.nestedProcessDefinitionId = null;
this.nestedProcessInstanceId = null;
}
this.linkedProcessInstanceId = linkedProcessInstanceId;
this.linkedProcessInstanceType = linkedProcessInstanceType;
}
@Override
public String getNestedProcessInstanceId() {
return this.nestedProcessInstanceId;
}
@Override
public String getNestedProcessDefinitionId() {
return this.nestedProcessDefinitionId;
}
@Override
public String getLinkedProcessInstanceId() {
return this.linkedProcessInstanceId;
}
@Override
public String getLinkedProcessInstanceType() {
return this.linkedProcessInstanceType;
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\delegate\event\impl\ActivitiProcessStartedEventImpl.java
| 1
|
请完成以下Java代码
|
public void setM_Picking_Job_ID (final int M_Picking_Job_ID)
{
if (M_Picking_Job_ID < 1)
set_Value (COLUMNNAME_M_Picking_Job_ID, null);
else
set_Value (COLUMNNAME_M_Picking_Job_ID, M_Picking_Job_ID);
}
@Override
public int getM_Picking_Job_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Picking_Job_ID);
}
@Override
public void setM_PickingSlot_ID (final int M_PickingSlot_ID)
{
if (M_PickingSlot_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_PickingSlot_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_PickingSlot_ID, M_PickingSlot_ID);
}
@Override
public int getM_PickingSlot_ID()
{
return get_ValueAsInt(COLUMNNAME_M_PickingSlot_ID);
}
@Override
public void setM_Warehouse_ID (final int M_Warehouse_ID)
{
if (M_Warehouse_ID < 1)
set_Value (COLUMNNAME_M_Warehouse_ID, null);
else
set_Value (COLUMNNAME_M_Warehouse_ID, M_Warehouse_ID);
|
}
@Override
public int getM_Warehouse_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Warehouse_ID);
}
@Override
public void setPickingSlot (final java.lang.String PickingSlot)
{
set_Value (COLUMNNAME_PickingSlot, PickingSlot);
}
@Override
public java.lang.String getPickingSlot()
{
return get_ValueAsString(COLUMNNAME_PickingSlot);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\de\metas\picking\model\X_M_PickingSlot.java
| 1
|
请完成以下Java代码
|
public String getType() {
return type;
}
public HistoricBatchQuery orderById() {
return orderBy(HistoricBatchQueryProperty.ID);
}
public HistoricBatchQuery orderByStartTime() {
return orderBy(HistoricBatchQueryProperty.START_TIME);
}
public HistoricBatchQuery orderByEndTime() {
return orderBy(HistoricBatchQueryProperty.END_TIME);
}
@Override
public HistoricBatchQuery orderByTenantId() {
return orderBy(HistoricBatchQueryProperty.TENANT_ID);
|
}
@Override
public long executeCount(CommandContext commandContext) {
checkQueryOk();
return commandContext
.getHistoricBatchManager()
.findBatchCountByQueryCriteria(this);
}
@Override
public List<HistoricBatch> executeList(CommandContext commandContext, Page page) {
checkQueryOk();
return commandContext
.getHistoricBatchManager()
.findBatchesByQueryCriteria(this, page);
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\batch\history\HistoricBatchQueryImpl.java
| 1
|
请完成以下Java代码
|
private IVendorInvoicingInfo getVendorInvoicingInfo()
{
Check.assumeNotNull(_vendorInvoicingInfo, "_vendorInvoicingInfo not null");
return _vendorInvoicingInfo;
}
/**
* Creates {@link IPricingContext} for parameters set.
*
* Following informations will be set:
* <ul>
* <li>bill bpartner
* <li>pricing system and price list
* <li>currency
* <li>IsSOTrx to <code>false</code>
* <li>Price Date - as quality order's production date
* <li>will NOT be set: product, qty, uom
* </ul>
*
* @return pricing context; never return null.
*/
public final IPricingContext create()
{
//
// Create Pricing Context
final IEditablePricingContext pricingCtx = pricingBL.createInitialContext(
-1, // AD_Org_ID - will be set later
-1, // M_Product_ID - will be set later
-1, // billBPartnerId - will be set later
-1, // C_UOM_ID - will be set later
BigDecimal.ZERO, // Qty - will be set later
false // IsSOTrx=false => we are on purchasing side
);
//
// Update pricing context
updatePricingContextFromVendorInvoicingInfo(pricingCtx);
return pricingCtx;
}
|
/**
* Updates the pricing context from original invoice candidate. Following informations will be set:
* <ul>
* <li>bill bpartner
* <li>pricing system and price list
* <li>currency
* <li>IsSOTrx to <code>false</code>
* <li>will NOT be set: product
* </ul>
*
* @param pricingCtx
*/
private void updatePricingContextFromVendorInvoicingInfo(final IEditablePricingContext pricingCtx)
{
final IVendorInvoicingInfo vendorInvoicingInfo = getVendorInvoicingInfo();
//
// Extract infos from original invoice candidate
final BPartnerId billBPartnerId = vendorInvoicingInfo.getBill_BPartner_ID();
final PricingSystemId pricingSytemId = vendorInvoicingInfo.getPricingSystemId();
final CurrencyId currencyId = CurrencyId.ofRepoId(vendorInvoicingInfo.getC_Currency_ID());
final I_M_PriceList_Version priceListVersion = vendorInvoicingInfo.getM_PriceList_Version();
//
// Update pricing context
pricingCtx.setSOTrx(SOTrx.PURCHASE); // we are always on purchase side
pricingCtx.setBPartnerId(billBPartnerId);
pricingCtx.setCurrencyId(currencyId);
pricingCtx.setPricingSystemId(pricingSytemId);
pricingCtx.setPriceListVersionId(PriceListVersionId.ofRepoId(priceListVersion.getM_PriceList_Version_ID()));
pricingCtx.setPriceDate(TimeUtil.asLocalDate(priceListVersion.getValidFrom())); // just to drive home this point
pricingCtx.setCountryId(vendorInvoicingInfo.getCountryId());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java\de\metas\materialtracking\qualityBasedInvoicing\impl\PricingContextBuilder.java
| 1
|
请完成以下Java代码
|
public class BigIntegerRestVariableConverter implements RestVariableConverter {
@Override
public String getRestTypeName() {
return "bigInteger";
}
@Override
public Class<?> getVariableType() {
return BigInteger.class;
}
@Override
public Object getVariableValue(EngineRestVariable result) {
if (result.getValue() != null) {
return new BigInteger(result.getValue().toString());
}
return null;
|
}
@Override
public void convertVariableValue(Object variableValue, EngineRestVariable result) {
if (variableValue != null) {
if (!(variableValue instanceof BigInteger)) {
throw new FlowableIllegalArgumentException("Converter can only convert big integer values");
}
result.setValue(variableValue.toString());
} else {
result.setValue(null);
}
}
}
|
repos\flowable-engine-main\modules\flowable-common-rest\src\main\java\org\flowable\common\rest\variable\BigIntegerRestVariableConverter.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class EmailAddress implements ContactAddress
{
@NonNull String value;
@NonNull DeactivatedOnRemotePlatform deactivatedOnRemotePlatform;
public static Optional<EmailAddress> cast(@Nullable final ContactAddress contactAddress)
{
return contactAddress instanceof EmailAddress
? Optional.of((EmailAddress)contactAddress)
: Optional.empty();
}
public static String getEmailAddressStringOrNull(@Nullable final ContactAddress contactAddress)
{
return cast(contactAddress).map(EmailAddress::getValue).orElse(null);
}
public static DeactivatedOnRemotePlatform getDeactivatedOnRemotePlatform(@Nullable final ContactAddress contactAddress)
{
final EmailAddress emailAddress = cast(contactAddress).orElse(null);
return emailAddress != null ? emailAddress.getDeactivatedOnRemotePlatform() : DeactivatedOnRemotePlatform.UNKNOWN;
}
public static EmailAddress ofString(@NonNull final String emailAddress)
{
return new EmailAddress(emailAddress, DeactivatedOnRemotePlatform.UNKNOWN);
}
public static EmailAddress ofStringOrNull(@Nullable final String emailAddress)
{
return emailAddress != null && !Check.isBlank(emailAddress)
|
? ofString(emailAddress)
: null;
}
public static EmailAddress of(
@NonNull final String emailAddress,
@NonNull final DeactivatedOnRemotePlatform deactivatedOnRemotePlatform)
{
return new EmailAddress(emailAddress, deactivatedOnRemotePlatform);
}
private EmailAddress(
@NonNull final String value,
@NonNull final DeactivatedOnRemotePlatform deactivatedOnRemotePlatform)
{
final String valueNorm = StringUtils.trimBlankToNull(value);
if (valueNorm == null)
{
throw new AdempiereException("blank email address is not allowed");
}
this.value = valueNorm;
this.deactivatedOnRemotePlatform = deactivatedOnRemotePlatform;
}
@Override
public TYPE getType()
{
return TYPE.EMAIL;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.marketing\base\src\main\java\de\metas\marketing\base\model\EmailAddress.java
| 2
|
请完成以下Java代码
|
private List<RelatedProcessDescriptor> createAdditionalRelatedProcessDescriptors()
{
return ImmutableList.of(
createProcessDescriptorForIssueReceiptWindow(de.metas.ui.web.pporder.process.WEBUI_PP_Order_Receipt.class),
createProcessDescriptorForIssueReceiptWindow(de.metas.ui.web.handlingunits.process.WEBUI_M_HU_Pick.class),
createProcessDescriptorForIssueReceiptWindow(de.metas.ui.web.pporder.process.WEBUI_PP_Order_IssueServiceProduct.class),
createProcessDescriptorForIssueReceiptWindow(de.metas.ui.web.pporder.process.WEBUI_PP_Order_ReverseCandidate.class),
createProcessDescriptorForIssueReceiptWindow(de.metas.ui.web.pporder.process.WEBUI_PP_Order_ChangePlanningStatus_Planning.class),
createProcessDescriptorForIssueReceiptWindow(de.metas.ui.web.pporder.process.WEBUI_PP_Order_ChangePlanningStatus_Review.class),
createProcessDescriptorForIssueReceiptWindow(de.metas.ui.web.pporder.process.WEBUI_PP_Order_ChangePlanningStatus_Complete.class),
createProcessDescriptorForIssueReceiptWindow(de.metas.ui.web.pporder.process.WEBUI_PP_Order_HUEditor_Launcher.class),
createProcessDescriptorForIssueReceiptWindow(de.metas.ui.web.pporder.process.WEBUI_PP_Order_M_Source_HU_Delete.class),
createProcessDescriptorForIssueReceiptWindow(de.metas.ui.web.pporder.process.WEBUI_PP_Order_M_Source_HU_IssueTuQty.class),
createProcessDescriptorForIssueReceiptWindow(de.metas.ui.web.pporder.process.WEBUI_PP_Order_M_Source_HU_IssueCUQty.class),
createProcessDescriptorForIssueReceiptWindow(de.metas.ui.web.pporder.process.WEBUI_PP_Order_PrintLabel.class),
createProcessDescriptorForIssueReceiptWindow(de.metas.ui.web.pporder.process.WEBUI_PP_Order_Pick_ReceivedHUs.class));
|
}
private RelatedProcessDescriptor createProcessDescriptorForIssueReceiptWindow(@NonNull final Class<?> processClass)
{
final AdProcessId processId = adProcessDAO.retrieveProcessIdByClass(processClass);
return RelatedProcessDescriptor.builder()
.processId(processId)
.windowId(PPOrderConstants.AD_WINDOW_ID_IssueReceipt.toAdWindowIdOrNull())
.anyTable()
.displayPlace(DisplayPlace.ViewQuickActions)
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\pporder\PPOrderLinesViewFactory.java
| 1
|
请完成以下Java代码
|
final class QueueProcessorStatistics implements IMutableQueueProcessorStatistics
{
private long countAll;
private long countProcessed;
private long countErrors;
private long countSkipped;
private long queueSize;
public QueueProcessorStatistics()
{
countAll = 0;
countProcessed = 0;
countErrors = 0;
countSkipped = 0;
queueSize = 0;
}
private QueueProcessorStatistics(final QueueProcessorStatistics from)
{
countAll = from.countAll;
countErrors = from.countErrors;
countProcessed = from.countProcessed;
countSkipped = from.countSkipped;
queueSize = from.queueSize;
}
@Override
public QueueProcessorStatistics clone()
{
return new QueueProcessorStatistics(this);
}
@Override
public long getCountAll()
{
return countAll;
}
@Override
public void incrementCountAll()
{
countAll++;
}
@Override
public long getCountProcessed()
{
return countProcessed;
}
@Override
|
public void incrementCountProcessed()
{
countProcessed++;
}
@Override
public long getCountErrors()
{
return countErrors;
}
@Override
public void incrementCountErrors()
{
countErrors++;
}
@Override
public long getQueueSize()
{
return queueSize;
}
@Override
public void incrementQueueSize()
{
queueSize++;
}
@Override
public void decrementQueueSize()
{
queueSize--;
}
@Override
public long getCountSkipped()
{
return countSkipped;
}
@Override
public void incrementCountSkipped()
{
countSkipped++;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java\de\metas\async\processor\impl\QueueProcessorStatistics.java
| 1
|
请完成以下Java代码
|
public final class TableCellNone implements TableCellEditor, TableCellRenderer
{
private Object m_value;
// private String m_columnName;
public TableCellNone(String columnName)
{
super();
// m_columnName = columnName;
}
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
{
m_value = value;
return null;
}
@Override
public void addCellEditorListener(CellEditorListener l)
{
}
@Override
public void cancelCellEditing()
{
}
@Override
public Object getCellEditorValue()
{
return m_value;
|
}
@Override
public boolean isCellEditable(EventObject anEvent)
{
return false;
}
@Override
public void removeCellEditorListener(CellEditorListener l)
{
}
@Override
public boolean shouldSelectCell(EventObject anEvent)
{
return false;
}
@Override
public boolean stopCellEditing()
{
return true;
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
{
m_value = value;
return null;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\swing\TableCellNone.java
| 1
|
请完成以下Java代码
|
public class FlowableUser extends org.springframework.security.core.userdetails.User implements FlowableUserDetails {
private static final long serialVersionUID = 1L;
protected final User user;
protected final List<Group> groups;
public FlowableUser(User user, boolean active, List<? extends Group> groups, Collection<? extends GrantedAuthority> authorities) {
super(user.getId(), user.getPassword() == null ? "" : user.getPassword(), active, active, active, active, authorities);
this.user = user;
this.groups = Collections.unmodifiableList(groups);
}
public FlowableUser(User user, String username, boolean enabled,
List<? extends Group> groups, Collection<? extends GrantedAuthority> authorities) {
super(username, user.getPassword() == null ? "" : user.getPassword(), enabled, true, true, true, authorities);
this.user = user;
this.groups = Collections.unmodifiableList(groups);
|
}
@Override
public User getUser() {
return user;
}
@Override
public List<Group> getGroups() {
return groups;
}
@Override
public void eraseCredentials() {
super.eraseCredentials();
user.setPassword(null);
}
}
|
repos\flowable-engine-main\modules\flowable-spring-security\src\main\java\org\flowable\spring\security\FlowableUser.java
| 1
|
请完成以下Java代码
|
public void setPostingType (final java.lang.String PostingType)
{
set_Value (COLUMNNAME_PostingType, PostingType);
}
@Override
public java.lang.String getPostingType()
{
return get_ValueAsString(COLUMNNAME_PostingType);
}
@Override
public void setProcessed (final boolean Processed)
{
set_Value (COLUMNNAME_Processed, Processed);
}
@Override
public boolean isProcessed()
{
return get_ValueAsBoolean(COLUMNNAME_Processed);
}
@Override
public void setProcessing (final boolean Processing)
{
set_Value (COLUMNNAME_Processing, Processing);
}
@Override
public boolean isProcessing()
{
return get_ValueAsBoolean(COLUMNNAME_Processing);
}
@Override
public org.compiere.model.I_GL_Journal getReversal()
{
return get_ValueAsPO(COLUMNNAME_Reversal_ID, org.compiere.model.I_GL_Journal.class);
}
@Override
public void setReversal(final org.compiere.model.I_GL_Journal Reversal)
{
set_ValueFromPO(COLUMNNAME_Reversal_ID, org.compiere.model.I_GL_Journal.class, Reversal);
}
@Override
public void setReversal_ID (final int Reversal_ID)
{
if (Reversal_ID < 1)
|
set_Value (COLUMNNAME_Reversal_ID, null);
else
set_Value (COLUMNNAME_Reversal_ID, Reversal_ID);
}
@Override
public int getReversal_ID()
{
return get_ValueAsInt(COLUMNNAME_Reversal_ID);
}
@Override
public void setSAP_GLJournal_ID (final int SAP_GLJournal_ID)
{
if (SAP_GLJournal_ID < 1)
set_ValueNoCheck (COLUMNNAME_SAP_GLJournal_ID, null);
else
set_ValueNoCheck (COLUMNNAME_SAP_GLJournal_ID, SAP_GLJournal_ID);
}
@Override
public int getSAP_GLJournal_ID()
{
return get_ValueAsInt(COLUMNNAME_SAP_GLJournal_ID);
}
@Override
public void setTotalCr (final BigDecimal TotalCr)
{
set_ValueNoCheck (COLUMNNAME_TotalCr, TotalCr);
}
@Override
public BigDecimal getTotalCr()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_TotalCr);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setTotalDr (final BigDecimal TotalDr)
{
set_ValueNoCheck (COLUMNNAME_TotalDr, TotalDr);
}
@Override
public BigDecimal getTotalDr()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_TotalDr);
return bd != null ? bd : BigDecimal.ZERO;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java-gen\de\metas\acct\model\X_SAP_GLJournal.java
| 1
|
请完成以下Java代码
|
public class IntermediateCatchEventParseHandler extends AbstractFlowNodeBpmnParseHandler<IntermediateCatchEvent> {
private static final Logger LOGGER = LoggerFactory.getLogger(IntermediateCatchEventParseHandler.class);
@Override
public Class<? extends BaseElement> getHandledType() {
return IntermediateCatchEvent.class;
}
@Override
protected void executeParse(BpmnParse bpmnParse, IntermediateCatchEvent intermediateCatchEvent) {
EventDefinition eventDefinition = null;
if (!intermediateCatchEvent.getEventDefinitions().isEmpty()) {
eventDefinition = intermediateCatchEvent.getEventDefinitions().get(0);
}
if (eventDefinition == null) {
Map<String, List<ExtensionElement>> extensionElements = intermediateCatchEvent.getExtensionElements();
if (!extensionElements.isEmpty()) {
List<ExtensionElement> eventTypeExtensionElements = intermediateCatchEvent.getExtensionElements().get(BpmnXMLConstants.ELEMENT_EVENT_TYPE);
if (eventTypeExtensionElements != null && !eventTypeExtensionElements.isEmpty()) {
String eventTypeValue = eventTypeExtensionElements.get(0).getElementText();
if (StringUtils.isNotEmpty(eventTypeValue)) {
intermediateCatchEvent.setBehavior(bpmnParse.getActivityBehaviorFactory().createIntermediateCatchEventRegistryEventActivityBehavior(intermediateCatchEvent, eventTypeValue));
return;
}
}
}
intermediateCatchEvent.setBehavior(bpmnParse.getActivityBehaviorFactory().createIntermediateCatchEventActivityBehavior(intermediateCatchEvent));
|
} else {
if (eventDefinition instanceof TimerEventDefinition ||
eventDefinition instanceof SignalEventDefinition ||
eventDefinition instanceof MessageEventDefinition ||
eventDefinition instanceof ConditionalEventDefinition ||
eventDefinition instanceof VariableListenerEventDefinition) {
bpmnParse.getBpmnParserHandlers().parseElement(bpmnParse, eventDefinition);
} else {
LOGGER.warn("Unsupported intermediate catch event type for event {}", intermediateCatchEvent.getId());
}
}
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\bpmn\parser\handler\IntermediateCatchEventParseHandler.java
| 1
|
请完成以下Java代码
|
public String getContent() {
return this.content;
}
public List<Comment> getComments() {
return this.comments;
}
public User getAuthor() {
return this.author;
}
public void setId(Long id) {
this.id = id;
}
public void setContent(String content) {
this.content = content;
}
public void setComments(List<Comment> comments) {
this.comments = comments;
}
public void setAuthor(User author) {
this.author = author;
}
|
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Post post = (Post) o;
return Objects.equals(id, post.id);
}
@Override
public int hashCode() {
return id != null ? id.hashCode() : 0;
}
public String toString() {
return "Post(id=" + this.getId() + ", content=" + this.getContent() + ", comments=" + this.getComments() + ", author="
+ this.getAuthor() + ")";
}
}
|
repos\tutorials-master\persistence-modules\spring-boot-persistence-4\src\main\java\com\baeldung\listvsset\eager\list\fulldomain\Post.java
| 1
|
请完成以下Java代码
|
private DocumentFieldDescriptor.Builder createCreatedUpdatedInfoFieldDescriptor(@NonNull final DataEntryField dataEntryField)
{
final String fieldName = createInfoFieldName(dataEntryField);
final boolean mandatory = false;
final DocumentFieldDataBindingDescriptor dataBinding = DataEntryFieldBindingDescriptor
.builder()
.columnName(fieldName)
.mandatory(mandatory)
.dataEntryFieldId(dataEntryField.getId())
.fieldType(FieldType.CREATED_UPDATED_INFO)
.build();
return DocumentFieldDescriptor
.builder(fieldName)
.setWidgetType(ofFieldType(FieldType.CREATED_UPDATED_INFO))
.setLookupDescriptorProvider(LookupDescriptorProviders.NULL)
.addCharacteristic(Characteristic.PublicField)
.setMandatoryLogic(ConstantLogicExpression.of(mandatory))
.setDataBinding(dataBinding);
}
private String createInfoFieldName(@NonNull final DataEntryField dataEntryField)
{
return dataEntryWebuiTools.computeFieldName(dataEntryField.getId()) + "_Info";
}
private static DetailId createDetailIdFor(@NonNull final DataEntryTab dataEntryTab)
{
return DetailId.fromPrefixAndId(I_DataEntry_Tab.Table_Name, dataEntryTab.getId().getRepoId());
}
private static DetailId createDetailIdFor(@NonNull final DataEntrySubTab subTab)
{
return DetailId.fromPrefixAndId(I_DataEntry_SubTab.Table_Name, subTab.getId().getRepoId());
|
}
private static DocumentFieldWidgetType ofFieldType(@NonNull final FieldType fieldType)
{
switch (fieldType)
{
case DATE:
return DocumentFieldWidgetType.LocalDate;
case LIST:
return DocumentFieldWidgetType.List;
case NUMBER:
return DocumentFieldWidgetType.Number;
case TEXT:
return DocumentFieldWidgetType.Text;
case LONG_TEXT:
return DocumentFieldWidgetType.LongText;
case YESNO:
return DocumentFieldWidgetType.YesNo;
case CREATED_UPDATED_INFO:
return DocumentFieldWidgetType.Text;
case SUB_TAB_ID:
return DocumentFieldWidgetType.Integer;
case PARENT_LINK_ID:
return DocumentFieldWidgetType.Integer;
default:
throw new AdempiereException("Unexpected DataEntryField.Type=" + fieldType);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\dataentry\window\descriptor\factory\DataEntryTabLoader.java
| 1
|
请完成以下Java代码
|
public void onPP_Order_ID(final I_PP_Cost_Collector cc)
{
final I_PP_Order ppOrder = cc.getPP_Order();
if (ppOrder == null)
{
return;
}
costCollectorBL.updateCostCollectorFromOrder(cc, ppOrder);
}
@CalloutMethod(columnNames = I_PP_Cost_Collector.COLUMNNAME_PP_Order_Node_ID)
public void onPP_Order_Node_ID(final I_PP_Cost_Collector cc)
{
final PPOrderId orderId = PPOrderId.ofRepoIdOrNull(cc.getPP_Order_ID());
if (orderId == null)
{
return;
}
final PPOrderRoutingActivityId orderRoutingActivityId = PPOrderRoutingActivityId.ofRepoIdOrNull(orderId, cc.getPP_Order_Node_ID());
if (orderRoutingActivityId == null)
{
return;
}
final PPOrderRoutingActivity orderActivity = orderRoutingRepository.getOrderRoutingActivity(orderRoutingActivityId);
cc.setS_Resource_ID(orderActivity.getResourceId().getRepoId());
cc.setIsSubcontracting(orderActivity.isSubcontracting());
final Quantity qtyToDeliver = orderActivity.getQtyToDeliver();
costCollectorBL.setQuantities(cc, PPCostCollectorQuantities.ofMovementQty(qtyToDeliver));
updateDurationReal(cc); // shall be automatically triggered
}
@CalloutMethod(columnNames = I_PP_Cost_Collector.COLUMNNAME_MovementQty)
public void onMovementQty(final I_PP_Cost_Collector cc)
{
updateDurationReal(cc);
}
|
/**
* Calculates and sets DurationReal based on selected PP_Order_Node
*/
private void updateDurationReal(final I_PP_Cost_Collector cc)
{
final WorkingTime durationReal = computeWorkingTime(cc);
if (durationReal == null)
{
return;
}
cc.setDurationReal(durationReal.toBigDecimalUsingActivityTimeUnit());
}
@Nullable
private WorkingTime computeWorkingTime(final I_PP_Cost_Collector cc)
{
final PPOrderId orderId = PPOrderId.ofRepoIdOrNull(cc.getPP_Order_ID());
if (orderId == null)
{
return null;
}
final PPOrderRoutingActivityId activityId = PPOrderRoutingActivityId.ofRepoIdOrNull(orderId, cc.getPP_Order_Node_ID());
if (activityId == null)
{
return null;
}
final PPOrderRoutingActivity activity = orderRoutingRepository.getOrderRoutingActivity(activityId);
return WorkingTime.builder()
.durationPerOneUnit(activity.getDurationPerOneUnit())
.unitsPerCycle(activity.getUnitsPerCycle())
.qty(costCollectorBL.getMovementQty(cc))
.activityTimeUnit(activity.getDurationUnit())
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\callout\PP_Cost_Collector.java
| 1
|
请完成以下Java代码
|
public File createReportFile(String extension)
{
if (Check.isEmpty(extension))
{
throw new IllegalArgumentException("Parameter extension cannot be empty");
}
String name = new SimpleDateFormat("yyyyMMddhhmm").format(new Timestamp(System.currentTimeMillis()))
+"_"+StringUtils.stripDiacritics(getName().trim());
File file = null;
try
{
file = new File(System.getProperty("java.io.tmpdir"), name+"."+extension);
file.createNewFile();
return file;
}
catch (Exception e)
{
file = null;
}
// Fallback
String filePrefix = "Alert_"; // TODO: add AD_AlertRule.FileName (maybe)
try
{
file = File.createTempFile(filePrefix, "."+extension);
}
catch (IOException e)
{
throw new AdempiereException(e);
}
return file;
}
/**
* Before Save
* @param newRecord new
* @return true
*/
@Override
protected boolean beforeSave (boolean newRecord)
{
if (newRecord)
setIsValid(true);
if (isValid())
setErrorMsg(null);
return true;
} // beforeSave
@Override
protected boolean afterSave(boolean newRecord, boolean success) {
if (!success)
return false;
return updateParent();
}
@Override
protected boolean afterDelete(boolean success) {
if (!success)
return false;
return updateParent();
}
/**
* Update parent flags
|
* @return true if success
*/
private boolean updateParent() {
final String sql_count = "SELECT COUNT(*) FROM "+Table_Name+" r"
+" WHERE r."+COLUMNNAME_AD_Alert_ID+"=a."+MAlert.COLUMNNAME_AD_Alert_ID
+" AND r."+COLUMNNAME_IsValid+"='N'"
+" AND r.IsActive='Y'"
;
final String sql = "UPDATE "+MAlert.Table_Name+" a SET "
+" "+MAlert.COLUMNNAME_IsValid+"=(CASE WHEN ("+sql_count+") > 0 THEN 'N' ELSE 'Y' END)"
+" WHERE a."+MAlert.COLUMNNAME_AD_Alert_ID+"=?"
;
int no = DB.executeUpdateAndSaveErrorOnFail(sql, getAD_Alert_ID(), get_TrxName());
return no == 1;
}
/**
* String Representation
* @return info
*/
@Override
public String toString ()
{
StringBuffer sb = new StringBuffer ("MAlertRule[");
sb.append(get_ID())
.append("-").append(getName())
.append(",Valid=").append(isValid())
.append(",").append(getSql(false));
sb.append ("]");
return sb.toString ();
} // toString
} // MAlertRule
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MAlertRule.java
| 1
|
请完成以下Java代码
|
public abstract class AbstractAuthorizedRestResource extends AbstractRestProcessEngineAware {
protected final Resource resource;
protected final String resourceId;
public AbstractAuthorizedRestResource(String processEngineName, Resource resource, String resourceId, ObjectMapper objectMapper) {
super(processEngineName, objectMapper);
this.resource = resource;
this.resourceId = resourceId;
}
protected boolean isAuthorized(Permission permission, Resource resource, String resourceId) {
ProcessEngine processEngine = getProcessEngine();
if (!processEngine.getProcessEngineConfiguration().isAuthorizationEnabled()) {
// if authorization is disabled everyone is authorized
return true;
}
final IdentityService identityService = processEngine.getIdentityService();
final AuthorizationService authorizationService = processEngine.getAuthorizationService();
Authentication authentication = identityService.getCurrentAuthentication();
if(authentication == null) {
return true;
|
} else {
return authorizationService
.isUserAuthorized(authentication.getUserId(), authentication.getGroupIds(), permission, resource, resourceId);
}
}
protected boolean isAuthorized(Permission permission, Resource resource) {
return isAuthorized(permission, resource, resourceId);
}
protected boolean isAuthorized(Permission permission) {
return isAuthorized(permission, resource);
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\impl\AbstractAuthorizedRestResource.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
public List<Student> getStudentsOfAgeAndGender(Integer age, String gender) {
String sql = "select student_id, student_name, age, gender, grade, state from student where age= ? and gender = ?";
Object[] args = {age, gender};
return jdbcTemplate.query(sql, args, new StudentRowMapper());
}
public List<Student> getStudentsOfAgeGenderAndGrade(Integer age, String gender, Integer grade) {
String sql = "select student_id, student_name, age, gender, grade, state from student where age= ? and gender = ? and grade = ?";
Object[] args = {age, gender, grade};
return jdbcTemplate.query(sql, args, new StudentRowMapper());
}
public List<Student> getStudentsOfGradeAndState(Integer grade, String state) {
String sql = "select student_id, student_name, age, gender, grade, state from student where grade = ? and state = ?";
Object[] args = {grade, state};
return jdbcTemplate.query(sql, args, new StudentResultExtractor());
}
|
public Student getStudentOfStudentIDAndGrade(Integer studentID, Integer grade) {
String sql = "select student_id, student_name, age, gender, grade, state from student where student_id = ? and grade = ?";
Object[] args = {studentID, grade};
return jdbcTemplate.queryForObject(sql, args, new StudentRowMapper());
}
public Integer getCountOfStudentsInAGradeFromAState(Integer grade, String state) {
String sql = "select student_id, student_name, age, gender, grade, state from student where grade = ? and state = ?";
Object[] args = {grade, state};
RowCountCallbackHandler countCallbackHandler = new RowCountCallbackHandler();
jdbcTemplate.query(sql, args, countCallbackHandler);
return countCallbackHandler.getRowCount();
}
}
|
repos\tutorials-master\persistence-modules\spring-jdbc\src\main\java\com\baeldung\spring\jdbc\replacedeprecated\StudentDaoWithDeprecatedJdbcTemplateMethods.java
| 2
|
请完成以下Java代码
|
public boolean isPalindromeUsingStringBuffer(String text) {
String clean = text.replaceAll("\\s+", "")
.toLowerCase();
StringBuffer plain = new StringBuffer(clean);
StringBuffer reverse = plain.reverse();
return (reverse.toString()).equals(clean);
}
public boolean isPalindromeRecursive(String text) {
String clean = text.replaceAll("\\s+", "")
.toLowerCase();
return recursivePalindrome(clean, 0, clean.length() - 1);
}
private boolean recursivePalindrome(String text, int forward, int backward) {
if (forward == backward)
return true;
if ((text.charAt(forward)) != (text.charAt(backward)))
return false;
if (forward < backward + 1) {
return recursivePalindrome(text, forward + 1, backward - 1);
}
return true;
}
public boolean isPalindromeUsingIntStream(String text) {
String temp = text.replaceAll("\\s+", "")
.toLowerCase();
|
return IntStream.range(0, temp.length() / 2)
.noneMatch(i -> temp.charAt(i) != temp.charAt(temp.length() - i - 1));
}
boolean hasPalindromePermutation(String text) {
long charsWithOddOccurrencesCount = text.chars()
.boxed()
.collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
.values()
.stream()
.filter(count -> count % 2 != 0)
.count();
return charsWithOddOccurrencesCount <= 1;
}
}
|
repos\tutorials-master\core-java-modules\core-java-string-algorithms-2\src\main\java\com\baeldung\palindrom\Palindrome.java
| 1
|
请完成以下Java代码
|
public String docValidate(final PO po, final int timing)
{
// nothing to do
return null;
}
@Override
public String modelChange(final PO po, int type)
{
assert po instanceof MInvoiceLine : po;
if (type == TYPE_BEFORE_CHANGE || type == TYPE_BEFORE_NEW)
{
final IInvoiceLineBL invoiceLineBL = Services.get(IInvoiceLineBL.class);
final I_C_InvoiceLine il = InterfaceWrapperHelper.create(po, I_C_InvoiceLine.class);
if (!il.isProcessed())
{
logger.debug("Reevaluating tax for " + il);
invoiceLineBL.setTaxBasedOnShipment(il, po.get_TrxName());
logger.debug("Setting TaxAmtInfo for " + il);
invoiceLineBL.setTaxAmtInfo(po.getCtx(), il, po.get_TrxName());
}
// Introduced by US1184, because having the same price on Order and Invoice is enforced by German Law
if (invoiceLineBL.isPriceLocked(il))
{
assertOrderInvoicePricesMatch(il);
}
}
else if (type == TYPE_BEFORE_DELETE)
{
final I_C_InvoiceLine il = InterfaceWrapperHelper.create(po, I_C_InvoiceLine.class);
beforeDelete(il);
}
|
return null;
}
void beforeDelete(final org.compiere.model.I_C_InvoiceLine invoiceLine)
{
final IInvoiceDAO invoiceDAO = Services.get(IInvoiceDAO.class);
final InvoiceAndLineId invoiceAndLineId = InvoiceAndLineId.ofRepoId(invoiceLine.getC_Invoice_ID(), invoiceLine.getC_InvoiceLine_ID());
for (final I_C_InvoiceLine refInvoiceLine : invoiceDAO.retrieveReferringLines(invoiceAndLineId))
{
refInvoiceLine.setRef_InvoiceLine_ID(0);
invoiceDAO.save(refInvoiceLine);
}
}
public static void assertOrderInvoicePricesMatch(final I_C_InvoiceLine invoiceLine)
{
final I_C_OrderLine oline = invoiceLine.getC_OrderLine();
if (invoiceLine.getPriceActual().compareTo(oline.getPriceActual()) != 0)
{
throw new OrderInvoicePricesNotMatchException(I_C_InvoiceLine.COLUMNNAME_PriceActual, oline.getPriceActual(), invoiceLine.getPriceActual());
}
if (invoiceLine.getPriceList().compareTo(oline.getPriceList()) != 0)
{
throw new OrderInvoicePricesNotMatchException(I_C_InvoiceLine.COLUMNNAME_PriceList, oline.getPriceList(), invoiceLine.getPriceList());
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\adempiere\modelvalidator\InvoiceLine.java
| 1
|
请完成以下Java代码
|
public void onRemoteSessionCloseCommand(UUID sessionId, SessionCloseNotificationProto sessionCloseNotification) {
log.trace("[{}] Received the remote command to close the session: {}", sessionId, sessionCloseNotification.getMessage());
responseWriter.setResult(new ResponseEntity<>(HttpStatus.REQUEST_TIMEOUT));
}
@Override
public void onToDeviceRpcRequest(UUID sessionId, ToDeviceRpcRequestMsg msg) {
log.trace("[{}] Received RPC command to device", sessionId);
responseWriter.setResult(new ResponseEntity<>(JsonConverter.toJson(msg, true).toString(), HttpStatus.OK));
transportService.process(sessionInfo, msg, RpcStatus.DELIVERED, TransportServiceCallback.EMPTY);
}
@Override
public void onToServerRpcResponse(ToServerRpcResponseMsg msg) {
responseWriter.setResult(new ResponseEntity<>(JsonConverter.toJson(msg).toString(), HttpStatus.OK));
}
@Override
public void onDeviceDeleted(DeviceId deviceId) {
UUID sessionId = new UUID(sessionInfo.getSessionIdMSB(), sessionInfo.getSessionIdLSB());
log.trace("[{}] Received device deleted notification for device with id: {}",sessionId, deviceId);
|
responseWriter.setResult(new ResponseEntity<>("Device was deleted!", HttpStatus.FORBIDDEN));
}
}
private static MediaType parseMediaType(String contentType) {
try {
return MediaType.parseMediaType(contentType);
} catch (Exception e) {
return MediaType.APPLICATION_OCTET_STREAM;
}
}
@Override
public String getName() {
return DataConstants.HTTP_TRANSPORT_NAME;
}
}
|
repos\thingsboard-master\common\transport\http\src\main\java\org\thingsboard\server\transport\http\DeviceApiController.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
protected void initProcessInstanceService(ProcessEngineConfigurationImpl processEngineConfiguration) {
cmmnEngineConfiguration.setProcessInstanceService(new DefaultProcessInstanceService(processEngineConfiguration));
}
protected void initCaseInstanceService(ProcessEngineConfigurationImpl processEngineConfiguration) {
processEngineConfiguration.setCaseInstanceService(new DefaultCaseInstanceService(cmmnEngineConfiguration));
}
protected void initProcessInstanceStateChangedCallbacks(ProcessEngineConfigurationImpl processEngineConfiguration) {
if (processEngineConfiguration.getProcessInstanceStateChangedCallbacks() == null) {
processEngineConfiguration.setProcessInstanceStateChangedCallbacks(new HashMap<>());
}
Map<String, List<RuntimeInstanceStateChangeCallback>> callbacks = processEngineConfiguration.getProcessInstanceStateChangedCallbacks();
if (!callbacks.containsKey(CallbackTypes.PLAN_ITEM_CHILD_PROCESS)) {
callbacks.put(CallbackTypes.PLAN_ITEM_CHILD_PROCESS, new ArrayList<>());
}
callbacks.get(CallbackTypes.PLAN_ITEM_CHILD_PROCESS).add(new ChildProcessInstanceStateChangeCallback(cmmnEngineConfiguration));
}
@Override
protected List<Class<? extends Entity>> getEntityInsertionOrder() {
return EntityDependencyOrder.INSERT_ORDER;
}
|
@Override
protected List<Class<? extends Entity>> getEntityDeletionOrder() {
return EntityDependencyOrder.DELETE_ORDER;
}
@Override
protected CmmnEngine buildEngine() {
if (cmmnEngineConfiguration == null) {
throw new FlowableException("CmmnEngineConfiguration is required");
}
return cmmnEngineConfiguration.buildCmmnEngine();
}
public CmmnEngineConfiguration getCmmnEngineConfiguration() {
return cmmnEngineConfiguration;
}
public CmmnEngineConfigurator setCmmnEngineConfiguration(CmmnEngineConfiguration cmmnEngineConfiguration) {
this.cmmnEngineConfiguration = cmmnEngineConfiguration;
return this;
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-engine-configurator\src\main\java\org\flowable\cmmn\engine\configurator\CmmnEngineConfigurator.java
| 2
|
请完成以下Java代码
|
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Response Text.
@param ResponseText
Request Response Text
*/
public void setResponseText (String ResponseText)
{
set_Value (COLUMNNAME_ResponseText, ResponseText);
}
/** Get Response Text.
@return Request Response Text
*/
public String getResponseText ()
{
return (String)get_Value(COLUMNNAME_ResponseText);
}
/** Set Standard Response.
@param R_StandardResponse_ID
Request Standard Response
*/
public void setR_StandardResponse_ID (int R_StandardResponse_ID)
{
|
if (R_StandardResponse_ID < 1)
set_ValueNoCheck (COLUMNNAME_R_StandardResponse_ID, null);
else
set_ValueNoCheck (COLUMNNAME_R_StandardResponse_ID, Integer.valueOf(R_StandardResponse_ID));
}
/** Get Standard Response.
@return Request Standard Response
*/
public int getR_StandardResponse_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_R_StandardResponse_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_R_StandardResponse.java
| 1
|
请完成以下Java代码
|
public boolean hasKey(Object key) {
Assert.notNull(key, "key cannot be null");
return this.context.containsKey(key);
}
/**
* Returns the {@link RegisteredClient registered client}.
* @return the {@link RegisteredClient}
*/
public RegisteredClient getRegisteredClient() {
return get(RegisteredClient.class);
}
/**
* Constructs a new {@link Builder} with the provided
* {@link OidcLogoutAuthenticationToken}.
* @param authentication the {@link OidcLogoutAuthenticationToken}
* @return the {@link Builder}
*/
public static Builder with(OidcLogoutAuthenticationToken authentication) {
return new Builder(authentication);
}
/**
* A builder for {@link OidcLogoutAuthenticationContext}.
*/
public static final class Builder extends AbstractBuilder<OidcLogoutAuthenticationContext, Builder> {
private Builder(OidcLogoutAuthenticationToken authentication) {
|
super(authentication);
}
/**
* Sets the {@link RegisteredClient registered client}.
* @param registeredClient the {@link RegisteredClient}
* @return the {@link Builder} for further configuration
*/
public Builder registeredClient(RegisteredClient registeredClient) {
return put(RegisteredClient.class, registeredClient);
}
/**
* Builds a new {@link OidcLogoutAuthenticationContext}.
* @return the {@link OidcLogoutAuthenticationContext}
*/
@Override
public OidcLogoutAuthenticationContext build() {
Assert.notNull(get(RegisteredClient.class), "registeredClient cannot be null");
return new OidcLogoutAuthenticationContext(getContext());
}
}
}
|
repos\spring-security-main\oauth2\oauth2-authorization-server\src\main\java\org\springframework\security\oauth2\server\authorization\oidc\authentication\OidcLogoutAuthenticationContext.java
| 1
|
请完成以下Java代码
|
public TbQueueProducer<TbProtoQueueMsg<ToHousekeeperServiceMsg>> getHousekeeperMsgProducer() {
return toHousekeeper;
}
@Override
public TbQueueProducer<TbProtoQueueMsg<ToEdgeMsg>> getTbEdgeMsgProducer() {
return toEdge;
}
@Override
public TbQueueProducer<TbProtoQueueMsg<ToEdgeNotificationMsg>> getTbEdgeNotificationsMsgProducer() {
return toEdgeNotifications;
}
@Override
|
public TbQueueProducer<TbProtoQueueMsg<ToEdgeEventNotificationMsg>> getTbEdgeEventsMsgProducer() {
return toEdgeEvents;
}
@Override
public TbQueueProducer<TbProtoQueueMsg<TransportProtos.ToCalculatedFieldMsg>> getCalculatedFieldsMsgProducer() {
return toCalculatedFields;
}
@Override
public TbQueueProducer<TbProtoQueueMsg<ToCalculatedFieldNotificationMsg>> getCalculatedFieldsNotificationsMsgProducer() {
return toCalculatedFieldNotifications;
}
}
|
repos\thingsboard-master\common\queue\src\main\java\org\thingsboard\server\queue\provider\TbCoreQueueProducerProvider.java
| 1
|
请完成以下Java代码
|
public int getLocal_Currency_ID()
{
return get_ValueAsInt(COLUMNNAME_Local_Currency_ID);
}
@Override
public void setMatchKey (final @Nullable java.lang.String MatchKey)
{
set_Value (COLUMNNAME_MatchKey, MatchKey);
}
@Override
public java.lang.String getMatchKey()
{
return get_ValueAsString(COLUMNNAME_MatchKey);
}
@Override
public void setM_Product_ID (final int M_Product_ID)
{
if (M_Product_ID < 1)
set_Value (COLUMNNAME_M_Product_ID, null);
else
set_Value (COLUMNNAME_M_Product_ID, M_Product_ID);
}
@Override
public int getM_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
/**
* PostingSign AD_Reference_ID=541699
* Reference name: PostingSign
*/
public static final int POSTINGSIGN_AD_Reference_ID=541699;
/** DR = D */
public static final String POSTINGSIGN_DR = "D";
/** CR = C */
public static final String POSTINGSIGN_CR = "C";
|
@Override
public void setPostingSign (final java.lang.String PostingSign)
{
set_Value (COLUMNNAME_PostingSign, PostingSign);
}
@Override
public java.lang.String getPostingSign()
{
return get_ValueAsString(COLUMNNAME_PostingSign);
}
@Override
public void setUserElementString1 (final @Nullable java.lang.String UserElementString1)
{
set_Value (COLUMNNAME_UserElementString1, UserElementString1);
}
@Override
public java.lang.String getUserElementString1()
{
return get_ValueAsString(COLUMNNAME_UserElementString1);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java-gen\de\metas\acct\model\X_Fact_Acct_UserChange.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public FaviconResourceResolver faviconResourceResolver() {
return new FaviconResourceResolver();
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
final String classpath = "classpath:" + properties.getWebapp().getWebjarClasspath();
WebappProperty webapp = properties.getWebapp();
String applicationPath = webapp.getApplicationPath();
registry.addResourceHandler(applicationPath + "/lib/**")
.addResourceLocations(classpath + "/lib/");
registry.addResourceHandler(applicationPath + "/api/**")
.addResourceLocations("classpath:/api/");
registry.addResourceHandler(applicationPath + "/app/**")
.addResourceLocations(classpath + "/app/");
registry.addResourceHandler(applicationPath + "/assets/**")
.addResourceLocations(classpath + "/assets/");
registry.addResourceHandler(applicationPath + "/favicon.ico")
|
.addResourceLocations(classpath + "/") // add slash to get rid of the WARN log
.resourceChain(true)
.addResolver(faviconResourceResolver());
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
WebappProperty webapp = properties.getWebapp();
if (webapp.isIndexRedirectEnabled()) {
String applicationPath = webapp.getApplicationPath();
registry.addRedirectViewController("/", applicationPath + "/app/");
}
}
}
|
repos\camunda-bpm-platform-master\spring-boot-starter\starter-webapp-core\src\main\java\org\camunda\bpm\spring\boot\starter\webapp\CamundaBpmWebappAutoConfiguration.java
| 2
|
请完成以下Java代码
|
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_C_Cycle[")
.append(get_ID()).append("]");
return sb.toString();
}
public I_C_Currency getC_Currency() throws RuntimeException
{
return (I_C_Currency)MTable.get(getCtx(), I_C_Currency.Table_Name)
.getPO(getC_Currency_ID(), get_TrxName()); }
/** Set Currency.
@param C_Currency_ID
The Currency for this record
*/
public void setC_Currency_ID (int C_Currency_ID)
{
if (C_Currency_ID < 1)
set_Value (COLUMNNAME_C_Currency_ID, null);
else
set_Value (COLUMNNAME_C_Currency_ID, Integer.valueOf(C_Currency_ID));
}
/** Get Currency.
@return The Currency for this record
*/
public int getC_Currency_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Currency_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Project Cycle.
@param C_Cycle_ID
Identifier for this Project Reporting Cycle
*/
public void setC_Cycle_ID (int C_Cycle_ID)
{
if (C_Cycle_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Cycle_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Cycle_ID, Integer.valueOf(C_Cycle_ID));
}
/** Get Project Cycle.
@return Identifier for this Project Reporting Cycle
*/
public int getC_Cycle_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Cycle_ID);
if (ii == null)
return 0;
return ii.intValue();
|
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Cycle.java
| 1
|
请完成以下Java代码
|
public void setValue (Object value)
{
if (value == null)
setText("");
else
setText(value.toString());
} // setValue
/**
* Return Editor value
* @return current value
*/
@Override
public Object getValue()
{
|
return new String(super.getPassword());
} // getValue
/**
* Return Display Value
* @return displayed String value
*/
@Override
public String getDisplay()
{
return new String(super.getPassword());
} // getDisplay
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\swing\CPassword.java
| 1
|
请完成以下Java代码
|
private RequestsCollector getRequestsCollector()
{
return trxManager.getThreadInheritedTrx(OnTrxMissingPolicy.Fail) // at this point we always run in trx
.getPropertyAndProcessAfterCommit(
RequestsCollector.class.getName(),
RequestsCollector::new,
this::enqueueNow);
}
private void enqueueNow(@NonNull final RequestsCollector requestsCollector)
{
final List<ModelToIndexEnqueueRequest> requests = requestsCollector.getRequestsAndMarkedProcessed();
enqueueNow(requests);
}
public void enqueueNow(@NonNull final List<ModelToIndexEnqueueRequest> requests)
{
repository.addToQueue(requests);
}
@ToString
private static class RequestsCollector
{
private boolean processed = false;
private final ArrayList<ModelToIndexEnqueueRequest> requests = new ArrayList<>();
public synchronized void addRequests(@NonNull final Collection<ModelToIndexEnqueueRequest> requests)
{
assertNotProcessed();
|
this.requests.addAll(requests);
}
private void assertNotProcessed()
{
if (processed)
{
throw new AdempiereException("already processed: " + this);
}
}
public synchronized List<ModelToIndexEnqueueRequest> getRequestsAndMarkedProcessed()
{
assertNotProcessed();
this.processed = true;
return requests;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.elasticsearch\src\main\java\de\metas\fulltextsearch\indexer\queue\ModelsToIndexQueueService.java
| 1
|
请完成以下Spring Boot application配置
|
server:
port: 8082
servlet:
context-path: /ui
register-default-servlet: true
session:
cookie:
name: UISESSION
security:
basic:
enabled: false
oauth2:
client:
clientId: SampleClientId
clientSecret: secret
accessTokenUri: http://localhost:8081/auth/oauth/token
userAuthorizationUr
|
i: http://localhost:8081/auth/oauth/authorize
resource:
userInfoUri: http://localhost:8081/auth/user/me
spring:
thymeleaf:
cache: false
|
repos\tutorials-master\spring-security-modules\spring-security-oauth2-sso\spring-security-sso-ui\src\main\resources\application.yml
| 2
|
请完成以下Java代码
|
public java.lang.String getCoordinates ()
{
return (java.lang.String)get_Value(COLUMNNAME_Coordinates);
}
/** Set Locode.
@param Locode
Location code - UN/LOCODE
*/
@Override
public void setLocode (java.lang.String Locode)
{
set_Value (COLUMNNAME_Locode, Locode);
}
/** Get Locode.
@return Location code - UN/LOCODE
*/
@Override
public java.lang.String getLocode ()
{
return (java.lang.String)get_Value(COLUMNNAME_Locode);
}
/** 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 PLZ.
@param Postal
Postal code
*/
@Override
public void setPostal (java.lang.String Postal)
{
set_Value (COLUMNNAME_Postal, Postal);
}
/** Get PLZ.
@return Postal code
*/
@Override
public java.lang.String getPostal ()
{
return (java.lang.String)get_Value(COLUMNNAME_Postal);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_City.java
| 1
|
请完成以下Java代码
|
public Set<String> deleteByTenantId(TenantId tenantId) {
return apiKeyRepository.deleteByTenantId(tenantId.getId());
}
@Override
public Set<String> deleteByUserId(TenantId tenantId, UserId userId) {
return apiKeyRepository.deleteByUserId(tenantId.getId(), userId.getId());
}
@Override
public int deleteAllByExpirationTimeBefore(long ts) {
return apiKeyRepository.deleteAllByExpirationTimeBefore(ts);
}
@Override
|
protected Class<ApiKeyEntity> getEntityClass() {
return ApiKeyEntity.class;
}
@Override
protected JpaRepository<ApiKeyEntity, UUID> getRepository() {
return apiKeyRepository;
}
@Override
public EntityType getEntityType() {
return EntityType.API_KEY;
}
}
|
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\sql\pat\JpaApiKeyDao.java
| 1
|
请完成以下Java代码
|
public Map<String, String> getExtensionProperties(){
return extensionProperties;
}
public static LockedExternalTaskDto fromLockedExternalTask(LockedExternalTask task) {
LockedExternalTaskDto dto = new LockedExternalTaskDto();
dto.activityId = task.getActivityId();
dto.activityInstanceId = task.getActivityInstanceId();
dto.errorMessage = task.getErrorMessage();
dto.errorDetails = task.getErrorDetails();
dto.executionId = task.getExecutionId();
dto.id = task.getId();
dto.lockExpirationTime = task.getLockExpirationTime();
dto.createTime = task.getCreateTime();
dto.processDefinitionId = task.getProcessDefinitionId();
dto.processDefinitionKey = task.getProcessDefinitionKey();
dto.processDefinitionVersionTag = task.getProcessDefinitionVersionTag();
dto.processInstanceId = task.getProcessInstanceId();
dto.retries = task.getRetries();
dto.topicName = task.getTopicName();
dto.workerId = task.getWorkerId();
dto.tenantId = task.getTenantId();
dto.variables = VariableValueDto.fromMap(task.getVariables());
dto.priority = task.getPriority();
dto.businessKey = task.getBusinessKey();
dto.extensionProperties = task.getExtensionProperties();
return dto;
}
public static List<LockedExternalTaskDto> fromLockedExternalTasks(List<LockedExternalTask> tasks) {
List<LockedExternalTaskDto> dtos = new ArrayList<>();
|
for (LockedExternalTask task : tasks) {
dtos.add(LockedExternalTaskDto.fromLockedExternalTask(task));
}
return dtos;
}
@Override
public String toString() {
return
"LockedExternalTaskDto [activityId=" + activityId
+ ", activityInstanceId=" + activityInstanceId
+ ", errorMessage=" + errorMessage
+ ", errorDetails=" + errorDetails
+ ", executionId=" + executionId
+ ", id=" + id
+ ", lockExpirationTime=" + lockExpirationTime
+ ", createTime=" + createTime
+ ", processDefinitionId=" + processDefinitionId
+ ", processDefinitionKey=" + processDefinitionKey
+ ", processDefinitionVersionTag=" + processDefinitionVersionTag
+ ", processInstanceId=" + processInstanceId
+ ", retries=" + retries
+ ", suspended=" + suspended
+ ", workerId=" + workerId
+ ", topicName=" + topicName
+ ", tenantId=" + tenantId
+ ", variables=" + variables
+ ", priority=" + priority
+ ", businessKey=" + businessKey + "]";
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\externaltask\LockedExternalTaskDto.java
| 1
|
请完成以下Java代码
|
private static final class ApplicationResource extends FileSystemResource implements ContextResource {
ApplicationResource(String path) {
super(path);
}
ApplicationResource(Path path) {
super(path);
}
@Override
public String getPathWithinContext() {
return getPath();
}
}
/**
* {@link ResourceLoader} decorator that adds support for additional
* {@link ProtocolResolver ProtocolResolvers}.
*/
private static class ProtocolResolvingResourceLoader implements ResourceLoader {
private final ResourceLoader resourceLoader;
private final List<ProtocolResolver> protocolResolvers;
private final List<FilePathResolver> filePathResolvers;
ProtocolResolvingResourceLoader(ResourceLoader resourceLoader, List<ProtocolResolver> protocolResolvers,
List<FilePathResolver> filePathResolvers) {
this.resourceLoader = resourceLoader;
this.protocolResolvers = protocolResolvers;
this.filePathResolvers = filePathResolvers;
}
@Override
public @Nullable ClassLoader getClassLoader() {
return this.resourceLoader.getClassLoader();
}
@Override
public Resource getResource(String location) {
if (StringUtils.hasLength(location)) {
for (ProtocolResolver protocolResolver : this.protocolResolvers) {
Resource resource = protocolResolver.resolve(location, this);
|
if (resource != null) {
return resource;
}
}
}
Resource resource = this.resourceLoader.getResource(location);
String filePath = getFilePath(location, resource);
return (filePath != null) ? new ApplicationResource(filePath) : resource;
}
private @Nullable String getFilePath(String location, Resource resource) {
for (FilePathResolver filePathResolver : this.filePathResolvers) {
String filePath = filePathResolver.resolveFilePath(location, resource);
if (filePath != null) {
return filePath;
}
}
return null;
}
}
}
|
repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\io\ApplicationResourceLoader.java
| 1
|
请完成以下Java代码
|
public void setResourceName(String resourceName) {
this.resourceName = resourceName;
}
/**
* @return the id of the resource if there
* is only one {@link MissingAuthorizationDto}, {@code null} otherwise
*
* @deprecated Use {@link #getMissingAuthorizations()} to get the id of the resource
* of the {@link MissingAuthorizationDto}(s). This method will be removed in future version.
*/
@Deprecated
public String getResourceId() {
return resourceId;
}
/**
* @deprecated Use {@link #setMissingAuthorizations(List)}} to set the
* the {@link MissingAuthorizationDto}(s). This method will be removed in future version.
*/
@Deprecated
public void setResourceId(String resourceId) {
this.resourceId = resourceId;
}
/**
* @return the name of the violated permission if there
* is only one {@link MissingAuthorizationDto}, {@code null} otherwise
*
* @deprecated Use {@link #getMissingAuthorizations()} to get the name of the violated permission
* of the {@link MissingAuthorizationDto}(s). This method will be removed in future version.
*/
@Deprecated
public String getPermissionName() {
return permissionName;
}
/**
* @deprecated Use {@link #setMissingAuthorizations(List)}} to set the
* the {@link MissingAuthorizationDto}(s). This method will be removed in future version.
*/
@Deprecated
public void setPermissionName(String permissionName) {
|
this.permissionName = permissionName;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
/**
* @return Disjunctive list of {@link MissingAuthorizationDto} from
* which a user needs to have at least one for the authorization to pass
*/
public List<MissingAuthorizationDto> getMissingAuthorizations() {
return missingAuthorizations;
}
public void setMissingAuthorizations(List<MissingAuthorizationDto> info) {
this.missingAuthorizations = info;
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\AuthorizationExceptionDto.java
| 1
|
请完成以下Java代码
|
public class InventoryLine_HandlerDAO implements IInventoryLine_HandlerDAO
{
@Override
public Iterator<I_M_InventoryLine> retrieveAllLinesWithoutIC(final Properties ctx, final int limit, final String trxName)
{
final IQueryBL queryBL = Services.get(IQueryBL.class);
final ICompositeQueryFilter<I_M_InventoryLine> filters = queryBL.createCompositeQueryFilter(I_M_InventoryLine.class);
filters.addEqualsFilter(I_M_InventoryLine.COLUMNNAME_Processed, true);
filters.addEqualsFilter(I_M_InventoryLine.COLUMNNAME_IsInvoiceCandidate, false); // which don't have invoice candidates already generated
filters.addOnlyActiveRecordsFilter();
//
// Filter M_Inventory
{
final IQueryBuilder<I_M_Inventory> inventoryQueryBuilder = queryBL.createQueryBuilder(I_M_Inventory.class, ctx, trxName);
// if the inventory was reversed, and there is no IC yet, don't bother creating one
inventoryQueryBuilder.addNotEqualsFilter(I_M_Inventory.COLUMNNAME_DocStatus, IDocument.STATUS_Reversed);
// Only create invoice candidates for material disposal
{
final IQuery<I_C_DocType> validDocTypesQuery = queryBL.createQueryBuilder(I_C_DocType.class, ctx, trxName)
.addEqualsFilter(I_C_DocType.COLUMNNAME_DocBaseType, X_C_DocType.DOCBASETYPE_MaterialPhysicalInventory)
.addEqualsFilter(I_C_DocType.COLUMNNAME_DocSubType, X_C_DocType.DOCSUBTYPE_InternalUseInventory)
//
.create();
inventoryQueryBuilder.addInSubQueryFilter(I_M_Inventory.COLUMNNAME_C_DocType_ID, I_C_DocType.COLUMNNAME_C_DocType_ID, validDocTypesQuery);
|
}
filters.addInSubQueryFilter(I_M_InventoryLine.COLUMNNAME_M_Inventory_ID, I_M_Inventory.COLUMNNAME_M_Inventory_ID, inventoryQueryBuilder.create());
}
final IQueryBuilder<I_M_InventoryLine> queryBuilder = queryBL.createQueryBuilder(I_M_InventoryLine.class, ctx, trxName)
.filter(filters)
.filterByClientId();
queryBuilder.orderBy()
.addColumn(I_M_InventoryLine.COLUMNNAME_M_InventoryLine_ID);
queryBuilder.setLimit(limit);
return queryBuilder.create()
.iterate(I_M_InventoryLine.class);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\spi\impl\InventoryLine_HandlerDAO.java
| 1
|
请完成以下Java代码
|
public String getProcessInstanceId() {
return businessProcess.getProcessInstanceId();
}
/**
* Returns the currently associated execution or 'null'
*/
/* Makes the current Execution available for injection */
@Produces
@Named
public Execution getExecution() {
return businessProcess.getExecution();
}
/**
* @see BusinessProcess#getExecution()
*/
/* Makes the id of the current Execution available for injection */
@Produces
@Named
public String getExecutionId() {
return businessProcess.getExecutionId();
}
/**
|
* Returns the currently associated {@link Task} or 'null'
*
* @throws FlowableCdiException
* if no {@link Task} is associated. Use {@link BusinessProcess#isTaskAssociated()} to check whether an association exists.
*/
/* Makes the current Task available for injection */
@Produces
@Named
public Task getTask() {
return businessProcess.getTask();
}
/**
* Returns the id of the task associated with the current conversation or 'null'.
*/
/* Makes the taskId available for injection */
@Produces
@Named
@TaskId
public String getTaskId() {
return businessProcess.getTaskId();
}
}
|
repos\flowable-engine-main\modules\flowable-cdi\src\main\java\org\flowable\cdi\CurrentProcessInstance.java
| 1
|
请完成以下Java代码
|
class SpringEnvironmentPropertySource implements PropertySource {
/**
* System properties take precedence followed by properties in Log4j properties files.
*/
private static final int PRIORITY = -100;
private volatile @Nullable Environment environment;
@Override
public int getPriority() {
return PRIORITY;
}
@Override
|
public @Nullable String getProperty(String key) {
Environment environment = this.environment;
return (environment != null) ? environment.getProperty(key) : null;
}
@Override
public boolean containsProperty(String key) {
Environment environment = this.environment;
return environment != null && environment.containsProperty(key);
}
void setEnvironment(@Nullable Environment environment) {
this.environment = environment;
}
}
|
repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\logging\log4j2\SpringEnvironmentPropertySource.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
String getId() {
return this.id;
}
Issuer getIssuer() {
return this.issuer;
}
byte[] getContent() {
return this.content;
}
String getAlgorithm() {
return this.algorithm;
}
byte[] getSignature() {
|
return this.signature;
}
boolean hasSignature() {
return this.signature != null;
}
}
}
interface DecryptionConfigurer {
void decrypt(XMLObject object);
}
}
|
repos\spring-security-main\saml2\saml2-service-provider\src\main\java\org\springframework\security\saml2\internal\OpenSamlOperations.java
| 2
|
请完成以下Java代码
|
protected List<Long> convertValuesToLong(List<TypedValue> typedValues) throws IllegalArgumentException {
List<Long> longValues = new ArrayList<Long>();
for (TypedValue typedValue : typedValues) {
if (ValueType.LONG.equals(typedValue.getType())) {
longValues.add((Long) typedValue.getValue());
} else if (typedValue.getType() == null) {
// check if it is a long or a string of a number
Object value = typedValue.getValue();
if (value instanceof Long) {
longValues.add((Long) value);
} else {
Long longValue = Long.valueOf(value.toString());
longValues.add(longValue);
}
} else {
// reject other typed values
throw new IllegalArgumentException();
}
}
return longValues;
}
|
protected List<Double> convertValuesToDouble(List<TypedValue> typedValues) throws IllegalArgumentException {
List<Double> doubleValues = new ArrayList<Double>();
for (TypedValue typedValue : typedValues) {
if (ValueType.DOUBLE.equals(typedValue.getType())) {
doubleValues.add((Double) typedValue.getValue());
} else if (typedValue.getType() == null) {
// check if it is a double or a string of a decimal number
Object value = typedValue.getValue();
if (value instanceof Double) {
doubleValues.add((Double) value);
} else {
Double doubleValue = Double.valueOf(value.toString());
doubleValues.add(doubleValue);
}
} else {
// reject other typed values
throw new IllegalArgumentException();
}
}
return doubleValues;
}
}
|
repos\camunda-bpm-platform-master\engine-dmn\engine\src\main\java\org\camunda\bpm\dmn\engine\impl\hitpolicy\AbstractCollectNumberHitPolicyHandler.java
| 1
|
请完成以下Java代码
|
public int getActivityInstanceState() {
return activityInstanceState;
}
public boolean isCompleteScope() {
return ActivityInstanceState.SCOPE_COMPLETE.getStateCode() == activityInstanceState;
}
public boolean isCanceled() {
return ActivityInstanceState.CANCELED.getStateCode() == activityInstanceState;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public String getRootProcessInstanceId() {
return rootProcessInstanceId;
}
public void setRootProcessInstanceId(String rootProcessInstanceId) {
this.rootProcessInstanceId = rootProcessInstanceId;
}
@Override
public String toString() {
return this.getClass().getSimpleName()
+ "[activityId=" + activityId
+ ", activityName=" + activityName
+ ", activityType=" + activityType
+ ", activityInstanceId=" + activityInstanceId
|
+ ", activityInstanceState=" + activityInstanceState
+ ", parentActivityInstanceId=" + parentActivityInstanceId
+ ", calledProcessInstanceId=" + calledProcessInstanceId
+ ", calledCaseInstanceId=" + calledCaseInstanceId
+ ", taskId=" + taskId
+ ", taskAssignee=" + taskAssignee
+ ", durationInMillis=" + durationInMillis
+ ", startTime=" + startTime
+ ", endTime=" + endTime
+ ", eventType=" + eventType
+ ", executionId=" + executionId
+ ", processDefinitionId=" + processDefinitionId
+ ", rootProcessInstanceId=" + rootProcessInstanceId
+ ", processInstanceId=" + processInstanceId
+ ", tenantId=" + tenantId
+ "]";
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\history\event\HistoricActivityInstanceEventEntity.java
| 1
|
请完成以下Java代码
|
public class CopyingAHashMapToAnother {
public Map<String, String> copyByIteration(Map<String, String> sourceMap, Map<String, String> targetMap) {
for (Map.Entry<String, String> entry : sourceMap.entrySet()) {
if (!targetMap.containsKey(entry.getKey())) {
targetMap.put(entry.getKey(), entry.getValue());
}
}
return targetMap;
}
public Map<String, String> copyUsingPutAll(Map<String, String> sourceMap, Map<String, String> targetMap) {
sourceMap.keySet()
.removeAll(targetMap.keySet());
targetMap.putAll(sourceMap);
return targetMap;
}
public Map<String, String> copyUsingPutIfAbsent(Map<String, String> sourceMap, Map<String, String> targetMap) {
for (Map.Entry<String, String> entry : sourceMap.entrySet()) {
targetMap.putIfAbsent(entry.getKey(), entry.getValue());
|
}
return targetMap;
}
public Map<String, String> copyUsingPutIfAbsentForEach(Map<String, String> sourceMap, Map<String, String> targetMap) {
sourceMap.forEach(targetMap::putIfAbsent);
return targetMap;
}
public Map<String, String> copyUsingMapMerge(Map<String, String> sourceMap, Map<String, String> targetMap) {
sourceMap.forEach((key, value) -> targetMap.merge(key, value, (oldVal, newVal) -> oldVal));
return targetMap;
}
public Map<String, String> copyUsingGuavaMapDifference(Map<String, String> sourceMap, Map<String, String> targetMap) {
MapDifference<String, String> differenceMap = Maps.difference(sourceMap, targetMap);
targetMap.putAll(differenceMap.entriesOnlyOnLeft());
return targetMap;
}
}
|
repos\tutorials-master\core-java-modules\core-java-collections-maps-6\src\main\java\com\baeldung\map\hashmapcopy\CopyingAHashMapToAnother.java
| 1
|
请完成以下Java代码
|
public void sendPrintPackageResponse(PrintPackage printPackage, PrintJobInstructionsConfirm response)
{
final int sessionId = getAD_Session_ID();
final PRTCPrintJobInstructionsConfirmType xmlRequest = converterPRTCPrintJobInstructionsConfirmType.createPRTADPrintPackageResponse(response, sessionId);
sendXmlObject(xmlRequest);
}
private <T> T sendXmlObject(final Object xmlRequestObj)
{
final Document xmlRequest = convertObjectToDocument(xmlRequestObj);
final StringBuilder importInfo = new StringBuilder();
final Document xmlResponse = importHelper.importXMLDocument(importInfo, xmlRequest, ITrx.TRXNAME_None);
if (xmlResponse == null)
{
return null;
}
try
{
@SuppressWarnings("unchecked")
final JAXBElement<T> jaxbElement = (JAXBElement<T>)jaxbUnmarshaller.unmarshal(xmlResponse);
final T xmlResponseObj = jaxbElement.getValue();
return xmlResponseObj;
}
catch (Exception e)
{
throw new AdempiereException("Cannot unmarshall xml response '" + xmlResponse + "' associated with request '" + xmlRequestObj + "'", e);
}
}
private Document convertObjectToDocument(final Object xmlObj)
{
try
{
return convertObjectToDocument0(xmlObj);
}
catch (final Exception e)
{
throw new AdempiereException("Error while converting object '" + xmlObj + "' to XML document", e);
}
}
private Document convertObjectToDocument0(final Object xmlObj) throws JAXBException, ParserConfigurationException, SAXException, IOException
{
final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setValidating(false);
final DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
final Document document = documentBuilder.newDocument();
|
final JAXBElement<Object> jaxbElement = ObjectFactoryHelper.createJAXBElement(new ObjectFactory(), xmlObj);
jaxbMarshaller.marshal(jaxbElement, document);
return document;
}
private String createTransactionId()
{
final String transactionId = UUID.randomUUID().toString();
return transactionId;
}
@Override
public LoginResponse login(final LoginRequest loginRequest)
{
throw new UnsupportedOperationException();
// final PRTLoginRequestType xmlLoginRequest = LoginRequestConverter.instance.convert(loginRequest);
// final PRTLoginRequestType xmlLoginResponse = sendXmlObject(xmlLoginRequest);
// final LoginResponse loginResponse = LoginResponseConverter.instance.convert(xmlLoginResponse);
// return loginResponse;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.printing\de.metas.printing.embedded-client\src\main\java\de\metas\printing\client\endpoint\LoopbackPrintConnectionEndpoint.java
| 1
|
请完成以下Java代码
|
public void setPurchaseType (java.math.BigDecimal PurchaseType)
{
set_Value (COLUMNNAME_PurchaseType, PurchaseType);
}
/** Get Kaufstyp.
@return Kaufstyp */
@Override
public java.math.BigDecimal getPurchaseType ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PurchaseType);
if (bd == null)
{
return BigDecimal.ZERO;
}
return bd;
}
/** Get Preis per Überprüfung.
@return Preis per Überprüfung */
@Override
public java.math.BigDecimal getRequestPrice ()
|
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_RequestPrice);
if (bd == null)
{
return BigDecimal.ZERO;
}
return bd;
}
/** Set Preis per Überprüfung.
@param RequestPrice Preis per Überprüfung */
@Override
public void setRequestPrice (java.math.BigDecimal RequestPrice)
{
set_Value (COLUMNNAME_RequestPrice, RequestPrice);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.creditscore\creditpass\src\main\java-gen\de\metas\vertical\creditscore\creditpass\model\X_CS_Creditpass_Config_PaymentRule.java
| 1
|
请完成以下Java代码
|
public static class DocTypeQueryBuilder
{
public DocTypeQueryBuilder docBaseType(@NonNull final String docBaseType)
{
return docBaseType(DocBaseType.ofCode(docBaseType));
}
public DocTypeQueryBuilder docBaseType(@NonNull final DocBaseType docBaseType)
{
this.docBaseType = docBaseType;
return this;
}
public DocTypeQueryBuilder docSubTypeAny()
{
return docSubType(DOCSUBTYPE_Any);
}
public DocTypeQueryBuilder docSubTypeNone()
{
|
return docSubType(DOCSUBTYPE_NONE);
}
public DocTypeQueryBuilder clientAndOrgId(@NonNull final ClientAndOrgId clientAndOrgId)
{
return clientAndOrgId(clientAndOrgId.getClientId(), clientAndOrgId.getOrgId());
}
public DocTypeQueryBuilder clientAndOrgId(@NonNull final ClientId clientId, @NonNull final OrgId orgId)
{
adClientId(clientId.getRepoId());
adOrgId(orgId.getRepoId());
return this;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\document\DocTypeQuery.java
| 1
|
请完成以下Java代码
|
public String getArtifactId() {
return this.artifactId;
}
/**
* Sets the artifact id.
* @param artifactId the artifact id
*/
public void setArtifactId(String artifactId) {
this.artifactId = artifactId;
}
@Override
public String getVersion() {
return this.version;
}
/**
* Sets the version.
* @param version the version
*/
public void setVersion(String version) {
this.version = version;
}
@Override
public String getName() {
return this.name;
}
/**
* Sets the name.
* @param name the name
*/
public void setName(String name) {
this.name = name;
}
@Override
public String getDescription() {
return this.description;
}
/**
* Sets the description.
* @param description the description
*/
public void setDescription(String description) {
this.description = description;
}
@Override
public String getApplicationName() {
return this.applicationName;
}
|
/**
* Sets the application name.
* @param applicationName the application name
*/
public void setApplicationName(String applicationName) {
this.applicationName = applicationName;
}
@Override
public String getPackageName() {
if (StringUtils.hasText(this.packageName)) {
return this.packageName;
}
if (StringUtils.hasText(this.groupId) && StringUtils.hasText(this.artifactId)) {
return this.groupId + "." + this.artifactId;
}
return null;
}
/**
* Sets the package name.
* @param packageName the package name
*/
public void setPackageName(String packageName) {
this.packageName = packageName;
}
@Override
public String getBaseDirectory() {
return this.baseDirectory;
}
/**
* Sets the base directory.
* @param baseDirectory the base directory
*/
public void setBaseDirectory(String baseDirectory) {
this.baseDirectory = baseDirectory;
}
}
|
repos\initializr-main\initializr-generator\src\main\java\io\spring\initializr\generator\project\MutableProjectDescription.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private CreditLimitType retrieveCreditLimitTypePOJO(final int C_CreditLimit_Type_ID)
{
final I_C_CreditLimit_Type type = queryBL
.createQueryBuilder(I_C_CreditLimit_Type.class)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_C_CreditLimit_Type.COLUMN_C_CreditLimit_Type_ID, C_CreditLimit_Type_ID)
.create()
.firstOnlyNotNull(I_C_CreditLimit_Type.class);
return CreditLimitType.builder()
.creditLimitTypeId(CreditLimitTypeId.ofRepoId(type.getC_CreditLimit_Type_ID()))
.seqNo(SeqNo.ofInt(type.getSeqNo()))
.name(type.getName())
.autoApproval(type.isAutoApproval())
.build();
|
}
public Optional<I_C_BPartner_CreditLimit> retrieveCreditLimitByBPartnerId(final int bpartnerId, final int typeId)
{
return queryBL
.createQueryBuilder(I_C_BPartner_CreditLimit.class)
.addEqualsFilter(I_C_BPartner_CreditLimit.COLUMNNAME_C_BPartner_ID, bpartnerId)
.addEqualsFilter(I_C_BPartner_CreditLimit.COLUMNNAME_Processed, true)
.addEqualsFilter(I_C_BPartner_CreditLimit.COLUMNNAME_C_CreditLimit_Type_ID, typeId)
.addOnlyActiveRecordsFilter()
.addOnlyContextClient()
.create()
.stream().min(comparator);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\bpartner\service\BPartnerCreditLimitRepository.java
| 2
|
请完成以下Java代码
|
public org.eevolution.model.I_PP_Product_BOMVersions getPP_Product_BOMVersions()
{
return get_ValueAsPO(COLUMNNAME_PP_Product_BOMVersions_ID, org.eevolution.model.I_PP_Product_BOMVersions.class);
}
@Override
public void setPP_Product_BOMVersions(final org.eevolution.model.I_PP_Product_BOMVersions PP_Product_BOMVersions)
{
set_ValueFromPO(COLUMNNAME_PP_Product_BOMVersions_ID, org.eevolution.model.I_PP_Product_BOMVersions.class, PP_Product_BOMVersions);
}
@Override
public void setPP_Product_BOMVersions_ID (final int PP_Product_BOMVersions_ID)
{
if (PP_Product_BOMVersions_ID < 1)
set_ValueNoCheck (COLUMNNAME_PP_Product_BOMVersions_ID, null);
else
set_ValueNoCheck (COLUMNNAME_PP_Product_BOMVersions_ID, PP_Product_BOMVersions_ID);
}
@Override
public int getPP_Product_BOMVersions_ID()
{
return get_ValueAsInt(COLUMNNAME_PP_Product_BOMVersions_ID);
}
@Override
public void setPP_Product_Planning_ID (final int PP_Product_Planning_ID)
{
if (PP_Product_Planning_ID < 1)
set_ValueNoCheck (COLUMNNAME_PP_Product_Planning_ID, null);
else
set_ValueNoCheck (COLUMNNAME_PP_Product_Planning_ID, PP_Product_Planning_ID);
|
}
@Override
public int getPP_Product_Planning_ID()
{
return get_ValueAsInt(COLUMNNAME_PP_Product_Planning_ID);
}
@Override
public void setQty (final @Nullable BigDecimal Qty)
{
set_ValueNoCheck (COLUMNNAME_Qty, Qty);
}
@Override
public BigDecimal getQty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty);
return bd != null ? bd : BigDecimal.ZERO;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_PP_Maturing_Candidates_v.java
| 1
|
请完成以下Java代码
|
public class ProblemImpl implements Problem {
protected String message;
protected int line;
protected int column;
protected String mainElementId;
protected List<String> elementIds = new ArrayList<>();
public ProblemImpl(SAXParseException e) {
concatenateErrorMessages(e);
this.line = e.getLineNumber();
this.column = e.getColumnNumber();
}
public ProblemImpl(String errorMessage, Element element) {
this.message = errorMessage;
extractElementDetails(element);
}
public ProblemImpl(String errorMessage, Element element, String... elementIds) {
this(errorMessage, element);
this.mainElementId = elementIds[0];
for (String elementId : elementIds) {
if(elementId != null && elementId.length() > 0) {
this.elementIds.add(elementId);
}
}
}
public ProblemImpl(BpmnParseException exception) {
concatenateErrorMessages(exception);
extractElementDetails(exception.getElement());
}
public ProblemImpl(BpmnParseException exception, String elementId) {
this(exception);
this.mainElementId = elementId;
if(elementId != null && elementId.length() > 0) {
this.elementIds.add(elementId);
}
}
protected void concatenateErrorMessages(Throwable throwable) {
while (throwable != null) {
if (message == null) {
message = throwable.getMessage();
} else {
message += ": " + throwable.getMessage();
}
throwable = throwable.getCause();
}
}
protected void extractElementDetails(Element element) {
if (element != null) {
this.line = element.getLine();
this.column = element.getColumn();
String id = element.attribute("id");
if (id != null && id.length() > 0) {
this.mainElementId = id;
this.elementIds.add(id);
|
}
}
}
// getters
@Override
public String getMessage() {
return message;
}
@Override
public int getLine() {
return line;
}
@Override
public int getColumn() {
return column;
}
@Override
public String getMainElementId() {
return mainElementId;
}
@Override
public List<String> getElementIds() {
return elementIds;
}
public String toString() {
StringBuilder string = new StringBuilder();
if (line > 0) {
string.append(" | line " + line);
}
if (column > 0) {
string.append(" | column " + column);
}
return string.toString();
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\xml\ProblemImpl.java
| 1
|
请完成以下Java代码
|
public static <T> T lookup(Class<T> clazz, boolean optional) {
BeanManager bm = BeanManagerLookup.getBeanManager();
return lookup(clazz, bm, optional);
}
public static Object lookup(String name) {
BeanManager bm = BeanManagerLookup.getBeanManager();
return lookup(name, bm);
}
@SuppressWarnings("unchecked")
private static <T> T getContextualReference(BeanManager bm, Set<Bean<?>> beans, Class<?> type) {
if (beans == null || beans.size() == 0) {
return null;
}
// if we would resolve to multiple beans then BeanManager#resolve would throw an AmbiguousResolutionException
Bean<?> bean = bm.resolve(beans);
if (bean == null) {
return null;
} else {
CreationalContext<?> creationalContext = bm.createCreationalContext(bean);
// if we obtain a contextual reference to a @Dependent scope bean, make sure it is released
if(isDependentScoped(bean)) {
|
releaseOnContextClose(creationalContext, bean);
}
return (T) bm.getReference(bean, type, creationalContext);
}
}
private static boolean isDependentScoped(Bean<?> bean) {
return Dependent.class.equals(bean.getScope());
}
private static void releaseOnContextClose(CreationalContext<?> creationalContext, Bean<?> bean) {
CommandContext commandContext = Context.getCommandContext();
if(commandContext != null) {
commandContext.registerCommandContextListener(new CreationalContextReleaseListener(creationalContext));
} else {
LOG.warning("Obtained instance of @Dependent scoped bean "+bean +" outside of process engine command context. "
+ "Bean instance will not be destroyed. This is likely to create a memory leak. Please use a normal scope like @ApplicationScoped for this bean.");
}
}
}
|
repos\camunda-bpm-platform-master\engine-cdi\core\src\main\java\org\camunda\bpm\engine\cdi\impl\util\ProgrammaticBeanLookup.java
| 1
|
请完成以下Java代码
|
public final Void execute(CommandContext commandContext) {
ExternalWorkerJobEntity externalWorkerJob = resolveJob(commandContext);
if (!ScopeTypes.CMMN.equals(externalWorkerJob.getScopeType())) {
throw new FlowableException(externalWorkerJob + " is not cmmn scoped. This command can only handle cmmn scoped external worker jobs");
}
runJobLogic(externalWorkerJob, commandContext);
if (externalWorkerJob.isExclusive()) {
// Part of the same transaction to avoid a race condition with the
// potentially new jobs (wrt process instance locking) that are created
// during the execution of the original job
CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
new UnlockExclusiveJobCmd(externalWorkerJob, cmmnEngineConfiguration.getJobServiceConfiguration()).execute(commandContext);
}
return null;
}
protected abstract void runJobLogic(ExternalWorkerJobEntity externalWorkerJob, CommandContext commandContext);
protected void moveExternalWorkerJobToExecutableJob(ExternalWorkerJobEntity externalWorkerJob, CommandContext commandContext) {
CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
cmmnEngineConfiguration.getJobServiceConfiguration().getJobManager().moveExternalWorkerJobToExecutableJob(externalWorkerJob);
cmmnEngineConfiguration.getIdentityLinkServiceConfiguration().getIdentityLinkService()
.deleteIdentityLinksByScopeIdAndType(externalWorkerJob.getCorrelationId(), ScopeTypes.EXTERNAL_WORKER);
}
protected ExternalWorkerJobEntity resolveJob(CommandContext commandContext) {
if (StringUtils.isEmpty(externalJobId)) {
throw new FlowableIllegalArgumentException("externalJobId must not be empty");
}
if (StringUtils.isEmpty(workerId)) {
throw new FlowableIllegalArgumentException("workerId must not be empty");
|
}
CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
ExternalWorkerJobEntityManager externalWorkerJobEntityManager = cmmnEngineConfiguration.getJobServiceConfiguration().getExternalWorkerJobEntityManager();
ExternalWorkerJobEntity job = externalWorkerJobEntityManager.findById(externalJobId);
if (job == null) {
throw new FlowableObjectNotFoundException("No External Worker job found for id: " + externalJobId, ExternalWorkerJobEntity.class);
}
if (!Objects.equals(workerId, job.getLockOwner())) {
throw new FlowableIllegalArgumentException(workerId + " does not hold a lock on the requested job");
}
return job;
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\cmd\AbstractExternalWorkerJobCmd.java
| 1
|
请完成以下Java代码
|
public Object createValue(Class<?> type, String value)
{
Object v = null;
try
{
Constructor<?> init = type.getDeclaredConstructor(String.class);
v = init.newInstance(value);
}
catch (NoSuchMethodException e)
{
// ignore
}
catch (Exception e)
{
throw new IllegalArgumentException("Failed to convertPKUtoCWS " + value + " to type " + type.getName(), e);
}
return v;
}
};
public static final ValueCreator ENUM_CREATOR = new ValueCreator()
{
@SuppressWarnings({"unchecked", "rawtypes"})
public Object createValue(Class type, String value)
{
if (Enum.class.isAssignableFrom(type))
{
return Enum.valueOf(type, value);
}
return null;
}
|
};
private static final List<ValueCreator> DEFAULT_VALUE_CREATORS = Arrays.asList(Args.FROM_STRING_CONSTRUCTOR, Args.ENUM_CREATOR);
private static List<ValueCreator> valueCreators = new ArrayList<ValueCreator>(DEFAULT_VALUE_CREATORS);
/**
* Allows external extension of the valiue creators.
*
* @param vc another value creator to take into account for trying to create values
*/
public static void registerValueCreator(ValueCreator vc)
{
valueCreators.add(vc);
}
/**
* Cleanup of registered ValueCreators (mainly for tests)
*/
public static void resetValueCreators()
{
valueCreators.clear();
valueCreators.addAll(DEFAULT_VALUE_CREATORS);
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\model\perceptron\cli\Args.java
| 1
|
请完成以下Java代码
|
public static TargetRecordAction of(@NonNull final String tableName, final int recordId)
{
return of(TableRecordReference.of(tableName, recordId));
}
public static TargetRecordAction cast(final TargetAction targetAction)
{
return (TargetRecordAction)targetAction;
}
@NonNull @Builder.Default Optional<AdWindowId> adWindowId = Optional.empty();
@NonNull TableRecordReference record;
String recordDisplayText;
}
|
@lombok.Value
@lombok.Builder
public static class TargetViewAction implements TargetAction
{
public static TargetViewAction cast(final TargetAction targetAction)
{
return (TargetViewAction)targetAction;
}
@Nullable
AdWindowId adWindowId;
@NonNull
String viewId;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\notification\UserNotificationRequest.java
| 1
|
请完成以下Java代码
|
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
|
public String getDetailAddress() {
return detailAddress;
}
public void setDetailAddress(String detailAddress) {
this.detailAddress = detailAddress;
}
@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(", addressName=").append(addressName);
sb.append(", sendStatus=").append(sendStatus);
sb.append(", receiveStatus=").append(receiveStatus);
sb.append(", name=").append(name);
sb.append(", phone=").append(phone);
sb.append(", province=").append(province);
sb.append(", city=").append(city);
sb.append(", region=").append(region);
sb.append(", detailAddress=").append(detailAddress);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
|
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\OmsCompanyAddress.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void updateAuthor1() {
Author author = authorRepository.findById(1L).orElseThrow();
author.setAge(49);
}
// benefit of the global TransactionProfiler and local profiler
@Transactional
public void updateAuthor2() {
TransactionSynchronizationManager.registerSynchronization(
new TransactionSynchronizationAdapter() {
@Override
public void afterCompletion(int status) {
logger.info("After completion (method) ...");
}
@Override
public void afterCommit() {
logger.info("After commit (method) ...");
|
}
@Override
public void beforeCompletion() {
logger.info("Before completion (method) ...");
}
@Override
public void beforeCommit(boolean readOnly) {
logger.info("Before commit (method) ...");
}
});
Author author = authorRepository.findById(1L).orElseThrow();
author.setAge(51);
}
}
|
repos\Hibernate-SpringBoot-master\HibernateSpringBootTransactionCallback\src\main\java\com\bookstore\service\BookstoreService.java
| 2
|
请完成以下Java代码
|
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());
}
/** POSKeyLayoutType AD_Reference_ID=53351 */
public static final int POSKEYLAYOUTTYPE_AD_Reference_ID=53351;
/** Keyboard = K */
public static final String POSKEYLAYOUTTYPE_Keyboard = "K";
/** Numberpad = N */
public static final String POSKEYLAYOUTTYPE_Numberpad = "N";
/** Product = P */
|
public static final String POSKEYLAYOUTTYPE_Product = "P";
/** Set POS Key Layout Type.
@param POSKeyLayoutType
The type of Key Layout
*/
public void setPOSKeyLayoutType (String POSKeyLayoutType)
{
set_Value (COLUMNNAME_POSKeyLayoutType, POSKeyLayoutType);
}
/** Get POS Key Layout Type.
@return The type of Key Layout
*/
public String getPOSKeyLayoutType ()
{
return (String)get_Value(COLUMNNAME_POSKeyLayoutType);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_POSKeyLayout.java
| 1
|
请完成以下Java代码
|
public void setAD_User_SortPref_Line_ID (int AD_User_SortPref_Line_ID)
{
if (AD_User_SortPref_Line_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_User_SortPref_Line_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_User_SortPref_Line_ID, Integer.valueOf(AD_User_SortPref_Line_ID));
}
/** Get Sortierbegriff pro Benutzer Position.
@return Sortierbegriff pro Benutzer Position */
@Override
public int getAD_User_SortPref_Line_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_SortPref_Line_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Sortierbegriff pro Benutzer Position Produkt.
@param AD_User_SortPref_Line_Product_ID Sortierbegriff pro Benutzer Position Produkt */
@Override
public void setAD_User_SortPref_Line_Product_ID (int AD_User_SortPref_Line_Product_ID)
{
if (AD_User_SortPref_Line_Product_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_User_SortPref_Line_Product_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_User_SortPref_Line_Product_ID, Integer.valueOf(AD_User_SortPref_Line_Product_ID));
}
/** Get Sortierbegriff pro Benutzer Position Produkt.
@return Sortierbegriff pro Benutzer Position Produkt */
@Override
public int getAD_User_SortPref_Line_Product_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_SortPref_Line_Product_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public org.compiere.model.I_M_Product getM_Product() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_M_Product_ID, org.compiere.model.I_M_Product.class);
}
@Override
public void setM_Product(org.compiere.model.I_M_Product M_Product)
{
|
set_ValueFromPO(COLUMNNAME_M_Product_ID, org.compiere.model.I_M_Product.class, M_Product);
}
/** Set Produkt.
@param M_Product_ID
Produkt, Leistung, Artikel
*/
@Override
public void setM_Product_ID (int M_Product_ID)
{
if (M_Product_ID < 1)
set_Value (COLUMNNAME_M_Product_ID, null);
else
set_Value (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID));
}
/** Get Produkt.
@return Produkt, Leistung, Artikel
*/
@Override
public int getM_Product_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Reihenfolge.
@param SeqNo
Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst
*/
@Override
public void setSeqNo (int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
}
/** Get Reihenfolge.
@return Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst
*/
@Override
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_User_SortPref_Line_Product.java
| 1
|
请完成以下Java代码
|
public <T extends Constraint> Optional<T> getConstraint(final Class<T> constraintType)
{
@SuppressWarnings("unchecked")
final T constraint = (T)constraints.get(constraintType);
return Optional.ofNullable(constraint);
}
public static final class Builder
{
private final LinkedHashMap<Class<? extends Constraint>, Constraint> constraints = new LinkedHashMap<>();
private Builder()
{
super();
}
public Constraints build()
{
return new Constraints(this);
}
private ImmutableMap<Class<? extends Constraint>, Constraint> getConstraints()
{
return ImmutableMap.copyOf(constraints);
}
|
public Builder addConstraint(final Constraint constraint)
{
Check.assumeNotNull(constraint, "constraint not null");
constraints.put(constraint.getClass(), constraint);
return this;
}
public Builder addConstraintIfNotEquals(final Constraint constraint, final Constraint constraintToExclude)
{
Check.assumeNotNull(constraint, "constraint not null");
Check.assumeNotNull(constraintToExclude, "constraintToExclude not null");
if (constraint.equals(constraintToExclude))
{
return this;
}
constraints.put(constraint.getClass(), constraint);
return this;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\security\permissions\Constraints.java
| 1
|
请完成以下Java代码
|
public class KryoRedisSerializer<T> implements RedisSerializer<T> {
Logger logger = LoggerFactory.getLogger(KryoRedisSerializer.class);
public static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
private static final ThreadLocal<Kryo> kryos = ThreadLocal.withInitial(Kryo::new);
private Class<T> clazz;
public KryoRedisSerializer(Class<T> clazz) {
super();
this.clazz = clazz;
}
@Override
public byte[] serialize(T t) throws SerializationException {
if (t == null) {
return EMPTY_BYTE_ARRAY;
}
Kryo kryo = kryos.get();
kryo.setReferences(false);
kryo.register(clazz);
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
Output output = new Output(baos)) {
kryo.writeClassAndObject(output, t);
output.flush();
return baos.toByteArray();
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return EMPTY_BYTE_ARRAY;
}
@Override
|
public T deserialize(byte[] bytes) throws SerializationException {
if (bytes == null || bytes.length <= 0) {
return null;
}
Kryo kryo = kryos.get();
kryo.setReferences(false);
kryo.register(clazz);
try (Input input = new Input(bytes)) {
return (T) kryo.readClassAndObject(input);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return null;
}
}
|
repos\spring-boot-student-master\spring-boot-student-cache-redis-caffeine\src\main\java\com\xiaolyuh\cache\redis\serializer\KryoRedisSerializer.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
class Movie {
@Id
@GeneratedValue
private Long id;
private String title;
private String screenRoom;
private Instant startTime;
@ElementCollection
@CollectionTable(name = "screen_room_free_seats", joinColumns = @JoinColumn(name = "room_id"))
@Column(name = "seat_number")
private List<String> freeSeats = allSeats();
@ElementCollection
@CollectionTable(name = "screen_room_occupied_seats", joinColumns = @JoinColumn(name = "room_id"))
@Column(name = "seat_number")
private List<String> occupiedSeats = new ArrayList<>();
Movie(String movieName, String screenRoom, Instant startTime) {
this.title = movieName;
this.screenRoom = screenRoom;
this.startTime = startTime;
}
void occupySeat(String seatNumber) {
if (freeSeats.contains(seatNumber)) {
freeSeats.remove(seatNumber);
occupiedSeats.add(seatNumber);
} else {
throw new IllegalArgumentException("Seat " + seatNumber + " is not available.");
}
}
void freeSeat(String seatNumber) {
if (occupiedSeats.contains(seatNumber)) {
occupiedSeats.remove(seatNumber);
freeSeats.add(seatNumber);
} else {
throw new IllegalArgumentException("Seat " + seatNumber + " is not currently occupied.");
|
}
}
static List<String> allSeats() {
List<Integer> rows = IntStream.range(1, 20)
.boxed()
.toList();
return IntStream.rangeClosed('A', 'J')
.mapToObj(c -> String.valueOf((char) c))
.flatMap(col -> rows.stream()
.map(row -> col + row))
.sorted()
.toList();
}
protected Movie() {
// Default constructor for JPA
}
Instant startTime() {
return startTime;
}
String title() {
return title;
}
String screenRoom() {
return screenRoom;
}
List<String> freeSeats() {
return List.copyOf(freeSeats);
}
List<String> occupiedSeatsSeats() {
return List.copyOf(freeSeats);
}
}
|
repos\tutorials-master\spring-boot-modules\spring-boot-libraries-3\src\main\java\com\baeldung\spring\modulith\cqrs\movie\Movie.java
| 2
|
请完成以下Java代码
|
public Integer getGrade() {
return grade;
}
public void setGrade(Integer grade) {
this.grade = grade;
}
public Double getCount() {
return count;
}
public void setCount(Double count) {
this.count = count;
}
public Integer getStrategy() {
return strategy;
}
public void setStrategy(Integer strategy) {
this.strategy = strategy;
}
public String getRefResource() {
return refResource;
}
public void setRefResource(String refResource) {
this.refResource = refResource;
}
public Integer getControlBehavior() {
return controlBehavior;
}
public void setControlBehavior(Integer controlBehavior) {
this.controlBehavior = controlBehavior;
}
public Integer getWarmUpPeriodSec() {
return warmUpPeriodSec;
}
public void setWarmUpPeriodSec(Integer warmUpPeriodSec) {
this.warmUpPeriodSec = warmUpPeriodSec;
}
public Integer getMaxQueueingTimeMs() {
return maxQueueingTimeMs;
}
public void setMaxQueueingTimeMs(Integer maxQueueingTimeMs) {
this.maxQueueingTimeMs = maxQueueingTimeMs;
}
public boolean isClusterMode() {
return clusterMode;
}
public FlowRuleEntity setClusterMode(boolean clusterMode) {
this.clusterMode = clusterMode;
return this;
}
public ClusterFlowConfig getClusterConfig() {
return clusterConfig;
}
public FlowRuleEntity setClusterConfig(ClusterFlowConfig clusterConfig) {
this.clusterConfig = clusterConfig;
return this;
}
@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 FlowRule toRule() {
FlowRule flowRule = new FlowRule();
flowRule.setCount(this.count);
flowRule.setGrade(this.grade);
flowRule.setResource(this.resource);
flowRule.setLimitApp(this.limitApp);
flowRule.setRefResource(this.refResource);
flowRule.setStrategy(this.strategy);
if (this.controlBehavior != null) {
flowRule.setControlBehavior(controlBehavior);
}
if (this.warmUpPeriodSec != null) {
flowRule.setWarmUpPeriodSec(warmUpPeriodSec);
}
if (this.maxQueueingTimeMs != null) {
flowRule.setMaxQueueingTimeMs(maxQueueingTimeMs);
}
flowRule.setClusterMode(clusterMode);
flowRule.setClusterConfig(clusterConfig);
return flowRule;
}
}
|
repos\spring-boot-student-master\spring-boot-student-sentinel-dashboard\src\main\java\com\alibaba\csp\sentinel\dashboard\datasource\entity\rule\FlowRuleEntity.java
| 1
|
请完成以下Java代码
|
public final class NullComparator implements Comparator<Object>, Serializable
{
/**
*
*/
private static final long serialVersionUID = 8769676939269341332L;
@SuppressWarnings("rawtypes")
private static final Comparator instance = new NullComparator();
public static <T> Comparator<T> getInstance()
{
@SuppressWarnings("unchecked")
final Comparator<T> cmp = instance;
return cmp;
}
|
public static <T> boolean isNull(final Comparator<T> comparator)
{
return comparator == null || comparator == instance;
}
private NullComparator()
{
super();
}
@Override
public int compare(final Object o1, final Object o2)
{
return 0;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\org\adempiere\util\comparator\NullComparator.java
| 1
|
请完成以下Java代码
|
public int getM_AttributeSetInstance_ID()
{
return olCand.getM_AttributeSetInstance_ID();
}
@Override
public void setM_AttributeSetInstance_ID(final int M_AttributeSetInstance_ID)
{
olCand.setM_AttributeSetInstance_ID(M_AttributeSetInstance_ID);
values.setM_AttributeSetInstance_ID(M_AttributeSetInstance_ID);
}
@Override
public int getC_UOM_ID()
{
return olCandEffectiveValuesBL.getEffectiveUomId(olCand).getRepoId();
}
@Override
public void setC_UOM_ID(final int uomId)
{
values.setUomId(UomId.ofRepoIdOrNull(uomId));
// NOTE: uom is mandatory
// we assume orderLine's UOM is correct
if (uomId > 0)
{
olCand.setPrice_UOM_Internal_ID(uomId);
}
}
@Override
public BigDecimal getQtyTU()
{
return Quantitys.toBigDecimalOrNull(olCandEffectiveValuesBL.getQtyItemCapacity_Effective(olCand));
}
@Override
public void setQtyTU(final BigDecimal qtyPacks)
|
{
values.setQtyTU(qtyPacks);
}
@Override
public int getC_BPartner_ID()
{
final BPartnerId bpartnerId = olCandEffectiveValuesBL.getBPartnerEffectiveId(olCand);
return BPartnerId.toRepoId(bpartnerId);
}
@Override
public void setC_BPartner_ID(final int partnerId)
{
olCand.setC_BPartner_Override_ID(partnerId);
values.setBpartnerId(BPartnerId.ofRepoIdOrNull(partnerId));
}
@Override
public boolean isInDispute()
{
// order line has no IsInDispute flag
return values.isInDispute();
}
@Override
public void setInDispute(final boolean inDispute)
{
values.setInDispute(inDispute);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\adempiere\gui\search\impl\OLCandHUPackingAware.java
| 1
|
请完成以下Java代码
|
public Criteria andModifyTimeBetween(Date value1, Date value2) {
addCriterion("modify_time between", value1, value2, "modifyTime");
return (Criteria) this;
}
public Criteria andModifyTimeNotBetween(Date value1, Date value2) {
addCriterion("modify_time not between", value1, value2, "modifyTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
|
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
|
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\OmsOrderExample.java
| 1
|
请完成以下Java代码
|
public void setMSV3_Substitution_ID (int MSV3_Substitution_ID)
{
if (MSV3_Substitution_ID < 1)
set_ValueNoCheck (COLUMNNAME_MSV3_Substitution_ID, null);
else
set_ValueNoCheck (COLUMNNAME_MSV3_Substitution_ID, Integer.valueOf(MSV3_Substitution_ID));
}
/** Get Substitution.
@return Substitution */
@Override
public int getMSV3_Substitution_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_MSV3_Substitution_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/**
* MSV3_Substitutionsgrund AD_Reference_ID=540818
* Reference name: MSV3_Substitutionsgrund
*/
public static final int MSV3_SUBSTITUTIONSGRUND_AD_Reference_ID=540818;
/** Nachfolgeprodukt = Nachfolgeprodukt */
public static final String MSV3_SUBSTITUTIONSGRUND_Nachfolgeprodukt = "Nachfolgeprodukt";
|
/** ReUndParallelImport = ReUndParallelImport */
public static final String MSV3_SUBSTITUTIONSGRUND_ReUndParallelImport = "ReUndParallelImport";
/** Vorschlag = Vorschlag */
public static final String MSV3_SUBSTITUTIONSGRUND_Vorschlag = "Vorschlag";
/** Set Substitutionsgrund.
@param MSV3_Substitutionsgrund Substitutionsgrund */
@Override
public void setMSV3_Substitutionsgrund (java.lang.String MSV3_Substitutionsgrund)
{
set_Value (COLUMNNAME_MSV3_Substitutionsgrund, MSV3_Substitutionsgrund);
}
/** Get Substitutionsgrund.
@return Substitutionsgrund */
@Override
public java.lang.String getMSV3_Substitutionsgrund ()
{
return (java.lang.String)get_Value(COLUMNNAME_MSV3_Substitutionsgrund);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.vendor.gateway.msv3\src\main\java-gen\de\metas\vertical\pharma\vendor\gateway\msv3\model\X_MSV3_Substitution.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public boolean equals(final Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
final H120 other = (H120)obj;
if (messageNo == null)
{
if (other.messageNo != null)
{
return false;
}
}
else if (!messageNo.equals(other.messageNo))
{
return false;
}
if (partner == null)
{
if (other.partner != null)
{
return false;
}
}
else if (!partner.equals(other.partner))
{
return false;
}
if (qualifier == null)
{
if (other.qualifier != null)
{
return false;
}
}
else if (!qualifier.equals(other.qualifier))
{
return false;
}
if (record == null)
{
if (other.record != null)
{
return false;
}
}
else if (!record.equals(other.record))
{
return false;
}
if (text1 == null)
{
if (other.text1 != null)
{
return false;
}
}
else if (!text1.equals(other.text1))
{
return false;
}
if (text2 == null)
{
if (other.text2 != null)
{
return false;
}
}
else if (!text2.equals(other.text2))
{
return false;
|
}
if (text3 == null)
{
if (other.text3 != null)
{
return false;
}
}
else if (!text3.equals(other.text3))
{
return false;
}
if (text4 == null)
{
if (other.text4 != null)
{
return false;
}
}
else if (!text4.equals(other.text4))
{
return false;
}
if (text5 == null)
{
if (other.text5 != null)
{
return false;
}
}
else if (!text5.equals(other.text5))
{
return false;
}
return true;
}
@Override
public String toString()
{
return "H120 [record=" + record + ", partner=" + partner + ", messageNo=" + messageNo + ", qualifier=" + qualifier + ", text1=" + text1 + ", text2=" + text2
+ ", text3=" + text3 + ", text4="
+ text4 + ", text5=" + text5 + "]";
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java\de\metas\edi\esb\ordersimport\compudata\H120.java
| 2
|
请完成以下Java代码
|
public String getFormKey() {
return formKey;
}
public String getExtraValue() {
return extraValue;
}
public String getInvolvedUser() {
return involvedUser;
}
public Collection<String> getInvolvedGroups() {
return involvedGroups;
}
public String getTenantId() {
return tenantId;
}
public boolean isWithoutTenantId() {
return withoutTenantId;
}
public boolean isIncludeLocalVariables() {
return includeLocalVariables;
}
public List<List<String>> getSafeInvolvedGroups() {
return safeInvolvedGroups;
}
public void setSafeInvolvedGroups(List<List<String>> safeInvolvedGroups) {
this.safeInvolvedGroups = safeInvolvedGroups;
}
@Override
protected void ensureVariablesInitialized() {
super.ensureVariablesInitialized();
for (PlanItemInstanceQueryImpl orQueryObject : orQueryObjects) {
|
orQueryObject.ensureVariablesInitialized();
}
}
public List<PlanItemInstanceQueryImpl> getOrQueryObjects() {
return orQueryObjects;
}
public List<List<String>> getSafeCaseInstanceIds() {
return safeCaseInstanceIds;
}
public void setSafeCaseInstanceIds(List<List<String>> safeProcessInstanceIds) {
this.safeCaseInstanceIds = safeProcessInstanceIds;
}
public Collection<String> getCaseInstanceIds() {
return caseInstanceIds;
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\runtime\PlanItemInstanceQueryImpl.java
| 1
|
请完成以下Java代码
|
private void pointcut() {
}
@Before("pointcut()")
public void before() {
System.out.println("********** @Before 前置通知");
}
@After("pointcut()")
public void after() {
System.out.println("******** @After 后置通知");
}
@AfterReturning("pointcut()")
public void afterReturning() {
System.out.println("******* @AfterReturning 返回通知");
}
|
@AfterThrowing("pointcut()")
public void afterThrowing() {
System.out.println("******** @AfterThrowing 异常通知");
}
@Around("pointcut()")
public Object around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
Object result;
System.out.println("环绕通知之前");
result = proceedingJoinPoint.proceed();
System.out.println("环绕通知之后");
return result;
}
}
|
repos\spring-boot-best-practice-master\spring-boot-aop\src\main\java\cn\javastack\springboot\aop\aspect\CalcAspect.java
| 1
|
请完成以下Java代码
|
public TenantQuery userMember(String userId) {
ensureNotNull("user id", userId);
this.userId = userId;
return this;
}
public TenantQuery groupMember(String groupId) {
ensureNotNull("group id", groupId);
this.groupId = groupId;
return this;
}
public TenantQuery includingGroupsOfUser(boolean includingGroups) {
this.includingGroups = includingGroups;
return this;
}
//sorting ////////////////////////////////////////////////////////
public TenantQuery orderByTenantId() {
return orderBy(TenantQueryProperty.GROUP_ID);
}
public TenantQuery orderByTenantName() {
return orderBy(TenantQueryProperty.NAME);
}
//getters ////////////////////////////////////////////////////////
public String getId() {
return id;
}
public String getName() {
|
return name;
}
public String getNameLike() {
return nameLike;
}
public String[] getIds() {
return ids;
}
public String getUserId() {
return userId;
}
public String getGroupId() {
return groupId;
}
public boolean isIncludingGroups() {
return includingGroups;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\TenantQueryImpl.java
| 1
|
请完成以下Java代码
|
protected VariableInstanceQuery baseQuery() {
return getEngine().getRuntimeService().createVariableInstanceQuery().variableId(getId());
}
@Override
protected Query<VariableInstanceQuery, VariableInstance> baseQueryForBinaryVariable() {
return baseQuery().disableCustomObjectDeserialization();
}
@Override
protected Query<VariableInstanceQuery, VariableInstance> baseQueryForVariable(boolean deserializeObjectValue) {
VariableInstanceQuery baseQuery = baseQuery();
// do not fetch byte arrays
baseQuery.disableBinaryFetching();
if (!deserializeObjectValue) {
baseQuery.disableCustomObjectDeserialization();
}
return baseQuery;
|
}
@Override
protected TypedValue transformQueryResultIntoTypedValue(VariableInstance queryResult) {
return queryResult.getTypedValue();
}
@Override
protected VariableInstanceDto transformToDto(VariableInstance queryResult) {
return VariableInstanceDto.fromVariableInstance(queryResult);
}
@Override
protected String getResourceNameForErrorMessage() {
return "Variable instance";
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\sub\runtime\impl\VariableInstanceResourceImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
@ApiModelProperty(example = "null")
public String getTaskUrl() {
return taskUrl;
}
public void setTaskUrl(String taskUrl) {
this.taskUrl = taskUrl;
}
|
@ApiModelProperty(example = "5")
public String getCaseInstanceId() {
return caseInstanceId;
}
public void setCaseInstanceId(String caseInstanceId) {
this.caseInstanceId = caseInstanceId;
}
@ApiModelProperty(example = "http://localhost:8182/cmmn-history/historic-case-instances/5")
public String getCaseInstanceUrl() {
return caseInstanceUrl;
}
public void setCaseInstanceUrl(String caseInstanceUrl) {
this.caseInstanceUrl = caseInstanceUrl;
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\history\task\HistoricIdentityLinkResponse.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public Watch getWatch() {
return this.watch;
}
public static class Watch {
/**
* File watching.
*/
private final File file = new File();
public File getFile() {
return this.file;
}
public static class File {
/**
* Quiet period, after which changes are detected.
*/
private Duration quietPeriod = Duration.ofSeconds(10);
|
public Duration getQuietPeriod() {
return this.quietPeriod;
}
public void setQuietPeriod(Duration quietPeriod) {
this.quietPeriod = quietPeriod;
}
}
}
}
}
|
repos\spring-boot-4.0.1\core\spring-boot-autoconfigure\src\main\java\org\springframework\boot\autoconfigure\ssl\SslProperties.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class KeyspaceRepository {
private Session session;
public KeyspaceRepository(Session session) {
this.session = session;
}
/**
* Method used to create any keyspace - schema.
*
* @param keyspaceName the name of the keyspaceName.
* @param replicationStrategy the replication strategy.
* @param numberOfReplicas the number of replicas.
*
*/
public void createKeyspace(String keyspaceName, String replicationStrategy, int numberOfReplicas) {
StringBuilder sb = new StringBuilder("CREATE KEYSPACE IF NOT EXISTS ").append(keyspaceName).append(" WITH replication = {").append("'class':'").append(replicationStrategy).append("','replication_factor':").append(numberOfReplicas).append("};");
final String query = sb.toString();
session.execute(query);
}
public void useKeyspace(String keyspace) {
|
session.execute("USE " + keyspace);
}
/**
* Method used to delete the specified schema.
* It results in the immediate, irreversable removal of the keyspace, including all tables and data contained in the keyspace.
*
* @param keyspaceName the name of the keyspace to delete.
*/
public void deleteKeyspace(String keyspaceName) {
StringBuilder sb = new StringBuilder("DROP KEYSPACE ").append(keyspaceName);
final String query = sb.toString();
session.execute(query);
}
}
|
repos\tutorials-master\persistence-modules\java-cassandra\src\main\java\com\baeldung\cassandra\java\client\repository\KeyspaceRepository.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public @Nullable List<String> getDataLocations() {
return this.dataLocations;
}
public void setDataLocations(@Nullable List<String> dataLocations) {
this.dataLocations = dataLocations;
}
public String getPlatform() {
return this.platform;
}
public void setPlatform(String platform) {
this.platform = platform;
}
public @Nullable String getUsername() {
return this.username;
}
public void setUsername(@Nullable String username) {
this.username = username;
}
public @Nullable String getPassword() {
return this.password;
}
public void setPassword(@Nullable String password) {
this.password = password;
}
|
public boolean isContinueOnError() {
return this.continueOnError;
}
public void setContinueOnError(boolean continueOnError) {
this.continueOnError = continueOnError;
}
public String getSeparator() {
return this.separator;
}
public void setSeparator(String separator) {
this.separator = separator;
}
public @Nullable Charset getEncoding() {
return this.encoding;
}
public void setEncoding(@Nullable Charset encoding) {
this.encoding = encoding;
}
public DatabaseInitializationMode getMode() {
return this.mode;
}
public void setMode(DatabaseInitializationMode mode) {
this.mode = mode;
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-sql\src\main\java\org\springframework\boot\sql\autoconfigure\init\SqlInitializationProperties.java
| 2
|
请完成以下Java代码
|
public void setM_LU_HU_PI_ID (final int M_LU_HU_PI_ID)
{
if (M_LU_HU_PI_ID < 1)
set_Value (COLUMNNAME_M_LU_HU_PI_ID, null);
else
set_Value (COLUMNNAME_M_LU_HU_PI_ID, M_LU_HU_PI_ID);
}
@Override
public int getM_LU_HU_PI_ID()
{
return get_ValueAsInt(COLUMNNAME_M_LU_HU_PI_ID);
}
@Override
public de.metas.handlingunits.model.I_M_HU_PI_Item getM_LU_HU_PI_Item()
{
return get_ValueAsPO(COLUMNNAME_M_LU_HU_PI_Item_ID, de.metas.handlingunits.model.I_M_HU_PI_Item.class);
}
@Override
public void setM_LU_HU_PI_Item(final de.metas.handlingunits.model.I_M_HU_PI_Item M_LU_HU_PI_Item)
{
set_ValueFromPO(COLUMNNAME_M_LU_HU_PI_Item_ID, de.metas.handlingunits.model.I_M_HU_PI_Item.class, M_LU_HU_PI_Item);
}
@Override
public void setM_LU_HU_PI_Item_ID (final int M_LU_HU_PI_Item_ID)
{
if (M_LU_HU_PI_Item_ID < 1)
set_Value (COLUMNNAME_M_LU_HU_PI_Item_ID, null);
else
set_Value (COLUMNNAME_M_LU_HU_PI_Item_ID, M_LU_HU_PI_Item_ID);
}
@Override
public int getM_LU_HU_PI_Item_ID()
{
return get_ValueAsInt(COLUMNNAME_M_LU_HU_PI_Item_ID);
}
@Override
public void setM_Product_ID (final int M_Product_ID)
{
if (M_Product_ID < 1)
set_Value (COLUMNNAME_M_Product_ID, null);
else
set_Value (COLUMNNAME_M_Product_ID, M_Product_ID);
}
@Override
public int getM_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
@Override
public de.metas.handlingunits.model.I_M_HU_PI getM_TU_HU_PI()
{
return get_ValueAsPO(COLUMNNAME_M_TU_HU_PI_ID, de.metas.handlingunits.model.I_M_HU_PI.class);
}
@Override
public void setM_TU_HU_PI(final de.metas.handlingunits.model.I_M_HU_PI M_TU_HU_PI)
{
set_ValueFromPO(COLUMNNAME_M_TU_HU_PI_ID, de.metas.handlingunits.model.I_M_HU_PI.class, M_TU_HU_PI);
}
@Override
public void setM_TU_HU_PI_ID (final int M_TU_HU_PI_ID)
{
if (M_TU_HU_PI_ID < 1)
set_Value (COLUMNNAME_M_TU_HU_PI_ID, null);
else
set_Value (COLUMNNAME_M_TU_HU_PI_ID, M_TU_HU_PI_ID);
}
@Override
|
public int getM_TU_HU_PI_ID()
{
return get_ValueAsInt(COLUMNNAME_M_TU_HU_PI_ID);
}
@Override
public void setQtyCUsPerTU (final BigDecimal QtyCUsPerTU)
{
set_Value (COLUMNNAME_QtyCUsPerTU, QtyCUsPerTU);
}
@Override
public BigDecimal getQtyCUsPerTU()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyCUsPerTU);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyLU (final BigDecimal QtyLU)
{
set_Value (COLUMNNAME_QtyLU, QtyLU);
}
@Override
public BigDecimal getQtyLU()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyLU);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyTU (final BigDecimal QtyTU)
{
set_Value (COLUMNNAME_QtyTU, QtyTU);
}
@Override
public BigDecimal getQtyTU()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyTU);
return bd != null ? bd : BigDecimal.ZERO;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java-gen\de\metas\handlingunits\model\X_M_HU_LUTU_Configuration.java
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.