instruction
string
input
string
output
string
source_file
string
priority
int64
请完成以下Java代码
public long executeCount(CommandContext commandContext) { checkQueryOk(); return commandContext .getJobManager() .findJobCountByQueryCriteria(this); } @Override public List<Job> executeList(CommandContext commandContext, Page page) { checkQueryOk(); return commandContext .getJobManager() .findJobsByQueryCriteria(this, page); } @Override public List<ImmutablePair<String, String>> executeDeploymentIdMappingsList(CommandContext commandContext) { checkQueryOk(); return commandContext .getJobManager() .findDeploymentIdMappingsByQueryCriteria(this); } //getters ////////////////////////////////////////// public Set<String> getIds() { return ids; } public String getRootProcessInstanceId() { return rootProcessInstanceId; } public String getProcessInstanceId() { return processInstanceId; } public Set<String> getProcessInstanceIds() {
return processInstanceIds; } public String getExecutionId() { return executionId; } public boolean getRetriesLeft() { return retriesLeft; } public boolean getExecutable() { return executable; } public Date getNow() { return ClockUtil.getCurrentTime(); } public boolean isWithException() { return withException; } public String getExceptionMessage() { return exceptionMessage; } public boolean getAcquired() { return acquired; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\JobQueryImpl.java
1
请完成以下Java代码
protected PlainTrx createTrx(String trxName, final boolean autoCommit) { Adempiere.assertUnitTestMode(); try { return new PlainTrx(this, trxName, autoCommit); } catch (Exception e) { throw DBException.wrapIfNeeded(e); } } public PlainTrxManager setFailCommitIfTrxNotStarted(final boolean failCommitIfTrxNotStarted) { this.failCommitIfTrxNotStarted = failCommitIfTrxNotStarted; return this; } public boolean isFailCommitIfTrxNotStarted() { return failCommitIfTrxNotStarted; } public PlainTrxManager setFailRollbackIfTrxNotStarted(final boolean failRollbackIfTrxNotStarted) { this.failRollbackIfTrxNotStarted = failRollbackIfTrxNotStarted; return this; } public boolean isFailRollbackIfTrxNotStarted() {
return failRollbackIfTrxNotStarted; } public void assertNoActiveTransactions() { final List<ITrx> activeTrxs = getActiveTransactionsList(); Check.assume(activeTrxs.isEmpty(), "Expected no active transactions but got: {}", activeTrxs); } /** * Ask the transactions to log their major events like COMMIT, ROLLBACK. * Those events will be visible on {@link PlainTrx#toString()}. * * @param debugTrxLog */ public void setDebugTrxLog(boolean debugTrxLog) { this.debugTrxLog = debugTrxLog; } /** * @see #setDebugTrxLog(boolean) */ public boolean isDebugTrxLog() { return debugTrxLog; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\trx\api\impl\PlainTrxManager.java
1
请在Spring Boot框架中完成以下Java代码
public class Screenshot implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; private Timestamp createOn; public Long getId() { return id; } public void setId(Long id) { this.id = id; }
public String getName() { return name; } public void setName(String name) { this.name = name; } public Timestamp getCreateOn() { return createOn; } public void setCreateOn(Timestamp createOn) { this.createOn = createOn; } }
repos\Hibernate-SpringBoot-master\HibernateSpringBootUTCTimezone\src\main\java\com\app\entity\Screenshot.java
2
请在Spring Boot框架中完成以下Java代码
public class ChatController { private final ChatService chatService; public ChatController(ChatService chatService) { this.chatService = chatService; } @PostMapping(value = "/chat") public Mono<String> chat(@RequestBody @Valid ChatRequest request) { return chatService.chatAsWord(request.getPrompt()) .collectList() .map(list -> String.join("", list)); }
@PostMapping(value = "/chat-word", produces = MediaType.TEXT_EVENT_STREAM_VALUE) public Flux<String> chatAsWord(@RequestBody @Valid ChatRequest request) { return chatService.chatAsWord(request.getPrompt()); } @PostMapping(value = "/chat-chunk", produces = MediaType.TEXT_EVENT_STREAM_VALUE) public Flux<String> chatAsChunk(@RequestBody @Valid ChatRequest request) { return chatService.chatAsChunk(request.getPrompt()); } @PostMapping(value = "/chat-json", produces = MediaType.TEXT_EVENT_STREAM_VALUE) public Flux<String> chatAsJson(@RequestBody @Valid ChatRequest request) { return chatService.chatAsJson(request.getPrompt()); } }
repos\tutorials-master\spring-ai-modules\spring-ai-chat-stream\src\main\java\com\baeldung\springai\streaming\ChatController.java
2
请完成以下Java代码
public final class InventoryAndLineIdSet { public static final InventoryAndLineIdSet EMPTY = new InventoryAndLineIdSet(ImmutableSet.of()); @NonNull private final ImmutableSet<InventoryAndLineId> set; @NonNull @Getter private final ImmutableSet<InventoryId> inventoryIds; private InventoryAndLineIdSet(@NonNull final Collection<InventoryAndLineId> set) { this.set = ImmutableSet.copyOf(set); this.inventoryIds = set.stream().map(InventoryAndLineId::getInventoryId).collect(ImmutableSet.toImmutableSet()); } public static InventoryAndLineIdSet ofCollection(@NonNull final Collection<InventoryAndLineId> inventoryAndLineIds) { return inventoryAndLineIds.isEmpty() ? EMPTY : new InventoryAndLineIdSet(inventoryAndLineIds); } public static @NonNull InventoryAndLineIdSet of(final @NonNull InventoryAndLineId inventoryAndLineId) { return new InventoryAndLineIdSet(ImmutableSet.of(inventoryAndLineId)); } public static Collector<InventoryAndLineId, ?, InventoryAndLineIdSet> collect() { return GuavaCollectors.collectUsingHashSetAccumulator(InventoryAndLineIdSet::ofCollection); } public boolean isEmpty() {return set.isEmpty();}
public boolean contains(final InventoryAndLineId inventoryAndLineId) { return set.contains(inventoryAndLineId); } public boolean contains(final I_M_InventoryLine inventoryLineRecord) { return contains(InventoryAndLineId.of(inventoryLineRecord)); } public Stream<InventoryAndLineId> stream() { return set.stream(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\inventory\InventoryAndLineIdSet.java
1
请在Spring Boot框架中完成以下Java代码
default String getRelativePath(String path) { String prefix = getPrefix(); if (!path.startsWith("/")) { path = "/" + path; } return prefix + path; } /** * Return a cleaned up version of the path that can be used as a prefix for URLs. The * resulting path will have path will not have a trailing slash. * @return the prefix * @see #getRelativePath(String) */ default String getPrefix() { String result = getPath(); int index = result.indexOf('*'); if (index != -1) { result = result.substring(0, index); } if (result.endsWith("/")) { result = result.substring(0, result.length() - 1); } return result; } /** * Return a URL mapping pattern that can be used with a
* {@link ServletRegistrationBean} to map the dispatcher servlet. * @return the path as a servlet URL mapping */ default String getServletUrlMapping() { if (getPath().isEmpty() || getPath().equals("/")) { return "/"; } if (getPath().contains("*")) { return getPath(); } if (getPath().endsWith("/")) { return getPath() + "*"; } return getPath() + "/*"; } }
repos\spring-boot-4.0.1\module\spring-boot-webmvc\src\main\java\org\springframework\boot\webmvc\autoconfigure\DispatcherServletPath.java
2
请完成以下Java代码
public static boolean hasText(String string) { return string != null && !string.isEmpty(); } public static String join(Iterator<String> iterator) { StringBuilder builder = new StringBuilder(); while (iterator.hasNext()) { builder.append(iterator.next()); if (iterator.hasNext()) { builder.append(", "); } } return builder.toString(); } public abstract static class StringIterator<T> implements Iterator<String> {
protected Iterator<? extends T> iterator; public StringIterator(Iterator<? extends T> iterator) { this.iterator = iterator; } public boolean hasNext() { return iterator.hasNext(); } public void remove() { iterator.remove(); } } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\util\StringUtil.java
1
请完成以下Java代码
public void close() throws IOException { wrappedReader.close(); } public synchronized void mark(int readlimit) throws IOException { wrappedReader.mark(readlimit); } public boolean markSupported() { return wrappedReader.markSupported(); } public synchronized void reset() throws IOException { wrappedReader.reset(); } public long skip(long n) throws IOException { return wrappedReader.skip(n); } /** * Rewinds the reader such that the initial characters are returned when invoking read(). * * Throws an exception if more than the buffering limit has already been read. * @throws IOException */ public void rewind() throws IOException { if (!rewindable) { throw LOG.unableToRewindReader();
} wrappedReader.unread(buffer, 0, pos); pos = 0; } public int getRewindBufferSize() { return buffer.length; } /** * * @return the number of characters that can still be read and rewound. */ public int getCurrentRewindableCapacity() { return buffer.length - pos; } }
repos\camunda-bpm-platform-master\spin\core\src\main\java\org\camunda\spin\impl\util\RewindableReader.java
1
请在Spring Boot框架中完成以下Java代码
public int getDependent(int index) { if (arcs[index] != null) return arcs[index].relationId; return -1; } public void setMaxSentenceSize(int maxSentenceSize) { this.maxSentenceSize = maxSentenceSize; } public void incrementBufferHead() { if (bufferHead == maxSentenceSize) bufferHead = -1; else bufferHead++; } public void setBufferHead(int bufferHead) { this.bufferHead = bufferHead; } @Override public State clone() { State state = new State(arcs.length - 1); state.stack = new ArrayDeque<Integer>(stack); for (int dependent = 0; dependent < arcs.length; dependent++) { if (arcs[dependent] != null) { Edge head = arcs[dependent];
state.arcs[dependent] = head; int h = head.headIndex; if (rightMostArcs[h] != 0) { state.rightMostArcs[h] = rightMostArcs[h]; state.rightValency[h] = rightValency[h]; state.rightDepLabels[h] = rightDepLabels[h]; } if (leftMostArcs[h] != 0) { state.leftMostArcs[h] = leftMostArcs[h]; state.leftValency[h] = leftValency[h]; state.leftDepLabels[h] = leftDepLabels[h]; } } } state.rootIndex = rootIndex; state.bufferHead = bufferHead; state.maxSentenceSize = maxSentenceSize; state.emptyFlag = emptyFlag; return state; } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\dependency\perceptron\transition\configuration\State.java
2
请完成以下Java代码
public List<CallableElementParameter> getInputs() { return inputs; } public void addInput(CallableElementParameter input) { inputs.add(input); } public void addInputs(List<CallableElementParameter> inputs) { this.inputs.addAll(inputs); } public VariableMap getInputVariables(VariableScope variableScope) { List<CallableElementParameter> inputs = getInputs(); return getVariables(inputs, variableScope); } // outputs ///////////////////////////////////////////////////////////////////// public List<CallableElementParameter> getOutputs() { return outputs; } public List<CallableElementParameter> getOutputsLocal() { return outputsLocal; } public void addOutput(CallableElementParameter output) { outputs.add(output); } public void addOutputLocal(CallableElementParameter output) { outputsLocal.add(output); }
public void addOutputs(List<CallableElementParameter> outputs) { this.outputs.addAll(outputs); } public VariableMap getOutputVariables(VariableScope calledElementScope) { List<CallableElementParameter> outputs = getOutputs(); return getVariables(outputs, calledElementScope); } public VariableMap getOutputVariablesLocal(VariableScope calledElementScope) { List<CallableElementParameter> outputs = getOutputsLocal(); return getVariables(outputs, calledElementScope); } // variables ////////////////////////////////////////////////////////////////// protected VariableMap getVariables(List<CallableElementParameter> params, VariableScope variableScope) { VariableMap result = Variables.createVariables(); for (CallableElementParameter param : params) { param.applyTo(variableScope, result); } return result; } // deployment id ////////////////////////////////////////////////////////////// }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\core\model\CallableElement.java
1
请完成以下Java代码
public class TimerEventDefinitionImpl extends EventDefinitionImpl implements TimerEventDefinition { protected static ChildElement<TimeDate> timeDateChild; protected static ChildElement<TimeDuration> timeDurationChild; protected static ChildElement<TimeCycle> timeCycleChild; public static void registerType(ModelBuilder modelBuilder) { ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(TimerEventDefinition.class, BPMN_ELEMENT_TIMER_EVENT_DEFINITION) .namespaceUri(BPMN20_NS) .extendsType(EventDefinition.class) .instanceProvider(new ModelTypeInstanceProvider<TimerEventDefinition>() { public TimerEventDefinition newInstance(ModelTypeInstanceContext instanceContext) { return new TimerEventDefinitionImpl(instanceContext); } }); SequenceBuilder sequenceBuilder = typeBuilder.sequence(); timeDateChild = sequenceBuilder.element(TimeDate.class) .build(); timeDurationChild = sequenceBuilder.element(TimeDuration.class) .build(); timeCycleChild = sequenceBuilder.element(TimeCycle.class) .build(); typeBuilder.build(); } public TimerEventDefinitionImpl(ModelTypeInstanceContext context) { super(context); }
public TimeDate getTimeDate() { return timeDateChild.getChild(this); } public void setTimeDate(TimeDate timeDate) { timeDateChild.setChild(this, timeDate); } public TimeDuration getTimeDuration() { return timeDurationChild.getChild(this); } public void setTimeDuration(TimeDuration timeDuration) { timeDurationChild.setChild(this, timeDuration); } public TimeCycle getTimeCycle() { return timeCycleChild.getChild(this); } public void setTimeCycle(TimeCycle timeCycle) { timeCycleChild.setChild(this, timeCycle); } }
repos\camunda-bpm-platform-master\model-api\bpmn-model\src\main\java\org\camunda\bpm\model\bpmn\impl\instance\TimerEventDefinitionImpl.java
1
请完成以下Java代码
private final void createUpdateBPCreditLimit( @NonNull final BPartnerId bpartnerId, @NonNull final BigDecimal amount, final int typeId) { final Optional<I_C_BPartner_CreditLimit> bpCreditLimit = creditLimitRepo.retrieveCreditLimitByBPartnerId(bpartnerId.getRepoId(), typeId); if (bpCreditLimit.isPresent()) { final I_C_BPartner_CreditLimit creditLimit = bpCreditLimit.get(); creditLimit.setAmount(amount); InterfaceWrapperHelper.save(bpCreditLimit); } else { final I_C_BPartner_CreditLimit creditLimit = createBPCreditLimit(amount, typeId);
creditLimit.setC_BPartner_ID(bpartnerId.getRepoId()); InterfaceWrapperHelper.save(bpCreditLimit); } } private final I_C_BPartner_CreditLimit createBPCreditLimit(@NonNull final BigDecimal amount, final int typeId) { final I_C_BPartner_CreditLimit bpCreditLimit = InterfaceWrapperHelper.newInstance(I_C_BPartner_CreditLimit.class); bpCreditLimit.setAmount(amount); bpCreditLimit.setC_CreditLimit_Type_ID(typeId); bpCreditLimit.setDateFrom(SystemTime.asDayTimestamp()); bpCreditLimit.setProcessed(true); return bpCreditLimit; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\bpartner\impexp\BPCreditLimitImportHelper.java
1
请在Spring Boot框架中完成以下Java代码
public OrderStatus salesId(String salesId) { this.salesId = salesId; return this; } /** * Id des Auftrags aus WaWi * @return salesId **/ @Schema(example = "A123445", required = true, description = "Id des Auftrags aus WaWi") public String getSalesId() { return salesId; } public void setSalesId(String salesId) { this.salesId = salesId; } public OrderStatus status(BigDecimal status) { this.status = status; return this; } /** * -3 &#x3D; Ausstehend, 0 &#x3D; Angelegt, 1 &#x3D; Übermittelt, 2 &#x3D; Übermittlung fehlgeschlagen, 3 &#x3D; Verarbeitet, 4 &#x3D; Versandt, 5 &#x3D; Ausgeliefert, 6 &#x3D; Gelöscht, 7 &#x3D; Storniert, 8 &#x3D; Gestoppte Serienbestellung * @return status **/ @Schema(example = "3", required = true, description = "-3 = Ausstehend, 0 = Angelegt, 1 = Übermittelt, 2 = Übermittlung fehlgeschlagen, 3 = Verarbeitet, 4 = Versandt, 5 = Ausgeliefert, 6 = Gelöscht, 7 = Storniert, 8 = Gestoppte Serienbestellung") public BigDecimal getStatus() { return status; } public void setStatus(BigDecimal status) { this.status = status; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } OrderStatus orderStatus = (OrderStatus) o; return Objects.equals(this._id, orderStatus._id) &&
Objects.equals(this.salesId, orderStatus.salesId) && Objects.equals(this.status, orderStatus.status); } @Override public int hashCode() { return Objects.hash(_id, salesId, status); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class OrderStatus {\n"); sb.append(" _id: ").append(toIndentedString(_id)).append("\n"); sb.append(" salesId: ").append(toIndentedString(salesId)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\alberta\alberta-orders-api\src\main\java\io\swagger\client\model\OrderStatus.java
2
请完成以下Java代码
public java.lang.String getDescription() { return get_ValueAsString(COLUMNNAME_Description); } @Override public void setM_Allergen_ID (final int M_Allergen_ID) { if (M_Allergen_ID < 1) set_ValueNoCheck (COLUMNNAME_M_Allergen_ID, null); else set_ValueNoCheck (COLUMNNAME_M_Allergen_ID, M_Allergen_ID); } @Override public int getM_Allergen_ID()
{ return get_ValueAsInt(COLUMNNAME_M_Allergen_ID); } @Override public void setName (final java.lang.String Name) { set_Value (COLUMNNAME_Name, Name); } @Override public java.lang.String getName() { return get_ValueAsString(COLUMNNAME_Name); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Allergen.java
1
请完成以下Java代码
public void execute(JobEntity job, String configuration, VariableScope variableScope, CommandContext commandContext) { CmmnEngineConfiguration engineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(); BatchService batchService = engineConfiguration.getBatchServiceConfiguration().getBatchService(); String batchId = getBatchIdFromHandlerCfg(configuration); Batch batch = batchService.getBatch(batchId); List<BatchPart> batchParts = batchService.findBatchPartsByBatchId(batchId); int completedBatchParts = 0; for (BatchPart batchPart : batchParts) { if (batchPart.getCompleteTime() != null) { completedBatchParts++; } } if (completedBatchParts == batchParts.size()) { batchService.completeBatch(batch.getId(), CaseInstanceBatchMigrationResult.STATUS_COMPLETED); job.setRepeat(null); } else {
if (batchParts.size() == 0) { updateBatchStatus(batch, batchService); job.setRepeat(null); } else { updateBatchStatus(batch, batchService); } } } protected void updateBatchStatus(Batch batch, BatchService batchService) { ((BatchEntity) batch).setStatus(CaseInstanceBatchMigrationResult.STATUS_COMPLETED); batchService.updateBatch(batch); } }
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\job\CaseInstanceMigrationStatusJobHandler.java
1
请完成以下Java代码
public List<String> getTopicNames(boolean withLockedTasks, boolean withUnlockedTasks, boolean withRetriesLeft) { return getProcessEngine().getExternalTaskService() .getTopicNames(withLockedTasks, withUnlockedTasks, withRetriesLeft); } @Override public void setRetries(SetRetriesForExternalTasksDto retriesDto){ UpdateExternalTaskRetriesBuilder builder = updateRetries(retriesDto); Integer retries = retriesDto.getRetries(); if (retries == null) { throw new InvalidRequestException(Status.BAD_REQUEST, "The number of retries cannot be null."); } try { builder.set(retries); } catch (NotFoundException e) { throw new InvalidRequestException(Status.NOT_FOUND, e.getMessage()); } catch (BadUserRequestException e) { throw new InvalidRequestException(Status.BAD_REQUEST, e.getMessage()); } } protected UpdateExternalTaskRetriesBuilder updateRetries(SetRetriesForExternalTasksDto retriesDto) { ExternalTaskService externalTaskService = getProcessEngine().getExternalTaskService(); List<String> externalTaskIds = retriesDto.getExternalTaskIds(); List<String> processInstanceIds = retriesDto.getProcessInstanceIds(); ExternalTaskQuery externalTaskQuery = null; ProcessInstanceQuery processInstanceQuery = null; HistoricProcessInstanceQuery historicProcessInstanceQuery = null; ExternalTaskQueryDto externalTaskQueryDto = retriesDto.getExternalTaskQuery(); if (externalTaskQueryDto != null) {
externalTaskQuery = externalTaskQueryDto.toQuery(getProcessEngine()); } ProcessInstanceQueryDto processInstanceQueryDto = retriesDto.getProcessInstanceQuery(); if (processInstanceQueryDto != null) { processInstanceQuery = processInstanceQueryDto.toQuery(getProcessEngine()); } HistoricProcessInstanceQueryDto historicProcessInstanceQueryDto = retriesDto.getHistoricProcessInstanceQuery(); if (historicProcessInstanceQueryDto != null) { historicProcessInstanceQuery = historicProcessInstanceQueryDto.toQuery(getProcessEngine()); } return externalTaskService.updateRetries() .externalTaskIds(externalTaskIds) .processInstanceIds(processInstanceIds) .externalTaskQuery(externalTaskQuery) .processInstanceQuery(processInstanceQuery) .historicProcessInstanceQuery(historicProcessInstanceQuery); } }
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\impl\ExternalTaskRestServiceImpl.java
1
请完成以下Java代码
public head getHead() { return m_head; } // getHead /** * Get Table (no class set) * @return table */ public table getTable() { return m_table; } // getTable /** * Get Table Row (no class set) * @return table row */ public tr getTopRow() { return m_topRow; } // getTopRow /** * Get Table Data Left (no class set) * @return table data */ public td getTopLeft() { return m_topLeft; } // getTopLeft /** * Get Table Data Right (no class set) * @return table data */ public td getTopRight() { return m_topRight; } // getTopRight /** * String representation * @return String */ @Override
public String toString() { return m_html.toString(); } // toString /** * Output Document * @param out out */ public void output (OutputStream out) { m_html.output(out); } // output /** * Output Document * @param out out */ public void output (PrintWriter out) { m_html.output(out); } // output /** * Add Popup Center * @param nowrap set nowrap in td * @return null or center single td */ public td addPopupCenter(boolean nowrap) { if (m_table == null) return null; // td center = new td ("popupCenter", AlignType.CENTER, AlignType.MIDDLE, nowrap); center.setColSpan(2); m_table.addElement(new tr() .addElement(center)); return center; } // addPopupCenter } // WDoc
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\util\WebDoc.java
1
请完成以下Java代码
public static <T, U, R> Singleton<R> from(final BiFunction<T, U, R> original, T arg0, U arg1) { return fromLazy(original, () -> arg0, () -> arg1); } /** * <p>fromLazy.</p> * * @param original a {@link java.util.function.Function} object * @param arg0Supplier a {@link java.util.function.Supplier} object * @param <T> a T class * @param <R> a R class * @return a {@link com.ulisesbocchio.jasyptspringboot.util.Singleton} object */ public static <T, R> Singleton<R> fromLazy(final Function<T, R> original, Supplier<T> arg0Supplier) { return from(() -> original.apply(arg0Supplier.get())); } /** * <p>fromLazy.</p> * * @param original a {@link java.util.function.BiFunction} object * @param arg0Supplier a {@link java.util.function.Supplier} object * @param arg1Supplier a {@link java.util.function.Supplier} object * @param <T> a T class * @param <U> a U class * @param <R> a R class * @return a {@link com.ulisesbocchio.jasyptspringboot.util.Singleton} object */ public static <T, U, R> Singleton<R> fromLazy(final BiFunction<T, U, R> original, Supplier<T> arg0Supplier, Supplier<U> arg1Supplier) { return from(() -> original.apply(arg0Supplier.get(), arg1Supplier.get())); } /**
* <p>Constructor for Singleton.</p> * * @param original a {@link java.util.function.Supplier} object */ public Singleton(final Supplier<R> original) { instanceSupplier = () -> { synchronized (original) { if (!initialized) { final R singletonInstance = original.get(); instanceSupplier = () -> singletonInstance; initialized = true; } return instanceSupplier.get(); } }; } /** {@inheritDoc} */ @Override public R get() { return instanceSupplier.get(); } }
repos\jasypt-spring-boot-master\jasypt-spring-boot\src\main\java\com\ulisesbocchio\jasyptspringboot\util\Singleton.java
1
请完成以下Java代码
public static TransformerFactory defaultTransformerFactory() { return TransformerFactory.newInstance(); } public static DocumentBuilderFactory defaultDocumentBuilderFactory() { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); LOG.documentBuilderFactoryConfiguration("namespaceAware", "true"); documentBuilderFactory.setValidating(false); LOG.documentBuilderFactoryConfiguration("validating", "false"); documentBuilderFactory.setIgnoringComments(true); LOG.documentBuilderFactoryConfiguration("ignoringComments", "true"); documentBuilderFactory.setIgnoringElementContentWhitespace(false); LOG.documentBuilderFactoryConfiguration("ignoringElementContentWhitespace", "false"); return documentBuilderFactory; } public static Class<?> loadClass(String classname, DataFormat dataFormat) { // first try context classoader ClassLoader cl = Thread.currentThread().getContextClassLoader(); if(cl != null) { try { return cl.loadClass(classname); }
catch(Exception e) { // ignore } } // else try the classloader which loaded the dataformat cl = dataFormat.getClass().getClassLoader(); try { return cl.loadClass(classname); } catch (ClassNotFoundException e) { throw LOG.classNotFound(classname, e); } } }
repos\camunda-bpm-platform-master\clients\java\client\src\main\java\org\camunda\bpm\client\variable\impl\format\xml\DomXmlDataFormat.java
1
请完成以下Java代码
public int getC_RfQResponseLineQty_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_RfQResponseLineQty_ID); if (ii == null) return 0; return ii.intValue(); } @Override public org.compiere.model.I_C_UOM getC_UOM() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_C_UOM_ID, org.compiere.model.I_C_UOM.class); } @Override public void setC_UOM(org.compiere.model.I_C_UOM C_UOM) { set_ValueFromPO(COLUMNNAME_C_UOM_ID, org.compiere.model.I_C_UOM.class, C_UOM); } /** Set Maßeinheit. @param C_UOM_ID Unit of Measure */ @Override public void setC_UOM_ID (int C_UOM_ID) { if (C_UOM_ID < 1) set_ValueNoCheck (COLUMNNAME_C_UOM_ID, null); else set_ValueNoCheck (COLUMNNAME_C_UOM_ID, Integer.valueOf(C_UOM_ID)); } /** Get Maßeinheit. @return Unit of Measure */ @Override public int getC_UOM_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_UOM_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Rabatt %. @param Discount Discount in percent */ @Override public void setDiscount (java.math.BigDecimal Discount) { set_ValueNoCheck (COLUMNNAME_Discount, Discount); } /** Get Rabatt %. @return Discount in percent */ @Override public java.math.BigDecimal getDiscount () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Discount); if (bd == null) return BigDecimal.ZERO; return bd; } @Override public org.compiere.model.I_C_ValidCombination getPr() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_Price, org.compiere.model.I_C_ValidCombination.class); } @Override public void setPr(org.compiere.model.I_C_ValidCombination Pr) { set_ValueFromPO(COLUMNNAME_Price, org.compiere.model.I_C_ValidCombination.class, Pr); } /** Set Preis. @param Price Price */ @Override public void setPrice (int Price) { set_ValueNoCheck (COLUMNNAME_Price, Integer.valueOf(Price)); } /** Get Preis. @return Price
*/ @Override public int getPrice () { Integer ii = (Integer)get_Value(COLUMNNAME_Price); if (ii == null) return 0; return ii.intValue(); } /** Set Menge. @param Qty Quantity */ @Override public void setQty (java.math.BigDecimal Qty) { set_ValueNoCheck (COLUMNNAME_Qty, Qty); } /** Get Menge. @return Quantity */ @Override public java.math.BigDecimal getQty () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty); if (bd == null) return BigDecimal.ZERO; return bd; } /** Set Symbol. @param UOMSymbol Symbol for a Unit of Measure */ @Override public void setUOMSymbol (java.lang.String UOMSymbol) { set_ValueNoCheck (COLUMNNAME_UOMSymbol, UOMSymbol); } /** Get Symbol. @return Symbol for a Unit of Measure */ @Override public java.lang.String getUOMSymbol () { return (java.lang.String)get_Value(COLUMNNAME_UOMSymbol); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.rfq\src\main\java-gen\de\metas\rfq\model\X_C_RfQResponseLineQty_v.java
1
请在Spring Boot框架中完成以下Java代码
public class HeroController { private HeroRepository heroRepository; private Counter searchCounter; private Counter addCounter; public HeroController(@Qualifier("heroRepository") HeroRepository heroRepository, MeterRegistry meterRegistry) { this.heroRepository = heroRepository; this.searchCounter = meterRegistry.counter("hero.usage.search"); this.addCounter = meterRegistry.counter("hero.usage.add"); } @GetMapping("/hero") public String viewStartPage(Model model){ model.addAttribute("ipAddress", inspectLocalHost()); return "hero/hero.search.html"; } @GetMapping("/hero/list") public String viewHeros(@RequestParam(value="search", required = false)String search, Model model) { model.addAttribute("heros", collectHeros(search)); model.addAttribute("ipAddress", inspectLocalHost()); return "hero/hero.list.html"; } private Collection<Hero> collectHeros(String search) { if(StringUtils.isBlank(search) || StringUtils.isEmpty(search)) { return heroRepository.allHeros();
} else { searchCounter.increment(); return heroRepository.findHerosBySearchCriteria(search); } } @GetMapping("/hero/new") public String newHero(Model model){ addCounter.increment(); model.addAttribute("newHero", new NewHeroModel()); return "hero/hero.new.html"; } @PostMapping("/hero/new") public String addNewHero(@ModelAttribute("newHero") NewHeroModel newHeroModel) { heroRepository.addHero(newHeroModel.getHero()); return "redirect:/hero/list"; } private String inspectLocalHost() { try { return Inet4Address.getLocalHost().getHostAddress(); } catch (UnknownHostException e) { throw new RuntimeException(e); } } }
repos\spring-boot-demo-master (1)\src\main\java\com\github\sparsick\springbootexample\hero\universum\HeroController.java
2
请完成以下Java代码
private IPricingResult createPricingResult( final IPricingContext pricingCtx, @NonNull final BigDecimal price, @NonNull final I_C_UOM priceUOM) { final IPricingResult pricingResult = pricingBL.calculatePrice(pricingCtx); Check.errorIf(!pricingResult.isCalculated() || pricingResult.getTaxCategoryId() == null, "pricingResult {} which was created from pricingCtx {} has calculated=false and/or least contains no C_TaxCategory_ID; the referenced model is {}", pricingResult, pricingCtx, pricingCtx.getReferencedObject()); final CurrencyPrecision pricePrecision = pricingResult.getPrecision(); final BigDecimal priceToSet = pricePrecision.round(price); pricingResult.setTaxCategoryId(pricingResult.getTaxCategoryId()); pricingResult.setPriceStd(priceToSet); pricingResult.setPriceLimit(priceToSet); pricingResult.setPriceList(priceToSet); pricingResult.setPriceUomId(UomId.ofRepoId(priceUOM.getC_UOM_ID())); pricingResult.setDiscount(Percent.ZERO); pricingResult.setCalculated(true); return pricingResult; } private BigDecimal getTotalInvoiceableAmount() { BigDecimal totalNetAmt = BigDecimal.ZERO; for (final IQualityInvoiceLineGroup invoiceLineGroup : _createdInvoiceLineGroups) { final IQualityInvoiceLine invoiceableLine = invoiceLineGroup.getInvoiceableLine(); final BigDecimal netAmt = getNetAmount(invoiceableLine); totalNetAmt = totalNetAmt.add(netAmt); } return totalNetAmt; } private BigDecimal getNetAmount(@NonNull final IQualityInvoiceLine line) { final IPricingResult pricingResult = line.getPrice(); Check.assumeNotNull(pricingResult, "pricingResult not null"); Check.assume(pricingResult.isCalculated(), "Price is calculated for {}", line);
final BigDecimal price = pricingResult.getPriceStd(); final UomId priceUomId = pricingResult.getPriceUomId(); final IUOMConversionBL uomConversionBL = Services.get(IUOMConversionBL.class); final Quantity qtyInPricingUom = uomConversionBL.convertQuantityTo( line.getQty(), UOMConversionContext.of(line.getProductId()), priceUomId); final CurrencyPrecision pricePrecision = pricingResult.getPrecision(); final BigDecimal netAmt = pricePrecision.round(price.multiply(qtyInPricingUom.toBigDecimal())); return netAmt; } /** * Creates an {@link QualityInvoiceLine} instance. * <p> * Product, Qty, UOM are copied from given {@link IQualityInspectionLine}. */ private QualityInvoiceLine createQualityInvoiceLine(final IQualityInspectionLine qiLine) { final QualityInvoiceLine invoiceLine = new QualityInvoiceLine(); invoiceLine.setM_Product(qiLine.getM_Product()); invoiceLine.setProductName(qiLine.getName()); invoiceLine.setPercentage(qiLine.getPercentage()); invoiceLine.setQty(Quantity.of(qiLine.getQtyProjected(), qiLine.getC_UOM())); invoiceLine.setHandlingUnitsInfo(qiLine.getHandlingUnitsInfoProjected()); return invoiceLine; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java\de\metas\materialtracking\ch\lagerkonf\invoicing\impl\QualityInvoiceLineGroupsBuilder.java
1
请完成以下Java代码
public class PendingCommit { private final UUID txId; private final String nodeId; private final TenantId tenantId; private final String workingBranch; private String branch; private String versionName; private String authorName; private String authorEmail; private Map<String, String[]> chunkedMsgs; public PendingCommit(TenantId tenantId, String nodeId, UUID txId, String branch, String versionName, String authorName, String authorEmail) { this.tenantId = tenantId; this.nodeId = nodeId;
this.txId = txId; this.branch = branch; this.versionName = versionName; this.authorName = authorName; this.authorEmail = authorEmail; this.workingBranch = txId.toString(); } public Map<String, String[]> getChunkedMsgs() { if (chunkedMsgs == null) { chunkedMsgs = new ConcurrentHashMap<>(); } return chunkedMsgs; } }
repos\thingsboard-master\common\version-control\src\main\java\org\thingsboard\server\service\sync\vc\PendingCommit.java
1
请在Spring Boot框架中完成以下Java代码
public class DiagramNode extends DiagramElement { private static final long serialVersionUID = 1L; private Double x; private Double y; private Double width; private Double height; public DiagramNode() { super(); } public DiagramNode(String id) { super(id); } public DiagramNode(String id, Double x, Double y, Double width, Double height) { super(id); this.x = x; this.y = y; this.width = width; this.height = height; } public Double getX() { return x; } public void setX(Double x) { this.x = x; } public Double getY() { return y; } public void setY(Double y) { this.y = y; } public Double getWidth() { return width;
} public void setWidth(Double width) { this.width = width; } public Double getHeight() { return height; } public void setHeight(Double height) { this.height = height; } @Override public String toString() { return ( super.toString() + ", x=" + getX() + ", y=" + getY() + ", width=" + getWidth() + ", height=" + getHeight() ); } @Override public boolean isNode() { return true; } @Override public boolean isEdge() { return false; } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\repository\DiagramNode.java
2
请完成以下Java代码
public java.lang.String getResponseCodeEffective () { return (java.lang.String)get_Value(COLUMNNAME_ResponseCodeEffective); } /** * ResponseCodeOverride AD_Reference_ID=540961 * Reference name: _CreditPassResult */ public static final int RESPONSECODEOVERRIDE_AD_Reference_ID=540961; /** Nicht authorisiert = N */ public static final String RESPONSECODEOVERRIDE_NichtAuthorisiert = "N"; /** Authorisiert = P */ public static final String RESPONSECODEOVERRIDE_Authorisiert = "P"; /** Fehler = E */ public static final String RESPONSECODEOVERRIDE_Fehler = "E"; /** Manuell überprüfen = M */ public static final String RESPONSECODEOVERRIDE_Manuellueberpruefen = "M"; /** Set Antwort abw.. @param ResponseCodeOverride Antwort abw. */ @Override public void setResponseCodeOverride (java.lang.String ResponseCodeOverride) { set_ValueNoCheck (COLUMNNAME_ResponseCodeOverride, ResponseCodeOverride); } /** Get Antwort abw.. @return Antwort abw. */ @Override public java.lang.String getResponseCodeOverride () { return (java.lang.String)get_Value(COLUMNNAME_ResponseCodeOverride); } /** Set Antwort Text. @param ResponseCodeText Antwort Text */ @Override public void setResponseCodeText (java.lang.String ResponseCodeText) { set_Value (COLUMNNAME_ResponseCodeText, ResponseCodeText); } /** Get Antwort Text. @return Antwort Text */ @Override public java.lang.String getResponseCodeText () { return (java.lang.String)get_Value(COLUMNNAME_ResponseCodeText); } /** Set Antwort Details. @param ResponseDetails Antwort Details */ @Override public void setResponseDetails (java.lang.String ResponseDetails) { set_ValueNoCheck (COLUMNNAME_ResponseDetails, ResponseDetails); } /** Get Antwort Details.
@return Antwort Details */ @Override public java.lang.String getResponseDetails () { return (java.lang.String)get_Value(COLUMNNAME_ResponseDetails); } /** Set Transaktionsreferenz Kunde . @param TransactionCustomerId Transaktionsreferenz Kunde */ @Override public void setTransactionCustomerId (java.lang.String TransactionCustomerId) { set_ValueNoCheck (COLUMNNAME_TransactionCustomerId, TransactionCustomerId); } /** Get Transaktionsreferenz Kunde . @return Transaktionsreferenz Kunde */ @Override public java.lang.String getTransactionCustomerId () { return (java.lang.String)get_Value(COLUMNNAME_TransactionCustomerId); } /** Set Transaktionsreferenz API. @param TransactionIdAPI Transaktionsreferenz API */ @Override public void setTransactionIdAPI (java.lang.String TransactionIdAPI) { set_ValueNoCheck (COLUMNNAME_TransactionIdAPI, TransactionIdAPI); } /** Get Transaktionsreferenz API. @return Transaktionsreferenz API */ @Override public java.lang.String getTransactionIdAPI () { return (java.lang.String)get_Value(COLUMNNAME_TransactionIdAPI); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.creditscore\base\src\main\java-gen\de\metas\vertical\creditscore\base\model\X_CS_Transaction_Result.java
1
请完成以下Java代码
public int getAD_PInstance_ID() { return get_ValueAsInt(COLUMNNAME_AD_PInstance_ID); } /** * Data_Export_Action AD_Reference_ID=541389 * Reference name: Data_Export_Actions */ public static final int DATA_EXPORT_ACTION_AD_Reference_ID=541389; /** Exported-Standalone = Exported-Standalone */ public static final String DATA_EXPORT_ACTION_Exported_Standalone = "Exported-Standalone"; /** Exported-AlongWithParent = Exported-AlongWithParent */ public static final String DATA_EXPORT_ACTION_Exported_AlongWithParent = "Exported-AlongWithParent"; /** AssignedToParent = AssignedToParent */ public static final String DATA_EXPORT_ACTION_AssignedToParent = "AssignedToParent"; /** Deleted = Deleted */ public static final String DATA_EXPORT_ACTION_Deleted = "Deleted"; @Override public void setData_Export_Action (final java.lang.String Data_Export_Action) { set_Value (COLUMNNAME_Data_Export_Action, Data_Export_Action); } @Override public java.lang.String getData_Export_Action() { return get_ValueAsString(COLUMNNAME_Data_Export_Action); } @Override public org.compiere.model.I_Data_Export_Audit getData_Export_Audit() { return get_ValueAsPO(COLUMNNAME_Data_Export_Audit_ID, org.compiere.model.I_Data_Export_Audit.class); } @Override public void setData_Export_Audit(final org.compiere.model.I_Data_Export_Audit Data_Export_Audit) { set_ValueFromPO(COLUMNNAME_Data_Export_Audit_ID, org.compiere.model.I_Data_Export_Audit.class, Data_Export_Audit); } @Override
public void setData_Export_Audit_ID (final int Data_Export_Audit_ID) { if (Data_Export_Audit_ID < 1) set_Value (COLUMNNAME_Data_Export_Audit_ID, null); else set_Value (COLUMNNAME_Data_Export_Audit_ID, Data_Export_Audit_ID); } @Override public int getData_Export_Audit_ID() { return get_ValueAsInt(COLUMNNAME_Data_Export_Audit_ID); } @Override public void setData_Export_Audit_Log_ID (final int Data_Export_Audit_Log_ID) { if (Data_Export_Audit_Log_ID < 1) set_ValueNoCheck (COLUMNNAME_Data_Export_Audit_Log_ID, null); else set_ValueNoCheck (COLUMNNAME_Data_Export_Audit_Log_ID, Data_Export_Audit_Log_ID); } @Override public int getData_Export_Audit_Log_ID() { return get_ValueAsInt(COLUMNNAME_Data_Export_Audit_Log_ID); } @Override public void setExternalSystem_Config_ID (final int ExternalSystem_Config_ID) { if (ExternalSystem_Config_ID < 1) set_Value (COLUMNNAME_ExternalSystem_Config_ID, null); else set_Value (COLUMNNAME_ExternalSystem_Config_ID, ExternalSystem_Config_ID); } @Override public int getExternalSystem_Config_ID() { return get_ValueAsInt(COLUMNNAME_ExternalSystem_Config_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_Data_Export_Audit_Log.java
1
请完成以下Java代码
protected org.compiere.model.POInfo initPO(final Properties ctx) { return org.compiere.model.POInfo.getPOInfo(Table_Name); } @Override public void setC_BPartner_DocType_ID (final int C_BPartner_DocType_ID) { if (C_BPartner_DocType_ID < 1) set_ValueNoCheck (COLUMNNAME_C_BPartner_DocType_ID, null); else set_ValueNoCheck (COLUMNNAME_C_BPartner_DocType_ID, C_BPartner_DocType_ID); } @Override public int getC_BPartner_DocType_ID() { return get_ValueAsInt(COLUMNNAME_C_BPartner_DocType_ID); } @Override public void setC_BPartner_ID (final int C_BPartner_ID) { if (C_BPartner_ID < 1) set_Value (COLUMNNAME_C_BPartner_ID, null); else set_Value (COLUMNNAME_C_BPartner_ID, C_BPartner_ID); } @Override public int getC_BPartner_ID() { return get_ValueAsInt(COLUMNNAME_C_BPartner_ID); } @Override public I_C_BPartner_Report_Text getC_BPartner_Report_Text() { return get_ValueAsPO(COLUMNNAME_C_BPartner_Report_Text_ID, I_C_BPartner_Report_Text.class); } @Override public void setC_BPartner_Report_Text(final I_C_BPartner_Report_Text C_BPartner_Report_Text) {
set_ValueFromPO(COLUMNNAME_C_BPartner_Report_Text_ID, I_C_BPartner_Report_Text.class, C_BPartner_Report_Text); } @Override public void setC_BPartner_Report_Text_ID (final int C_BPartner_Report_Text_ID) { if (C_BPartner_Report_Text_ID < 1) set_Value (COLUMNNAME_C_BPartner_Report_Text_ID, null); else set_Value (COLUMNNAME_C_BPartner_Report_Text_ID, C_BPartner_Report_Text_ID); } @Override public int getC_BPartner_Report_Text_ID() { return get_ValueAsInt(COLUMNNAME_C_BPartner_Report_Text_ID); } @Override public void setC_DocType_ID (final int C_DocType_ID) { if (C_DocType_ID < 0) set_Value (COLUMNNAME_C_DocType_ID, null); else set_Value (COLUMNNAME_C_DocType_ID, C_DocType_ID); } @Override public int getC_DocType_ID() { return get_ValueAsInt(COLUMNNAME_C_DocType_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.fresh\de.metas.fresh.base\src\main\java\de\metas\fresh\partnerreporttext\model\X_C_BPartner_DocType.java
1
请在Spring Boot框架中完成以下Java代码
public String getPayWayCode() { return payWayCode; } public void setPayWayCode(String payWayCode) { this.payWayCode = payWayCode; } public String getPayWayName() { return payWayName; } public void setPayWayName(String payWayName) { this.payWayName = payWayName; } public String getPartnerKey() { return partnerKey; } public void setPartnerKey(String partnerKey) { this.partnerKey = partnerKey; } private static final long serialVersionUID = 1L; public String getAppId() { return appId; } public void setAppId(String appId) { this.appId = appId == null ? null : appId.trim(); } public String getAppSectet() { return appSectet; } public void setAppSectet(String appSectet) { this.appSectet = appSectet == null ? null : appSectet.trim(); } public String getMerchantId() { return merchantId; } public void setMerchantId(String merchantId) {
this.merchantId = merchantId == null ? null : merchantId.trim(); } public String getAppType() { return appType; } public void setAppType(String appType) { this.appType = appType == null ? null : appType.trim(); } public String getUserNo() { return userNo; } public void setUserNo(String userNo) { this.userNo = userNo == null ? null : userNo.trim(); } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName == null ? null : userName.trim(); } }
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\user\entity\RpUserPayInfo.java
2
请完成以下Java代码
public void setCommission_Product_ID (final int Commission_Product_ID) { if (Commission_Product_ID < 1) set_Value (COLUMNNAME_Commission_Product_ID, null); else set_Value (COLUMNNAME_Commission_Product_ID, Commission_Product_ID); } @Override public int getCommission_Product_ID() { return get_ValueAsInt(COLUMNNAME_Commission_Product_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); } @Override
public void setName (final java.lang.String Name) { set_Value (COLUMNNAME_Name, Name); } @Override public java.lang.String getName() { return get_ValueAsString(COLUMNNAME_Name); } @Override public void setPointsPrecision (final int PointsPrecision) { set_Value (COLUMNNAME_PointsPrecision, PointsPrecision); } @Override public int getPointsPrecision() { return get_ValueAsInt(COLUMNNAME_PointsPrecision); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java-gen\de\metas\contracts\commission\model\X_C_Customer_Trade_Margin.java
1
请完成以下Java代码
private ImportState newImportState( @NonNull final TableRecordReference recordRef, @NonNull final AdWindowId adWindowId, @NonNull final DataEntrySubTabId subTabId) { final DataEntryLayout layout = dataEntryLayoutRepo.getByWindowId(adWindowId); final DataEntrySubTab subTab = layout.getSubTabById(subTabId); final DataEntryRecord dataEntryRecord = dataEntryRecordRepo.getBy(DataEntryRecordQuery.builder() .dataEntrySubTabId(subTab.getId()) .recordId(recordRef.getRecord_ID()) .build()) .orElseGet(() -> DataEntryRecord.builder() .mainRecord(recordRef) .dataEntrySubTabId(subTabId) .build()); return ImportState.builder() .subTab(subTab) .dataEntryRecord(dataEntryRecord) .updatedBy(Env.getLoggedUserId()) .build(); } @Override protected void markImported(@NonNull final I_I_DataEntry_Record importRecord) { importRecord.setI_IsImported(X_I_Replenish.I_ISIMPORTED_Imported); importRecord.setProcessed(true); InterfaceWrapperHelper.save(importRecord); } @Builder @Getter @ToString private static class ImportState { @NonNull private final DataEntrySubTab subTab; @NonNull private final DataEntryRecord dataEntryRecord; @NonNull private final UserId updatedBy; public boolean isMatching( @NonNull final TableRecordReference recordRef, @NonNull final DataEntrySubTabId subTabId) { return dataEntryRecord.getMainRecord().equals(recordRef) && dataEntryRecord.getDataEntrySubTabId().equals(subTabId); }
public void setFieldValue(final DataEntryFieldId fieldId, final Object value) { final Object valueConv = convertValueToFieldType(value, fieldId); dataEntryRecord.setRecordField(fieldId, updatedBy, valueConv); } private Object convertValueToFieldType(final Object value, @NonNull final DataEntryFieldId fieldId) { final DataEntryField field = subTab.getFieldById(fieldId); try { return DataEntryRecordField.convertValueToFieldType(value, field); } catch (Exception ex) { throw AdempiereException.wrapIfNeeded(ex) .setParameter("field", field) .appendParametersToMessage(); } } public boolean isNewDataEntryRecord() { return !dataEntryRecord.getId().isPresent(); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\dataentry\data\impexp\DataEntryRecordsImportProcess.java
1
请完成以下Java代码
public DocumentPostRequest extractDocumentPostRequest(@NonNull final Event event) { final String requestStr = event.getProperty(EVENT_PROPERTY_DocumentPostRequest); return fromJson(requestStr); } @NonNull public Event createEventFromRequest(@NonNull final DocumentPostRequest request) { return Event.builder() .putProperty(EVENT_PROPERTY_DocumentPostRequest, toJsonString(request)) .setSourceRecordReference(request.getRecord()) .setEventName(EVENTNAME) .shallBeLogged() .build(); } @NonNull private String toJsonString(@NonNull final DocumentPostRequest request) { try { return jsonObjectMapper.writeValueAsString(request); } catch (Exception ex) { throw new AdempiereException("Failed converting to JSON: " + request, ex); } } @NonNull private DocumentPostRequest fromJson(@NonNull final String json) { try { return jsonObjectMapper.readValue(json, DocumentPostRequest.class); } catch (JsonProcessingException e) { throw new AdempiereException("Failed converting from JSON: " + json, e); } } } // // // ------------------------------------------------------------------------- // // @lombok.Builder @lombok.ToString private static final class DocumentPostRequestHandlerAsEventListener implements IEventListener { @NonNull private final DocumentPostRequestHandler handler; @NonNull private final EventConverter eventConverter; @NonNull private final EventLogUserService eventLogUserService; @Override public void onEvent(@NonNull final IEventBus eventBus, @NonNull final Event event) { final DocumentPostRequest request = eventConverter.extractDocumentPostRequest(event); try (final IAutoCloseable ignored = switchCtx(request); final MDCCloseable ignored1 = TableRecordMDC.putTableRecordReference(request.getRecord());
final MDCCloseable ignored2 = MDC.putCloseable("eventHandler.className", handler.getClass().getName())) { eventLogUserService.invokeHandlerAndLog(InvokeHandlerAndLogRequest.builder() .handlerClass(handler.getClass()) .invokaction(() -> handleRequest(request)) .build()); } } private void handleRequest(@NonNull final DocumentPostRequest request) { handler.handleRequest(request); } private IAutoCloseable switchCtx(@NonNull final DocumentPostRequest request) { final Properties ctx = createCtx(request); return Env.switchContext(ctx); } private Properties createCtx(@NonNull final DocumentPostRequest request) { final Properties ctx = Env.newTemporaryCtx(); Env.setClientId(ctx, request.getClientId()); return ctx; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\posting\DocumentPostingBusService.java
1
请完成以下Java代码
public <T> T execute(Callable<T> callable) throws ProcessApplicationExecutionException { ClassLoader originalClassloader = ClassLoaderUtil.getContextClassloader(); ClassLoader processApplicationClassloader = getProcessApplicationClassloader(); try { if (originalClassloader != processApplicationClassloader) { ClassLoaderUtil.setContextClassloader(processApplicationClassloader); } return callable.call(); } catch(Exception e) { throw LOG.processApplicationExecutionException(e); } finally { ClassLoaderUtil.setContextClassloader(originalClassloader); } } protected void ensureInitialized() { if(selfReference == null) { selfReference = lookupSelfReference(); } ensureEjbProcessApplicationReferenceInitialized(); } protected abstract void ensureEjbProcessApplicationReferenceInitialized(); protected abstract ProcessApplicationReference getEjbProcessApplicationReference(); /** * lookup a proxy object representing the invoked business view of this component. */ protected abstract ProcessApplicationInterface lookupSelfReference();
/** * determine the ee application name based on information obtained from JNDI. */ protected String lookupEeApplicationName() { try { InitialContext initialContext = new InitialContext(); String appName = (String) initialContext.lookup(JAVA_APP_APP_NAME_PATH); String moduleName = (String) initialContext.lookup(MODULE_NAME_PATH); // make sure that if an EAR carries multiple PAs, they are correctly // identified by appName + moduleName if (moduleName != null && !moduleName.equals(appName)) { return appName + "/" + moduleName; } else { return appName; } } catch (NamingException e) { throw LOG.ejbPaCannotAutodetectName(e); } } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\application\impl\AbstractEjbProcessApplication.java
1
请在Spring Boot框架中完成以下Java代码
public int getSubscriptionConnectionMinimumIdleSize() { return subscriptionConnectionMinimumIdleSize; } public void setSubscriptionConnectionMinimumIdleSize(int subscriptionConnectionMinimumIdleSize) { this.subscriptionConnectionMinimumIdleSize = subscriptionConnectionMinimumIdleSize; } public int getSubscriptionConnectionPoolSize() { return subscriptionConnectionPoolSize; } public void setSubscriptionConnectionPoolSize(int subscriptionConnectionPoolSize) { this.subscriptionConnectionPoolSize = subscriptionConnectionPoolSize; } public int getConnectionMinimumIdleSize() { return connectionMinimumIdleSize; } public void setConnectionMinimumIdleSize(int connectionMinimumIdleSize) { this.connectionMinimumIdleSize = connectionMinimumIdleSize; } public int getConnectionPoolSize() { return connectionPoolSize; } public void setConnectionPoolSize(int connectionPoolSize) { this.connectionPoolSize = connectionPoolSize; } public int getDatabase() { return database; }
public void setDatabase(int database) { this.database = database; } public boolean isDnsMonitoring() { return dnsMonitoring; } public void setDnsMonitoring(boolean dnsMonitoring) { this.dnsMonitoring = dnsMonitoring; } public int getDnsMonitoringInterval() { return dnsMonitoringInterval; } public void setDnsMonitoringInterval(int dnsMonitoringInterval) { this.dnsMonitoringInterval = dnsMonitoringInterval; } public String getCodec() { return codec; } public void setCodec(String codec) { this.codec = codec; } }
repos\kkFileView-master\server\src\main\java\cn\keking\config\RedissonConfig.java
2
请在Spring Boot框架中完成以下Java代码
public static boolean verify(String text, String sign, String key, String input_charset) { text = text + key; String mysign = DigestUtils.md5Hex(getContentBytes(text, input_charset)); if(mysign.equals(sign)) { return true; } else { return false; } } /** * @param content * @param charset * @return
* @throws SignatureException * @throws UnsupportedEncodingException */ private static byte[] getContentBytes(String content, String charset) { if (charset == null || "".equals(charset)) { return content.getBytes(); } try { return content.getBytes(charset); } catch (UnsupportedEncodingException e) { throw new RuntimeException("MD5签名过程中出现错误,指定的编码集不对,您目前指定的编码集是:" + charset); } } }
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\reconciliation\utils\alipay\MD5.java
2
请完成以下Java代码
public Map<String, Object> deserializeUsingJsonP(String jsonString) { try (JsonReader reader = Json.createReader(new StringReader(jsonString))) { JsonObject jsonObject = reader.readObject(); return convertJsonToMap(jsonObject); } catch (Exception e) { throw new RuntimeException("JSON-P deserialization failed: " + e.getMessage(), e); } } private Map<String, Object> convertJsonToMap(JsonObject jsonObject) { Map<String, Object> result = new HashMap<>(); for (Map.Entry<String, JsonValue> entry : jsonObject.entrySet()) { String key = entry.getKey(); JsonValue value = entry.getValue(); result.put(key, convertJsonValue(value)); } return result; } private Object convertJsonValue(JsonValue jsonValue) { switch (jsonValue.getValueType()) { case STRING: return ((JsonString) jsonValue).getString(); case NUMBER: JsonNumber num = (JsonNumber) jsonValue; return num.isIntegral() ? num.longValue() : num.doubleValue(); case TRUE: return true;
case FALSE: return false; case NULL: return null; case ARRAY: return convertJsonArray(( jakarta.json.JsonArray) jsonValue); case OBJECT: return convertJsonToMap((JsonObject) jsonValue); default: return jsonValue.toString(); } } private List<Object> convertJsonArray( jakarta.json.JsonArray jsonArray) { List<Object> list = new ArrayList<>(); for (JsonValue value : jsonArray) { list.add(convertJsonValue(value)); } return list; } }
repos\tutorials-master\json-modules\json-3\src\main\java\com\baeldung\jsondeserialization\JsonDeserializerService.java
1
请完成以下Java代码
public abstract class AbstractSetVariableCmd extends AbstractVariableCmd { private static final long serialVersionUID = 1L; protected Map<String, ? extends Object> variables; protected boolean skipJavaSerializationFormatCheck; public AbstractSetVariableCmd(String entityId, Map<String, ? extends Object> variables, boolean isLocal) { super(entityId, isLocal); this.variables = variables; } public AbstractSetVariableCmd(String entityId, Map<String, ? extends Object> variables, boolean isLocal, boolean skipJavaSerializationFormatCheck) {
this(entityId, variables, isLocal); this.skipJavaSerializationFormatCheck = skipJavaSerializationFormatCheck; } protected void executeOperation(AbstractVariableScope scope) { if (isLocal) { scope.setVariablesLocal(variables, skipJavaSerializationFormatCheck); } else { scope.setVariables(variables, skipJavaSerializationFormatCheck); } } protected String getLogEntryOperation() { return UserOperationLogEntry.OPERATION_TYPE_SET_VARIABLE; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmd\AbstractSetVariableCmd.java
1
请完成以下Java代码
public class ExchangeRateResponse { private String disclaimer; private String license; private Long timestamp; private String base; private Map<String, Double> rates; public String getDisclaimer() { return disclaimer; } public void setDisclaimer(String disclaimer) { this.disclaimer = disclaimer; } public String getLicense() { return license; } public void setLicense(String license) { this.license = license; } public Long getTimestamp() { return timestamp; } public void setTimestamp(Long timestamp) { this.timestamp = timestamp; }
public String getBase() { return base; } public void setBase(String base) { this.base = base; } public Map<String, Double> getRates() { return rates; } public void setRates(Map<String, Double> rates) { this.rates = rates; } @Override public String toString() { return "ExchangeRateResponse{" + "disclaimer='" + disclaimer + '\'' + ", license='" + license + '\'' + ", timestamp=" + timestamp + ", base='" + base + '\'' + ", rates=" + rates + '}'; } }
repos\tutorials-master\libraries-apm\new-relic\currency-converter\src\main\java\com\baeldung\currencyconverter\dto\ExchangeRateResponse.java
1
请完成以下Java代码
protected String getOrderByValue(String sortBy) { return null; } @Override protected boolean isValidSortByValue(String value) { return false; } public void validateAndPrepareQuery() { if (subscriptionStartDate == null || !subscriptionStartDate.before(ClockUtil.now())) { throw new InvalidRequestException(Response.Status.BAD_REQUEST, "subscriptionStartDate parameter has invalid value: " + subscriptionStartDate); } if (startDate != null && endDate != null && !endDate.after(startDate)) { throw new InvalidRequestException(Response.Status.BAD_REQUEST, "endDate parameter must be after startDate"); } if (!VALID_GROUP_BY_VALUES.contains(groupBy)) { throw new InvalidRequestException(Response.Status.BAD_REQUEST, "groupBy parameter has invalid value: " + groupBy); } if (metrics == null || metrics.isEmpty()) {
metrics = VALID_METRIC_VALUES; } // convert metrics to internal names this.metrics = metrics.stream() .map(MetricsUtil::resolveInternalName) .collect(Collectors.toSet()); } public int getSubscriptionMonth() { return subscriptionMonth; } public int getSubscriptionDay() { return subscriptionDay; } }
repos\camunda-bpm-platform-master\webapps\assembly\src\main\java\org\camunda\bpm\admin\impl\plugin\base\dto\MetricsAggregatedQueryDto.java
1
请完成以下Java代码
public boolean isEmpty() { return trie.isEmpty(); } @Override public boolean contains(Object o) { throw new UnsupportedOperationException(); } @Override public Iterator<Entry<String, V>> iterator() { return new Iterator<Entry<String, V>>() { MutableDoubleArrayTrieInteger.KeyValuePair iterator = trie.iterator(); @Override public boolean hasNext() { return iterator.hasNext(); } @Override public Entry<String, V> next() { iterator.next(); return new AbstractMap.SimpleEntry<String, V>(iterator.key(), values.get(iterator.value())); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } @Override public Object[] toArray() { throw new UnsupportedOperationException(); } @Override public <T> T[] toArray(T[] a) { throw new UnsupportedOperationException(); } @Override public boolean add(Entry<String, V> stringVEntry) { throw new UnsupportedOperationException(); }
@Override public boolean remove(Object o) { throw new UnsupportedOperationException(); } @Override public boolean containsAll(Collection<?> c) { throw new UnsupportedOperationException(); } @Override public boolean addAll(Collection<? extends Entry<String, V>> c) { throw new UnsupportedOperationException(); } @Override public boolean retainAll(Collection<?> c) { throw new UnsupportedOperationException(); } @Override public boolean removeAll(Collection<?> c) { throw new UnsupportedOperationException(); } @Override public void clear() { MutableDoubleArrayTrie.this.clear(); } }; } @Override public Iterator<Entry<String, V>> iterator() { return entrySet().iterator(); } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\collection\trie\datrie\MutableDoubleArrayTrie.java
1
请完成以下Java代码
public Date subtractDays(GregorianCalendar calendar, int daysToSubtract) { GregorianCalendar cal = calendar; cal.add(Calendar.DATE, -daysToSubtract); return cal.getTime(); } public Date addDays(GregorianCalendar calendar, int daysToAdd) { GregorianCalendar cal = calendar; cal.add(Calendar.DATE, daysToAdd); return cal.getTime(); } public XMLGregorianCalendar toXMLGregorianCalendar(GregorianCalendar calendar) throws DatatypeConfigurationException { DatatypeFactory datatypeFactory = DatatypeFactory.newInstance(); return datatypeFactory.newXMLGregorianCalendar(calendar); }
public Date toDate(XMLGregorianCalendar calendar) { return calendar.toGregorianCalendar() .getTime(); } public int compareDates(GregorianCalendar firstDate, GregorianCalendar secondDate) { return firstDate.compareTo(secondDate); } public String formatDate(GregorianCalendar calendar) { return calendar.toZonedDateTime() .format(DateTimeFormatter.ofPattern("d MMM uuuu")); } }
repos\tutorials-master\core-java-modules\core-java-date-operations-4\src\main\java\com\baeldung\gregorian\calendar\GregorianCalendarExample.java
1
请完成以下Java代码
public Map<String, List<ExtensionAttribute>> getAttributes() { return attributes; } @Override public String getAttributeValue(String namespace, String name) { List<ExtensionAttribute> attributes = getAttributes().get(name); if (attributes != null && !attributes.isEmpty()) { for (ExtensionAttribute attribute : attributes) { if ((namespace == null && attribute.getNamespace() == null) || namespace.equals(attribute.getNamespace())) { return attribute.getValue(); } } } return null; } @Override public void addAttribute(ExtensionAttribute attribute) { if (attribute != null && StringUtils.isNotEmpty(attribute.getName())) { List<ExtensionAttribute> attributeList = null; if (!this.attributes.containsKey(attribute.getName())) { attributeList = new ArrayList<>(); this.attributes.put(attribute.getName(), attributeList); } this.attributes.get(attribute.getName()).add(attribute); } } @Override public void setAttributes(Map<String, List<ExtensionAttribute>> attributes) { this.attributes = attributes; } public void setValues(BaseElement otherElement) { setId(otherElement.getId()); extensionElements = new LinkedHashMap<>(); if (otherElement.getExtensionElements() != null && !otherElement.getExtensionElements().isEmpty()) { for (String key : otherElement.getExtensionElements().keySet()) { List<ExtensionElement> otherElementList = otherElement.getExtensionElements().get(key);
if (otherElementList != null && !otherElementList.isEmpty()) { List<ExtensionElement> elementList = new ArrayList<>(); for (ExtensionElement extensionElement : otherElementList) { elementList.add(extensionElement.clone()); } extensionElements.put(key, elementList); } } } attributes = new LinkedHashMap<>(); if (otherElement.getAttributes() != null && !otherElement.getAttributes().isEmpty()) { for (String key : otherElement.getAttributes().keySet()) { List<ExtensionAttribute> otherAttributeList = otherElement.getAttributes().get(key); if (otherAttributeList != null && !otherAttributeList.isEmpty()) { List<ExtensionAttribute> attributeList = new ArrayList<>(); for (ExtensionAttribute extensionAttribute : otherAttributeList) { attributeList.add(extensionAttribute.clone()); } attributes.put(key, attributeList); } } } } @Override public abstract BaseElement clone(); }
repos\flowable-engine-main\modules\flowable-bpmn-model\src\main\java\org\flowable\bpmn\model\BaseElement.java
1
请在Spring Boot框架中完成以下Java代码
public Result createProduct(ProdInsertReq prodInsertReq) { //新增产品 return productService.createProduct(prodInsertReq); } @Override public Result<ProdImageEntity> uploadImage(MultipartFile file) { return null; } @Override public Result updateProduct(ProdUpdateReq prodUpdateReq) { //增量更新产品 return productService.updateProduct(prodUpdateReq); } @Override public Result<List<ProductEntity>> findProducts(ProdQueryReq prodQueryReq) { return productService.findProducts(prodQueryReq); } @Override public Result createCategoty(CategoryEntity categoryEntity) { return productService.createCategoty(categoryEntity); } @Override public Result modifyCategory(CategoryEntity categoryEntity) { return productService.modifyCategory(categoryEntity); } @Override public Result deleteCategory(String categoryId) { return productService.deleteCategory(categoryId); } @Override
public Result<List<CategoryEntity>> findCategorys(CategoryQueryReq categoryQueryReq) { return productService.findCategorys(categoryQueryReq); } @Override public Result createBrand(BrandInsertReq brandInsertReq) { return productService.createBrand(brandInsertReq); } @Override public Result modifyBrand(BrandInsertReq brandInsertReq) { return productService.modifyBrand(brandInsertReq); } @Override public Result<List<BrandEntity>> findBrands(BrandQueryReq brandQueryReq) { return productService.findBrands(brandQueryReq); } }
repos\SpringBoot-Dubbo-Docker-Jenkins-master\Gaoxi-Controller\src\main\java\com\gaoxi\controller\product\ProductControllerImpl.java
2
请完成以下Java代码
public String getF_MEMO() { return F_MEMO; } public void setF_MEMO(String f_MEMO) { F_MEMO = f_MEMO; } public String getF_LEVEL() { return F_LEVEL; } public void setF_LEVEL(String f_LEVEL) { F_LEVEL = f_LEVEL; } public String getF_END() { return F_END; } public void setF_END(String f_END) { F_END = f_END; } public String getF_SHAREDIREC() { return F_SHAREDIREC; } public void setF_SHAREDIREC(String f_SHAREDIREC) { F_SHAREDIREC = f_SHAREDIREC; } public String getF_HISTORYID() { return F_HISTORYID; } public void setF_HISTORYID(String f_HISTORYID) { F_HISTORYID = f_HISTORYID; } public String getF_STATUS() { return F_STATUS; } public void setF_STATUS(String f_STATUS) { F_STATUS = f_STATUS; } public String getF_VERSION() { return F_VERSION; } public void setF_VERSION(String f_VERSION) { F_VERSION = f_VERSION; } public String getF_ISSTD() { return F_ISSTD; } public void setF_ISSTD(String f_ISSTD) {
F_ISSTD = f_ISSTD; } public Timestamp getF_EDITTIME() { return F_EDITTIME; } public void setF_EDITTIME(Timestamp f_EDITTIME) { F_EDITTIME = f_EDITTIME; } public String getF_PLATFORM_ID() { return F_PLATFORM_ID; } public void setF_PLATFORM_ID(String f_PLATFORM_ID) { F_PLATFORM_ID = f_PLATFORM_ID; } public String getF_ISENTERPRISES() { return F_ISENTERPRISES; } public void setF_ISENTERPRISES(String f_ISENTERPRISES) { F_ISENTERPRISES = f_ISENTERPRISES; } public String getF_ISCLEAR() { return F_ISCLEAR; } public void setF_ISCLEAR(String f_ISCLEAR) { F_ISCLEAR = f_ISCLEAR; } public String getF_PARENTID() { return F_PARENTID; } public void setF_PARENTID(String f_PARENTID) { F_PARENTID = f_PARENTID; } }
repos\SpringBootBucket-master\springboot-batch\src\main\java\com\xncoding\trans\modules\common\vo\BscTollItem.java
1
请完成以下Java代码
public void setPrev_CumulatedAmt (java.math.BigDecimal Prev_CumulatedAmt) { set_Value (COLUMNNAME_Prev_CumulatedAmt, Prev_CumulatedAmt); } /** Get Previous Cumulated Amount. @return Previous Cumulated Amount */ @Override public java.math.BigDecimal getPrev_CumulatedAmt () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Prev_CumulatedAmt); if (bd == null) return BigDecimal.ZERO; return bd; } /** Set Previous Cumulated Quantity. @param Prev_CumulatedQty Previous Cumulated Quantity */ @Override public void setPrev_CumulatedQty (java.math.BigDecimal Prev_CumulatedQty) { set_Value (COLUMNNAME_Prev_CumulatedQty, Prev_CumulatedQty); } /** Get Previous Cumulated Quantity. @return Previous Cumulated Quantity */ @Override public java.math.BigDecimal getPrev_CumulatedQty () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Prev_CumulatedQty); if (bd == null) return BigDecimal.ZERO; return bd; } /** Set Previous Current Cost Price. @param Prev_CurrentCostPrice Previous Current Cost Price */ @Override public void setPrev_CurrentCostPrice (java.math.BigDecimal Prev_CurrentCostPrice) { set_Value (COLUMNNAME_Prev_CurrentCostPrice, Prev_CurrentCostPrice); } /** Get Previous Current Cost Price. @return Previous Current Cost Price */ @Override public java.math.BigDecimal getPrev_CurrentCostPrice () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Prev_CurrentCostPrice); if (bd == null) return BigDecimal.ZERO; return bd; } /** Set Previous Current Cost Price LL. @param Prev_CurrentCostPriceLL Previous Current Cost Price LL */ @Override public void setPrev_CurrentCostPriceLL (java.math.BigDecimal Prev_CurrentCostPriceLL) { set_Value (COLUMNNAME_Prev_CurrentCostPriceLL, Prev_CurrentCostPriceLL); } /** Get Previous Current Cost Price LL. @return Previous Current Cost Price LL */ @Override public java.math.BigDecimal getPrev_CurrentCostPriceLL () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Prev_CurrentCostPriceLL); if (bd == null) return BigDecimal.ZERO; return bd; } /** Set Previous Current Qty. @param Prev_CurrentQty Previous Current Qty */ @Override public void setPrev_CurrentQty (java.math.BigDecimal Prev_CurrentQty) { set_Value (COLUMNNAME_Prev_CurrentQty, Prev_CurrentQty);
} /** Get Previous Current Qty. @return Previous Current Qty */ @Override public java.math.BigDecimal getPrev_CurrentQty () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Prev_CurrentQty); if (bd == null) return BigDecimal.ZERO; return bd; } /** Set Menge. @param Qty Menge */ @Override public void setQty (java.math.BigDecimal Qty) { set_ValueNoCheck (COLUMNNAME_Qty, Qty); } /** Get Menge. @return Menge */ @Override public java.math.BigDecimal getQty () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty); if (bd == null) return BigDecimal.ZERO; return bd; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_PP_Cost_Collector_CostDetailAdjust.java
1
请完成以下Java代码
public class IDCache<V> extends CCache<Object, V> { private static final CachingKeysMapper<Object> KEYS_MAPPER = tableRecordReference -> ImmutableList.of(tableRecordReference.getRecord_ID()); public static final CacheLabel LABEL_MODEL_CACHE = CacheLabel.ofString("MODEL_CACHE"); public static final CacheLabel LABEL_MODEL_CACHE_IN_TRANSACTION = CacheLabel.ofString("MODEL_CACHE_IN_TRANSACTION"); public IDCache(final String tableName, final String trxName, final int initialCapacity, final int expireMinutes, final CacheMapType cacheMapType) { super( tableName + "#TrxName=" + trxName, tableName, null, // additionalTableNamesToResetFor computeAdditionalLabels(trxName), initialCapacity, null, expireMinutes, cacheMapType, KEYS_MAPPER, null,
null); Check.assumeNotEmpty(tableName, "tableName not empty"); } private static Set<CacheLabel> computeAdditionalLabels(final String trxName) { final HashSet<CacheLabel> additionalLabels = new HashSet<>(); additionalLabels.add(LABEL_MODEL_CACHE); if (trxName != null) { additionalLabels.add(LABEL_MODEL_CACHE_IN_TRANSACTION); } return additionalLabels; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\cache\IDCache.java
1
请完成以下Java代码
private static String sqlSelect(final String tableAlias) { return sqlSelectColumn(tableAlias, "AD_UI_ElementGroup_ID", PREFIX) + ", " + sqlSelectColumn(tableAlias, "Name", PREFIX); } private static ADUIElementGroupNameFQ retrieve(final ResultSet rs) throws SQLException { return ADUIElementGroupNameFQ.builder() .uiElementGroupId(AdUIElementGroupId.ofRepoId(rs.getInt(PREFIX + "AD_UI_ElementGroup_ID"))) .name(rs.getString(PREFIX + "Name")) .uiColumnName(ADUIColumnNameFQ_Loader.retrieve(rs)) .build(); } } public static final class ADProcessName_Loader { private static final String PREFIX = "process_"; public static ADProcessName retrieve(final AdProcessId adProcessId) { final ADProcessName name = DB.retrieveFirstRowOrNull( "SELECT " + ADProcessName_Loader.sqlSelect("p") + " FROM AD_Process p" + " WHERE p.AD_Process_ID=?", Collections.singletonList(adProcessId), ADProcessName_Loader::retrieve ); return name != null ? name : ADProcessName.missing(adProcessId); } @SuppressWarnings("SameParameterValue") private static String sqlSelect(final String tableAlias) { return sqlSelectColumn(tableAlias, "Value", PREFIX) + ", " + sqlSelectColumn(tableAlias, "Classname", PREFIX); } private static ADProcessName retrieve(final ResultSet rs) throws SQLException { return ADProcessName.builder()
.value(rs.getString(PREFIX + "Value")) .classname(rs.getString(PREFIX + "Classname")) .build(); } } public static final class ADElementName_Loader { public static String retrieveColumnName(@NonNull final AdElementId adElementId) { return DB.getSQLValueStringEx(ITrx.TRXNAME_ThreadInherited, "SELECT ColumnName FROM AD_Element WHERE AD_Element_ID=?", adElementId); } } public static final class ADMessageName_Loader { public static String retrieveValue(@NonNull final AdMessageId adMessageId) { return DB.getSQLValueStringEx(ITrx.TRXNAME_ThreadInherited, "SELECT Value FROM AD_Message WHERE AD_Message_ID=?", adMessageId); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\migration\validator\sql_migration_context_info\names\Names.java
1
请完成以下Java代码
public int getM_Product_ID() { return order.getM_Product_ID(); } @Override public void setM_Product_ID(final int productId) { order.setM_Product_ID(productId); } @Override public int getM_AttributeSetInstance_ID() { return -1; // N/A } @Override public void setM_AttributeSetInstance_ID(final int M_AttributeSetInstance_ID) { throw new UnsupportedOperationException(); } @Override public int getC_UOM_ID() { // TODO Auto-generated method stub return -1; } @Override public void setC_UOM_ID(final int uomId) { throw new UnsupportedOperationException(); } @Override public void setQty(final BigDecimal qty) { order.setQty_FastInput(qty); } @Override public BigDecimal getQty() { return order.getQty_FastInput(); } @Override public int getM_HU_PI_Item_Product_ID() { return order.getM_HU_PI_Item_Product_ID(); }
@Override public void setM_HU_PI_Item_Product_ID(final int huPiItemProductId) { order.setM_HU_PI_Item_Product_ID(huPiItemProductId); } @Override public BigDecimal getQtyTU() { return order.getQty_FastInput_TU(); } @Override public void setQtyTU(final BigDecimal qtyPacks) { order.setQty_FastInput_TU(qtyPacks); } @Override public void setC_BPartner_ID(final int bpartnerId) { order.setC_BPartner_ID(bpartnerId); } @Override public int getC_BPartner_ID() { return order.getC_BPartner_ID(); } @Override public boolean isInDispute() { return false; } @Override public void setInDispute(final boolean inDispute) { throw new UnsupportedOperationException(); } @Override public String toString() { return String .format("OrderHUPackingAware [order=%s, getM_Product_ID()=%s, getM_Product()=%s, getM_AttributeSetInstance_ID()=%s, getC_UOM()=%s, getQty()=%s, getM_HU_PI_Item_Product()=%s, getQtyPacks()=%s, getC_BPartner()=%s, getM_HU_PI_Item_Product_ID()=%s, isInDispute()=%s]", order, getM_Product_ID(), getM_Product_ID(), getM_AttributeSetInstance_ID(), getC_UOM_ID(), getQty(), getM_HU_PI_Item_Product_ID(), getQtyTU(), getC_BPartner_ID(), getM_HU_PI_Item_Product_ID(), isInDispute()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\adempiere\gui\search\impl\OrderHUPackingAware.java
1
请完成以下Java代码
public ProcessPreconditionsResolution checkPreconditionsApplicable(final @NonNull IProcessPreconditionsContext context) { final Optional<ProcessPreconditionsResolution> customPreconditions = applyCustomPreconditionsIfAny(context); if (customPreconditions.isPresent()) { return customPreconditions.get(); } if (context.isNoSelection()) { return ProcessPreconditionsResolution.rejectBecauseNoSelection(); } if (!externalSystemConfigRepo.isAnyConfigActive(getExternalSystemType())) { return ProcessPreconditionsResolution.reject(); } return ProcessPreconditionsResolution.accept(); } @Override protected String doIt() throws Exception { addLog("Calling with params: externalSystemChildConfigId: {}", getExternalSystemChildConfigId()); final Iterator<I_C_BPartner> bPartnerIterator = getSelectedBPartnerRecords(); final IExternalSystemChildConfigId externalSystemChildConfigId = getExternalSystemChildConfigId(); while (bPartnerIterator.hasNext()) { final TableRecordReference bPartnerRecordRef = TableRecordReference.of(bPartnerIterator.next()); getExportToBPartnerExternalSystem().exportToExternalSystem(externalSystemChildConfigId, bPartnerRecordRef, getPinstanceId()); }
return JavaProcess.MSG_OK; } @NonNull private Iterator<I_C_BPartner> getSelectedBPartnerRecords() { final IQueryBuilder<I_C_BPartner> bPartnerQuery = retrieveSelectedRecordsQueryBuilder(I_C_BPartner.class); return bPartnerQuery .create() .iterate(I_C_BPartner.class); } protected Optional<ProcessPreconditionsResolution> applyCustomPreconditionsIfAny(final @NonNull IProcessPreconditionsContext context) { return Optional.empty(); } protected abstract ExternalSystemType getExternalSystemType(); protected abstract IExternalSystemChildConfigId getExternalSystemChildConfigId(); protected abstract String getExternalSystemParam(); protected abstract ExportToExternalSystemService getExportToBPartnerExternalSystem(); }
repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java\de\metas\externalsystem\export\bpartner\C_BPartner_SyncTo_ExternalSystem.java
1
请在Spring Boot框架中完成以下Java代码
public java.lang.String getPOSPaymentMethod() { return get_ValueAsString(COLUMNNAME_POSPaymentMethod); } /** * POSPaymentProcessingStatus AD_Reference_ID=541897 * Reference name: POSPaymentProcessingStatus */ public static final int POSPAYMENTPROCESSINGSTATUS_AD_Reference_ID=541897; /** SUCCESSFUL = SUCCESSFUL */ public static final String POSPAYMENTPROCESSINGSTATUS_SUCCESSFUL = "SUCCESSFUL"; /** CANCELLED = CANCELLED */ public static final String POSPAYMENTPROCESSINGSTATUS_CANCELLED = "CANCELLED"; /** FAILED = FAILED */ public static final String POSPAYMENTPROCESSINGSTATUS_FAILED = "FAILED"; /** PENDING = PENDING */ public static final String POSPAYMENTPROCESSINGSTATUS_PENDING = "PENDING"; /** NEW = NEW */ public static final String POSPAYMENTPROCESSINGSTATUS_NEW = "NEW"; /** DELETED = DELETED */ public static final String POSPAYMENTPROCESSINGSTATUS_DELETED = "DELETED"; @Override public void setPOSPaymentProcessingStatus (final java.lang.String POSPaymentProcessingStatus) { set_Value (COLUMNNAME_POSPaymentProcessingStatus, POSPaymentProcessingStatus); } @Override public java.lang.String getPOSPaymentProcessingStatus() { return get_ValueAsString(COLUMNNAME_POSPaymentProcessingStatus); } @Override public void setPOSPaymentProcessingSummary (final @Nullable java.lang.String POSPaymentProcessingSummary) { set_Value (COLUMNNAME_POSPaymentProcessingSummary, POSPaymentProcessingSummary); } @Override public java.lang.String getPOSPaymentProcessingSummary() { return get_ValueAsString(COLUMNNAME_POSPaymentProcessingSummary); } @Override public void setPOSPaymentProcessing_TrxId (final @Nullable java.lang.String POSPaymentProcessing_TrxId) { set_Value (COLUMNNAME_POSPaymentProcessing_TrxId, POSPaymentProcessing_TrxId); } @Override public java.lang.String getPOSPaymentProcessing_TrxId() { return get_ValueAsString(COLUMNNAME_POSPaymentProcessing_TrxId); } /** * POSPaymentProcessor AD_Reference_ID=541896 * Reference name: POSPaymentProcessor */ public static final int POSPAYMENTPROCESSOR_AD_Reference_ID=541896; /** SumUp = sumup */
public static final String POSPAYMENTPROCESSOR_SumUp = "sumup"; @Override public void setPOSPaymentProcessor (final @Nullable java.lang.String POSPaymentProcessor) { set_Value (COLUMNNAME_POSPaymentProcessor, POSPaymentProcessor); } @Override public java.lang.String getPOSPaymentProcessor() { return get_ValueAsString(COLUMNNAME_POSPaymentProcessor); } @Override public void setSUMUP_Config_ID (final int SUMUP_Config_ID) { if (SUMUP_Config_ID < 1) set_Value (COLUMNNAME_SUMUP_Config_ID, null); else set_Value (COLUMNNAME_SUMUP_Config_ID, SUMUP_Config_ID); } @Override public int getSUMUP_Config_ID() { return get_ValueAsInt(COLUMNNAME_SUMUP_Config_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.pos.base\src\main\java-gen\de\metas\pos\repository\model\X_C_POS_Payment.java
2
请完成以下Java代码
class DockerComposeSkipCheck { private static final Set<String> REQUIRED_CLASSES = Set.of("org.junit.jupiter.api.Test", "org.junit.Test"); private static final Set<String> SKIPPED_STACK_ELEMENTS; static { Set<String> skipped = new LinkedHashSet<>(); skipped.add("org.junit.runners."); skipped.add("org.junit.platform."); skipped.add("org.springframework.boot.test."); skipped.add(SpringApplicationAotProcessor.class.getName()); skipped.add("cucumber.runtime."); SKIPPED_STACK_ELEMENTS = Collections.unmodifiableSet(skipped); } boolean shouldSkip(@Nullable ClassLoader classLoader, DockerComposeProperties.Skip properties) { if (properties.isInTests() && hasAtLeastOneRequiredClass(classLoader)) { Thread thread = Thread.currentThread(); for (StackTraceElement element : thread.getStackTrace()) { if (isSkippedStackElement(element)) { return true; } } } return false; } private boolean hasAtLeastOneRequiredClass(@Nullable ClassLoader classLoader) { for (String requiredClass : REQUIRED_CLASSES) { if (ClassUtils.isPresent(requiredClass, classLoader)) {
return true; } } return false; } private static boolean isSkippedStackElement(StackTraceElement element) { for (String skipped : SKIPPED_STACK_ELEMENTS) { if (element.getClassName().startsWith(skipped)) { return true; } } return false; } }
repos\spring-boot-4.0.1\core\spring-boot-docker-compose\src\main\java\org\springframework\boot\docker\compose\lifecycle\DockerComposeSkipCheck.java
1
请完成以下Java代码
default Set<TableRecordReference> getSelectedIncludedRecords() { return ImmutableSet.of(); } default boolean isSingleIncludedRecordSelected() { return getSelectedIncludedRecords().size() == 1; } <T> IQueryFilter<T> getQueryFilter(@NonNull Class<T> recordClass); default ProcessPreconditionsResolution acceptIfSingleSelection() { if (isNoSelection()) { return ProcessPreconditionsResolution.rejectBecauseNoSelection();
} else if (isMoreThanOneSelected()) { return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection(); } else { return ProcessPreconditionsResolution.accept(); } } default OptionalBoolean isExistingDocument() {return OptionalBoolean.UNKNOWN;} default OptionalBoolean isProcessedDocument() { return OptionalBoolean.UNKNOWN; }; }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\process\IProcessPreconditionsContext.java
1
请在Spring Boot框架中完成以下Java代码
public class Category { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private Long id; @Column(name = "name") private String name; // getters and setters public Category() { } public Category(String name) { this.name = name; } public Long getId() {
return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
repos\tutorials-master\persistence-modules\spring-jpa-2\src\main\java\com\baeldung\manytomanyremoval\Category.java
2
请完成以下Java代码
public String getModelTableNameOrNull(final Object model) { return POWrapper.getStrictPO(model).get_TableName(); } @Override public boolean isNew(final Object model) { return POWrapper.isNew(model); } @Override public <T> T getValue(final Object model, final String columnName, final boolean throwExIfColumnNotFound, final boolean useOverrideColumnIfAvailable) { if (useOverrideColumnIfAvailable) { final IModelInternalAccessor modelAccessor = POWrapper.getModelInternalAccessor(model); final T value = getValueOverrideOrNull(modelAccessor, columnName); if (value != null) { return value; } } // final boolean useOldValues = POWrapper.isOldValues(model); final PO po = POWrapper.getStrictPO(model); final int idxColumnName = po.get_ColumnIndex(columnName); if (idxColumnName < 0) { if (throwExIfColumnNotFound) { throw new AdempiereException("No columnName " + columnName + " found for " + model); } else { return null; } } if (useOldValues) { @SuppressWarnings("unchecked") final T value = (T)po.get_ValueOld(idxColumnName); return value; } else { @SuppressWarnings("unchecked") final T value = (T)po.get_Value(idxColumnName); return value; } } @Override public boolean isValueChanged(final Object model, final String columnName)
{ return POWrapper.isValueChanged(model, columnName); } @Override public boolean isValueChanged(final Object model, final Set<String> columnNames) { return POWrapper.isValueChanged(model, columnNames); } @Override public boolean isNull(final Object model, final String columnName) { return POWrapper.isNull(model, columnName); } @Nullable @Override public <T> T getDynAttribute(final @NonNull Object model, final String attributeName) { return POWrapper.getDynAttribute(model, attributeName); } @Override public Object setDynAttribute(final Object model, final String attributeName, final Object value) { return POWrapper.setDynAttribute(model, attributeName, value); } public <T> T computeDynAttributeIfAbsent(@NonNull final Object model, @NonNull final String attributeName, @NonNull final Supplier<T> supplier) { return POWrapper.computeDynAttributeIfAbsent(model, attributeName, supplier); } @Override public <T extends PO> T getPO(final Object model, final boolean strict) { // always strict, else other wrapper helpers will handle it! return POWrapper.getStrictPO(model); } @Override public Evaluatee getEvaluatee(final Object model) { return POWrapper.getStrictPO(model); } @Override public boolean isCopy(final Object model) {return POWrapper.getStrictPO(model).isCopiedFromOtherRecord();} @Override public boolean isCopying(final Object model) {return POWrapper.getStrictPO(model).isCopying();} }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\wrapper\POInterfaceWrapperHelper.java
1
请完成以下Java代码
public Integer getId(String word) { return wordId.get(word); } public String getWord(int id) { assert 0 <= id; assert id <= idWord.size(); return idWord.get(id); } public int size() { return idWord.size(); }
public String[] getWordIdArray() { String[] wordIdArray = new String[idWord.size()]; if (idWord.isEmpty()) return wordIdArray; int p = -1; Iterator<String> iterator = idWord.iterator(); while (iterator.hasNext()) { wordIdArray[++p] = iterator.next(); } return wordIdArray; } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\classification\corpus\Lexicon.java
1
请完成以下Java代码
public int getAD_User_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Org Assignment. @param C_OrgAssignment_ID Assigment to (transaction) Organization */ public void setC_OrgAssignment_ID (int C_OrgAssignment_ID) { if (C_OrgAssignment_ID < 1) set_ValueNoCheck (COLUMNNAME_C_OrgAssignment_ID, null); else set_ValueNoCheck (COLUMNNAME_C_OrgAssignment_ID, Integer.valueOf(C_OrgAssignment_ID)); } /** Get Org Assignment. @return Assigment to (transaction) Organization */ public int getC_OrgAssignment_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_OrgAssignment_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 Valid from. @param ValidFrom Valid from including this date (first day) */ public void setValidFrom (Timestamp ValidFrom) { set_Value (COLUMNNAME_ValidFrom, ValidFrom); } /** Get Valid from. @return Valid from including this date (first day) */ public Timestamp getValidFrom () { return (Timestamp)get_Value(COLUMNNAME_ValidFrom); } /** Set Valid to. @param ValidTo Valid to including this date (last day) */ public void setValidTo (Timestamp ValidTo) { set_Value (COLUMNNAME_ValidTo, ValidTo); } /** Get Valid to. @return Valid to including this date (last day) */ public Timestamp getValidTo () { return (Timestamp)get_Value(COLUMNNAME_ValidTo); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_OrgAssignment.java
1
请完成以下Java代码
public void reload(final InboundEMailConfigId id) { final InboundEMailConfig config = configsRepo.getById(id); reload(config); } public synchronized void reload(final InboundEMailConfig config) { final InboundEMailConfigId configId = config.getId(); final InboundEMailConfig loadedConfig = loadedConfigs.get(configId); if (loadedConfig != null && loadedConfig.equals(config)) { logger.info("Skip reloading {} because it's already loaded and not changed", config); } unloadById(configId); load(config); } public synchronized void unloadById(final InboundEMailConfigId configId) { final InboundEMailConfig loadedConfig = loadedConfigs.remove(configId); if (loadedConfig == null) { logger.info("Skip unloading inbound mail for {} because it's not loaded", configId); return; } try { flowContext.remove(toFlowId(configId)); logger.info("Unloaded inbound mail for {}", configId); } catch (final Exception ex) { logger.warn("Unloading inbound mail for {} failed. Ignored.", configId, ex); } } private synchronized void load(final InboundEMailConfig config) { final IntegrationFlow flow = createIntegrationFlow(config); flowContext.registration(flow) .id(toFlowId(config.getId())) .register(); loadedConfigs.put(config.getId(), config);
logger.info("Loaded inbound mail for {}", config); } private IntegrationFlow createIntegrationFlow(final InboundEMailConfig config) { return IntegrationFlows .from(Mail.imapIdleAdapter(config.getUrl()) .javaMailProperties(p -> p.put("mail.debug", Boolean.toString(config.isDebugProtocol()))) .userFlag(IMAP_USER_FLAG) .shouldMarkMessagesAsRead(false) .shouldDeleteMessages(false) .shouldReconnectAutomatically(true) .embeddedPartsAsBytes(false) .headerMapper(InboundEMailHeaderAndContentMapper.newInstance())) .handle(InboundEMailMessageHandler.builder() .config(config) .emailService(emailService) .build()) .get(); } @Override public void onInboundEMailConfigChanged(final Set<InboundEMailConfigId> changedConfigIds) { final List<InboundEMailConfig> newOrChangedConfigs = configsRepo.getByIds(changedConfigIds); final Set<InboundEMailConfigId> newOrChangedConfigIds = newOrChangedConfigs.stream() .map(InboundEMailConfig::getId) .collect(ImmutableSet.toImmutableSet()); final Set<InboundEMailConfigId> deletedConfigIds = Sets.difference(changedConfigIds, newOrChangedConfigIds); deletedConfigIds.forEach(this::unloadById); reload(newOrChangedConfigs); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.inbound.mail\src\main\java\de\metas\inbound\mail\InboundEMailServer.java
1
请完成以下Java代码
public class FormTypes { protected Map<String, AbstractFormFieldType> formTypes = new HashMap<String, AbstractFormFieldType>(); public void addFormType(AbstractFormFieldType formType) { formTypes.put(formType.getName(), formType); } public AbstractFormFieldType parseFormPropertyType(Element formFieldElement, BpmnParse bpmnParse) { AbstractFormFieldType formType = null; String typeText = formFieldElement.attribute("type"); String datePatternText = formFieldElement.attribute("datePattern"); if (typeText == null && DefaultFormHandler.FORM_FIELD_ELEMENT.equals(formFieldElement.getTagName())) { bpmnParse.addError("form field must have a 'type' attribute", formFieldElement); } if ("date".equals(typeText) && datePatternText!=null) { formType = new DateFormType(datePatternText); } else if ("enum".equals(typeText)) { // ACT-1023: Using linked hashmap to preserve the order in which the entries are defined
Map<String, String> values = new LinkedHashMap<String, String>(); for (Element valueElement: formFieldElement.elementsNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS,"value")) { String valueId = valueElement.attribute("id"); String valueName = valueElement.attribute("name"); values.put(valueId, valueName); } formType = new EnumFormType(values); } else if (typeText!=null) { formType = formTypes.get(typeText); if (formType==null) { bpmnParse.addError("unknown type '"+typeText+"'", formFieldElement); } } return formType; } public AbstractFormFieldType getFormType(String name) { return formTypes.get(name); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\form\type\FormTypes.java
1
请完成以下Java代码
public String getEndActivityId() { return endActivityId; } public void setEndActivityId(String endActivityId) { this.endActivityId = endActivityId; } public String getStartActivityId() { return startActivityId; } public void setStartActivityId(String startActivityId) { this.startActivityId = startActivityId; } public String getBusinessKey() { return businessKey; } public void setBusinessKey(String businessKey) { this.businessKey = businessKey; } public String getStartUserId() { return startUserId; } public void setStartUserId(String startUserId) { this.startUserId = startUserId; } public String getSuperProcessInstanceId() { return superProcessInstanceId; } public void setSuperProcessInstanceId(String superProcessInstanceId) { this.superProcessInstanceId = superProcessInstanceId; } public String getSuperCaseInstanceId() { return superCaseInstanceId; } public void setSuperCaseInstanceId(String superCaseInstanceId) { this.superCaseInstanceId = superCaseInstanceId; } public String getDeleteReason() { return deleteReason; } public void setDeleteReason(String deleteReason) { this.deleteReason = deleteReason; }
public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getRestartedProcessInstanceId() { return restartedProcessInstanceId; } public void setRestartedProcessInstanceId(String restartedProcessInstanceId) { this.restartedProcessInstanceId = restartedProcessInstanceId; } @Override public String toString() { return this.getClass().getSimpleName() + "[businessKey=" + businessKey + ", startUserId=" + startUserId + ", superProcessInstanceId=" + superProcessInstanceId + ", rootProcessInstanceId=" + rootProcessInstanceId + ", superCaseInstanceId=" + superCaseInstanceId + ", deleteReason=" + deleteReason + ", durationInMillis=" + durationInMillis + ", startTime=" + startTime + ", endTime=" + endTime + ", removalTime=" + removalTime + ", endActivityId=" + endActivityId + ", startActivityId=" + startActivityId + ", id=" + id + ", eventType=" + eventType + ", executionId=" + executionId + ", processDefinitionId=" + processDefinitionId + ", processInstanceId=" + processInstanceId + ", tenantId=" + tenantId + ", restartedProcessInstanceId=" + restartedProcessInstanceId + "]"; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\history\event\HistoricProcessInstanceEventEntity.java
1
请完成以下Java代码
public FormFieldHandler getFormFieldHandler() { return formFieldHandler; } public DelegateExecution getExecution() { if(variableScope instanceof DelegateExecution) { return (DelegateExecution) variableScope; } else if(variableScope instanceof TaskEntity){ return ((TaskEntity) variableScope).getExecution(); } else { return null; } }
public VariableScope getVariableScope() { return variableScope; } public String getConfiguration() { return configuration; } public void setConfiguration(String configuration) { this.configuration = configuration; } public Map<String, Object> getSubmittedValues() { return submittedValues; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\form\handler\DefaultFormFieldValidatorContext.java
1
请完成以下Java代码
public boolean isOptOut() { return getOptOutDate() != null; } // isOptOut /** * Set Subscribe Date * User action only. * @param SubscribeDate date */ @Override public void setSubscribeDate (Timestamp SubscribeDate) { if (SubscribeDate == null) SubscribeDate = new Timestamp(System.currentTimeMillis()); log.debug("" + SubscribeDate); super.setSubscribeDate(SubscribeDate); super.setOptOutDate(null); setIsActive(true); } // setSubscribeDate /** * Subscribe * User action only. */ public void subscribe() { setSubscribeDate(null); if (!isActive()) setIsActive(true); } // subscribe /** * Subscribe. * User action only. * @param subscribe subscribe */ public void subscribe (boolean subscribe) { if (subscribe) setSubscribeDate(null); else setOptOutDate(null); } // subscribe /** * Is Subscribed. * Active is set internally, * the opt out date is set by the user via the web UI. * @return true if subscribed */ public boolean isSubscribed() { return isActive() && getOptOutDate() == null; } // isSubscribed /** * String representation
* @return info */ @Override public String toString () { StringBuffer sb = new StringBuffer ("MContactInterest[") .append("R_InterestArea_ID=").append(getR_InterestArea_ID()) .append(",AD_User_ID=").append(getAD_User_ID()) .append(",Subscribed=").append(isSubscribed()) .append ("]"); return sb.toString (); } // toString /************************************************************************** * @param args ignored */ public static void main (String[] args) { org.compiere.Adempiere.startup(true); int R_InterestArea_ID = 1000002; int AD_User_ID = 1000002; MContactInterest ci = MContactInterest.get(Env.getCtx(), R_InterestArea_ID, AD_User_ID, false, null); ci.subscribe(); ci.save(); // ci = MContactInterest.get(Env.getCtx(), R_InterestArea_ID, AD_User_ID, false, null); } // main } // MContactInterest
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MContactInterest.java
1
请完成以下Java代码
public IAllocationRequestBuilder setFromReferencedModel(@Nullable final Object referenceModel) { final TableRecordReference fromReferencedTableRecord = TableRecordReference.ofOrNull(referenceModel); return setFromReferencedTableRecord(fromReferencedTableRecord); } @Override public IAllocationRequestBuilder setForceQtyAllocation(final Boolean forceQtyAllocation) { this.forceQtyAllocation = forceQtyAllocation; return this; } private boolean isForceQtyAllocationToUse() { if (forceQtyAllocation != null) { return forceQtyAllocation; } else if (baseAllocationRequest != null) { return baseAllocationRequest.isForceQtyAllocation(); } throw new AdempiereException("ForceQtyAllocation not set in " + this); } @Override public IAllocationRequestBuilder addEmptyHUListener(@NonNull final EmptyHUListener emptyHUListener) { if (emptyHUListeners == null) { emptyHUListeners = new ArrayList<>(); } emptyHUListeners.add(emptyHUListener); return this; } @Override public IAllocationRequestBuilder setClearanceStatusInfo(@Nullable final ClearanceStatusInfo clearanceStatusInfo) { this.clearanceStatusInfo = clearanceStatusInfo; return this; } @Override @Nullable public ClearanceStatusInfo getClearanceStatusInfo() { if (clearanceStatusInfo != null) { return clearanceStatusInfo; } else if (baseAllocationRequest != null) { return baseAllocationRequest.getClearanceStatusInfo(); }
return null; } @Override public IAllocationRequestBuilder setDeleteEmptyAndJustCreatedAggregatedTUs(@Nullable final Boolean deleteEmptyAndJustCreatedAggregatedTUs) { this.deleteEmptyAndJustCreatedAggregatedTUs = deleteEmptyAndJustCreatedAggregatedTUs; return this; } private boolean isDeleteEmptyAndJustCreatedAggregatedTUs() { if (deleteEmptyAndJustCreatedAggregatedTUs != null) { return deleteEmptyAndJustCreatedAggregatedTUs; } else if (baseAllocationRequest != null) { return baseAllocationRequest.isDeleteEmptyAndJustCreatedAggregatedTUs(); } return false; } @Override public IAllocationRequest create() { final IHUContext huContext = getHUContextToUse(); final ProductId productId = getProductIdToUse(); final Quantity quantity = getQuantityToUse(); final ZonedDateTime date = getDateToUse(); final TableRecordReference fromTableRecord = getFromReferencedTableRecordToUse(); final boolean forceQtyAllocation = isForceQtyAllocationToUse(); final ClearanceStatusInfo clearanceStatusInfo = getClearanceStatusInfo(); return new AllocationRequest( huContext, productId, quantity, date, fromTableRecord, forceQtyAllocation, clearanceStatusInfo, isDeleteEmptyAndJustCreatedAggregatedTUs()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\allocation\impl\AllocationRequestBuilder.java
1
请完成以下Java代码
public void collectAndSet(final IFacetsPool<ModelType> facetsPool) { final IFacetCollectorResult<ModelType> result = collect(); facetsPool.setFacetCategories(result.getFacetCategories()); facetsPool.setFacets(result.getFacets()); } /** * Collect the facets, and update the given {@link IFacetsPool}. * Compared with {@link #collectAndSet(IFacetsPool)} which is fully reseting the pool, this method will reset only the collected facet categories. * * @param facetsPool * @see #collectAndSet(IFacetsPool) */ public void collectAndUpdate(final IFacetsPool<ModelType> facetsPool) { final IFacetCollectorResult<ModelType> result = collect(); facetsPool.updateFrom(result); } /** * Sets the source from where the facets will be collected. * * @param dataSource */ public FacetCollectorRequestBuilder<ModelType> setSource(final IFacetFilterable<ModelType> dataSource) { this.source_filterable = dataSource; return this; } /** * @param onlyFacetCategoriesPredicate * @return facets collecting source to be used when collecting facets. */ public IQueryBuilder<ModelType> getSourceToUse(final Predicate<IFacetCategory> onlyFacetCategoriesPredicate) { Check.assumeNotNull(source_filterable, "source_filterable not null"); final IQueryBuilder<ModelType> queryBuilder = source_filterable.createQueryBuilder(onlyFacetCategoriesPredicate); return queryBuilder; } /** * Advice to collect facets only from given included facet categories. All other facet categories will be excluded. * * @param facetCategory */ public FacetCollectorRequestBuilder<ModelType> includeFacetCategory(final IFacetCategory facetCategory)
{ facetCategoryIncludesExcludes.include(facetCategory); return this; } /** * Advice to NOT collect facets from given exclude facet categories, even if they were added to include list. * * @param facetCategory */ public FacetCollectorRequestBuilder<ModelType> excludeFacetCategory(final IFacetCategory facetCategory) { facetCategoryIncludesExcludes.exclude(facetCategory); return this; } /** * * @param facetCategory * @return true if given facet category shall be considered when collecting facets */ public boolean acceptFacetCategory(final IFacetCategory facetCategory) { // Don't accept it if is excluded by includes/excludes list if (!facetCategoryIncludesExcludes.build().test(facetCategory)) { return false; } // Only categories which have "eager refresh" set (if asked) if (onlyEagerRefreshCategories && !facetCategory.isEagerRefresh()) { return false; } // accept the facet category return true; } /** * Collect facets only for categories which have {@link IFacetCategory#isEagerRefresh()}. */ public FacetCollectorRequestBuilder<ModelType> setOnlyEagerRefreshCategories() { this.onlyEagerRefreshCategories = true; return this; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\facet\FacetCollectorRequestBuilder.java
1
请完成以下Java代码
public void onActivate(TbActorCtx context) throws Exception { restart(context); } public void onSuspend(TbActorCtx context) throws Exception { stop(context); } public void onStop(TbActorCtx context) throws Exception { stop(context); } private void restart(TbActorCtx context) throws Exception { stop(context); start(context); } public ScheduledFuture<?> scheduleStatsPersistTick(TbActorCtx context, long statsPersistFrequency) { return schedulePeriodicMsgWithDelay(context, StatsPersistTick.INSTANCE, statsPersistFrequency, statsPersistFrequency); } protected boolean checkMsgValid(TbMsg tbMsg) { var valid = tbMsg.isValid(); if (!valid) { if (log.isTraceEnabled()) { log.trace("Skip processing of message: {} because it is no longer valid!", tbMsg); } }
return valid; } protected void checkComponentStateActive(TbMsg tbMsg) throws RuleNodeException { if (state != ComponentLifecycleState.ACTIVE) { log.debug("Component is not active. Current state [{}] for processor [{}][{}] tenant [{}]", state, entityId.getEntityType(), entityId, tenantId); RuleNodeException ruleNodeException = getInactiveException(); if (tbMsg != null) { tbMsg.getCallback().onFailure(ruleNodeException); } throw ruleNodeException; } } abstract protected RuleNodeException getInactiveException(); }
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\actors\shared\ComponentMsgProcessor.java
1
请完成以下Java代码
public void setSession_ID (int Session_ID) { if (Session_ID < 1) set_Value (COLUMNNAME_Session_ID, null); else set_Value (COLUMNNAME_Session_ID, Integer.valueOf(Session_ID)); } /** Get Session ID. @return Session ID */ public int getSession_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_Session_ID); if (ii == null) return 0; return ii.intValue(); } /** Get Record ID/ColumnName @return ID/ColumnName pair */ public KeyNamePair getKeyNamePair() { return new KeyNamePair(get_ID(), String.valueOf(getSession_ID()));
} /** Set W_Basket_ID. @param W_Basket_ID Web Basket */ public void setW_Basket_ID (int W_Basket_ID) { if (W_Basket_ID < 1) set_ValueNoCheck (COLUMNNAME_W_Basket_ID, null); else set_ValueNoCheck (COLUMNNAME_W_Basket_ID, Integer.valueOf(W_Basket_ID)); } /** Get W_Basket_ID. @return Web Basket */ public int getW_Basket_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_W_Basket_ID); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_W_Basket.java
1
请完成以下Java代码
public class XxlJobGroup { private int id; private String appname; private String title; private int addressType; // 执行器地址类型:0=自动注册、1=手动录入 private String addressList; // 执行器地址列表,多地址逗号分隔(手动录入) private Date updateTime; // registry list private List<String> registryList; // 执行器地址列表(系统注册) public List<String> getRegistryList() { if (addressList!=null && addressList.trim().length()>0) { registryList = new ArrayList<String>(Arrays.asList(addressList.split(","))); } return registryList; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getAppname() { return appname; } public void setAppname(String appname) { this.appname = appname; } public String getTitle() { return title; } public void setTitle(String title) {
this.title = title; } public int getAddressType() { return addressType; } public void setAddressType(int addressType) { this.addressType = addressType; } public String getAddressList() { return addressList; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public void setAddressList(String addressList) { this.addressList = addressList; } }
repos\JeecgBoot-main\jeecg-boot\jeecg-server-cloud\jeecg-visual\jeecg-cloud-xxljob\src\main\java\com\xxl\job\admin\core\model\XxlJobGroup.java
1
请完成以下Java代码
public ImmutableSet<HuId> retrieveHuIdAndDownstream(@NonNull final HuId huId) { final ImmutableSet.Builder<HuId> huIdAndDownstream = ImmutableSet.builder(); new HUIterator() .setEnableStorageIteration(false) .setListener(new HUIteratorListenerAdapter() { @Override public Result beforeHU(final IMutable<I_M_HU> hu) { huIdAndDownstream.add(HuId.ofRepoId(hu.getValue().getM_HU_ID())); return Result.CONTINUE; } }) .iterate(getById(huId)); return huIdAndDownstream.build(); } @Override public <T> Stream<T> streamByQuery(@NonNull final IQueryBuilder<I_M_HU> queryBuilder, @NonNull final Function<I_M_HU, T> mapper) { return queryBuilder .create() .iterateAndStream() .map(mapper); } @Override public void createTUPackingInstructions(final CreateTUPackingInstructionsRequest request) { CreateTUPackingInstructionsCommand.builder() .handlingUnitsDAO(this) .request(request) .build() .execute(); }
@Override public Optional<I_M_HU_PI_Item> getTUPIItemForLUPIAndItemProduct(final BPartnerId bpartnerId, final @NonNull HuPackingInstructionsId luPIId, final @NonNull HUPIItemProductId piItemProductId) { final I_M_HU_PI_Version luPIVersion = retrievePICurrentVersionOrNull(luPIId); if (luPIVersion == null || !luPIVersion.isActive() || !luPIVersion.isCurrent() || !X_M_HU_PI_Version.HU_UNITTYPE_LoadLogistiqueUnit.equals(luPIVersion.getHU_UnitType())) { return Optional.empty(); } return queryBL.createQueryBuilder(I_M_HU_PI_Item_Product.class) .addOnlyActiveRecordsFilter() .addEqualsFilter(I_M_HU_PI_Item_Product.COLUMNNAME_M_HU_PI_Item_Product_ID, piItemProductId) .andCollect(I_M_HU_PI_Item_Product.COLUMNNAME_M_HU_PI_Item_ID, I_M_HU_PI_Item.class) .addEqualsFilter(I_M_HU_PI_Item.COLUMNNAME_ItemType, X_M_HU_PI_Item.ITEMTYPE_Material) .addInArrayFilter(I_M_HU_PI_Item.COLUMNNAME_C_BPartner_ID, bpartnerId, null) .addOnlyActiveRecordsFilter() .andCollect(I_M_HU_PI_Item.COLUMNNAME_M_HU_PI_Version_ID, I_M_HU_PI_Version.class) .addEqualsFilter(I_M_HU_PI_Version.COLUMNNAME_HU_UnitType, X_M_HU_PI_Version.HU_UNITTYPE_TransportUnit) .addEqualsFilter(I_M_HU_PI_Version.COLUMNNAME_IsCurrent, true) .addOnlyActiveRecordsFilter() .andCollect(I_M_HU_PI_Version.COLUMNNAME_M_HU_PI_ID, I_M_HU_PI.class) .andCollectChildren(I_M_HU_PI_Item.COLUMNNAME_Included_HU_PI_ID, I_M_HU_PI_Item.class) .addOnlyActiveRecordsFilter() .addEqualsFilter(I_M_HU_PI_Item.COLUMNNAME_ItemType, X_M_HU_PI_Item.ITEMTYPE_HandlingUnit) .addEqualsFilter(I_M_HU_PI_Item.COLUMNNAME_M_HU_PI_Version_ID, luPIVersion.getM_HU_PI_Version_ID()) .orderBy(I_M_HU_PI_Item.COLUMNNAME_M_HU_PI_Version_ID) .create() .firstOptional(I_M_HU_PI_Item.class); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\impl\HandlingUnitsDAO.java
1
请完成以下Java代码
public class IgniteCacheExample { public static void main(String[] args) { Ignite ignite = Ignition.ignite(); IgniteCache<Integer, String> cache = ignite.cache("baeldungCache"); cache.put(1, "baeldung cache value"); String message = cache.get(1); } private static void getObjectFromCache(Ignite ignite) { IgniteCache<Integer, Employee> cache = ignite.getOrCreateCache("baeldungCache"); cache.put(1, new Employee(1, "John", true)); cache.put(2, new Employee(2, "Anna", false)); cache.put(3, new Employee(3, "George", true)); Employee employee = cache.get(1); } private static void getFromCacheWithSQl(Ignite ignite) { IgniteCache<Integer, Employee> cache = ignite.cache("baeldungCache"); SqlFieldsQuery sql = new SqlFieldsQuery( "select name from Employee where isEmployed = 'true'");
QueryCursor<List<?>> cursor = cache.query(sql); for (List<?> row : cursor) { System.out.println(row.get(0)); } } private static void customInitialization() { IgniteConfiguration configuration = new IgniteConfiguration(); configuration.setLifecycleBeans(new CustomLifecycleBean()); Ignite ignite = Ignition.start(configuration); } }
repos\tutorials-master\libraries-data-2\src\main\java\com\baeldung\ignite\cache\IgniteCacheExample.java
1
请完成以下Java代码
public java.lang.String getSummary () { return (java.lang.String)get_Value(COLUMNNAME_Summary); } /** * TaskStatus AD_Reference_ID=366 * Reference name: R_Request TaskStatus */ public static final int TASKSTATUS_AD_Reference_ID=366; /** 0% Not Started = 0 */ public static final String TASKSTATUS_0NotStarted = "0"; /** 100% Complete = D */ public static final String TASKSTATUS_100Complete = "D"; /** 20% Started = 2 */ public static final String TASKSTATUS_20Started = "2"; /** 80% Nearly Done = 8 */ public static final String TASKSTATUS_80NearlyDone = "8"; /** 40% Busy = 4 */ public static final String TASKSTATUS_40Busy = "4"; /** 60% Good Progress = 6 */ public static final String TASKSTATUS_60GoodProgress = "6"; /** 90% Finishing = 9 */ public static final String TASKSTATUS_90Finishing = "9"; /** 95% Almost Done = A */
public static final String TASKSTATUS_95AlmostDone = "A"; /** 99% Cleaning up = C */ public static final String TASKSTATUS_99CleaningUp = "C"; /** Set Task Status. @param TaskStatus Status of the Task */ @Override public void setTaskStatus (java.lang.String TaskStatus) { set_Value (COLUMNNAME_TaskStatus, TaskStatus); } /** Get Task Status. @return Status of the Task */ @Override public java.lang.String getTaskStatus () { return (java.lang.String)get_Value(COLUMNNAME_TaskStatus); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_R_Request.java
1
请在Spring Boot框架中完成以下Java代码
public class AD_WF_Node_CopyRecordSupport extends GeneralCopyRecordSupport { private final IQueryBL queryBL = Services.get(IQueryBL.class); @Override protected void onRecordAndChildrenCopied(final PO to, final PO from, final CopyTemplate template) { final I_AD_WF_Node toWFNode = InterfaceWrapperHelper.create(to, I_AD_WF_Node.class); final I_AD_WF_Node fromWFNode = InterfaceWrapperHelper.create(from, I_AD_WF_Node.class); cloneWFNodeProductsForWFNode(toWFNode, fromWFNode); ClonedWFNodesInfo.getOrCreate(getTargetWorkflow()) .addOriginalToClonedWFStepMapping(WFNodeId.ofRepoId(fromWFNode.getAD_WF_Node_ID()), WFNodeId.ofRepoId(toWFNode.getAD_WF_Node_ID())); } private I_AD_Workflow getTargetWorkflow() { return Check.assumeNotNull(getParentModel(I_AD_Workflow.class), "target workflow is not null"); } private void cloneWFNodeProductsForWFNode(@NonNull final I_AD_WF_Node toWFNode, @NonNull final I_AD_WF_Node fromWFNode) { getWFNodeProductsByWorkflowIdAndWFNodeId(WorkflowId.ofRepoId(fromWFNode.getAD_Workflow_ID()), WFNodeId.ofRepoId(fromWFNode.getAD_WF_Node_ID())) .forEach(wfNodeProduct -> cloneWFNodeProductAndSetNewWorkflowAndWFNode(wfNodeProduct, WFNodeId.ofRepoId(toWFNode.getAD_WF_Node_ID()), WorkflowId.ofRepoId(toWFNode.getAD_Workflow_ID()))); } public ImmutableList<I_PP_WF_Node_Product> getWFNodeProductsByWorkflowIdAndWFNodeId( @NonNull final WorkflowId fromWorkflowId,
@NonNull final WFNodeId fromWFNodeId) { return queryBL.createQueryBuilder(I_PP_WF_Node_Product.class) .addEqualsFilter(I_PP_WF_Node_Product.COLUMNNAME_AD_Workflow_ID, fromWorkflowId.getRepoId()) .addEqualsFilter(I_PP_WF_Node_Product.COLUMNNAME_AD_WF_Node_ID, fromWFNodeId.getRepoId()) .create() .stream() .collect(ImmutableList.toImmutableList()); } private void cloneWFNodeProductAndSetNewWorkflowAndWFNode( final @NonNull I_PP_WF_Node_Product wfNodeProduct, final @NonNull WFNodeId toWFNodeId, final @NonNull WorkflowId toWorkflowId) { final I_PP_WF_Node_Product newWFNodeProduct = InterfaceWrapperHelper.newInstance(I_PP_WF_Node_Product.class); InterfaceWrapperHelper.copyValues(wfNodeProduct, newWFNodeProduct); newWFNodeProduct.setAD_WF_Node_ID(toWFNodeId.getRepoId()); newWFNodeProduct.setAD_Workflow_ID(toWorkflowId.getRepoId()); InterfaceWrapperHelper.saveRecord(newWFNodeProduct); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\workflow\service\impl\AD_WF_Node_CopyRecordSupport.java
2
请完成以下Java代码
protected long createHashAsLong(String assignee) { String algorithm = "MD5"; try { // create a 64 bit (8 byte) hash from an MD5 hash (128 bit) and convert to a long (8 byte) MessageDigest digest = MessageDigest.getInstance(algorithm); digest.update(assignee.getBytes(StandardCharsets.UTF_8)); return ByteBuffer.wrap(digest.digest(), 0, 8).getLong(); } catch (NoSuchAlgorithmException e) { throw new ProcessEngineException("Cannot lookup hash algorithm '" + algorithm + "'"); } } public TaskMeterLogEntity() { } public String getId() { return id; } public void setId(String id) { this.id = id; } public Date getTimestamp() { return timestamp; } public void setTimestamp(Date timestamp) { this.timestamp = timestamp; } public long getAssigneeHash() { return assigneeHash;
} public void setAssigneeHash(long assigneeHash) { this.assigneeHash = assigneeHash; } public Object getPersistentState() { // immutable return TaskMeterLogEntity.class; } @Override public Set<String> getReferencedEntityIds() { Set<String> referencedEntityIds = new HashSet<>(); return referencedEntityIds; } @Override public Map<String, Class> getReferencedEntitiesIdAndClass() { Map<String, Class> referenceIdAndClass = new HashMap<>(); return referenceIdAndClass; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\TaskMeterLogEntity.java
1
请完成以下Java代码
public List<PrintPackageInfo> getPrintPackageInfos() { if (printPackageInfos == null) { return Collections.emptyList(); } return printPackageInfos; } public void setPrintPackageInfos(List<PrintPackageInfo> printPackageInfos) { this.printPackageInfos = printPackageInfos; } public String getPrintJobInstructionsID() { return printJobInstructionsID; } public void setPrintJobInstructionsID(String printJobInstructionsID) { this.printJobInstructionsID = printJobInstructionsID; } public int getCopies() { return copies; } public void setCopies(final int copies) { this.copies = copies; } @Override public String toString() { return String.format("PrintPackage [transactionId=%s, printPackageId=%s, pageCount=%s, copies=%s, format=%s, printPackageInfos=%s, printJobInstructionsID=%s]", transactionId, printPackageId, pageCount, copies, format, printPackageInfos, printJobInstructionsID); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + copies; result = prime * result + ((format == null) ? 0 : format.hashCode()); result = prime * result + pageCount; result = prime * result + ((printJobInstructionsID == null) ? 0 : printJobInstructionsID.hashCode()); result = prime * result + ((printPackageId == null) ? 0 : printPackageId.hashCode()); result = prime * result + ((printPackageInfos == null) ? 0 : printPackageInfos.hashCode()); result = prime * result + ((transactionId == null) ? 0 : transactionId.hashCode()); return result; } @Override
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PrintPackage other = (PrintPackage)obj; if (copies != other.copies) return false; if (format == null) { if (other.format != null) return false; } else if (!format.equals(other.format)) return false; if (pageCount != other.pageCount) return false; if (printJobInstructionsID == null) { if (other.printJobInstructionsID != null) return false; } else if (!printJobInstructionsID.equals(other.printJobInstructionsID)) return false; if (printPackageId == null) { if (other.printPackageId != null) return false; } else if (!printPackageId.equals(other.printPackageId)) return false; if (printPackageInfos == null) { if (other.printPackageInfos != null) return false; } else if (!printPackageInfos.equals(other.printPackageInfos)) return false; if (transactionId == null) { if (other.transactionId != null) return false; } else if (!transactionId.equals(other.transactionId)) return false; return true; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.printing.common\de.metas.printing.api\src\main\java\de\metas\printing\esb\api\PrintPackage.java
1
请完成以下Java代码
class CollectingMessageListener<S, T> implements MessageListener<S, T> { private final BlockingDeque<Message<S, T>> messages = new LinkedBlockingDeque<>(); private final AtomicInteger count = new AtomicInteger(); /* * (non-Javadoc) * @see org.springframework.data.mongodb.core.messaging.MessageListener#onMessage(org.springframework.data.mongodb.core.messaging.Message) */ @Override public void onMessage(Message<S, T> message) { System.out.println(String.format("Received Message in collection %s.\n\trawsource: %s\n\tconverted: %s", message.getProperties().getCollectionName(), message.getRaw(), message.getBody()));
count.incrementAndGet(); messages.add(message); } int messageCount() { return count.get(); } void awaitNextMessages(int count) throws InterruptedException { for (var i = 0; i < count; i++) { messages.take(); } } }
repos\spring-data-examples-main\mongodb\change-streams\src\main\java\example\springdata\mongodb\CollectingMessageListener.java
1
请在Spring Boot框架中完成以下Java代码
public void configure(H http) { J2eePreAuthenticatedProcessingFilter filter = getFilter(http.getSharedObject(AuthenticationManager.class), http); http.addFilter(filter); } /** * Gets the {@link J2eePreAuthenticatedProcessingFilter} or creates a default instance * using the properties provided. * @param authenticationManager the {@link AuthenticationManager} to use. * @return the {@link J2eePreAuthenticatedProcessingFilter} to use. */ private J2eePreAuthenticatedProcessingFilter getFilter(AuthenticationManager authenticationManager, H http) { if (this.j2eePreAuthenticatedProcessingFilter == null) { this.j2eePreAuthenticatedProcessingFilter = new J2eePreAuthenticatedProcessingFilter(); this.j2eePreAuthenticatedProcessingFilter.setAuthenticationManager(authenticationManager); this.j2eePreAuthenticatedProcessingFilter .setAuthenticationDetailsSource(createWebAuthenticationDetailsSource()); this.j2eePreAuthenticatedProcessingFilter .setSecurityContextHolderStrategy(getSecurityContextHolderStrategy()); this.j2eePreAuthenticatedProcessingFilter = postProcess(this.j2eePreAuthenticatedProcessingFilter); } return this.j2eePreAuthenticatedProcessingFilter; } /** * Gets the {@link AuthenticationUserDetailsService} that was specified or defaults to * {@link PreAuthenticatedGrantedAuthoritiesUserDetailsService}. * @return the {@link AuthenticationUserDetailsService} to use */
private AuthenticationUserDetailsService<PreAuthenticatedAuthenticationToken> getUserDetailsService() { return (this.authenticationUserDetailsService != null) ? this.authenticationUserDetailsService : new PreAuthenticatedGrantedAuthoritiesUserDetailsService(); } /** * Creates the {@link J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource} to set * on the {@link J2eePreAuthenticatedProcessingFilter}. It is populated with a * {@link SimpleMappableAttributesRetriever}. * @return the {@link J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource} to use. */ private J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource createWebAuthenticationDetailsSource() { J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource detailsSource = new J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource(); SimpleMappableAttributesRetriever rolesRetriever = new SimpleMappableAttributesRetriever(); rolesRetriever.setMappableAttributes(this.mappableRoles); detailsSource.setMappableRolesRetriever(rolesRetriever); detailsSource = postProcess(detailsSource); return detailsSource; } }
repos\spring-security-main\config\src\main\java\org\springframework\security\config\annotation\web\configurers\JeeConfigurer.java
2
请完成以下Java代码
public void setWeightUOM (final @Nullable java.lang.String WeightUOM) { set_Value (COLUMNNAME_WeightUOM, WeightUOM); } @Override public java.lang.String getWeightUOM() { return get_ValueAsString(COLUMNNAME_WeightUOM); } @Override public void setWeight_UOM_ID (final int Weight_UOM_ID) { if (Weight_UOM_ID < 1) set_Value (COLUMNNAME_Weight_UOM_ID, null); else set_Value (COLUMNNAME_Weight_UOM_ID, Weight_UOM_ID); } @Override public int getWeight_UOM_ID() { return get_ValueAsInt(COLUMNNAME_Weight_UOM_ID); } @Override public void setWidthInCm (final int WidthInCm) { set_Value (COLUMNNAME_WidthInCm, WidthInCm); }
@Override public int getWidthInCm() { return get_ValueAsInt(COLUMNNAME_WidthInCm); } @Override public void setX12DE355 (final @Nullable java.lang.String X12DE355) { set_Value (COLUMNNAME_X12DE355, X12DE355); } @Override public java.lang.String getX12DE355() { return get_ValueAsString(COLUMNNAME_X12DE355); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_I_Product.java
1
请完成以下Java代码
public int getES_FTS_Config_SourceModel_ID() { return get_ValueAsInt(COLUMNNAME_ES_FTS_Config_SourceModel_ID); } @Override public org.compiere.model.I_AD_Column getParent_Column() { return get_ValueAsPO(COLUMNNAME_Parent_Column_ID, org.compiere.model.I_AD_Column.class); } @Override public void setParent_Column(final org.compiere.model.I_AD_Column Parent_Column) { set_ValueFromPO(COLUMNNAME_Parent_Column_ID, org.compiere.model.I_AD_Column.class, Parent_Column); }
@Override public void setParent_Column_ID (final int Parent_Column_ID) { if (Parent_Column_ID < 1) set_Value (COLUMNNAME_Parent_Column_ID, null); else set_Value (COLUMNNAME_Parent_Column_ID, Parent_Column_ID); } @Override public int getParent_Column_ID() { return get_ValueAsInt(COLUMNNAME_Parent_Column_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.elasticsearch\src\main\java-gen\de\metas\elasticsearch\model\X_ES_FTS_Config_SourceModel.java
1
请完成以下Java代码
public void setDescription (String Description) { set_Value (COLUMNNAME_Description, Description); } /** Get Description. @return Optional short description of the record */ public String getDescription () { return (String)get_Value(COLUMNNAME_Description); } /** Set Comment/Help. @param Help Comment or Hint */ public void setHelp (String Help) { set_Value (COLUMNNAME_Help, Help); } /** Get Comment/Help. @return Comment or Hint */ public String getHelp () { return (String)get_Value(COLUMNNAME_Help); } /** Set IP Address. @param IP_Address Defines the IP address to transfer data to */ public void setIP_Address (String IP_Address) { set_Value (COLUMNNAME_IP_Address, IP_Address); } /** Get IP Address. @return Defines the IP address to transfer data to */ public String getIP_Address () { return (String)get_Value(COLUMNNAME_IP_Address); } /** Set Last Synchronized. @param LastSynchronized Date when last synchronized */ public void setLastSynchronized (Timestamp LastSynchronized) { set_Value (COLUMNNAME_LastSynchronized, LastSynchronized); }
/** Get Last Synchronized. @return Date when last synchronized */ public Timestamp getLastSynchronized () { return (Timestamp)get_Value(COLUMNNAME_LastSynchronized); } /** 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_CM_BroadcastServer.java
1
请完成以下Java代码
public Store rename(Name name) { return new Store(name, null); } /** * Rename this table */ @Override public Store rename(Table<?> name) { return new Store(name.getQualifiedName(), null); } /** * Create an inline derived table from this table */ @Override public Store where(Condition condition) { return new Store(getQualifiedName(), aliased() ? this : null, null, condition); } /** * Create an inline derived table from this table */ @Override public Store where(Collection<? extends Condition> conditions) { return where(DSL.and(conditions)); } /** * Create an inline derived table from this table */ @Override public Store where(Condition... conditions) { return where(DSL.and(conditions)); } /** * Create an inline derived table from this table */ @Override public Store where(Field<Boolean> condition) { return where(DSL.condition(condition)); } /** * Create an inline derived table from this table */ @Override @PlainSQL public Store where(SQL condition) { return where(DSL.condition(condition)); } /** * Create an inline derived table from this table */ @Override @PlainSQL public Store where(@Stringly.SQL String condition) {
return where(DSL.condition(condition)); } /** * Create an inline derived table from this table */ @Override @PlainSQL public Store where(@Stringly.SQL String condition, Object... binds) { return where(DSL.condition(condition, binds)); } /** * Create an inline derived table from this table */ @Override @PlainSQL public Store where(@Stringly.SQL String condition, QueryPart... parts) { return where(DSL.condition(condition, parts)); } /** * Create an inline derived table from this table */ @Override public Store whereExists(Select<?> select) { return where(DSL.exists(select)); } /** * Create an inline derived table from this table */ @Override public Store whereNotExists(Select<?> select) { return where(DSL.notExists(select)); } }
repos\tutorials-master\persistence-modules\jooq\src\main\java\com\baeldung\jooq\jointables\public_\tables\Store.java
1
请在Spring Boot框架中完成以下Java代码
public String getGateway() { return this.gateway; } public void setGateway(String gateway) { this.gateway = gateway; } public String getJmx() { return this.jmx; } public void setJmx(String jmx) { this.jmx = jmx; } public String getLocator() { return this.locator; } public void setLocator(String locator) { this.locator = locator;
} public String getServer() { return this.server; } public void setServer(String server) { this.server = server; } public String getWeb() { return this.web; } public void setWeb(String web) { this.web = web; } } }
repos\spring-boot-data-geode-main\spring-geode-project\spring-geode-autoconfigure\src\main\java\org\springframework\geode\boot\autoconfigure\configuration\support\SslProperties.java
2
请在Spring Boot框架中完成以下Java代码
public class Song extends BaseEntity { private Long length = 0L; @Type(type = "json") @Column(columnDefinition = "json") private Artist artist; @Column( name = "recorded_on", columnDefinition = "mediumint" ) private YearMonth recordedOn = YearMonth.now(); public Long getLength() { return length; } public void setLength(Long length) { this.length = length;
} public Artist getArtist() { return artist; } public void setArtist(Artist artist) { this.artist = artist; } public YearMonth getRecordedOn() { return recordedOn; } public void setRecordedOn(YearMonth recordedOn) { this.recordedOn = recordedOn; } }
repos\tutorials-master\persistence-modules\hibernate-libraries\src\main\java\com\baeldung\hibernate\types\Song.java
2
请完成以下Java代码
public int getMSV3_VerfuegbarkeitsantwortArtikel_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_MSV3_VerfuegbarkeitsantwortArtikel_ID); if (ii == null) return 0; return ii.intValue(); } @Override public de.metas.vertical.pharma.vendor.gateway.msv3.model.I_MSV3_Substitution getMSV3_VerfuegbarkeitSubstitution() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_MSV3_VerfuegbarkeitSubstitution_ID, de.metas.vertical.pharma.vendor.gateway.msv3.model.I_MSV3_Substitution.class); } @Override public void setMSV3_VerfuegbarkeitSubstitution(de.metas.vertical.pharma.vendor.gateway.msv3.model.I_MSV3_Substitution MSV3_VerfuegbarkeitSubstitution) { set_ValueFromPO(COLUMNNAME_MSV3_VerfuegbarkeitSubstitution_ID, de.metas.vertical.pharma.vendor.gateway.msv3.model.I_MSV3_Substitution.class, MSV3_VerfuegbarkeitSubstitution); } /** Set VerfuegbarkeitSubstitution.
@param MSV3_VerfuegbarkeitSubstitution_ID VerfuegbarkeitSubstitution */ @Override public void setMSV3_VerfuegbarkeitSubstitution_ID (int MSV3_VerfuegbarkeitSubstitution_ID) { if (MSV3_VerfuegbarkeitSubstitution_ID < 1) set_Value (COLUMNNAME_MSV3_VerfuegbarkeitSubstitution_ID, null); else set_Value (COLUMNNAME_MSV3_VerfuegbarkeitSubstitution_ID, Integer.valueOf(MSV3_VerfuegbarkeitSubstitution_ID)); } /** Get VerfuegbarkeitSubstitution. @return VerfuegbarkeitSubstitution */ @Override public int getMSV3_VerfuegbarkeitSubstitution_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_MSV3_VerfuegbarkeitSubstitution_ID); if (ii == null) return 0; return ii.intValue(); } }
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_VerfuegbarkeitsantwortArtikel.java
1
请完成以下Java代码
public class Item { public Item() { } public Item(String code, Double price, Integer quantity) { this.code = code; this.price = price; this.quantity = quantity; } private String code; private Double price; private Integer quantity; public String getCode() { return code; } public void setCode(String code) { this.code = code; } public Double getPrice() { return price; } public void setPrice(Double price) { this.price = price; } public Integer getQuantity() { return quantity; } public void setQuantity(Integer quantity) { this.quantity = quantity; } @Override
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Item item = (Item) o; if (code != null ? !code.equals(item.code) : item.code != null) return false; if (price != null ? !price.equals(item.price) : item.price != null) return false; return quantity != null ? quantity.equals(item.quantity) : item.quantity == null; } @Override public int hashCode() { int result = code != null ? code.hashCode() : 0; result = 31 * result + (price != null ? price.hashCode() : 0); result = 31 * result + (quantity != null ? quantity.hashCode() : 0); return result; } @Override public String toString() { return "Item{" + "code='" + code + '\'' + ", price=" + price + ", quantity=" + quantity + '}'; } }
repos\tutorials-master\libraries-data-io-2\src\main\java\com\baeldung\libraries\smooks\model\Item.java
1
请在Spring Boot框架中完成以下Java代码
public static byte[] createMasterKey(String path) throws FileNotFoundException, IOException { byte[] masterKey = new byte[KEY_SIZE]; new SecureRandom().nextBytes(masterKey); try (FileOutputStream stream = new FileOutputStream(path)) { stream.write(masterKey); } return masterKey; } public static byte[] readMasterKey(String path) throws FileNotFoundException, IOException { byte[] masterKey = new byte[KEY_SIZE]; try (FileInputStream stream = new FileInputStream(path)) { stream.read(masterKey, 0, KEY_SIZE); } return masterKey; }
public static Map<String, Map<String, Object>> providersMap(String masterKeyPath) throws FileNotFoundException, IOException { if (masterKeyPath == null) throw new IllegalArgumentException("master key path cannot be null"); File masterKeyFile = new File(masterKeyPath); byte[] masterKey = masterKeyFile.isFile() ? readMasterKey(masterKeyPath) : createMasterKey(masterKeyPath); Map<String, Object> masterKeyMap = new HashMap<>(); masterKeyMap.put("key", masterKey); Map<String, Map<String, Object>> providersMap = new HashMap<>(); providersMap.put("local", masterKeyMap); return providersMap; } }
repos\tutorials-master\persistence-modules\spring-boot-persistence-mongodb-3\src\main\java\com\baeldung\boot\csfle\config\LocalKmsUtils.java
2
请完成以下Java代码
public class CachedBodyHttpServletRequest extends HttpServletRequestWrapper { private byte[] cachedBody; public CachedBodyHttpServletRequest(final HttpServletRequest request) throws IOException { super(request); } @Override public ServletInputStream getInputStream() throws IOException { if (this.cachedBody == null) { cacheBody(); } return new CachedBodyServletInputStream(this.cachedBody); } @Override public BufferedReader getReader() throws IOException { if (cachedBody == null) { cacheBody(); } final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(this.cachedBody); return new BufferedReader(new InputStreamReader(byteArrayInputStream)); } private void cacheBody() throws IOException { this.cachedBody = StreamUtils.copyToByteArray(super.getInputStream()); }
public static class CachedBodyServletInputStream extends ServletInputStream { private final ByteArrayInputStream cachedBodyInputStream; public CachedBodyServletInputStream(final byte[] cachedBody) { this.cachedBodyInputStream = new ByteArrayInputStream(cachedBody); } @Override public int read() throws IOException { return cachedBodyInputStream.read(); } @Override public boolean isFinished() { return cachedBodyInputStream.available() == 0; } @Override public boolean isReady() { return true; } @Override public void setReadListener(final ReadListener readListener) { throw new AdempiereException("Not implemented"); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.util.web\src\main\java\de\metas\util\web\audit\dto\CachedBodyHttpServletRequest.java
1
请在Spring Boot框架中完成以下Java代码
public class UserServiceImpl implements UserService { /** * 模拟数据库 */ private static final Map<Long, User> DATABASES = Maps.newConcurrentMap(); /** * 初始化数据 */ static { DATABASES.put(1L, new User(1L, "user1")); DATABASES.put(2L, new User(2L, "user2")); DATABASES.put(3L, new User(3L, "user3")); } /** * 保存或修改用户 * * @param user 用户对象 * @return 操作结果 */ @CachePut(value = "user", key = "#user.id") @Override public User saveOrUpdate(User user) { DATABASES.put(user.getId(), user); log.info("保存用户【user】= {}", user); return user; } /** * 获取用户 * * @param id key值 * @return 返回结果 */ @Cacheable(value = "user", key = "#id") @Override
public User get(Long id) { // 我们假设从数据库读取 log.info("查询用户【id】= {}", id); return DATABASES.get(id); } /** * 删除 * * @param id key值 */ @CacheEvict(value = "user", key = "#id") @Override public void delete(Long id) { DATABASES.remove(id); log.info("删除用户【id】= {}", id); } }
repos\spring-boot-demo-master\demo-cache-ehcache\src\main\java\com\xkcoding\cache\ehcache\service\impl\UserServiceImpl.java
2
请完成以下Spring Boot application配置
spring.jpa.open-in-view=false spring.jpa.hibernate.ddl-auto=none spring.datasource.url=jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE logging.level.s
ql=DEBUG security.allowedOrigins=http://localhost:3000,http://localhost:3001
repos\realworld-springboot-java-master\src\main\resources\application.properties
2
请在Spring Boot框架中完成以下Java代码
public void setRateUnits(TimeUnit rateUnits) { this.rateUnits = rateUnits; } public TimeUnit getDurationUnits() { return this.durationUnits; } public void setDurationUnits(TimeUnit durationUnits) { this.durationUnits = durationUnits; } public String getHost() { return this.host; } public void setHost(String host) { this.host = host; } public Integer getPort() { return this.port; } public void setPort(Integer port) { this.port = port; } public GraphiteProtocol getProtocol() { return this.protocol; } public void setProtocol(GraphiteProtocol protocol) { this.protocol = protocol; } public Boolean getGraphiteTagsEnabled() {
return (this.graphiteTagsEnabled != null) ? this.graphiteTagsEnabled : ObjectUtils.isEmpty(this.tagsAsPrefix); } public void setGraphiteTagsEnabled(Boolean graphiteTagsEnabled) { this.graphiteTagsEnabled = graphiteTagsEnabled; } public String[] getTagsAsPrefix() { return this.tagsAsPrefix; } public void setTagsAsPrefix(String[] tagsAsPrefix) { this.tagsAsPrefix = tagsAsPrefix; } }
repos\spring-boot-4.0.1\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\export\graphite\GraphiteProperties.java
2
请完成以下Java代码
public void setProductAttribute(String productAttribute) { this.productAttribute = productAttribute; } public Integer getCollectCouont() { return collectCouont; } public void setCollectCouont(Integer collectCouont) { this.collectCouont = collectCouont; } public Integer getReadCount() { return readCount; } public void setReadCount(Integer readCount) { this.readCount = readCount; } public String getPics() { return pics; } public void setPics(String pics) { this.pics = pics; } public String getMemberIcon() { return memberIcon; } public void setMemberIcon(String memberIcon) { this.memberIcon = memberIcon; } public Integer getReplayCount() { return replayCount; }
public void setReplayCount(Integer replayCount) { this.replayCount = replayCount; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } @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(", productId=").append(productId); sb.append(", memberNickName=").append(memberNickName); sb.append(", productName=").append(productName); sb.append(", star=").append(star); sb.append(", memberIp=").append(memberIp); sb.append(", createTime=").append(createTime); sb.append(", showStatus=").append(showStatus); sb.append(", productAttribute=").append(productAttribute); sb.append(", collectCouont=").append(collectCouont); sb.append(", readCount=").append(readCount); sb.append(", pics=").append(pics); sb.append(", memberIcon=").append(memberIcon); sb.append(", replayCount=").append(replayCount); sb.append(", content=").append(content); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); } }
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\PmsComment.java
1
请在Spring Boot框架中完成以下Java代码
public SecurityContextHolderAwareRequestFilter getBean() { this.filter.setSecurityContextHolderStrategy(this.securityContextHolderStrategy); this.filter.setRolePrefix(this.rolePrefix); return this.filter; } void setSecurityContextHolderStrategy(SecurityContextHolderStrategy securityContextHolderStrategy) { this.securityContextHolderStrategy = securityContextHolderStrategy; } } static class SecurityContextHolderStrategyFactory implements FactoryBean<SecurityContextHolderStrategy> { @Override public SecurityContextHolderStrategy getObject() throws Exception { return SecurityContextHolder.getContextHolderStrategy(); } @Override public Class<?> getObjectType() { return SecurityContextHolderStrategy.class;
} } static class ObservationRegistryFactory implements FactoryBean<ObservationRegistry> { @Override public ObservationRegistry getObject() throws Exception { return ObservationRegistry.NOOP; } @Override public Class<?> getObjectType() { return ObservationRegistry.class; } } }
repos\spring-security-main\config\src\main\java\org\springframework\security\config\http\HttpConfigurationBuilder.java
2
请完成以下Java代码
public org.compiere.model.I_M_CostType getM_CostType() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_M_CostType_ID, org.compiere.model.I_M_CostType.class); } @Override public void setM_CostType(org.compiere.model.I_M_CostType M_CostType) { set_ValueFromPO(COLUMNNAME_M_CostType_ID, org.compiere.model.I_M_CostType.class, M_CostType); } /** Set Kostenkategorie. @param M_CostType_ID Type of Cost (e.g. Current, Plan, Future) */ @Override public void setM_CostType_ID (int M_CostType_ID) { if (M_CostType_ID < 1) set_ValueNoCheck (COLUMNNAME_M_CostType_ID, null); else set_ValueNoCheck (COLUMNNAME_M_CostType_ID, Integer.valueOf(M_CostType_ID)); } /** Get Kostenkategorie. @return Type of Cost (e.g. Current, Plan, Future) */ @Override public int getM_CostType_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_CostType_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_ValueNoCheck (COLUMNNAME_M_Product_ID, null); else set_ValueNoCheck (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(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_CostQueue.java
1
请在Spring Boot框架中完成以下Java代码
public class Application { final static CountDownLatch LATCH = new CountDownLatch(1); public static void main(String[] args) throws InterruptedException { ConfigurableApplicationContext context = SpringApplication.run(Application.class, args); LATCH.await(); Thread.sleep(5_000); context.close(); } @Bean public RecordMessageConverter converter() { return new JsonMessageConverter(); } @Bean public BatchMessagingMessageConverter batchConverter() { return new BatchMessagingMessageConverter(converter()); } @Bean public NewTopic topic2() { return TopicBuilder.name("topic2").partitions(1).replicas(1).build(); } @Bean public NewTopic topic3() { return TopicBuilder.name("topic3").partitions(1).replicas(1).build(); } } @Component class Listener { private static final Logger LOGGER = LoggerFactory.getLogger(Listener.class); @Autowired
private KafkaTemplate<String, String> kafkaTemplate; @KafkaListener(id = "fooGroup2", topics = "topic2") public void listen1(List<Foo2> foos) throws IOException { LOGGER.info("Received: " + foos); foos.forEach(f -> kafkaTemplate.send("topic3", f.getFoo().toUpperCase())); LOGGER.info("Messages sent, hit Enter to commit tx"); System.in.read(); } @KafkaListener(id = "fooGroup3", topics = "topic3") public void listen2(List<String> in) { LOGGER.info("Received: " + in); Application.LATCH.countDown(); } }
repos\spring-kafka-main\samples\sample-03\src\main\java\com\example\Application.java
2
请完成以下Java代码
public void afterEnqueueBeforeSave(final I_C_Printing_Queue queueItem, final I_AD_Archive archive) { // further down we use informations from the PO referenced by the archive, *if* the archive references any final Object archiveRerencedModel = Services.get(IArchiveDAO.class).retrieveReferencedModel(archive, Object.class); if (archiveRerencedModel == null) { logger.debug("AD_Archive {} does not reference a PO; returning", archive); return; } if (InterfaceWrapperHelper.isInstanceOf(archiveRerencedModel, I_C_DunningDoc.class)) { queueItem.setItemName(X_C_Printing_Queue.ITEMNAME_Mahnung); } }
@Override public String toString() { return ObjectUtils.toString(this); } /** * Allays returns <code>true</code>. */ @Override public boolean isApplyHandler(I_C_Printing_Queue queue_IGNORED, I_AD_Archive printout_IGNORED) { return true; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.dunning\src\main\java\de\metas\dunning\printing\spi\impl\DunningPrintingQueueHandler.java
1
请完成以下Java代码
public class JSONEmail { public static JSONEmail of(@NonNull final WebuiEmail email, @NonNull final String adLanguage) { return new JSONEmail(email, adLanguage); } private final String emailId; private final JSONLookupValue from; private final List<JSONLookupValue> to; private final String subject; private final String message; private final List<JSONLookupValue> attachments; private JSONEmail(@NonNull final WebuiEmail email, @NonNull final String adLanguage)
{ emailId = email.getEmailId(); from = JSONLookupValue.ofLookupValue(email.getFrom(), adLanguage); to = email.getTo() .stream() .map(lookupValue -> JSONLookupValue.ofLookupValue(lookupValue, adLanguage)) .collect(ImmutableList.toImmutableList()); subject = email.getSubject(); message = email.getMessage(); attachments = email.getAttachments() .stream() .map(lookupValue -> JSONLookupValue.ofLookupValue(lookupValue, adLanguage)) .collect(ImmutableList.toImmutableList()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\mail\json\JSONEmail.java
1
请在Spring Boot框架中完成以下Java代码
public Dept getDept(Long id) { return null; } @Override public String getDeptName(Long id) { return null; } @Override public String getDeptIds(String tenantId, String deptNames) { return null; } @Override public List<String> getDeptNames(String deptIds) { return null; } @Override public String getPostIds(String tenantId, String postNames) { return null; } @Override public List<String> getPostNames(String postIds) { return null; } @Override public Role getRole(Long id) { return null; } @Override public String getRoleIds(String tenantId, String roleNames) { return null; }
@Override public String getRoleName(Long id) { return null; } @Override public List<String> getRoleNames(String roleIds) { return null; } @Override public String getRoleAlias(Long id) { return null; } @Override public R<Tenant> getTenant(Long id) { return null; } @Override public R<Tenant> getTenant(String tenantId) { return null; } }
repos\SpringBlade-master\blade-service-api\blade-system-api\src\main\java\org\springblade\system\feign\ISysClientFallback.java
2
请完成以下Java代码
public String getDefaultScheme() { return DISCOVERY_SCHEME; } @Override protected boolean isAvailable() { return true; } @Override protected int priority() { return 6; // More important than DNS } /** * Triggers a refresh of the registered name resolvers. * * @param event The event that triggered the update. */ @EventListener(HeartbeatEvent.class) public void heartbeat(final HeartbeatEvent event) {
if (this.monitor.update(event.getValue())) { for (final DiscoveryClientNameResolver discoveryClientNameResolver : this.discoveryClientNameResolvers) { discoveryClientNameResolver.refreshFromExternal(); } } } /** * Cleans up the name resolvers. */ @PreDestroy public void destroy() { this.discoveryClientNameResolvers.clear(); } @Override public String toString() { return "DiscoveryClientResolverFactory [scheme=" + getDefaultScheme() + ", discoveryClient=" + this.client + "]"; } }
repos\grpc-spring-master\grpc-client-spring-boot-starter\src\main\java\net\devh\boot\grpc\client\nameresolver\DiscoveryClientResolverFactory.java
1
请完成以下Java代码
public void setPMM_WeekReport_Event_ID (int PMM_WeekReport_Event_ID) { if (PMM_WeekReport_Event_ID < 1) set_ValueNoCheck (COLUMNNAME_PMM_WeekReport_Event_ID, null); else set_ValueNoCheck (COLUMNNAME_PMM_WeekReport_Event_ID, Integer.valueOf(PMM_WeekReport_Event_ID)); } /** Get Week report event. @return Week report event */ @Override public int getPMM_WeekReport_Event_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_PMM_WeekReport_Event_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Verarbeitet. @param Processed Checkbox sagt aus, ob der Beleg verarbeitet wurde. */ @Override public void setProcessed (boolean Processed) { set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed)); } /** Get Verarbeitet. @return Checkbox sagt aus, ob der Beleg verarbeitet wurde.
*/ @Override public boolean isProcessed () { Object oo = get_Value(COLUMNNAME_Processed); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Wochenerster. @param WeekDate Wochenerster */ @Override public void setWeekDate (java.sql.Timestamp WeekDate) { set_Value (COLUMNNAME_WeekDate, WeekDate); } /** Get Wochenerster. @return Wochenerster */ @Override public java.sql.Timestamp getWeekDate () { return (java.sql.Timestamp)get_Value(COLUMNNAME_WeekDate); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java-gen\de\metas\procurement\base\model\X_PMM_WeekReport_Event.java
1
请完成以下Java代码
public void setExternalSystem_ExportAudit_ID (final int ExternalSystem_ExportAudit_ID) { if (ExternalSystem_ExportAudit_ID < 1) set_ValueNoCheck (COLUMNNAME_ExternalSystem_ExportAudit_ID, null); else set_ValueNoCheck (COLUMNNAME_ExternalSystem_ExportAudit_ID, ExternalSystem_ExportAudit_ID); } @Override public int getExternalSystem_ExportAudit_ID() { return get_ValueAsInt(COLUMNNAME_ExternalSystem_ExportAudit_ID); } @Override public de.metas.externalsystem.model.I_ExternalSystem getExternalSystem() { return get_ValueAsPO(COLUMNNAME_ExternalSystem_ID, de.metas.externalsystem.model.I_ExternalSystem.class); } @Override public void setExternalSystem(final de.metas.externalsystem.model.I_ExternalSystem ExternalSystem) { set_ValueFromPO(COLUMNNAME_ExternalSystem_ID, de.metas.externalsystem.model.I_ExternalSystem.class, ExternalSystem); } @Override public void setExternalSystem_ID (final int ExternalSystem_ID) { if (ExternalSystem_ID < 1) set_Value (COLUMNNAME_ExternalSystem_ID, null); else set_Value (COLUMNNAME_ExternalSystem_ID, ExternalSystem_ID); } @Override
public int getExternalSystem_ID() { return get_ValueAsInt(COLUMNNAME_ExternalSystem_ID); } @Override public void setRecord_ID (final int Record_ID) { if (Record_ID < 0) set_Value (COLUMNNAME_Record_ID, null); else set_Value (COLUMNNAME_Record_ID, Record_ID); } @Override public int getRecord_ID() { return get_ValueAsInt(COLUMNNAME_Record_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java-gen\de\metas\externalsystem\model\X_ExternalSystem_ExportAudit.java
1
请完成以下Java代码
public ITrxSavepoint createTrxSavepoint(final String name) throws DBException { throw new UnsupportedOperationException(); } @Override public void releaseSavepoint(final ITrxSavepoint savepoint) { throw new UnsupportedOperationException(); } @Override public ITrxListenerManager getTrxListenerManager() { throw new UnsupportedOperationException(); } @Override public ITrxManager getTrxManager() { throw new UnsupportedOperationException(); } @Override public <T> T setProperty(final String name, final Object value) { throw new UnsupportedOperationException(); } @Override public <T> T getProperty(final String name) { throw new UnsupportedOperationException(); }
@Override public <T> T getProperty(final String name, final Supplier<T> valueInitializer) { throw new UnsupportedOperationException(); } @Override public <T> T getProperty(final String name, final Function<ITrx, T> valueInitializer) { throw new UnsupportedOperationException(); } @Override public <T> T setAndGetProperty(final String name, final Function<T, T> valueRemappingFunction) { throw new UnsupportedOperationException(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\trx\api\NullTrxPlaceholder.java
1
请在Spring Boot框架中完成以下Java代码
/* package */class TourVersionRange implements ITourVersionRange { private I_M_TourVersion tourVersion; private LocalDate validFrom; private LocalDate validTo; private DateSequenceGenerator dateSequenceGenerator; @Builder private TourVersionRange( @NonNull final I_M_TourVersion tourVersion, @NonNull final LocalDate validFrom, @NonNull final LocalDate validTo, final DateSequenceGenerator dateSequenceGenerator) { Check.assume(validFrom.compareTo(validTo) <= 0, "ValidFrom({}) <= ValidTo({})", validFrom, validTo); this.tourVersion = tourVersion; this.validFrom = validFrom; this.validTo = validTo; this.dateSequenceGenerator = dateSequenceGenerator; } @Override public String toString() { return "TourVersionRange [" + "tourVersion=" + tourVersion == null ? null : tourVersion.getName() + ", validFrom=" + validFrom + ", validTo=" + validTo + "]"; } @Override
public I_M_TourVersion getM_TourVersion() { return tourVersion; } @Override public LocalDate getValidFrom() { return validFrom; } @Override public LocalDate getValidTo() { return validTo; } @Override public Set<LocalDate> generateDeliveryDates() { if (dateSequenceGenerator == null) { return ImmutableSet.of(); } return dateSequenceGenerator.generate(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\tourplanning\api\impl\TourVersionRange.java
2
请完成以下Java代码
public long sum() { callback = new MetricsQuerySumCmd(this); return (Long) commandExecutor.execute(this); } @Override public Object execute(CommandContext commandContext) { if (callback != null) { return callback.execute(commandContext); } throw new ProcessEngineException("Query can't be executed. Use either sum or interval to query the metrics."); } @Override public MetricsQuery offset(int offset) { setFirstResult(offset); return this; } @Override public MetricsQuery limit(int maxResults) { setMaxResults(maxResults); return this; } @Override public MetricsQuery aggregateByReporter() { aggregateByReporter = true; return this; } @Override public void setMaxResults(int maxResults) { if (maxResults > DEFAULT_LIMIT_SELECT_INTERVAL) { throw new ProcessEngineException("Metrics interval query row limit can't be set larger than " + DEFAULT_LIMIT_SELECT_INTERVAL + '.'); } this.maxResults = maxResults; } public Date getStartDate() { return startDate; } public Date getEndDate() { return endDate; } public Long getStartDateMilliseconds() { return startDateMilliseconds; } public Long getEndDateMilliseconds() { return endDateMilliseconds; } public String getName() { return name; } public String getReporter() { return reporter; } public Long getInterval() { if (interval == null) { return DEFAULT_SELECT_INTERVAL; } return interval; } @Override public int getMaxResults() {
if (maxResults > DEFAULT_LIMIT_SELECT_INTERVAL) { return DEFAULT_LIMIT_SELECT_INTERVAL; } return super.getMaxResults(); } protected class MetricsQueryIntervalCmd implements Command<Object> { protected MetricsQueryImpl metricsQuery; public MetricsQueryIntervalCmd(MetricsQueryImpl metricsQuery) { this.metricsQuery = metricsQuery; } @Override public Object execute(CommandContext commandContext) { return commandContext.getMeterLogManager() .executeSelectInterval(metricsQuery); } } protected class MetricsQuerySumCmd implements Command<Object> { protected MetricsQueryImpl metricsQuery; public MetricsQuerySumCmd(MetricsQueryImpl metricsQuery) { this.metricsQuery = metricsQuery; } @Override public Object execute(CommandContext commandContext) { return commandContext.getMeterLogManager() .executeSelectSum(metricsQuery); } } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\metrics\MetricsQueryImpl.java
1
请在Spring Boot框架中完成以下Java代码
public XMLGregorianCalendar getPaymentDate() { return paymentDate; } /** * Sets the value of the paymentDate property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setPaymentDate(XMLGregorianCalendar value) { this.paymentDate = value; } /** * The base amount for the discount. * * @return * possible object is * {@link BigDecimal } * */ public BigDecimal getBaseAmount() { return baseAmount; } /** * Sets the value of the baseAmount property. * * @param value * allowed object is * {@link BigDecimal } * */ public void setBaseAmount(BigDecimal value) { this.baseAmount = value; } /** * The discount rate. * * @return * possible object is * {@link BigDecimal } * */ public BigDecimal getPercentage() { return percentage; } /** * Sets the value of the percentage property. * * @param value * allowed object is * {@link BigDecimal } * */ public void setPercentage(BigDecimal value) { this.percentage = value; } /** * The discount amount. The discount amount is calculated by: Base amount x percentage = discount amount. In case both, percentage and discount amount, are provided, discount amount is normative. * * @return * possible object is * {@link BigDecimal } * */ public BigDecimal getAmount() {
return amount; } /** * Sets the value of the amount property. * * @param value * allowed object is * {@link BigDecimal } * */ public void setAmount(BigDecimal value) { this.amount = value; } /** * Free text comment field for the given discount. * * @return * possible object is * {@link String } * */ public String getComment() { return comment; } /** * Sets the value of the comment property. * * @param value * allowed object is * {@link String } * */ public void setComment(String value) { this.comment = value; } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\DiscountType.java
2