instruction
string
input
string
output
string
source_file
string
priority
int64
请在Spring Boot框架中完成以下Java代码
public final class DataCassandraAutoConfiguration { private final CqlSession session; DataCassandraAutoConfiguration(@Lazy CqlSession session) { this.session = session; } @Bean @ConditionalOnMissingBean static CassandraManagedTypes cassandraManagedTypes(BeanFactory beanFactory) throws ClassNotFoundException { List<String> packages = EntityScanPackages.get(beanFactory).getPackageNames(); if (packages.isEmpty() && AutoConfigurationPackages.has(beanFactory)) { packages = AutoConfigurationPackages.get(beanFactory); } if (!packages.isEmpty()) { return CassandraManagedTypes.fromIterable(CassandraEntityClassScanner.scan(packages)); } return CassandraManagedTypes.empty(); } @Bean @ConditionalOnMissingBean CassandraMappingContext cassandraMappingContext(CassandraManagedTypes cassandraManagedTypes, CassandraCustomConversions conversions) { CassandraMappingContext context = new CassandraMappingContext(); context.setManagedTypes(cassandraManagedTypes); context.setSimpleTypeHolder(conversions.getSimpleTypeHolder()); return context; } @Bean @ConditionalOnMissingBean CassandraConverter cassandraConverter(CassandraMappingContext mapping, CassandraCustomConversions conversions) { MappingCassandraConverter converter = new MappingCassandraConverter(mapping); converter.setCodecRegistry(() -> this.session.getContext().getCodecRegistry()); converter.setCustomConversions(conversions); converter.setUserTypeResolver(new SimpleUserTypeResolver(this.session)); return converter; } @Bean @ConditionalOnMissingBean(SessionFactory.class) SessionFactoryFactoryBean cassandraSessionFactory(Environment environment, CassandraConverter converter) { SessionFactoryFactoryBean session = new SessionFactoryFactoryBean(); session.setSession(this.session); session.setConverter(converter); Binder binder = Binder.get(environment); binder.bind("spring.cassandra.schema-action", SchemaAction.class).ifBound(session::setSchemaAction);
return session; } @Bean @ConditionalOnMissingBean(CqlOperations.class) CqlTemplate cqlTemplate(SessionFactory sessionFactory) { return new CqlTemplate(sessionFactory); } @Bean @ConditionalOnMissingBean(CassandraOperations.class) CassandraTemplate cassandraTemplate(CqlTemplate cqlTemplate, CassandraConverter converter) { return new CassandraTemplate(cqlTemplate, converter); } @Bean @ConditionalOnMissingBean CassandraCustomConversions cassandraCustomConversions() { return new CassandraCustomConversions(Collections.emptyList()); } }
repos\spring-boot-4.0.1\module\spring-boot-data-cassandra\src\main\java\org\springframework\boot\data\cassandra\autoconfigure\DataCassandraAutoConfiguration.java
2
请完成以下Java代码
public IValidationRule isOpenItemRule() { return SQLValidationRule.ofSqlWhereClause(I_C_ElementValue.COLUMNNAME_IsOpenItem + "=" + DB.TO_BOOLEAN(true)); } // // // // // private static final class ElementValuesMap { private final ImmutableMap<ElementValueId, ElementValue> byId; private ImmutableSet<ElementValueId> _openItemIds; private ElementValuesMap(final List<ElementValue> list) { byId = Maps.uniqueIndex(list, ElementValue::getId); } public ElementValue getById(final ElementValueId id) { final ElementValue elementValue = byId.get(id); if (elementValue == null) { throw new AdempiereException("No Element Value found for " + id); } return elementValue; }
public ImmutableSet<ElementValueId> getOpenItemIds() { ImmutableSet<ElementValueId> openItemIds = this._openItemIds; if (openItemIds == null) { openItemIds = this._openItemIds = byId.values() .stream() .filter(ElementValue::isOpenItem) .map(ElementValue::getId) .collect(ImmutableSet.toImmutableSet()); } return openItemIds; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\elementvalue\ElementValueRepository.java
1
请完成以下Java代码
public ITranslatableString getCUNetAmtNotApprovedAsTranslatableString() { return toTranslatableString(getCUNetAmtNotApproved()); } public BigDecimal getTotalNetAmt() { return totalNetAmtApproved.add(totalNetAmtNotApproved); } public int getCountTotalToRecompute() { return countTotalToRecompute; } public Set<String> getCurrencySymbols() { return currencySymbols; } @Nullable private String getSingleCurrencySymbolOrNull() { final boolean singleCurrencySymbol = currencySymbols.size() == 1; return singleCurrencySymbol ? currencySymbols.iterator().next() : null; } private ITranslatableString toTranslatableString(final BigDecimal amt) { final TranslatableStringBuilder builder = TranslatableStrings.builder(); builder.append(amt, DisplayType.Amount); final String singleCurrencySymbol = getSingleCurrencySymbolOrNull(); if (singleCurrencySymbol != null) { builder.append(" ").append(singleCurrencySymbol); } return builder.build(); } /** * Builder */ public static class Builder { private BigDecimal totalNetAmtApproved = BigDecimal.ZERO; private BigDecimal huNetAmtApproved = BigDecimal.ZERO; private BigDecimal cuNetAmtApproved = BigDecimal.ZERO; private BigDecimal totalNetAmtNotApproved = BigDecimal.ZERO; private BigDecimal huNetAmtNotApproved = BigDecimal.ZERO; private BigDecimal cuNetAmtNotApproved = BigDecimal.ZERO; private int countTotalToRecompute = 0; private final ImmutableSet.Builder<String> currencySymbols = ImmutableSet.builder(); private Builder() { } public InvoiceCandidatesAmtSelectionSummary build() { return new InvoiceCandidatesAmtSelectionSummary(this);
} public Builder addTotalNetAmt(final BigDecimal amtToAdd, final boolean approved, final boolean isPackingMaterial) { if (approved) { totalNetAmtApproved = totalNetAmtApproved.add(amtToAdd); if (isPackingMaterial) { huNetAmtApproved = huNetAmtApproved.add(amtToAdd); } else { cuNetAmtApproved = cuNetAmtApproved.add(amtToAdd); } } else { totalNetAmtNotApproved = totalNetAmtNotApproved.add(amtToAdd); if (isPackingMaterial) { huNetAmtNotApproved = huNetAmtNotApproved.add(amtToAdd); } else { cuNetAmtNotApproved = cuNetAmtNotApproved.add(amtToAdd); } } return this; } @SuppressWarnings("UnusedReturnValue") public Builder addCurrencySymbol(final String currencySymbol) { if (Check.isEmpty(currencySymbol, true)) { // NOTE: prevent adding null values because ImmutableSet.Builder will fail in this case currencySymbols.add("?"); } else { currencySymbols.add(currencySymbol); } return this; } public void addCountToRecompute(final int countToRecomputeToAdd) { Check.assume(countToRecomputeToAdd > 0, "countToRecomputeToAdd > 0"); countTotalToRecompute += countToRecomputeToAdd; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\api\impl\InvoiceCandidatesAmtSelectionSummary.java
1
请完成以下Java代码
protected POInfo initPO(final Properties ctx) { return POInfo.getPOInfo(Table_Name); } @Override public void setC_OLCand_AlbertaTherapy_ID(final int C_OLCand_AlbertaTherapy_ID) { if (C_OLCand_AlbertaTherapy_ID < 1) set_ValueNoCheck(COLUMNNAME_C_OLCand_AlbertaTherapy_ID, null); else set_ValueNoCheck(COLUMNNAME_C_OLCand_AlbertaTherapy_ID, C_OLCand_AlbertaTherapy_ID); } @Override public int getC_OLCand_AlbertaTherapy_ID() { return get_ValueAsInt(COLUMNNAME_C_OLCand_AlbertaTherapy_ID); } @Override public void setC_OLCand_ID(final int C_OLCand_ID) { if (C_OLCand_ID < 1) set_Value(COLUMNNAME_C_OLCand_ID, null); else set_Value(COLUMNNAME_C_OLCand_ID, C_OLCand_ID);
} @Override public int getC_OLCand_ID() { return get_ValueAsInt(COLUMNNAME_C_OLCand_ID); } @Override public void setTherapy(final String Therapy) { set_Value(COLUMNNAME_Therapy, Therapy); } @Override public String getTherapy() { return get_ValueAsString(COLUMNNAME_Therapy); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.healthcare.alberta\src\main\java-gen\de\metas\vertical\healthcare\alberta\model\X_C_OLCand_AlbertaTherapy.java
1
请完成以下Java代码
public class DataStoreJsonConverter extends BaseBpmnJsonConverter { public static void fillTypes( Map<String, Class<? extends BaseBpmnJsonConverter>> convertersToBpmnMap, Map<Class<? extends BaseElement>, Class<? extends BaseBpmnJsonConverter>> convertersToJsonMap ) { fillJsonTypes(convertersToBpmnMap); fillBpmnTypes(convertersToJsonMap); } public static void fillJsonTypes(Map<String, Class<? extends BaseBpmnJsonConverter>> convertersToBpmnMap) { convertersToBpmnMap.put(STENCIL_DATA_STORE, DataStoreJsonConverter.class); } public static void fillBpmnTypes( Map<Class<? extends BaseElement>, Class<? extends BaseBpmnJsonConverter>> convertersToJsonMap ) {
convertersToJsonMap.put(DataStoreReference.class, DataStoreJsonConverter.class); } protected String getStencilId(BaseElement baseElement) { return STENCIL_DATA_STORE; } protected void convertElementToJson(ObjectNode propertiesNode, BaseElement baseElement) {} protected BaseElement convertJsonToElement( JsonNode elementNode, JsonNode modelNode, Map<String, JsonNode> shapeMap ) { DataStoreReference dataStore = new DataStoreReference(); return dataStore; } }
repos\Activiti-develop\activiti-core\activiti-json-converter\src\main\java\org\activiti\editor\language\json\converter\DataStoreJsonConverter.java
1
请完成以下Java代码
public boolean equalsByValue(final LogicExpressionResult obj) { if (this == obj) { return true; } if (obj == null) { return false; } return value == obj.value; } public boolean equalsByNameAndValue(final LogicExpressionResult obj) { if (this == obj) { return true; } if (obj == null) { return false; } return Objects.equals(name, obj.name) && value == obj.value; } public boolean booleanValue() { return value; } public boolean isTrue() { return value; } public boolean isFalse() { return !value; } public String getName() { return name; } public ILogicExpression getExpression() { return expression; } /** * @return which parameters were used while evaluating and which was their value */ public Map<CtxName, String> getUsedParameters() { return usedParameters == null ? ImmutableMap.of() : usedParameters; }
private static final class Constant extends LogicExpressionResult { private Constant(final boolean value) { super(null, value, value ? ConstantLogicExpression.TRUE : ConstantLogicExpression.FALSE, null); } @Override public String toString() { return value ? "TRUE" : "FALSE"; } } private static final class NamedConstant extends LogicExpressionResult { private transient String _toString = null; // lazy private NamedConstant(final String name, final boolean value) { super(name, value, value ? ConstantLogicExpression.TRUE : ConstantLogicExpression.FALSE, null); } @Override public String toString() { if (_toString == null) { _toString = MoreObjects.toStringHelper(value ? "TRUE" : "FALSE") .omitNullValues() .addValue(name) .toString(); } return _toString; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\expression\api\LogicExpressionResult.java
1
请完成以下Java代码
public int getRef_OrderLine_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_Ref_OrderLine_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Ressourcenzuordnung. @param S_ResourceAssignment_ID Ressourcenzuordnung */ public void setS_ResourceAssignment_ID (int S_ResourceAssignment_ID) { if (S_ResourceAssignment_ID < 1) set_Value (COLUMNNAME_S_ResourceAssignment_ID, null);
else set_Value (COLUMNNAME_S_ResourceAssignment_ID, Integer.valueOf(S_ResourceAssignment_ID)); } /** Get Ressourcenzuordnung. @return Ressourcenzuordnung */ public int getS_ResourceAssignment_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_S_ResourceAssignment_ID); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\org\adempiere\model\X_RV_C_OrderLine_Overview.java
1
请完成以下Java代码
public void setBeanFactory(BeanFactory beanFactory) { this.beanFactory = beanFactory; } private static final Log LOG = LogFactory.getLog(ReconciliationFileParserBiz.class); /** * 解析file文件 * * @param batch * 对账批次实体 * @param file * 下载的对账文件 * @param billDate * 下载对账单的日期 * * @param interfaceCode * 具体的支付方式 * * @return 转换之后的vo对象 * @throws IOException */ public List<ReconciliationEntityVo> parser(RpAccountCheckBatch batch, File file, Date billDate, String interfaceCode) throws IOException { // 解析成 ReconciliationEntityVo 对象 List<ReconciliationEntityVo> rcVoList = null;
// 根据支付方式得到解析器的名字 String parserClassName = interfaceCode + "Parser"; LOG.info("根据支付方式得到解析器的名字[" + parserClassName + "]"); ParserInterface service = null; try { // 根据名字获取相应的解析器 service = (ParserInterface) this.getService(parserClassName); } catch (NoSuchBeanDefinitionException e) { LOG.error("根据解析器的名字[" + parserClassName + "],没有找到相应的解析器"); return null; } // 使用相应的解析器解析文件 rcVoList = service.parser(file, billDate, batch); return rcVoList; } }
repos\roncoo-pay-master\roncoo-pay-app-reconciliation\src\main\java\com\roncoo\pay\app\reconciliation\biz\ReconciliationFileParserBiz.java
1
请完成以下Java代码
public DeferredResult shutdown() throws Exception { Map<String, Object> shutdownCountData = dubboShutdownMetadata.shutdown(); return new DeferredResult(null, shutdownCountData); } @RequestMapping(value = DUBBO_CONFIGS_ENDPOINT_URI, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public Map<String, Map<String, Map<String, Object>>> configs() { return dubboConfigsMetadata.configs(); } @RequestMapping(value = DUBBO_SERVICES_ENDPOINT_URI, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public Map<String, Map<String, Object>> services() {
return dubboServicesMetadata.services(); } @RequestMapping(value = DUBBO_REFERENCES_ENDPOINT_URI, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public Map<String, Map<String, Object>> references() { return dubboReferencesMetadata.references(); } @RequestMapping(value = DUBBO_PROPERTIES_ENDPOINT_URI, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public SortedMap<String, Object> properties() { return dubboPropertiesMetadata.properties(); } }
repos\dubbo-spring-boot-project-master\dubbo-spring-boot-compatible\actuator\src\main\java\org\apache\dubbo\spring\boot\actuate\endpoint\mvc\DubboMvcEndpoint.java
1
请完成以下Java代码
public PInstanceId createSelection(final Collection<Integer> selection) { final PInstanceId selectionId = PInstanceId.ofRepoId(nextId(I_AD_PInstance.Table_Name)); createSelection(selectionId, selection); return selectionId; } @SafeVarargs public final <T> PInstanceId createSelectionFromModels(T... models) { final PInstanceId adPInstanceId = createSelectionPInstanceId(); if (models != null) { createSelectionFromModelsCollection(adPInstanceId, Arrays.asList(models)); } return adPInstanceId; } public <T> PInstanceId createSelectionFromModelsCollection(Collection<T> models) { final PInstanceId adPInstanceId = createSelectionPInstanceId(); createSelectionFromModelsCollection(adPInstanceId, models); return adPInstanceId; } public <T> void createSelectionFromModelsCollection(final PInstanceId selectionId, final Collection<T> models) { if (models == null || models.isEmpty()) { return; } final Set<Integer> selection = new HashSet<>(models.size()); for (final T model : models) { final int modelId = InterfaceWrapperHelper.getId(model); selection.add(modelId); } createSelection(selectionId, selection); } public boolean isInSelection(final PInstanceId selectionId, final int id) {
return getSelectionIds(selectionId).contains(id); } public Set<Integer> getSelectionIds(final PInstanceId selectionId) { final Set<Integer> selection = selectionId2selection.get(selectionId); return selection != null ? selection : ImmutableSet.of(); } public void dumpSelections() { StringBuilder sb = new StringBuilder(); sb.append("=====================[ SELECTIONS ]============================================================"); for (final PInstanceId selectionId : selectionId2selection.keySet()) { sb.append("\n\t").append(selectionId).append(": ").append(selectionId2selection.get(selectionId)); } sb.append("\n"); System.out.println(sb); } /** * @return new database restore point. */ public POJOLookupMapRestorePoint createRestorePoint() { return new POJOLookupMapRestorePoint(this); } @Override public void addImportInterceptor(String importTableName, IImportInterceptor listener) { // nothing } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\wrapper\POJOLookupMap.java
1
请完成以下Java代码
public void setS_TimeExpense_ID (int S_TimeExpense_ID) { if (S_TimeExpense_ID < 1) set_ValueNoCheck (COLUMNNAME_S_TimeExpense_ID, null); else set_ValueNoCheck (COLUMNNAME_S_TimeExpense_ID, Integer.valueOf(S_TimeExpense_ID)); } /** Get Expense Report. @return Time and Expense Report */ public int getS_TimeExpense_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_S_TimeExpense_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Expense Line. @param S_TimeExpenseLine_ID Time and Expense Report Line */ public void setS_TimeExpenseLine_ID (int S_TimeExpenseLine_ID) { if (S_TimeExpenseLine_ID < 1) set_ValueNoCheck (COLUMNNAME_S_TimeExpenseLine_ID, null); else set_ValueNoCheck (COLUMNNAME_S_TimeExpenseLine_ID, Integer.valueOf(S_TimeExpenseLine_ID)); } /** Get Expense Line. @return Time and Expense Report Line */ public int getS_TimeExpenseLine_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_S_TimeExpenseLine_ID); if (ii == null) return 0; return ii.intValue(); } public I_S_TimeType getS_TimeType() throws RuntimeException { return (I_S_TimeType)MTable.get(getCtx(), I_S_TimeType.Table_Name) .getPO(getS_TimeType_ID(), get_TrxName()); }
/** Set Time Type. @param S_TimeType_ID Type of time recorded */ public void setS_TimeType_ID (int S_TimeType_ID) { if (S_TimeType_ID < 1) set_Value (COLUMNNAME_S_TimeType_ID, null); else set_Value (COLUMNNAME_S_TimeType_ID, Integer.valueOf(S_TimeType_ID)); } /** Get Time Type. @return Type of time recorded */ public int getS_TimeType_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_S_TimeType_ID); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_S_TimeExpenseLine.java
1
请完成以下Java代码
public boolean wasApplied() { return iterator.wasApplied(); } private class RowIterator extends CountingIterator<Row> { private GuavaSession session; private Statement statement; private AsyncResultSet currentPage; private Iterator<Row> currentRows; private RowIterator(GuavaSession session, Statement statement, AsyncResultSet firstPage) { super(firstPage.remaining()); this.session = session; this.statement = statement; this.currentPage = firstPage; this.currentRows = firstPage.currentPage().iterator(); } @Override protected Row computeNext() { maybeMoveToNextPage(); return currentRows.hasNext() ? currentRows.next() : endOfData(); }
private void maybeMoveToNextPage() { if (!currentRows.hasNext() && currentPage.hasMorePages()) { BlockingOperation.checkNotDriverThread(); ByteBuffer nextPagingState = currentPage.getExecutionInfo().getPagingState(); this.statement = this.statement.setPagingState(nextPagingState); AsyncResultSet nextPage = GuavaSession.getSafe(this.session.executeAsync(this.statement)); currentPage = nextPage; remaining += nextPage.remaining(); currentRows = nextPage.currentPage().iterator(); executionInfos.add(nextPage.getExecutionInfo()); // The definitions can change from page to page if this result set was built from a bound // 'SELECT *', and the schema was altered. columnDefinitions = nextPage.getColumnDefinitions(); } } private boolean isFullyFetched() { return !currentPage.hasMorePages(); } private boolean wasApplied() { return currentPage.wasApplied(); } } }
repos\thingsboard-master\common\dao-api\src\main\java\org\thingsboard\server\dao\cassandra\guava\GuavaMultiPageResultSet.java
1
请完成以下Java代码
protected String getCorrelationKey(CommandContext commandContext, PlanItemInstanceEntity planItemInstanceEntity) { String correlationKey; PlanItemDefinition planItemDefinition = planItemInstanceEntity.getPlanItemDefinition(); if (planItemDefinition != null) { List<ExtensionElement> eventCorrelations = planItemDefinition.getExtensionElements() .getOrDefault(CmmnXmlConstants.ELEMENT_EVENT_CORRELATION_PARAMETER, Collections.emptyList()); if (!eventCorrelations.isEmpty()) { CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext); ExpressionManager expressionManager = cmmnEngineConfiguration.getExpressionManager(); Map<String, Object> correlationParameters = new HashMap<>(); for (ExtensionElement eventCorrelation : eventCorrelations) { String name = eventCorrelation.getAttributeValue(null, "name"); String valueExpression = eventCorrelation.getAttributeValue(null, "value"); if (StringUtils.isNotEmpty(valueExpression)) { Object value = expressionManager.createExpression(valueExpression).getValue(planItemInstanceEntity);
correlationParameters.put(name, value); } else { correlationParameters.put(name, null); } } correlationKey = CommandContextUtil.getEventRegistry().generateKey(correlationParameters); } else { correlationKey = null; } } else { correlationKey = null; } return correlationKey; } }
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\behavior\impl\EventRegistryEventListenerActivityBehaviour.java
1
请完成以下Java代码
Mono<User> retrieveUsersWithExchangeAndError(@PathVariable int id) { return client.get() .uri("/{id}", id) .exchangeToMono(res -> { if (res.statusCode() .is2xxSuccessful()) { return res.bodyToMono(User.class); } else if (res.statusCode() .is4xxClientError()) { return Mono.error(new RuntimeException("Client Error: can't fetch user")); } else if (res.statusCode() .is5xxServerError()) { return Mono.error(new RuntimeException("Server Error: can't fetch user")); } else { return res.createError(); } }); } @GetMapping("/user/exchange-header/{id}") Mono<User> retrieveUsersWithExchangeAndHeader(@PathVariable int id) { return client.get() .uri("/{id}", id) .exchangeToMono(res -> { if (res.statusCode() .is2xxSuccessful()) { logger.info("Status code: " + res.headers() .asHttpHeaders()); logger.info("Content-type" + res.headers() .contentType()); return res.bodyToMono(User.class); } else if (res.statusCode() .is4xxClientError()) { return Mono.error(new RuntimeException("Client Error: can't fetch user")); } else if (res.statusCode() .is5xxServerError()) { return Mono.error(new RuntimeException("Server Error: can't fetch user")); } else { return res.createError(); } }); }
@GetMapping("/user-exchange") Flux<User> retrieveAllUserWithExchange(@PathVariable int id) { return client.get() .exchangeToFlux(res -> res.bodyToFlux(User.class)) .onErrorResume(Flux::error); } @GetMapping("/user-exchange-flux") Flux<User> retrieveUsersWithExchange() { return client.get() .exchangeToFlux(res -> { if (res.statusCode() .is2xxSuccessful()) { return res.bodyToFlux(User.class); } else { return Flux.error(new RuntimeException("Error while fetching users")); } }); } }
repos\tutorials-master\spring-reactive-modules\spring-reactive-client-2\src\main\java\com\baeldung\webclientretrievevsexchange\RetrieveAndExchangeController.java
1
请完成以下Java代码
public void parseSubProcess(Element subProcessElement, ScopeImpl scope, ActivityImpl activity) { } public void parseCallActivity(Element callActivityElement, ScopeImpl scope, ActivityImpl activity) { } public void parseProperty(Element propertyElement, VariableDeclaration variableDeclaration, ActivityImpl activity) { } public void parseSequenceFlow(Element sequenceFlowElement, ScopeImpl scopeElement, TransitionImpl transition) { } public void parseSendTask(Element sendTaskElement, ScopeImpl scope, ActivityImpl activity) { } public void parseMultiInstanceLoopCharacteristics(Element activityElement, Element multiInstanceLoopCharacteristicsElement, ActivityImpl activity) { } public void parseIntermediateTimerEventDefinition(Element timerEventDefinition, ActivityImpl timerActivity) { } public void parseRootElement(Element rootElement, List<ProcessDefinitionEntity> processDefinitions) { } public void parseReceiveTask(Element receiveTaskElement, ScopeImpl scope, ActivityImpl activity) { } public void parseIntermediateSignalCatchEventDefinition(Element signalEventDefinition, ActivityImpl signalActivity) { } public void parseBoundarySignalEventDefinition(Element signalEventDefinition, boolean interrupting, ActivityImpl signalActivity) { } public void parseEventBasedGateway(Element eventBasedGwElement, ScopeImpl scope, ActivityImpl activity) { } public void parseTransaction(Element transactionElement, ScopeImpl scope, ActivityImpl activity) { }
public void parseCompensateEventDefinition(Element compensateEventDefinition, ActivityImpl compensationActivity) { } public void parseIntermediateThrowEvent(Element intermediateEventElement, ScopeImpl scope, ActivityImpl activity) { } public void parseIntermediateCatchEvent(Element intermediateEventElement, ScopeImpl scope, ActivityImpl activity) { } public void parseBoundaryEvent(Element boundaryEventElement, ScopeImpl scopeElement, ActivityImpl nestedActivity) { } public void parseIntermediateMessageCatchEventDefinition(Element messageEventDefinition, ActivityImpl nestedActivity) { } public void parseBoundaryMessageEventDefinition(Element element, boolean interrupting, ActivityImpl messageActivity) { } public void parseBoundaryEscalationEventDefinition(Element escalationEventDefinition, boolean interrupting, ActivityImpl boundaryEventActivity) { } public void parseBoundaryConditionalEventDefinition(Element element, boolean interrupting, ActivityImpl conditionalActivity) { } public void parseIntermediateConditionalEventDefinition(Element conditionalEventDefinition, ActivityImpl conditionalActivity) { } public void parseConditionalStartEventForEventSubprocess(Element element, ActivityImpl conditionalActivity, boolean interrupting) { } @Override public void parseIoMapping(Element extensionElements, ActivityImpl activity, IoMapping inputOutput) { } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\bpmn\parser\AbstractBpmnParseListener.java
1
请在Spring Boot框架中完成以下Java代码
public String getACCOUNTHOLDERCURR() { return accountholdercurr; } /** * Sets the value of the accountholdercurr property. * * @param value * allowed object is * {@link String } * */ public void setACCOUNTHOLDERCURR(String value) { this.accountholdercurr = value; } /** * Gets the value of the institutionnamecode property. * * @return * possible object is * {@link String } * */ public String getINSTITUTIONNAMECODE() { return institutionnamecode; } /** * Sets the value of the institutionnamecode property. * * @param value * allowed object is * {@link String } * */ public void setINSTITUTIONNAMECODE(String value) { this.institutionnamecode = value; } /** * Gets the value of the institutionbranchid property. * * @return * possible object is * {@link String } * */ public String getINSTITUTIONBRANCHID() { return institutionbranchid; } /** * Sets the value of the institutionbranchid property. * * @param value * allowed object is * {@link String } * */ public void setINSTITUTIONBRANCHID(String value) { this.institutionbranchid = value; } /** * Gets the value of the institutionname property. * * @return * possible object is * {@link String } * */ public String getINSTITUTIONNAME() { return institutionname; } /** * Sets the value of the institutionname property. * * @param value * allowed object is * {@link String } * */ public void setINSTITUTIONNAME(String value) { this.institutionname = value; } /** * Gets the value of the institutionlocation property. * * @return * possible object is
* {@link String } * */ public String getINSTITUTIONLOCATION() { return institutionlocation; } /** * Sets the value of the institutionlocation property. * * @param value * allowed object is * {@link String } * */ public void setINSTITUTIONLOCATION(String value) { this.institutionlocation = value; } /** * Gets the value of the country property. * * @return * possible object is * {@link String } * */ public String getCOUNTRY() { return country; } /** * Sets the value of the country property. * * @param value * allowed object is * {@link String } * */ public void setCOUNTRY(String value) { this.country = value; } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_stepcom_desadv\de\metas\edi\esb\jaxb\stepcom\desadv\HFINI1.java
2
请完成以下Java代码
public boolean hasRequestType(@NonNull final DocTypeId docTypeId) { return docTypesRepo.getById(docTypeId).getR_RequestType_ID() > 0; } @Override public boolean isRequisition(final DocTypeId docTypeId) { final I_C_DocType dt = docTypesRepo.getById(docTypeId); return X_C_DocType.DOCSUBTYPE_Requisition.equals(dt.getDocSubType()) && X_C_DocType.DOCBASETYPE_PurchaseOrder.equals(dt.getDocBaseType()); } @Override public boolean isMediated(@NonNull final DocTypeId docTypeId) { final I_C_DocType dt = docTypesRepo.getById(docTypeId); return X_C_DocType.DOCSUBTYPE_Mediated.equals(dt.getDocSubType()) && X_C_DocType.DOCBASETYPE_PurchaseOrder.equals(dt.getDocBaseType()); } @Override public boolean isCallOrder(@NonNull final DocTypeId docTypeId) { final I_C_DocType dt = docTypesRepo.getById(docTypeId); return (X_C_DocType.DOCBASETYPE_SalesOrder.equals(dt.getDocBaseType()) || X_C_DocType.DOCBASETYPE_PurchaseOrder.equals(dt.getDocBaseType())) && X_C_DocType.DOCSUBTYPE_CallOrder.equals(dt.getDocSubType()); } @Override public void save(@NonNull final I_C_DocType dt) { docTypesRepo.save(dt); } @NonNull public ImmutableList<I_C_DocType> retrieveForSelection(@NonNull final PInstanceId pinstanceId) { return docTypesRepo.retrieveForSelection(pinstanceId); } public DocTypeId cloneToOrg(@NonNull final I_C_DocType fromDocType, @NonNull final OrgId toOrgId)
{ final String newName = fromDocType.getName() + "_cloned"; final I_C_DocType newDocType = InterfaceWrapperHelper.copy() .setFrom(fromDocType) .setSkipCalculatedColumns(true) .copyToNew(I_C_DocType.class); newDocType.setAD_Org_ID(toOrgId.getRepoId()); // dev-note: unique index (ad_client_id, name) newDocType.setName(newName); final DocSequenceId fromDocSequenceId = DocSequenceId.ofRepoIdOrNull(fromDocType.getDocNoSequence_ID()); if (fromDocType.isDocNoControlled() && fromDocSequenceId != null) { final DocSequenceId clonedDocSequenceId = sequenceDAO.cloneToOrg(fromDocSequenceId, toOrgId); newDocType.setDocNoSequence_ID(clonedDocSequenceId.getRepoId()); newDocType.setIsDocNoControlled(true); } save(newDocType); return DocTypeId.ofRepoId(newDocType.getC_DocType_ID()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\document\impl\DocTypeBL.java
1
请完成以下Java代码
public class ServerDeployDto extends BaseDTO implements Serializable { @ApiModelProperty(value = "ID") private Long id; @ApiModelProperty(value = "名称") private String name; @ApiModelProperty(value = "IP") private String ip; @ApiModelProperty(value = "端口") private Integer port; @ApiModelProperty(value = "账号") private String account; @ApiModelProperty(value = "密码") private String password;
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ServerDeployDto that = (ServerDeployDto) o; return Objects.equals(id, that.id) && Objects.equals(name, that.name); } @Override public int hashCode() { return Objects.hash(id, name); } }
repos\eladmin-master\eladmin-system\src\main\java\me\zhengjie\modules\maint\service\dto\ServerDeployDto.java
1
请完成以下Java代码
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 setPP_Weighting_Spec_ID (final int PP_Weighting_Spec_ID) { if (PP_Weighting_Spec_ID < 1) set_ValueNoCheck (COLUMNNAME_PP_Weighting_Spec_ID, null); else set_ValueNoCheck (COLUMNNAME_PP_Weighting_Spec_ID, PP_Weighting_Spec_ID); } @Override public int getPP_Weighting_Spec_ID() { return get_ValueAsInt(COLUMNNAME_PP_Weighting_Spec_ID); } @Override public void setTolerance_Perc (final BigDecimal Tolerance_Perc) {
set_Value (COLUMNNAME_Tolerance_Perc, Tolerance_Perc); } @Override public BigDecimal getTolerance_Perc() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Tolerance_Perc); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setWeightChecksRequired (final int WeightChecksRequired) { set_Value (COLUMNNAME_WeightChecksRequired, WeightChecksRequired); } @Override public int getWeightChecksRequired() { return get_ValueAsInt(COLUMNNAME_WeightChecksRequired); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_PP_Weighting_Spec.java
1
请完成以下Java代码
public void setClassname (java.lang.String Classname) { set_Value (COLUMNNAME_Classname, Classname); } /** Get Java-Klasse. @return Java-Klasse */ @Override public java.lang.String getClassname () { return (java.lang.String)get_Value(COLUMNNAME_Classname); } /** Set Beschreibung. @param Description Beschreibung */ @Override public void setDescription (java.lang.String Description) { set_Value (COLUMNNAME_Description, Description); } /** Get Beschreibung. @return Beschreibung */ @Override public java.lang.String getDescription () { return (java.lang.String)get_Value(COLUMNNAME_Description); } /** Set Interface. @param IsInterface Interface */ @Override public void setIsInterface (boolean IsInterface) { set_Value (COLUMNNAME_IsInterface, Boolean.valueOf(IsInterface)); }
/** Get Interface. @return Interface */ @Override public boolean isInterface () { Object oo = get_Value(COLUMNNAME_IsInterface); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Name. @param Name Alphanumeric identifier of the entity */ @Override public void setName (java.lang.String Name) { set_Value (COLUMNNAME_Name, Name); } /** Get Name. @return Alphanumeric identifier of the entity */ @Override public java.lang.String getName () { return (java.lang.String)get_Value(COLUMNNAME_Name); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\de\metas\javaclasses\model\X_AD_JavaClass.java
1
请完成以下Java代码
public void close(final ResultSet rs) { if (rs != null) { try { rs.close(); } catch (final SQLException e) { logger.debug(e.getLocalizedMessage(), e); } } } public void close(final Statement stmt) { if (stmt != null) { try { stmt.close(); } catch (final SQLException e) { logger.debug(e.getLocalizedMessage(), e); } } } public void close(final Connection conn) { if (conn != null) { try { conn.close(); } catch (final SQLException e) { logger.debug(e.getLocalizedMessage(), e); } } } public void close(final ResultSet rs, final PreparedStatement pstmt, final Connection conn) { close(rs); close(pstmt); close(conn); } public Set<String> getDBFunctionsMatchingPattern(final String functionNamePattern) { ResultSet rs = null; try { final ImmutableSet.Builder<String> result = ImmutableSet.builder(); // // Fetch database functions close(rs); rs = database.getConnection() .getMetaData() .getFunctions(database.getDbName(), null, functionNamePattern); while (rs.next()) { final String functionName = rs.getString("FUNCTION_NAME"); final String schemaName = rs.getString("FUNCTION_SCHEM"); final String functionNameFQ = schemaName != null ? schemaName + "." + functionName : functionName; result.add(functionNameFQ); }
// // Fetch database procedures // NOTE: after PostgreSQL 11 this will fetch nothing because our "after_import" routines are functions, // but we are keeping it for legacy purposes. // (see org.postgresql.jdbc.PgDatabaseMetaData.getProcedures) close(rs); rs = database.getConnection() .getMetaData() .getProcedures(database.getDbName(), null, functionNamePattern); while (rs.next()) { final String functionName = rs.getString("PROCEDURE_NAME"); final String schemaName = rs.getString("PROCEDURE_SCHEM"); final String functionNameFQ = schemaName != null ? schemaName + "." + functionName : functionName; result.add(functionNameFQ); } return result.build(); } catch (final SQLException ex) { logger.warn("Error while fetching functions for pattern {}. Considering no functions found.", functionNamePattern, ex); return ImmutableSet.of(); } finally { close(rs); } } @FunctionalInterface public static interface ResultSetRowLoader<T> { T loadRow(ResultSet rs) throws SQLException; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.migration\de.metas.migration.base\src\main\java\de\metas\migration\impl\SQLHelper.java
1
请完成以下Java代码
protected HistoricVariableInstanceEntityManager getHistoricVariableInstanceManager() { return getSession(HistoricVariableInstanceEntityManager.class); } protected HistoricTaskInstanceEntityManager getHistoricTaskInstanceManager() { return getSession(HistoricTaskInstanceEntityManager.class); } protected HistoricIdentityLinkEntityManager getHistoricIdentityLinkEntityManager() { return getSession(HistoricIdentityLinkEntityManager.class); } protected AttachmentEntityManager getAttachmentManager() { return getSession(AttachmentEntityManager.class); }
protected HistoryManager getHistoryManager() { return getSession(HistoryManager.class); } protected ProcessEngineConfigurationImpl getProcessEngineConfiguration() { return Context.getProcessEngineConfiguration(); } @Override public void close() { } @Override public void flush() { } }
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\persistence\AbstractManager.java
1
请完成以下Java代码
default RSocketGraphQlInterceptor andThen(RSocketGraphQlInterceptor nextInterceptor) { return (request, chain) -> intercept(request, (nextRequest) -> nextInterceptor.intercept(nextRequest, chain)); } /** * Apply this interceptor to the given {@code Chain} resulting in an intercepted chain. * @param chain the chain to add interception around * @return a new chain instance */ default Chain apply(Chain chain) { return (request) -> intercept(request, chain); } /**
* Contract for delegation to the rest of the chain. */ interface Chain { /** * Delegate to the rest of the chain to execute the request. * @param request the request to execute * the {@link ExecutionInput} for {@link graphql.GraphQL}. * @return {@code Mono} with the response */ Mono<RSocketGraphQlResponse> next(RSocketGraphQlRequest request); } }
repos\spring-graphql-main\spring-graphql\src\main\java\org\springframework\graphql\server\RSocketGraphQlInterceptor.java
1
请完成以下Java代码
public String toString() { StringBuffer sb = new StringBuffer ("X_U_RoleMenu[") .append(get_ID()).append("]"); return sb.toString(); } public I_AD_Role getAD_Role() throws RuntimeException { return (I_AD_Role)MTable.get(getCtx(), I_AD_Role.Table_Name) .getPO(getAD_Role_ID(), get_TrxName()); } /** Set Role. @param AD_Role_ID Responsibility Role */ public void setAD_Role_ID (int AD_Role_ID) { if (AD_Role_ID < 0) set_Value (COLUMNNAME_AD_Role_ID, null); else set_Value (COLUMNNAME_AD_Role_ID, Integer.valueOf(AD_Role_ID)); } /** Get Role. @return Responsibility Role */ public int getAD_Role_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_AD_Role_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Role Menu. @param U_RoleMenu_ID Role Menu */ public void setU_RoleMenu_ID (int U_RoleMenu_ID) { if (U_RoleMenu_ID < 1) set_ValueNoCheck (COLUMNNAME_U_RoleMenu_ID, null); else set_ValueNoCheck (COLUMNNAME_U_RoleMenu_ID, Integer.valueOf(U_RoleMenu_ID)); }
/** Get Role Menu. @return Role Menu */ public int getU_RoleMenu_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_U_RoleMenu_ID); if (ii == null) return 0; return ii.intValue(); } public I_U_WebMenu getU_WebMenu() throws RuntimeException { return (I_U_WebMenu)MTable.get(getCtx(), I_U_WebMenu.Table_Name) .getPO(getU_WebMenu_ID(), get_TrxName()); } /** Set Web Menu. @param U_WebMenu_ID Web Menu */ public void setU_WebMenu_ID (int U_WebMenu_ID) { if (U_WebMenu_ID < 1) set_Value (COLUMNNAME_U_WebMenu_ID, null); else set_Value (COLUMNNAME_U_WebMenu_ID, Integer.valueOf(U_WebMenu_ID)); } /** Get Web Menu. @return Web Menu */ public int getU_WebMenu_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_U_WebMenu_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_U_RoleMenu.java
1
请完成以下Java代码
public class RabbitGatewaySupport implements InitializingBean { /** Logger available to subclasses. */ protected final Log logger = LogFactory.getLog(getClass()); // NOSONAR private @Nullable RabbitOperations rabbitOperations; /** * Set the Rabbit connection factory to be used by the gateway. * Will automatically create a RabbitTemplate for the given ConnectionFactory. * @param connectionFactory The connection factory. * @see #createRabbitTemplate * @see #setConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory) */ public final void setConnectionFactory(ConnectionFactory connectionFactory) { this.rabbitOperations = createRabbitTemplate(connectionFactory); } /** * Create a RabbitTemplate for the given ConnectionFactory. * Only invoked if populating the gateway with a ConnectionFactory reference. * * @param connectionFactory the Rabbit ConnectionFactory to create a RabbitTemplate for * @return the new RabbitTemplate instance * @see #setConnectionFactory */ protected RabbitTemplate createRabbitTemplate(ConnectionFactory connectionFactory) { return new RabbitTemplate(connectionFactory); } /** * @return The Rabbit ConnectionFactory used by the gateway. */ public final @Nullable ConnectionFactory getConnectionFactory() { return (this.rabbitOperations != null ? this.rabbitOperations.getConnectionFactory() : null); } /** * Set the {@link RabbitOperations} for the gateway. * @param rabbitOperations The Rabbit operations. * @see #setConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory) */ public final void setRabbitOperations(RabbitOperations rabbitOperations) { this.rabbitOperations = rabbitOperations;
} /** * @return The {@link RabbitOperations} for the gateway. */ public final @Nullable RabbitOperations getRabbitOperations() { return this.rabbitOperations; } @Override public final void afterPropertiesSet() throws IllegalArgumentException, BeanInitializationException { if (this.rabbitOperations == null) { throw new IllegalArgumentException("'connectionFactory' or 'rabbitTemplate' is required"); } try { initGateway(); } catch (Exception ex) { throw new BeanInitializationException("Initialization of Rabbit gateway failed: " + ex.getMessage(), ex); } } /** * Subclasses can override this for custom initialization behavior. * Gets called after population of this instance's bean properties. */ protected void initGateway() { } }
repos\spring-amqp-main\spring-rabbit\src\main\java\org\springframework\amqp\rabbit\core\RabbitGatewaySupport.java
1
请完成以下Java代码
public class Page<T> extends SimplePage implements java.io.Serializable, Paginable { public Page() { } public Page(int pageNo, int pageSize, int totalCount) { super(pageNo, pageSize, totalCount); } @SuppressWarnings({ "unchecked", "rawtypes" }) public Page(int pageNo, int pageSize, int totalCount, List list) { super(pageNo, pageSize, totalCount); this.list = list; } public int getFirstResult() {
return (pageNo - 1) * pageSize; } /** * 当前页的数据 */ private List<T> list; public List<T> getList() { return list; } public void setList(List<T> list) { this.list = list; } }
repos\springboot-demo-master\elasticsearch\src\main\java\demo\et59\elaticsearch\page\Page.java
1
请完成以下Java代码
public class MergePdfByteArrays { private ByteArrayOutputStream outStream = null; private Document document = null; private PdfWriter writer = null; private PdfContentByte cb = null; public byte[] getMergedPdfByteArray() { if (document == null) { return null; } try { this.document.close(); this.document = null; } catch (Exception e) { throw new AdempiereException(e); } if (this.outStream != null) { return this.outStream.toByteArray(); } else { return null; } } public MergePdfByteArrays add(final byte[] pdfByteArray) { try { final PdfReader reader = new PdfReader(pdfByteArray); int numberOfPages = reader.getNumberOfPages(); if (this.document == null) { this.document = new Document(reader.getPageSizeWithRotation(1)); this.outStream = new ByteArrayOutputStream(); this.writer = PdfWriter.getInstance(this.document, this.outStream);
this.writer.addViewerPreference(PdfName.PRINTSCALING, PdfName.NONE); // needs to be specified explicitly; will not work with PdfWriter.PrintScalingNone this.document.open(); this.cb = this.writer.getDirectContent(); } PdfImportedPage page; int rotation; { int i = 0; while (i < numberOfPages) { i++; document.setPageSize(reader.getPageSizeWithRotation(i)); document.newPage(); page = writer.getImportedPage(reader, i); rotation = reader.getPageRotation(i); if (rotation == 90 || rotation == 270) { cb.addTemplate(page, 0, -1f, 1f, 0, 0, reader.getPageSizeWithRotation(i).getHeight()); } else { cb.addTemplate(page, 1f, 0, 0, 1f, 0, 0); } } } } catch (Exception e) { throw new AdempiereException(e); } return this; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.printing\de.metas.printing.base\src\main\java\de\metas\printing\MergePdfByteArrays.java
1
请完成以下Java代码
public DmnElementTransformHandlerRegistry getElementTransformHandlerRegistry() { return elementTransformHandlerRegistry; } public void setElementTransformHandlerRegistry(DmnElementTransformHandlerRegistry elementTransformHandlerRegistry) { this.elementTransformHandlerRegistry = elementTransformHandlerRegistry; } public DmnTransformer elementTransformHandlerRegistry(DmnElementTransformHandlerRegistry elementTransformHandlerRegistry) { setElementTransformHandlerRegistry(elementTransformHandlerRegistry); return this; } public DmnDataTypeTransformerRegistry getDataTypeTransformerRegistry() { return dataTypeTransformerRegistry; } public void setDataTypeTransformerRegistry(DmnDataTypeTransformerRegistry dataTypeTransformerRegistry) { this.dataTypeTransformerRegistry = dataTypeTransformerRegistry; } public DmnTransformer dataTypeTransformerRegistry(DmnDataTypeTransformerRegistry dataTypeTransformerRegistry) { setDataTypeTransformerRegistry(dataTypeTransformerRegistry); return this; }
public DmnHitPolicyHandlerRegistry getHitPolicyHandlerRegistry() { return hitPolicyHandlerRegistry; } public void setHitPolicyHandlerRegistry(DmnHitPolicyHandlerRegistry hitPolicyHandlerRegistry) { this.hitPolicyHandlerRegistry = hitPolicyHandlerRegistry; } public DmnTransformer hitPolicyHandlerRegistry(DmnHitPolicyHandlerRegistry hitPolicyHandlerRegistry) { setHitPolicyHandlerRegistry(hitPolicyHandlerRegistry); return this; } public DmnTransform createTransform() { return transformFactory.createTransform(this); } }
repos\camunda-bpm-platform-master\engine-dmn\engine\src\main\java\org\camunda\bpm\dmn\engine\impl\transform\DefaultDmnTransformer.java
1
请完成以下Java代码
private I_AD_Table createTargetTable() { final I_AD_Table targetTable = InterfaceWrapperHelper.newInstance(I_AD_Table.class); targetTable.setName(getTargetTableName()); targetTable.setTableName(getTargetTableName()); targetTable.setEntityType(getEntityType()); save(targetTable); return targetTable; } private I_AD_Column createColumn(final ColumnSource sourceColumn, final I_AD_Table targetTable) { final I_AD_Column colTarget = InterfaceWrapperHelper.newInstance(I_AD_Column.class); colTarget.setAD_Org_ID(0); colTarget.setAD_Table_ID(targetTable.getAD_Table_ID()); colTarget.setEntityType(getEntityType()); final Properties ctx = Env.getCtx(); M_Element element = M_Element.get(ctx, sourceColumn.getName()); if (element == null) { element = new M_Element(ctx, sourceColumn.getName(), targetTable.getEntityType(), ITrx.TRXNAME_ThreadInherited); element.setColumnName(sourceColumn.getName()); element.setName(sourceColumn.getName()); element.setPrintName(sourceColumn.getName());
element.saveEx(ITrx.TRXNAME_ThreadInherited); addLog("@AD_Element_ID@ " + element.getColumnName() + ": @Created@"); // metas } colTarget.setAD_Element_ID(element.getAD_Element_ID()); colTarget.setName(targetTable.getName()); colTarget.setIsAllowLogging(false); colTarget.setFieldLength(sourceColumn.getLength()); colTarget.setAD_Reference_ID(sourceColumn.getType()); colTarget.setIsActive(true); colTarget.setIsUpdateable(true); save(colTarget); addLog("@AD_Column_ID@ " + targetTable.getTableName() + "." + colTarget.getColumnName() + ": @Created@"); return colTarget; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\table\api\impl\CreateColumnsProducer.java
1
请完成以下Java代码
public void setM_Demand_ID (int M_Demand_ID) { if (M_Demand_ID < 1) set_ValueNoCheck (COLUMNNAME_M_Demand_ID, null); else set_ValueNoCheck (COLUMNNAME_M_Demand_ID, Integer.valueOf(M_Demand_ID)); } /** Get Demand. @return Material Demand */ public int getM_Demand_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_Demand_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Name. @param Name Alphanumeric identifier of the entity */ public void setName (String Name) { set_Value (COLUMNNAME_Name, Name); } /** Get Name. @return Alphanumeric identifier of the entity */ public String getName () { return (String)get_Value(COLUMNNAME_Name); } /** Get Record ID/ColumnName @return ID/ColumnName pair */ public KeyNamePair getKeyNamePair() {
return new KeyNamePair(get_ID(), getName()); } /** Set Process Now. @param Processing Process Now */ public void setProcessing (boolean Processing) { set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing)); } /** Get Process Now. @return Process Now */ public boolean isProcessing () { Object oo = get_Value(COLUMNNAME_Processing); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Demand.java
1
请完成以下Java代码
public void setNameLikeIgnoreCase(String nameLikeIgnoreCase) { this.nameLikeIgnoreCase = nameLikeIgnoreCase; } public Date getStartedBefore() { return startedBefore; } public void setStartedBefore(Date startedBefore) { this.startedBefore = startedBefore; } public Date getStartedAfter() { return startedAfter; } public void setStartedAfter(Date startedAfter) { this.startedAfter = startedAfter; }
public String getStartedBy() { return startedBy; } public void setStartedBy(String startedBy) { this.startedBy = startedBy; } public List<String> getInvolvedGroups() { return involvedGroups; } public void setInvolvedGroups(List<String> involvedGroups) { this.involvedGroups = involvedGroups; } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\ExecutionQueryImpl.java
1
请完成以下Java代码
public int count() { return collection.size(); } @SuppressWarnings("unchecked") public <V extends ModelElementInstance> Query<V> filterByType(ModelElementType elementType) { Class<V> elementClass = (Class<V>) elementType.getInstanceType(); return filterByType(elementClass); } @SuppressWarnings("unchecked") public <V extends ModelElementInstance> Query<V> filterByType(Class<V> elementClass) { List<V> filtered = new ArrayList<V>(); for (T instance : collection) { if (elementClass.isAssignableFrom(instance.getClass())) {
filtered.add((V) instance); } } return new QueryImpl<V>(filtered); } public T singleResult() { if (collection.size() == 1) { return collection.iterator().next(); } else { throw new CmmnModelException("Collection expected to have <1> entry but has <" + collection.size() + ">"); } } }
repos\camunda-bpm-platform-master\model-api\cmmn-model\src\main\java\org\camunda\bpm\model\cmmn\impl\QueryImpl.java
1
请完成以下Java代码
private static String stripDiacritics(final String string) { String s = Normalizer.normalize(string, Normalizer.Form.NFD); s = s.replaceAll("[\\p{InCombiningDiacriticalMarks}]", ""); return s; } public MenuNode getRootNodeWithFavoritesOnly(@NonNull final MenuNodeFavoriteProvider menuNodeFavoriteProvider) { return getRootNode() .deepCopy(node -> { if (node.isRoot()) { return MenuNodeFilterResolution.Accept; }
if (node.isGroupingNode()) { return MenuNodeFilterResolution.AcceptIfHasChildren; } if (menuNodeFavoriteProvider.isFavorite(node)) { return MenuNodeFilterResolution.Accept; } return MenuNodeFilterResolution.Reject; }); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\menu\MenuTree.java
1
请在Spring Boot框架中完成以下Java代码
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException { final String requestTokenHeader = request.getHeader("Authorization"); String username = null; String jwtToken = null; // JWT Token is in the form "Bearer token". Remove Bearer word and get only the Token if (requestTokenHeader != null && requestTokenHeader.startsWith("Bearer ")) { jwtToken = requestTokenHeader.substring(7); try { username = jwtTokenUtil.getUsernameFromToken(jwtToken); } catch (IllegalArgumentException e) { System.out.println("Unable to get JWT Token"); } catch (ExpiredJwtException e) { System.out.println("JWT Token has expired"); } } else { logger.warn("JWT Token does not begin with Bearer String"); } //Once we get the token validate it. if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) { UserDetails userDetails = this.jwtUserDetailsService.loadUserByUsername(username); // if token is valid configure Spring Security to manually set authentication
if (jwtTokenUtil.validateToken(jwtToken, userDetails)) { UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = new UsernamePasswordAuthenticationToken( userDetails, null, userDetails.getAuthorities()); usernamePasswordAuthenticationToken .setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); // After setting the Authentication in the context, we specify // that the current user is authenticated. So it passes the Spring Security Configurations successfully. SecurityContextHolder.getContext().setAuthentication(usernamePasswordAuthenticationToken); } } chain.doFilter(request, response); } }
repos\SpringBoot-Projects-FullStack-master\Advanced-SpringSecure\spring-boot-jwt-without-JPA\spring-boot-jwt\src\main\java\com\javainuse\config\JwtRequestFilter.java
2
请完成以下Java代码
public byte[] getMergedPdfByteArray() { if (document == null) { return null; } try { this.document.close(); this.document = null; } catch (Exception e) { throw new AdempiereException(e); } if (this.outStream != null) { return this.outStream.toByteArray(); } else { return null; } } public MergePdfByteArrays add(final byte[] pdfByteArray) { try { final PdfReader reader = new PdfReader(pdfByteArray); int numberOfPages = reader.getNumberOfPages(); if (this.document == null) { this.document = new Document(reader.getPageSizeWithRotation(1)); this.outStream = new ByteArrayOutputStream(); this.writer = PdfWriter.getInstance(this.document, this.outStream); this.writer.addViewerPreference(PdfName.PRINTSCALING, PdfName.NONE); // needs to be specified explicitly; will not work with PdfWriter.PrintScalingNone this.document.open(); this.cb = this.writer.getDirectContent(); }
PdfImportedPage page; int rotation; { int i = 0; while (i < numberOfPages) { i++; document.setPageSize(reader.getPageSizeWithRotation(i)); document.newPage(); page = writer.getImportedPage(reader, i); rotation = reader.getPageRotation(i); if (rotation == 90 || rotation == 270) { cb.addTemplate(page, 0, -1f, 1f, 0, 0, reader.getPageSizeWithRotation(i).getHeight()); } else { cb.addTemplate(page, 1f, 0, 0, 1f, 0, 0); } } } } catch (Exception e) { throw new AdempiereException(e); } return this; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.printing\de.metas.printing.base\src\main\java\de\metas\printing\MergePdfByteArrays.java
1
请完成以下Java代码
public QuickInputDescriptor createQuickInputDescriptor( final DocumentType documentType, final DocumentId documentTypeId, final DetailId detailId, @NonNull final Optional<SOTrx> soTrx) { final DocumentEntityDescriptor entityDescriptor = createEntityDescriptor(documentTypeId, detailId, soTrx); final QuickInputLayoutDescriptor layout = createLayout(entityDescriptor); return QuickInputDescriptor.of(entityDescriptor, layout, EmptiesQuickInputProcessor.class); } private DocumentEntityDescriptor createEntityDescriptor( final DocumentId documentTypeId, final DetailId detailId, @NonNull final Optional<SOTrx> soTrx) { final IMsgBL msgBL = Services.get(IMsgBL.class); final DocumentEntityDescriptor.Builder entityDescriptor = DocumentEntityDescriptor.builder() .setDocumentType(DocumentType.QuickInput, documentTypeId) .setIsSOTrx(soTrx) .disableDefaultTableCallouts() .setDataBinding(DocumentEntityDataBindingDescriptorBuilder.NULL) // Defaults: .setDetailId(detailId) // ; entityDescriptor.addField(DocumentFieldDescriptor.builder(IEmptiesQuickInput.COLUMNNAME_M_HU_PackingMaterial_ID) .setCaption(msgBL.translatable(IEmptiesQuickInput.COLUMNNAME_M_HU_PackingMaterial_ID)) // .setWidgetType(DocumentFieldWidgetType.Lookup) .setLookupDescriptorProvider(lookupDescriptorProviders.sql() .setCtxTableName(null) // ctxTableName .setCtxColumnName(IEmptiesQuickInput.COLUMNNAME_M_HU_PackingMaterial_ID) .setDisplayType(DisplayType.Search) .build()) .setValueClass(IntegerLookupValue.class) .setReadonlyLogic(ConstantLogicExpression.FALSE) .setAlwaysUpdateable(true) .setMandatoryLogic(ConstantLogicExpression.TRUE)
.setDisplayLogic(ConstantLogicExpression.TRUE) .addCharacteristic(Characteristic.PublicField)); entityDescriptor.addField(DocumentFieldDescriptor.builder(IEmptiesQuickInput.COLUMNNAME_Qty) .setCaption(msgBL.translatable(IEmptiesQuickInput.COLUMNNAME_Qty)) .setWidgetType(DocumentFieldWidgetType.Integer) .setReadonlyLogic(ConstantLogicExpression.FALSE) .setAlwaysUpdateable(true) .setMandatoryLogic(ConstantLogicExpression.TRUE) .setDisplayLogic(ConstantLogicExpression.TRUE) .addCharacteristic(Characteristic.PublicField)); return entityDescriptor.build(); } private QuickInputLayoutDescriptor createLayout(final DocumentEntityDescriptor entityDescriptor) { return QuickInputLayoutDescriptor.onlyFields(entityDescriptor, new String[][] { { IEmptiesQuickInput.COLUMNNAME_M_HU_PackingMaterial_ID } // , { IEmptiesQuickInput.COLUMNNAME_Qty } }); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\quickinput\inout\EmptiesQuickInputDescriptorFactory.java
1
请完成以下Java代码
private void addAssignListener(UserTask userTask) { addListenerToUserTask(userTask, TaskListener.EVENTNAME_ASSIGNMENT, new CdiTaskListener(userTask.getId(), BusinessProcessEventType.ASSIGN_TASK)); } private void addCreateListener(UserTask userTask) { addListenerToUserTask(userTask, TaskListener.EVENTNAME_CREATE, new CdiTaskListener(userTask.getId(), BusinessProcessEventType.CREATE_TASK)); } protected void addDeleteListener(UserTask userTask) { addListenerToUserTask(userTask, TaskListener.EVENTNAME_DELETE, new CdiTaskListener(userTask.getId(), BusinessProcessEventType.DELETE_TASK)); } protected void addStartEventListener(FlowElement flowElement) { CdiExecutionListener listener = new CdiExecutionListener(flowElement.getId(), BusinessProcessEventType.START_ACTIVITY); addListenerToElement(flowElement, ExecutionListener.EVENTNAME_START, listener); } protected void addEndEventListener(FlowElement flowElement) { CdiExecutionListener listener = new CdiExecutionListener(flowElement.getId(), BusinessProcessEventType.END_ACTIVITY); addListenerToElement(flowElement, ExecutionListener.EVENTNAME_END, listener);
} protected void addListenerToElement(FlowElement flowElement, String event, Object instance) { FlowableListener listener = new FlowableListener(); listener.setEvent(event); listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_INSTANCE); listener.setInstance(instance); flowElement.getExecutionListeners().add(listener); } protected void addListenerToUserTask(UserTask userTask, String event, Object instance) { FlowableListener listener = new FlowableListener(); listener.setEvent(event); listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_INSTANCE); listener.setInstance(instance); userTask.getTaskListeners().add(listener); } }
repos\flowable-engine-main\modules\flowable-cdi\src\main\java\org\flowable\cdi\impl\event\CdiEventSupportBpmnParseHandler.java
1
请在Spring Boot框架中完成以下Java代码
public String getCamelFileName() { return CamelFileName; } // public String getEDIMessageDatePattern() // { // return EDIMessageDatePattern; // } public String getAD_Client_Value() { return AD_Client_Value; } public int getAD_Org_ID() { return AD_Org_ID; } public String getADInputDataDestination_InternalName() { return ADInputDataDestination_InternalName; } public BigInteger getADInputDataSourceID() { return ADInputDataSourceID; }
public BigInteger getADUserEnteredByID() { return ADUserEnteredByID; } public String getDeliveryRule() { return DeliveryRule; } public String getDeliveryViaRule() { return DeliveryViaRule; } public String getCurrencyISOCode() { return currencyISOCode; } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java\de\metas\edi\esb\excelimport\ExcelConfigurationContext.java
2
请完成以下Java代码
private DocumentDescriptor loadDocumentDescriptor(final WindowId windowId) { return newLoader(windowId).load(); } private DefaultDocumentDescriptorLoader newLoader(@NonNull final WindowId windowId) { return DefaultDocumentDescriptorLoader.builder() .layoutFactoryProvider(layoutFactoryProvider) .dataEntrySubTabBindingDescriptorBuilder(dataEntrySubTabBindingDescriptorBuilder) .adWindowId(windowId.toAdWindowId()) .build(); } /** * @return {@code false} if the given {@code windowId} * <br> * is {@code null} <br>
* or its {@link WindowId#isInt()} returns {@code false} * or it was declared unsupported via {@link #addUnsupportedWindowId(WindowId)}. */ @Override public boolean isWindowIdSupported(@Nullable final WindowId windowId) { return windowId != null && windowId.isInt() && !unsupportedWindowIds.contains(windowId); } /** * Tell this instance that it shall not attempt to work with the given window ID. */ public void addUnsupportedWindowId(@NonNull final WindowId windowId) { unsupportedWindowIds.add(windowId); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\descriptor\factory\standard\DefaultDocumentDescriptorFactory.java
1
请完成以下Java代码
public abstract class SpinValueImpl extends AbstractTypedValue<Spin<?>> implements SpinValue { private static final long serialVersionUID = 1L; protected String serializedValue; protected boolean isDeserialized; protected String dataFormatName; public SpinValueImpl( Spin<?> value, String serializedValue, String dataFormatName, boolean isDeserialized, ValueType type, boolean isTransient) { super(value, type); this.serializedValue = serializedValue; this.dataFormatName = dataFormatName; this.isDeserialized = isDeserialized; this.isTransient = isTransient; } public Spin<?> getValue() { if(isDeserialized) { return super.getValue(); } else { // deserialize the serialized value by using // the given data format value = S(getValueSerialized(), getSerializationDataFormat()); isDeserialized = true; setValueSerialized(null); return value; } } public SpinValueType getType() { return (SpinValueType) super.getType(); } public boolean isDeserialized() { return isDeserialized;
} public String getValueSerialized() { return serializedValue; } public void setValueSerialized(String serializedValue) { this.serializedValue = serializedValue; } public String getSerializationDataFormat() { return dataFormatName; } public void setSerializationDataFormat(String serializationDataFormat) { this.dataFormatName = serializationDataFormat; } public DataFormat<? extends Spin<?>> getDataFormat() { if(isDeserialized) { return DataFormats.getDataFormat(dataFormatName); } else { throw new IllegalStateException("Spin value is not deserialized."); } } }
repos\camunda-bpm-platform-master\engine-plugins\spin-plugin\src\main\java\org\camunda\spin\plugin\variable\value\impl\SpinValueImpl.java
1
请完成以下Java代码
public class SimpleObservationApplication { // we can run this as a simple command line application public static void main(String[] args) { // create registry final var observationRegistry = ObservationRegistry.create(); // create meter registry and observation handler final var meterRegistry = new SimpleMeterRegistry(); final var meterObservationHandler = new DefaultMeterObservationHandler(meterRegistry); // create simple logging observation handler final var loggingObservationHandler = new ObservationTextPublisher(System.out::println); // register observation handlers observationRegistry .observationConfig() .observationHandler(meterObservationHandler) .observationHandler(loggingObservationHandler); // make an observation Observation.Context context = new Observation.Context(); String observationName = "obs1"; Observation observation = Observation .createNotStarted(observationName, () -> context, observationRegistry) .lowCardinalityKeyValue("gender", "male") .highCardinalityKeyValue("age", "41"); for (int i = 0; i < 10; i++) { observation.observe(SimpleObservationApplication::doSomeAction); } meterRegistry.getMeters().forEach(m -> {
System.out.println(m.getId() + "\n============"); m.measure().forEach(ms -> System.out.println(ms.getValue() + " [" + ms.getStatistic() + "]")); System.out.println("----------------------------"); }); Optional<Double> maximumDuration = meterRegistry.getMeters().stream() .filter(m -> "obs1".equals(m.getId().getName())) .flatMap(m -> StreamSupport.stream(m.measure().spliterator(), false)) .filter(ms -> ms.getStatistic() == Statistic.MAX) .findFirst() .map(Measurement::getValue); System.out.println(maximumDuration); } private static void doSomeAction() { try { Thread.sleep(Math.round(Math.random() * 1000)); System.out.println("Hello World!"); } catch (InterruptedException e) { throw new RuntimeException(e); } } }
repos\tutorials-master\spring-boot-modules\spring-boot-3-observation\src\main\java\com\baeldung\samples\SimpleObservationApplication.java
1
请完成以下Java代码
public String getId() { return id; } @Override public ProductId getProductId() { return productId; } @Override public I_M_Locator getLocator() { return huPart.getM_Locator(); } @Override public I_C_BPartner getC_BPartner() { return huPart.getC_BPartner(); } @Override public IAttributeSet getAttributes()
{ return huPart.getAttributes(); } @Override public BigDecimal getQtyOnHand() { return qtyOnHand.toBigDecimal(); } public I_M_HU getVHU() { return huPart.getM_HU(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\storage\spi\hu\impl\HUStorageRecord.java
1
请在Spring Boot框架中完成以下Java代码
public Set<WarehouseId> getWarehouseIds() { return getDelegate().getWarehouseIds(); } @Override public Set<ShipmentScheduleId> getShipmentScheduleIds() { return getDelegate().getShipmentScheduleIds(); } @Override public IPackingItem subtractToPackingItem( final Quantity subtrahent, final Predicate<PackingItemPart> acceptPartPredicate) { return getDelegate().subtractToPackingItem(subtrahent, acceptPartPredicate); } @Override public PackingItemParts subtract(final Quantity subtrahent) { return getDelegate().subtract(subtrahent); } @Override public PackingItemParts getParts()
{ return getDelegate().getParts(); } @Override public ProductId getProductId() { return getDelegate().getProductId(); } @Override public Quantity getQtySum() { return getDelegate().getQtySum(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\picking\service\ForwardingPackingItem.java
2
请在Spring Boot框架中完成以下Java代码
public JXlsExporter setTemplateResourceName(final String templateResourceName) { this._templateResourceName = templateResourceName; return this; } private InputStream getTemplate() { if (_template != null) { return _template; } if (!Check.isEmpty(_templateResourceName, true)) { final ClassLoader loader = getLoader(); final InputStream template = loader.getResourceAsStream(_templateResourceName); if (template == null) { throw new JXlsExporterException("Could not find template for name: " + _templateResourceName + " using " + loader); } return template; } throw new JXlsExporterException("Template is not configured"); } public JXlsExporter setTemplate(final InputStream template) { this._template = template; return this; } private IXlsDataSource getDataSource() { Check.assumeNotNull(_dataSource, "dataSource not null"); return _dataSource; } public JXlsExporter setDataSource(final IXlsDataSource dataSource) { this._dataSource = dataSource; return this; } public JXlsExporter setResourceBundle(final ResourceBundle resourceBundle) { this._resourceBundle = resourceBundle; return this; }
private ResourceBundle getResourceBundle() { if (_resourceBundle != null) { return _resourceBundle; } if (!Check.isEmpty(_templateResourceName, true)) { String baseName = null; try { final int dotIndex = _templateResourceName.lastIndexOf('.'); baseName = dotIndex <= 0 ? _templateResourceName : _templateResourceName.substring(0, dotIndex); return ResourceBundle.getBundle(baseName, getLocale(), getLoader()); } catch (final MissingResourceException e) { logger.debug("No resource found for {}", baseName); } } return null; } public Map<String, String> getResourceBundleAsMap() { final ResourceBundle bundle = getResourceBundle(); if (bundle == null) { return ImmutableMap.of(); } return ResourceBundleMapWrapper.of(bundle); } public JXlsExporter setProperty(@NonNull final String name, @NonNull final Object value) { Check.assumeNotEmpty(name, "name not empty"); _properties.put(name, value); return this; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.report\metasfresh-report-service\src\main\java\de\metas\report\xls\engine\JXlsExporter.java
2
请在Spring Boot框架中完成以下Java代码
final ImmutableList<PayableDocument> getPayableDocuments() { return _payableDocuments; } @VisibleForTesting final ImmutableList<PaymentDocument> getPaymentDocuments() { return _paymentDocuments; } public PaymentAllocationBuilder invoiceProcessingServiceCompanyService(@NonNull final InvoiceProcessingServiceCompanyService invoiceProcessingServiceCompanyService) { assertNotBuilt(); this.invoiceProcessingServiceCompanyService = invoiceProcessingServiceCompanyService; return this;
} /** * @param allocatePayableAmountsAsIs if true, we allow the allocated amount to exceed the payment's amount, * if the given payable is that big. * We need this behavior when we want to allocate a remittance advice and know that *in sum* the payables' amounts will match the payment */ public PaymentAllocationBuilder allocatePayableAmountsAsIs(final boolean allocatePayableAmountsAsIs) { assertNotBuilt(); this.allocatePayableAmountsAsIs = allocatePayableAmountsAsIs; return this; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.base\src\main\java\de\metas\banking\payment\paymentallocation\service\PaymentAllocationBuilder.java
2
请完成以下Java代码
public class DateValueMapper extends PrimitiveValueMapper<DateValue> { protected static final ExternalTaskClientLogger LOG = ExternalTaskClientLogger.CLIENT_LOGGER; protected String dateFormat; public DateValueMapper(String dateFormat) { super(ValueType.DATE); this.dateFormat = dateFormat; } public DateValue convertToTypedValue(UntypedValueImpl untypedValue) { return Variables.dateValue((Date) untypedValue.getValue()); } public DateValue readValue(TypedValueField typedValueField) { Date date = null; String value = (String) typedValueField.getValue(); if (value != null) { SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); try { date = sdf.parse(value); } catch (ParseException e) { throw LOG.valueMapperExceptionWhileParsingDate(value, e); } } return Variables.dateValue(date); }
public void writeValue(DateValue dateValue, TypedValueField typedValueField) { Date date = (Date) dateValue.getValue(); if (date != null) { SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); typedValueField.setValue(sdf.format(date)); } } protected boolean canReadValue(TypedValueField typedValueField) { Object value = typedValueField.getValue(); return value == null || value instanceof String; } }
repos\camunda-bpm-platform-master\clients\java\client\src\main\java\org\camunda\bpm\client\variable\impl\mapper\DateValueMapper.java
1
请完成以下Java代码
public static class PlanItemInstanceByStagePlanItemInstanceIdCachedEntityMatcher extends CachedEntityMatcherAdapter<PlanItemInstanceEntity> { @Override public boolean isRetained(PlanItemInstanceEntity entity, Object param) { String stagePlanItemInstanceId = (String) param; return stagePlanItemInstanceId.equals(entity.getStageInstanceId()); } } public static class PlanItemInstanceByCaseInstanceIdAndTypeAndStateCachedEntityMatcher extends CachedEntityMatcherAdapter<PlanItemInstanceEntity> { @Override @SuppressWarnings("unchecked") public boolean isRetained(PlanItemInstanceEntity entity, Object param) { Map<String, Object> map = (Map<String, Object>) param; String caseInstanceId = (String) map.get("caseInstanceId"); List<String> planItemDefinitionTypes = (List<String>) map.get("planItemDefinitionTypes"); List<String> states = (List<String>) map.get("states"); boolean ended = (boolean) map.get("ended"); return caseInstanceId.equals(entity.getCaseInstanceId()) && (planItemDefinitionTypes == null || planItemDefinitionTypes.contains(entity.getPlanItemDefinitionType())) && (states == null || states.contains(entity.getState()))
&& (ended ? entity.getEndedTime() != null : entity.getEndedTime() == null); } } protected void setSafeInValueLists(PlanItemInstanceQueryImpl planItemInstanceQuery) { if (planItemInstanceQuery.getInvolvedGroups() != null) { planItemInstanceQuery.setSafeInvolvedGroups(createSafeInValuesList(planItemInstanceQuery.getInvolvedGroups())); } if(planItemInstanceQuery.getCaseInstanceIds() != null) { planItemInstanceQuery.setSafeCaseInstanceIds(createSafeInValuesList(planItemInstanceQuery.getCaseInstanceIds())); } if (planItemInstanceQuery.getOrQueryObjects() != null && !planItemInstanceQuery.getOrQueryObjects().isEmpty()) { for (PlanItemInstanceQueryImpl oInstanceQuery : planItemInstanceQuery.getOrQueryObjects()) { setSafeInValueLists(oInstanceQuery); } } } }
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\persistence\entity\data\impl\MybatisPlanItemInstanceDataManagerImpl.java
1
请完成以下Java代码
public long addMachine(MachineInfo machineInfo) { AssertUtil.notNull(machineInfo, "machineInfo cannot be null"); AppInfo appInfo = apps.computeIfAbsent(machineInfo.getApp(), o -> new AppInfo(machineInfo.getApp(), machineInfo.getAppType())); appInfo.addMachine(machineInfo); return 1; } @Override public boolean removeMachine(String app, String ip, int port) { AssertUtil.assertNotBlank(app, "app name cannot be blank"); AppInfo appInfo = apps.get(app); if (appInfo != null) { return appInfo.removeMachine(ip, port); } return false; } @Override public List<String> getAppNames() { return new ArrayList<>(apps.keySet()); }
@Override public AppInfo getDetailApp(String app) { AssertUtil.assertNotBlank(app, "app name cannot be blank"); return apps.get(app); } @Override public Set<AppInfo> getBriefApps() { return new HashSet<>(apps.values()); } @Override public void removeApp(String app) { AssertUtil.assertNotBlank(app, "app name cannot be blank"); apps.remove(app); } }
repos\spring-boot-student-master\spring-boot-student-sentinel-dashboard\src\main\java\com\alibaba\csp\sentinel\dashboard\discovery\SimpleMachineDiscovery.java
1
请完成以下Java代码
public class DeliveryAddress { private String forename; private String surname; private String street; private String postalcode; private String county; public String getForename() { return forename; } public DeliveryAddress setForename(String forename) { this.forename = forename; return this; } public String getSurname() { return surname; } public DeliveryAddress setSurname(String surname) { this.surname = surname; return this; } public String getStreet() { return street; } public DeliveryAddress setStreet(String street) { this.street = street; return this; } public String getPostalcode() { return postalcode;
} public DeliveryAddress setPostalcode(String postalcode) { this.postalcode = postalcode; return this; } public String getCounty() { return county; } public DeliveryAddress setCounty(String county) { this.county = county; return this; } }
repos\tutorials-master\mapstruct\src\main\java\com\baeldung\entity\DeliveryAddress.java
1
请完成以下Java代码
public void setSetupTime (int SetupTime) { set_Value (COLUMNNAME_SetupTime, Integer.valueOf(SetupTime)); } /** Get Setup Time. @return Setup time before starting Production */ @Override public int getSetupTime () { Integer ii = (Integer)get_Value(COLUMNNAME_SetupTime); if (ii == null) return 0; return ii.intValue(); } /** Set Units by Cycles. @param UnitsCycles The Units by Cycles are defined for process type Flow Repetitive Dedicated and indicated the product to be manufactured on a production line for duration unit. */ @Override public void setUnitsCycles (java.math.BigDecimal UnitsCycles) { set_Value (COLUMNNAME_UnitsCycles, UnitsCycles); } /** Get Units by Cycles. @return The Units by Cycles are defined for process type Flow Repetitive Dedicated and indicated the product to be manufactured on a production line for duration unit. */ @Override public java.math.BigDecimal getUnitsCycles () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_UnitsCycles); if (bd == null) return BigDecimal.ZERO; return bd; } /** Set Waiting Time. @param WaitingTime Workflow Simulation Waiting time */ @Override public void setWaitingTime (int WaitingTime) { set_Value (COLUMNNAME_WaitingTime, Integer.valueOf(WaitingTime)); } /** Get Waiting Time. @return Workflow Simulation Waiting time */ @Override public int getWaitingTime () { Integer ii = (Integer)get_Value(COLUMNNAME_WaitingTime);
if (ii == null) return 0; return ii.intValue(); } /** Set Working Time. @param WorkingTime Workflow Simulation Execution Time */ @Override public void setWorkingTime (int WorkingTime) { set_Value (COLUMNNAME_WorkingTime, Integer.valueOf(WorkingTime)); } /** Get Working Time. @return Workflow Simulation Execution Time */ @Override public int getWorkingTime () { Integer ii = (Integer)get_Value(COLUMNNAME_WorkingTime); if (ii == null) return 0; return ii.intValue(); } /** Set Yield %. @param Yield The Yield is the percentage of a lot that is expected to be of acceptable wuality may fall below 100 percent */ @Override public void setYield (int Yield) { set_Value (COLUMNNAME_Yield, Integer.valueOf(Yield)); } /** Get Yield %. @return The Yield is the percentage of a lot that is expected to be of acceptable wuality may fall below 100 percent */ @Override public int getYield () { Integer ii = (Integer)get_Value(COLUMNNAME_Yield); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_PP_Order_Workflow.java
1
请完成以下Java代码
public class Page { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "content") private String content; @Column(name = "number") private int number; @ToString.Exclude @ManyToOne @JoinColumn(name = "book_id") private Book book;
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false; Page page = (Page) o; return getId() != null && Objects.equals(getId(), page.getId()); } @Override public int hashCode() { return getClass().hashCode(); } }
repos\tutorials-master\persistence-modules\jimmer\src\main\java\com\baeldung\jimmer\introduction\hibernate\Page.java
1
请完成以下Java代码
public boolean containsAnyOfRowIds(final ViewRowIdsOrderedSelection selection, final DocumentIdsSelection rowIds) { if (rowIds.isEmpty()) { return false; } final SqlAndParams sqlCount = newSqlViewSelectionQueryBuilder().buildSqlCount(selection.getSelectionId(), rowIds); final int count = DB.getSQLValueEx(ITrx.TRXNAME_ThreadInherited, sqlCount.getSql(), sqlCount.getSqlParamsArray()); return count > 0; } @Override public void deleteSelections(@NonNull final Set<String> selectionIds) { if (selectionIds.isEmpty()) { return; } final SqlViewSelectionQueryBuilder viewQueryBuilder = newSqlViewSelectionQueryBuilder(); // Delete selection lines { final SqlAndParams sql = viewQueryBuilder.buildSqlDeleteSelectionLines(selectionIds); final int countDeleted = DB.executeUpdateAndThrowExceptionOnFail(sql.getSql(), sql.getSqlParamsArray(), ITrx.TRXNAME_ThreadInherited); logger.trace("Delete {} selection lines for {}", countDeleted, selectionIds); } // Delete selection rows { final SqlAndParams sql = viewQueryBuilder.buildSqlDeleteSelection(selectionIds); final int countDeleted = DB.executeUpdateAndThrowExceptionOnFail(sql.getSql(), sql.getSqlParamsArray(), ITrx.TRXNAME_ThreadInherited); logger.trace("Delete {} selection rows for {}", countDeleted, selectionIds); } } @Override public void scheduleDeleteSelections(@NonNull final Set<String> selectionIds) { SqlViewSelectionToDeleteHelper.scheduleDeleteSelections(selectionIds); } public static Set<DocumentId> retrieveRowIdsForLineIds( @NonNull final SqlViewKeyColumnNamesMap keyColumnNamesMap, final ViewId viewId, final Set<Integer> lineIds) { final SqlAndParams sqlAndParams = SqlViewSelectionQueryBuilder.buildSqlSelectRowIdsForLineIds(keyColumnNamesMap, viewId.getViewId(), lineIds); PreparedStatement pstmt = null; ResultSet rs = null;
try { pstmt = DB.prepareStatement(sqlAndParams.getSql(), ITrx.TRXNAME_ThreadInherited); DB.setParameters(pstmt, sqlAndParams.getSqlParams()); rs = pstmt.executeQuery(); final ImmutableSet.Builder<DocumentId> rowIds = ImmutableSet.builder(); while (rs.next()) { final DocumentId rowId = keyColumnNamesMap.retrieveRowId(rs, "", false); if (rowId != null) { rowIds.add(rowId); } } return rowIds.build(); } catch (final SQLException ex) { throw new DBException(ex, sqlAndParams.getSql(), sqlAndParams.getSqlParams()); } finally { DB.close(rs, pstmt); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\view\SqlViewRowIdsOrderedSelectionFactory.java
1
请完成以下Java代码
public void setPercentUtilization (final BigDecimal PercentUtilization) { set_Value (COLUMNNAME_PercentUtilization, PercentUtilization); } @Override public BigDecimal getPercentUtilization() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PercentUtilization); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setPlanningHorizon (final int PlanningHorizon) { set_Value (COLUMNNAME_PlanningHorizon, PlanningHorizon); } @Override public int getPlanningHorizon() { return get_ValueAsInt(COLUMNNAME_PlanningHorizon); } @Override public void setQueuingTime (final @Nullable BigDecimal QueuingTime) { set_Value (COLUMNNAME_QueuingTime, QueuingTime); } @Override public BigDecimal getQueuingTime() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QueuingTime); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setS_Resource_ID (final int S_Resource_ID) { if (S_Resource_ID < 1) set_ValueNoCheck (COLUMNNAME_S_Resource_ID, null); else set_ValueNoCheck (COLUMNNAME_S_Resource_ID, S_Resource_ID); } @Override public int getS_Resource_ID() { return get_ValueAsInt(COLUMNNAME_S_Resource_ID); } @Override public org.compiere.model.I_S_ResourceType getS_ResourceType() { return get_ValueAsPO(COLUMNNAME_S_ResourceType_ID, org.compiere.model.I_S_ResourceType.class); } @Override public void setS_ResourceType(final org.compiere.model.I_S_ResourceType S_ResourceType) { set_ValueFromPO(COLUMNNAME_S_ResourceType_ID, org.compiere.model.I_S_ResourceType.class, S_ResourceType); } @Override public void setS_ResourceType_ID (final int S_ResourceType_ID) { if (S_ResourceType_ID < 1)
set_Value (COLUMNNAME_S_ResourceType_ID, null); else set_Value (COLUMNNAME_S_ResourceType_ID, S_ResourceType_ID); } @Override public int getS_ResourceType_ID() { return get_ValueAsInt(COLUMNNAME_S_ResourceType_ID); } @Override public void setValue (final java.lang.String Value) { set_Value (COLUMNNAME_Value, Value); } @Override public java.lang.String getValue() { return get_ValueAsString(COLUMNNAME_Value); } @Override public void setWaitingTime (final @Nullable BigDecimal WaitingTime) { set_Value (COLUMNNAME_WaitingTime, WaitingTime); } @Override public BigDecimal getWaitingTime() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_WaitingTime); return bd != null ? bd : BigDecimal.ZERO; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_S_Resource.java
1
请在Spring Boot框架中完成以下Java代码
public RabbitTemplate secondRabbitTemplate( @Qualifier("secondConnectionFactory") ConnectionFactory connectionFactory) { RabbitTemplate secondRabbitTemplate = new RabbitTemplate(connectionFactory); //使用外部事物 //lpzRabbitTemplate.setChannelTransacted(true); return secondRabbitTemplate; } @Bean(name = "secondContainerFactory") public SimpleRabbitListenerContainerFactory secondFactory( SimpleRabbitListenerContainerFactoryConfigurer configurer, @Qualifier("secondConnectionFactory") ConnectionFactory connectionFactory) { SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory(); configurer.configure(factory, connectionFactory); return factory;
} private CachingConnectionFactory getCachingConnectionFactory(String host, int port, String username, String password, String virtualHost) { CachingConnectionFactory connectionFactory = new CachingConnectionFactory(); connectionFactory.setHost(host); connectionFactory.setPort(port); connectionFactory.setUsername(username); connectionFactory.setPassword(password); connectionFactory.setVirtualHost(virtualHost); return connectionFactory; } }
repos\spring-boot-quick-master\quick-multi-rabbitmq\src\main\java\com\multi\rabbitmq\config\RabbitMqConfiguration.java
2
请完成以下Java代码
public String getReason() { return reason; } public void setReason(String reason) { this.reason = reason; } public HttpHeaders getHttpHeaders() { return httpHeaders; } public String getHttpHeadersAsString() { return httpHeaders != null ? httpHeaders.formatAsString() : null; } public void setHttpHeaders(HttpHeaders httpHeaders) { this.httpHeaders = httpHeaders; } public String getBody() { return body; } public void setBody(String body) { this.body = body;
} public byte[] getBodyBytes() { return bodyBytes; } public void setBodyBytes(byte[] bodyBytes) { this.bodyBytes = bodyBytes; } public boolean isBodyResponseHandled() { return bodyResponseHandled; } public void setBodyResponseHandled(boolean bodyResponseHandled) { this.bodyResponseHandled = bodyResponseHandled; } }
repos\flowable-engine-main\modules\flowable-http-common\src\main\java\org\flowable\http\common\api\HttpResponse.java
1
请完成以下Java代码
protected void fireTransactionEvent(TransactionState transactionState) { this.setLastTransactionState(transactionState); if (stateTransactionListeners==null) { return; } List<TransactionListener> transactionListeners = stateTransactionListeners.get(transactionState); if (transactionListeners==null) { return; } for (TransactionListener transactionListener: transactionListeners) { transactionListener.execute(commandContext); } } protected void setLastTransactionState(TransactionState transactionState) { this.lastTransactionState = transactionState; } private PersistenceSession getPersistenceProvider() { return commandContext.getSession(PersistenceSession.class); } public void rollback() { try { try { LOG.debugTransactionOperation("firing event rollback..."); fireTransactionEvent(TransactionState.ROLLINGBACK); } catch (Throwable exception) {
LOG.exceptionWhileFiringEvent(TransactionState.ROLLINGBACK, exception); Context.getCommandInvocationContext().trySetThrowable(exception); } finally { LOG.debugTransactionOperation("rolling back the persistence session..."); getPersistenceProvider().rollback(); } } catch (Throwable exception) { LOG.exceptionWhileFiringEvent(TransactionState.ROLLINGBACK, exception); Context.getCommandInvocationContext().trySetThrowable(exception); } finally { LOG.debugFiringEventRolledBack(); fireTransactionEvent(TransactionState.ROLLED_BACK); } } public boolean isTransactionActive() { return !TransactionState.ROLLINGBACK.equals(lastTransactionState) && !TransactionState.ROLLED_BACK.equals(lastTransactionState); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cfg\standalone\StandaloneTransactionContext.java
1
请完成以下Java代码
public boolean isReceiveNewsletter() { return receiveNewsletter; } public void setReceiveNewsletter(final boolean receiveNewsletter) { this.receiveNewsletter = receiveNewsletter; } public String[] getHobbies() { return hobbies; } public void setHobbies(final String[] hobbies) { this.hobbies = hobbies; } public List<String> getFavouriteLanguage() { return favouriteLanguage; } public void setFavouriteLanguage(final List<String> favouriteLanguage) { this.favouriteLanguage = favouriteLanguage; } public String getNotes() { return notes; } public void setNotes(final String notes) { this.notes = notes; } public List<String> getFruit() { return fruit; }
public void setFruit(final List<String> fruit) { this.fruit = fruit; } public String getBook() { return book; } public void setBook(final String book) { this.book = book; } public MultipartFile getFile() { return file; } public void setFile(final MultipartFile file) { this.file = file; } }
repos\tutorials-master\spring-web-modules\spring-mvc-xml-2\src\main\java\com\baeldung\spring\taglibrary\Person.java
1
请完成以下Java代码
public class X_Fresh_QtyOnHand extends org.compiere.model.PO implements I_Fresh_QtyOnHand, org.compiere.model.I_Persistent { /** * */ private static final long serialVersionUID = -1179934163L; /** Standard Constructor */ public X_Fresh_QtyOnHand (Properties ctx, int Fresh_QtyOnHand_ID, String trxName) { super (ctx, Fresh_QtyOnHand_ID, trxName); /** if (Fresh_QtyOnHand_ID == 0) { setDateDoc (new Timestamp( System.currentTimeMillis() )); // @#Date@ setFresh_QtyOnHand_ID (0); setProcessed (false); // N } */ } /** Load Constructor */ public X_Fresh_QtyOnHand (Properties ctx, ResultSet rs, String trxName) { super (ctx, rs, trxName); } /** Load Meta Data */ @Override protected org.compiere.model.POInfo initPO (Properties ctx) { org.compiere.model.POInfo poi = org.compiere.model.POInfo.getPOInfo (ctx, Table_Name, get_TrxName()); return poi; } /** Set Belegdatum. @param DateDoc Datum des Belegs */ @Override public void setDateDoc (java.sql.Timestamp DateDoc) { set_Value (COLUMNNAME_DateDoc, DateDoc); } /** Get Belegdatum. @return Datum des Belegs */ @Override public java.sql.Timestamp getDateDoc () { return (java.sql.Timestamp)get_Value(COLUMNNAME_DateDoc); } /** Set Beschreibung. @param Description Beschreibung */ @Override public void setDescription (java.lang.String Description) { set_Value (COLUMNNAME_Description, Description); } /** Get Beschreibung. @return Beschreibung */ @Override public java.lang.String getDescription () { return (java.lang.String)get_Value(COLUMNNAME_Description); } /** Set Zählbestand Einkauf (fresh). @param Fresh_QtyOnHand_ID Zählbestand Einkauf (fresh) */ @Override public void setFresh_QtyOnHand_ID (int Fresh_QtyOnHand_ID)
{ if (Fresh_QtyOnHand_ID < 1) set_ValueNoCheck (COLUMNNAME_Fresh_QtyOnHand_ID, null); else set_ValueNoCheck (COLUMNNAME_Fresh_QtyOnHand_ID, Integer.valueOf(Fresh_QtyOnHand_ID)); } /** Get Zählbestand Einkauf (fresh). @return Zählbestand Einkauf (fresh) */ @Override public int getFresh_QtyOnHand_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_Fresh_QtyOnHand_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; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.fresh\de.metas.fresh.base\src\main\java-gen\de\metas\fresh\model\X_Fresh_QtyOnHand.java
1
请完成以下Java代码
public String getF_TOLLCODE() { return F_TOLLCODE; } public void setF_TOLLCODE(String f_TOLLCODE) { F_TOLLCODE = f_TOLLCODE; } public String getF_START() { return F_START; } public void setF_START(String f_START) { F_START = f_START; } public String getF_END() { return F_END; }
public void setF_END(String f_END) { F_END = f_END; } 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; } }
repos\SpringBootBucket-master\springboot-batch\src\main\java\com\xncoding\trans\modules\common\vo\BscOfficeExeItem.java
1
请在Spring Boot框架中完成以下Java代码
public TwoFaAccountConfig generateNewAccountConfig(User user, TwoFaProviderType providerType) throws ThingsboardException { TwoFaProviderConfig providerConfig = getTwoFaProviderConfig(user.getTenantId(), providerType); return getTwoFaProvider(providerType).generateNewAccountConfig(user, providerConfig); } private void cleanUpRateLimits(UserId userId) { for (TwoFaProviderType providerType : TwoFaProviderType.values()) { rateLimitService.cleanUp(LimitedApi.TWO_FA_VERIFICATION_CODE_SEND, Pair.of(userId, providerType)); rateLimitService.cleanUp(LimitedApi.TWO_FA_VERIFICATION_CODE_CHECK, Pair.of(userId, providerType)); } } private TwoFaProviderConfig getTwoFaProviderConfig(TenantId tenantId, TwoFaProviderType providerType) throws ThingsboardException { return configManager.getPlatformTwoFaSettings(tenantId, true) .flatMap(twoFaSettings -> twoFaSettings.getProviderConfig(providerType)) .orElseThrow(() -> PROVIDER_NOT_CONFIGURED_ERROR);
} private TwoFaProvider<TwoFaProviderConfig, TwoFaAccountConfig> getTwoFaProvider(TwoFaProviderType providerType) throws ThingsboardException { return Optional.ofNullable(providers.get(providerType)) .orElseThrow(() -> PROVIDER_NOT_AVAILABLE_ERROR); } @Autowired private void setProviders(Collection<TwoFaProvider> providers) { providers.forEach(provider -> { this.providers.put(provider.getType(), provider); }); } }
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\security\auth\mfa\DefaultTwoFactorAuthService.java
2
请完成以下Java代码
public final class UrlDecoder { private UrlDecoder() { } /** * Decode the given encoded URI component value by replacing each "<i>{@code %xy}</i>" * sequence with a hexadecimal representation of the character in * {@link StandardCharsets#UTF_8 UTF-8}, leaving other characters unmodified. * @param source the encoded URI component value * @return the decoded value */ public static String decode(String source) { return decode(source, StandardCharsets.UTF_8); } /** * Decode the given encoded URI component value by replacing each "<i>{@code %xy}</i>" * sequence with a hexadecimal representation of the character in the specified * character encoding, leaving other characters unmodified. * @param source the encoded URI component value * @param charset the character encoding to use to decode the "<i>{@code %xy}</i>" * sequences * @return the decoded value * @since 4.0.0 */ public static String decode(String source, Charset charset) { int length = source.length(); int firstPercentIndex = source.indexOf('%'); if (length == 0 || firstPercentIndex < 0) { return source; } StringBuilder output = new StringBuilder(length); output.append(source, 0, firstPercentIndex); byte[] bytes = null; int i = firstPercentIndex; while (i < length) { char ch = source.charAt(i); if (ch == '%') { try { if (bytes == null) { bytes = new byte[(length - i) / 3]; } int pos = 0; while (i + 2 < length && ch == '%') { bytes[pos++] = (byte) HexFormat.fromHexDigits(source, i + 1, i + 3); i += 3; if (i < length) { ch = source.charAt(i);
} } if (i < length && ch == '%') { throw new IllegalArgumentException("Incomplete trailing escape (%) pattern"); } output.append(new String(bytes, 0, pos, charset)); } catch (NumberFormatException ex) { throw new IllegalArgumentException("Invalid encoded sequence \"" + source.substring(i) + "\""); } } else { output.append(ch); i++; } } return output.toString(); } }
repos\spring-boot-4.0.1\loader\spring-boot-loader\src\main\java\org\springframework\boot\loader\net\util\UrlDecoder.java
1
请在Spring Boot框架中完成以下Java代码
public class HumioProperties extends StepRegistryProperties { /** * Humio API token. */ private @Nullable String apiToken; /** * Connection timeout for requests to this backend. */ private Duration connectTimeout = Duration.ofSeconds(5); /** * Humio tags describing the data source in which metrics will be stored. Humio tags * are a distinct concept from Micrometer's tags. Micrometer's tags are used to divide * metrics along dimensional boundaries. */ private Map<String, String> tags = new HashMap<>(); /** * URI to ship metrics to. If you need to publish metrics to an internal proxy * en-route to Humio, you can define the location of the proxy with this. */ private String uri = "https://cloud.humio.com"; public @Nullable String getApiToken() { return this.apiToken; } public void setApiToken(@Nullable String apiToken) {
this.apiToken = apiToken; } @Override public Duration getConnectTimeout() { return this.connectTimeout; } @Override public void setConnectTimeout(Duration connectTimeout) { this.connectTimeout = connectTimeout; } public Map<String, String> getTags() { return this.tags; } public void setTags(Map<String, String> tags) { this.tags = tags; } public String getUri() { return this.uri; } public void setUri(String uri) { this.uri = uri; } }
repos\spring-boot-4.0.1\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\export\humio\HumioProperties.java
2
请在Spring Boot框架中完成以下Java代码
public class Photo { @Id @GeneratedValue private Long id; private String label; private Photo() { } public Photo(String label) { this.label = label; } public Long getId() {
return id; } public void setId(Long id) { this.id = id; } public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } }
repos\flowable-engine-main\modules\flowable-spring-boot\flowable-spring-boot-samples\flowable-spring-boot-sample-jpa-all\src\main\java\flowable\Photo.java
2
请在Spring Boot框架中完成以下Java代码
void setSignMetadata(boolean signMetadata) { this.signMetadata = signMetadata; } /** * A tuple containing an OpenSAML {@link EntityDescriptor} and its associated * {@link RelyingPartyRegistration} * * @since 5.7 */ static final class EntityDescriptorParameters { private final EntityDescriptor entityDescriptor; private final RelyingPartyRegistration registration;
EntityDescriptorParameters(EntityDescriptor entityDescriptor, RelyingPartyRegistration registration) { this.entityDescriptor = entityDescriptor; this.registration = registration; } EntityDescriptor getEntityDescriptor() { return this.entityDescriptor; } RelyingPartyRegistration getRelyingPartyRegistration() { return this.registration; } } }
repos\spring-security-main\saml2\saml2-service-provider\src\main\java\org\springframework\security\saml2\provider\service\metadata\BaseOpenSamlMetadataResolver.java
2
请完成以下Java代码
public String buildKey(final PurchaseCandidate item) { return item.getHeaderAggregationKey().toString(); } @Override public boolean isSame(final PurchaseCandidate item1, final PurchaseCandidate item2) { throw new UnsupportedOperationException(); // shall not be called } @Override public List<String> getDependsOnColumnNames() { throw new UnsupportedOperationException(); // shall not be called } }); } @Override public String toString() { return ObjectUtils.toString(this); } @Override protected OrderHeaderAggregation createGroup(final Object itemHashKey, final PurchaseCandidate candidate) { return new OrderHeaderAggregation();
} @Override protected void closeGroup(final OrderHeaderAggregation orderHeader) { I_C_Order order = orderHeader.build(); if (order != null) { collector.add(order); } } @Override protected void addItemToGroup(final OrderHeaderAggregation orderHeader, final PurchaseCandidate candidate) { orderHeader.add(candidate); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java\de\metas\procurement\base\order\impl\OrdersAggregator.java
1
请完成以下Spring Boot application配置
spring: application: name: demo-consumer # Spring 应用名 cloud: nacos: # Nacos 作为注册中心的配置项,对应 NacosDiscoveryProperties 配置类 discovery: server-addr: 127.0.0.1:8848 # Nacos 服务器地址 server: port: 28080 # 服务器端口。默认为 8080 #demo-provider: # ribbon: # NFLoadBalancerR
uleClassName: com.netflix.loadbalancer.RandomRule #ribbon: # NFLoadBalancerRuleClassName: com.netflix.loadbalancer.RandomRule
repos\SpringBoot-Labs-master\labx-02-spring-cloud-netflix-ribbon\labx-02-scn-ribbon-demo01-consumer\src\main\resources\application.yaml
2
请完成以下Java代码
public java.lang.String getName () { return (java.lang.String)get_Value(COLUMNNAME_Name); } /** Set DB1 %. @param PlannedMargin Project's planned margin as a percentage */ @Override public void setPlannedMargin (java.math.BigDecimal PlannedMargin) { set_Value (COLUMNNAME_PlannedMargin, PlannedMargin); } /** Get DB1 %. @return Project's planned margin as a percentage */ @Override public java.math.BigDecimal getPlannedMargin () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PlannedMargin); if (bd == null) return BigDecimal.ZERO;
return bd; } /** Set Suchschlüssel. @param Value Search key for the record in the format required - must be unique */ @Override public void setValue (java.lang.String Value) { set_Value (COLUMNNAME_Value, Value); } /** Get Suchschlüssel. @return Search key for the record in the format required - must be unique */ @Override public java.lang.String getValue () { return (java.lang.String)get_Value(COLUMNNAME_Value); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Product_Category.java
1
请完成以下Java代码
public boolean validate(Object submittedValue, FormFieldValidatorContext validatorContext) { if(submittedValue == null) { var variableName = validatorContext.getFormFieldHandler().getId(); TypedValue value = validatorContext.getVariableScope().getVariableTyped(variableName); if (value != null) { return value.getValue() != null; } // check if there is a default value var defaultValueExpression = validatorContext.getFormFieldHandler().getDefaultValueExpression(); if (defaultValueExpression != null) { var variableValue = defaultValueExpression.getValue(validatorContext.getVariableScope()); if (variableValue != null) { // set default value
validatorContext.getVariableScope().setVariable(variableName, variableValue); return true; } } return false; } else { if (submittedValue instanceof String) { return !((String)submittedValue).isEmpty(); } else { return true; } } } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\form\validator\RequiredValidator.java
1
请在Spring Boot框架中完成以下Java代码
public String getNameLike() { return nameLike; } public String getKey() { return key; } public String getKeyLike() { return keyLike; } public Integer getVersion() { return version; } public Integer getVersionGt() { return versionGt; } public Integer getVersionGte() { return versionGte; } public Integer getVersionLt() { return versionLt; } public Integer getVersionLte() { return versionLte; } public boolean isLatest() { return latest; } public String getCategory() { return category; } public String getCategoryLike() { return categoryLike; }
public String getResourceName() { return resourceName; } public String getResourceNameLike() { return resourceNameLike; } public String getCategoryNotEquals() { return categoryNotEquals; } public String getTenantId() { return tenantId; } public String getTenantIdLike() { return tenantIdLike; } public boolean isWithoutTenantId() { return withoutTenantId; } }
repos\flowable-engine-main\modules\flowable-app-engine\src\main\java\org\flowable\app\engine\impl\repository\AppDefinitionQueryImpl.java
2
请在Spring Boot框架中完成以下Java代码
public class PlainInvoiceDAO extends AbstractInvoiceDAO { private final POJOLookupMap db = POJOLookupMap.get(); public PlainInvoiceDAO() { Adempiere.assertUnitTestMode(); } public POJOLookupMap getDB() { return db; } @Override public I_C_InvoiceLine createInvoiceLine(org.compiere.model.I_C_Invoice invoice) { throw new UnsupportedOperationException(); } @Override public List<I_C_LandedCost> retrieveLandedCosts(I_C_InvoiceLine invoiceLine, String whereClause, String trxName) { throw new UnsupportedOperationException(); } @Override public I_C_LandedCost createLandedCost(String trxName) { throw new UnsupportedOperationException(); } @Override public I_C_InvoiceLine createInvoiceLine(String trxName) { throw new UnsupportedOperationException(); } private List<I_C_AllocationLine> retrieveAllocationLines(final org.compiere.model.I_C_Invoice invoice) { Adempiere.assertUnitTestMode(); return db.getRecords(I_C_AllocationLine.class, pojo -> { if (pojo == null) { return false; } if (pojo.getC_Invoice_ID() != invoice.getC_Invoice_ID()) { return false; } return true; }); } private BigDecimal retrieveAllocatedAmt(final org.compiere.model.I_C_Invoice invoice, final TypedAccessor<BigDecimal> amountAccessor) { Adempiere.assertUnitTestMode();
final Properties ctx = InterfaceWrapperHelper.getCtx(invoice); BigDecimal sum = BigDecimal.ZERO; for (final I_C_AllocationLine line : retrieveAllocationLines(invoice)) { final I_C_AllocationHdr ah = line.getC_AllocationHdr(); final BigDecimal lineAmt = amountAccessor.getValue(line); if ((null != ah) && (ah.getC_Currency_ID() != invoice.getC_Currency_ID())) { final BigDecimal lineAmtConv = Services.get(ICurrencyBL.class).convert( lineAmt, // Amt CurrencyId.ofRepoId(ah.getC_Currency_ID()), // CurFrom_ID CurrencyId.ofRepoId(invoice.getC_Currency_ID()), // CurTo_ID ah.getDateTrx().toInstant(), // ConvDate CurrencyConversionTypeId.ofRepoIdOrNull(invoice.getC_ConversionType_ID()), ClientId.ofRepoId(line.getAD_Client_ID()), OrgId.ofRepoId(line.getAD_Org_ID())); sum = sum.add(lineAmtConv); } else { sum = sum.add(lineAmt); } } return sum; } public BigDecimal retrieveWriteOffAmt(final org.compiere.model.I_C_Invoice invoice) { Adempiere.assertUnitTestMode(); return retrieveAllocatedAmt(invoice, o -> { final I_C_AllocationLine line = (I_C_AllocationLine)o; return line.getWriteOffAmt(); }); } @Override public List<I_C_InvoiceTax> retrieveTaxes(org.compiere.model.I_C_Invoice invoice) { throw new UnsupportedOperationException(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\invoice\service\impl\PlainInvoiceDAO.java
2
请在Spring Boot框架中完成以下Java代码
public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } @ApiModelProperty(example = "http://localhost:8182/identity/users/testuser") public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } @ApiModelProperty(example = "testuser") public String getId() { return id; } public void setId(String id) { this.id = id; } @ApiModelProperty(example = "Fred") public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } @ApiModelProperty(example = "Smith") public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } @ApiModelProperty(example = "Fred Smith") public String getDisplayName() { return displayName; }
public void setDisplayName(String displayName) { this.displayName = displayName; } @JsonInclude(JsonInclude.Include.NON_NULL) public String getPassword() { return passWord; } public void setPassword(String passWord) { this.passWord = passWord; } @JsonInclude(JsonInclude.Include.NON_NULL) @ApiModelProperty(example = "companyTenantId") public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } @ApiModelProperty(example = "http://localhost:8182/identity/users/testuser/picture") public String getPictureUrl() { return pictureUrl; } public void setPictureUrl(String pictureUrl) { this.pictureUrl = pictureUrl; } }
repos\flowable-engine-main\modules\flowable-rest\src\main\java\org\flowable\rest\service\api\identity\UserResponse.java
2
请完成以下Spring Boot application配置
spring.jpa.defer-datasource-initialization=true logging.level.net.ttddyy.dsproxy.listener=info spring.datasource.url=jdbc:postgresql://localhost:5432/postgres spring.datasource.username=postgres spring.datasource.password= spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect spring.jpa.hibernate.ddl-auto=create spring.jpa.show-sql=true
logging.level.org.hibernate.SQL=ERROR logging.level.org.hibernate.type.descriptor.sql.BasicBinder=ERROR spring.jpa.properties.hibernate.format_sql=true
repos\tutorials-master\persistence-modules\spring-data-jpa-query-4\src\main\resources\application.properties
2
请在Spring Boot框架中完成以下Java代码
public String getMethod() { return method; } public void setMethod(String method) { this.method = method; } public int getConnectionTimeout() { return connectionTimeout; } public void setConnectionTimeout(int connectionTimeout) { this.connectionTimeout = connectionTimeout; } public int getTimeout() { return timeout; } public void setTimeout(int timeout) { this.timeout = timeout; }
/** * @return Returns the charset. */ public String getCharset() { return charset; } /** * @param charset The charset to set. */ public void setCharset(String charset) { this.charset = charset; } public HttpResultType getResultType() { return resultType; } public void setResultType(HttpResultType resultType) { this.resultType = resultType; } }
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\reconciliation\utils\alipay\httpClient\HttpRequest.java
2
请完成以下Java代码
public BigDecimal getQtyBOM() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyBOM); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setScrap (final @Nullable BigDecimal Scrap) { set_Value (COLUMNNAME_Scrap, Scrap); } @Override public BigDecimal getScrap() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Scrap); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setShowSubBOMIngredients (final boolean ShowSubBOMIngredients) { set_Value (COLUMNNAME_ShowSubBOMIngredients, ShowSubBOMIngredients); } @Override public boolean isShowSubBOMIngredients() { return get_ValueAsBoolean(COLUMNNAME_ShowSubBOMIngredients); } @Override public void setValidFrom (final java.sql.Timestamp ValidFrom) { set_Value (COLUMNNAME_ValidFrom, ValidFrom); } @Override public java.sql.Timestamp getValidFrom() { return get_ValueAsTimestamp(COLUMNNAME_ValidFrom); } @Override public void setValidTo (final @Nullable java.sql.Timestamp ValidTo) { set_Value (COLUMNNAME_ValidTo, ValidTo); } @Override public java.sql.Timestamp getValidTo() { return get_ValueAsTimestamp(COLUMNNAME_ValidTo); } /**
* VariantGroup AD_Reference_ID=540490 * Reference name: VariantGroup */ public static final int VARIANTGROUP_AD_Reference_ID=540490; /** 01 = 01 */ public static final String VARIANTGROUP_01 = "01"; /** 02 = 02 */ public static final String VARIANTGROUP_02 = "02"; /** 03 = 03 */ public static final String VARIANTGROUP_03 = "03"; /** 04 = 04 */ public static final String VARIANTGROUP_04 = "04"; /** 05 = 05 */ public static final String VARIANTGROUP_05 = "05"; /** 06 = 06 */ public static final String VARIANTGROUP_06 = "06"; /** 07 = 07 */ public static final String VARIANTGROUP_07 = "07"; /** 08 = 08 */ public static final String VARIANTGROUP_08 = "08"; /** 09 = 09 */ public static final String VARIANTGROUP_09 = "09"; @Override public void setVariantGroup (final @Nullable java.lang.String VariantGroup) { set_Value (COLUMNNAME_VariantGroup, VariantGroup); } @Override public java.lang.String getVariantGroup() { return get_ValueAsString(COLUMNNAME_VariantGroup); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_PP_Product_BOMLine.java
1
请完成以下Java代码
public class X_K_Synonym extends PO implements I_K_Synonym, I_Persistent { /** * */ private static final long serialVersionUID = 20090915L; /** Standard Constructor */ public X_K_Synonym (Properties ctx, int K_Synonym_ID, String trxName) { super (ctx, K_Synonym_ID, trxName); /** if (K_Synonym_ID == 0) { setAD_Language (null); setK_Synonym_ID (0); setName (null); setSynonymName (null); } */ } /** Load Constructor */ public X_K_Synonym (Properties ctx, ResultSet rs, String trxName) { super (ctx, rs, trxName); } /** AccessLevel * @return 3 - Client - Org */ protected int get_AccessLevel() { return accessLevel.intValue(); } /** Load Meta Data */ protected POInfo initPO (Properties ctx) { POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName()); return poi; } public String toString() { StringBuffer sb = new StringBuffer ("X_K_Synonym[") .append(get_ID()).append("]"); return sb.toString(); } /** AD_Language AD_Reference_ID=106 */ public static final int AD_LANGUAGE_AD_Reference_ID=106; /** Set Language. @param AD_Language Language for this entity */ public void setAD_Language (String AD_Language) { set_Value (COLUMNNAME_AD_Language, AD_Language); } /** Get Language. @return Language for this entity */ public String getAD_Language () { return (String)get_Value(COLUMNNAME_AD_Language); }
/** Set Knowledge Synonym. @param K_Synonym_ID Knowlege Keyword Synonym */ public void setK_Synonym_ID (int K_Synonym_ID) { if (K_Synonym_ID < 1) set_ValueNoCheck (COLUMNNAME_K_Synonym_ID, null); else set_ValueNoCheck (COLUMNNAME_K_Synonym_ID, Integer.valueOf(K_Synonym_ID)); } /** Get Knowledge Synonym. @return Knowlege Keyword Synonym */ public int getK_Synonym_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_K_Synonym_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Name. @param Name Alphanumeric identifier of the entity */ public void setName (String Name) { set_Value (COLUMNNAME_Name, Name); } /** Get Name. @return Alphanumeric identifier of the entity */ public String getName () { return (String)get_Value(COLUMNNAME_Name); } /** Get Record ID/ColumnName @return ID/ColumnName pair */ public KeyNamePair getKeyNamePair() { return new KeyNamePair(get_ID(), getName()); } /** Set Synonym Name. @param SynonymName The synonym for the name */ public void setSynonymName (String SynonymName) { set_Value (COLUMNNAME_SynonymName, SynonymName); } /** Get Synonym Name. @return The synonym for the name */ public String getSynonymName () { return (String)get_Value(COLUMNNAME_SynonymName); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_K_Synonym.java
1
请完成以下Java代码
public Collection<Class<? extends PPOrderCandidateRequestedEvent>> getHandledEventType() { return ImmutableList.of(PPOrderCandidateRequestedEvent.class); } @Override public void handleEvent(@NonNull final PPOrderCandidateRequestedEvent event) { final I_PP_Order_Candidate createdCandidate = createProductionOrderCandidate(event); if (event.isDirectlyCreatePPOrder()) { final ImmutableList<PPOrderCandidateId> ppOrderCandidateIds = ImmutableList.of(PPOrderCandidateId.ofRepoId(createdCandidate.getPP_Order_Candidate_ID())); final PPOrderCandidateEnqueuer.Result result = ppOrderCandidateEnqueuer.enqueueCandidateIds(ppOrderCandidateIds); Check.errorIf(result.getEnqueuedPackagesCount() != 1, "Couldn't enqueue workpackage for PPOrder creation!, event: {}", event); } } /** * Creates a production order candidate. */ @VisibleForTesting I_PP_Order_Candidate createProductionOrderCandidate(@NonNull final PPOrderCandidateRequestedEvent ppOrderCandidateRequestedEvent) { final PPOrderData ppOrderData = ppOrderCandidateRequestedEvent.getPpOrderCandidate().getPpOrderData(); final ProductId productId = ProductId.ofRepoId(ppOrderData.getProductDescriptor().getProductId()); final Quantity qtyRequired = Quantity.of(ppOrderData.getQtyRequired(), productBL.getStockUOM(productId)); final String traceId = ppOrderCandidateRequestedEvent.getTraceId(); final boolean isSimulated = ppOrderCandidateRequestedEvent.getPpOrderCandidate().isSimulated(); return ppOrderCandidateService.createUpdateCandidate(PPOrderCandidateCreateUpdateRequest.builder()
.clientAndOrgId(ppOrderData.getClientAndOrgId()) .productPlanningId(ProductPlanningId.ofRepoIdOrNull(ppOrderData.getProductPlanningId())) .materialDispoGroupId(ppOrderData.getMaterialDispoGroupId()) .plantId(ppOrderData.getPlantId()) .warehouseId(ppOrderData.getWarehouseId()) .productId(productId) .attributeSetInstanceId(AttributeSetInstanceId.ofRepoIdOrNone(ppOrderData.getProductDescriptor().getAttributeSetInstanceId())) .qtyRequired(qtyRequired) .datePromised(ppOrderData.getDatePromised()) .dateStartSchedule(ppOrderData.getDateStartSchedule()) .salesOrderLineId(OrderLineId.ofRepoIdOrNull(ppOrderData.getOrderLineIdAsRepoId())) .shipmentScheduleId(ShipmentScheduleId.ofRepoIdOrNull(ppOrderData.getShipmentScheduleIdAsRepoId())) .simulated(isSimulated) .traceId(traceId) .packingMaterialId(ppOrderData.getPackingMaterialId()) .build()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\event\PPOrderCandidateRequestedEventHandler.java
1
请在Spring Boot框架中完成以下Java代码
public class MySQLAutoconfiguration { @Bean @ConditionalOnBean(name = "dataSource") LocalContainerEntityManagerFactoryBean entityManagerFactory() throws IOException { final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); em.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); final JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); em.setJpaProperties(additionalProperties()); return em; } @Bean @ConditionalOnProperty(name = "usemysql", havingValue = "local") DataSource dataSource() { DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName("org.hsqldb.jdbcDriver"); dataSource.setUrl("jdbc:hsqldb:mem:testdb");
dataSource.setUsername( "sa" ); dataSource.setPassword( "" ); return dataSource; } @ConditionalOnResource(resources = "classpath:mysql.properties") Properties additionalProperties() throws IOException { final Properties additionalProperties = new Properties(); try (InputStream inputStream = new ClassPathResource("classpath:mysql.properties").getInputStream()) { additionalProperties.load(inputStream); } return additionalProperties; } }
repos\tutorials-master\spring-boot-modules\spring-boot-annotations\src\main\java\com\baeldung\annotations\MySQLAutoconfiguration.java
2
请完成以下Java代码
private ImmutableSet<ProductId> getProductIds(final I_C_Order order) { final OrderId orderId = OrderId.ofRepoId(order.getC_Order_ID()); return orderDAO.retrieveOrderLines(orderId) .stream() .map(orderLine -> ProductId.ofRepoId(orderLine.getM_Product_ID())) .collect(ImmutableSet.toImmutableSet()); } public void invalidateByProducts(@NonNull Set<ProductId> productIds, @NonNull LocalDate date) { if (productIds.isEmpty()) { return; } final ArrayList<Object> sqlValuesParams = new ArrayList<>(); final StringBuilder sqlValues = new StringBuilder();
for (final ProductId productId : productIds) { if (sqlValues.length() > 0) { sqlValues.append(","); } sqlValues.append("(?,?)"); sqlValuesParams.add(productId); sqlValuesParams.add(date); } final String sql = "INSERT INTO " + TABLENAME_Recompute + " (m_product_id, date)" + "VALUES " + sqlValues; DB.executeUpdateAndThrowExceptionOnFail(sql, sqlValuesParams.toArray(), ITrx.TRXNAME_ThreadInherited); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\order\stats\purchase_max_price\PurchaseLastMaxPriceService.java
1
请完成以下Java代码
private Iterator<CityVO> retrieveAllCities(final int adClientId, final int countryId, final int regionId) { if (countryId <= 0) { return Collections.emptyIterator(); } final List<Object> sqlParams = new ArrayList<Object>(); final StringBuilder sql = new StringBuilder( "SELECT cy.C_City_ID, cy.Name, cy.C_Region_ID, r.Name" + " FROM C_City cy" + " LEFT OUTER JOIN C_Region r ON (r.C_Region_ID=cy.C_Region_ID)" + " WHERE cy.AD_Client_ID IN (0,?)"); sqlParams.add(adClientId); if (regionId > 0) { sql.append(" AND cy.C_Region_ID=?"); sqlParams.add(regionId); } if (countryId > 0) { sql.append(" AND COALESCE(cy.C_Country_ID, r.C_Country_ID)=?"); sqlParams.add(countryId); } sql.append(" ORDER BY cy.Name, r.Name"); return IteratorUtils.asIterator(new AbstractPreparedStatementBlindIterator<CityVO>() { @Override protected PreparedStatement createPreparedStatement() throws SQLException { final PreparedStatement pstmt = DB.prepareStatement(sql.toString(), ITrx.TRXNAME_None); DB.setParameters(pstmt, sqlParams); return pstmt; }
@Override protected CityVO fetch(ResultSet rs) throws SQLException { final CityVO vo = new CityVO(rs.getInt(1), rs.getString(2), rs.getInt(3), rs.getString(4)); return vo; } }); } private int getAD_Client_ID() { return Env.getAD_Client_ID(Env.getCtx()); } private int getC_Country_ID() { return countryId; } public void setC_Country_ID(final int countryId) { this.countryId = countryId > 0 ? countryId : -1; } public int getC_Region_ID() { return regionId; } public void setC_Region_ID(final int regionId) { this.regionId = regionId > 0 ? regionId : -1; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\grid\ed\CityAutoCompleter.java
1
请完成以下Java代码
public class UIDStringUtil { private static final AtomicLong nextViewId = new AtomicLong(1); private static final char[] VIEW_DIGITS = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', }; private static final Supplier<String> DEFAULT_RANDOM_UUID_SOURCE = () -> UUID.randomUUID().toString(); private static Supplier<String> randomUUIDSource; public String createNext() { return encodeUsingDigits(nextViewId.getAndIncrement(), VIEW_DIGITS); } @VisibleForTesting String encodeUsingDigits(final long value, char[] digits) { if (value == 0) { return String.valueOf(digits[0]); } final int base = digits.length; final StringBuilder buf = new StringBuilder(); long currentValue = value; while (currentValue > 0) { final int remainder = (int)(currentValue % base); currentValue = currentValue / base; buf.append(digits[remainder]); } return buf.reverse().toString();
} public void setRandomUUIDSource(@NonNull final Supplier<String> newRandomUUIDSource) { randomUUIDSource = newRandomUUIDSource; } public void reset() { nextViewId.set(1); randomUUIDSource = null; } public String createRandomUUID() { return coalesceSuppliers(randomUUIDSource, DEFAULT_RANDOM_UUID_SOURCE); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\de\metas\util\lang\UIDStringUtil.java
1
请完成以下Spring Boot application配置
gemfire.distributed-system-id=10 gemfire.remote-locators=localhost[12480] geode.distributed-system.remote.id=20 spring.application.name=BootGeodeMultiSiteCachingServerApplication-Site1 #spring.profiles.include=locator-manager,gateway
-receiver,gateway-sender spring.data.gemfire.locator.port=11235 spring.data.gemfire.manager.port=1199
repos\spring-boot-data-geode-main\spring-geode-samples\caching\multi-site\src\main\resources\application-server-site1.properties
2
请完成以下Java代码
public PropertyDescriptor[] getPropertyDescriptors() { try { PropertyDescriptor _background = new PropertyDescriptor("background", beanClass, null, "setBackground"); PropertyDescriptor _border = new PropertyDescriptor("border", beanClass, null, "setBorder"); PropertyDescriptor _display = new PropertyDescriptor("display", beanClass, "getDisplay", null); PropertyDescriptor _editable = new PropertyDescriptor("editable", beanClass, "isEditable", "setEditable"); PropertyDescriptor _font = new PropertyDescriptor("font", beanClass, null, "setFont"); PropertyDescriptor _foreground = new PropertyDescriptor("foreground", beanClass, null, "setForeground"); PropertyDescriptor _mandatory = new PropertyDescriptor("mandatory", beanClass, "isMandatory", "setMandatory"); PropertyDescriptor _value = new PropertyDescriptor("value", beanClass, "getValue", "setValue"); PropertyDescriptor[] pds = new PropertyDescriptor[] { _background, _border, _display, _editable, _font, _foreground, _mandatory, _value}; return pds; } catch(IntrospectionException ex) { ex.printStackTrace(); return null; } } public java.awt.Image getIcon(int iconKind) { switch (iconKind) { case BeanInfo.ICON_COLOR_16x16: return iconColor16x16Filename != null ? loadImage(iconColor16x16Filename) : null; case BeanInfo.ICON_COLOR_32x32: return iconColor32x32Filename != null ? loadImage(iconColor32x32Filename) : null; case BeanInfo.ICON_MONO_16x16:
return iconMono16x16Filename != null ? loadImage(iconMono16x16Filename) : null; case BeanInfo.ICON_MONO_32x32: return iconMono32x32Filename != null ? loadImage(iconMono32x32Filename) : null; } return null; } public BeanInfo[] getAdditionalBeanInfo() { Class superclass = beanClass.getSuperclass(); try { BeanInfo superBeanInfo = Introspector.getBeanInfo(superclass); return new BeanInfo[] { superBeanInfo }; } catch(IntrospectionException ex) { ex.printStackTrace(); return null; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\grid\ed\VTextBeanInfo.java
1
请完成以下Java代码
protected FlowElement convertJsonToElement( JsonNode elementNode, JsonNode modelNode, Map<String, JsonNode> shapeMap ) { SubProcess subProcess = null; if (getPropertyValueAsBoolean("istransaction", elementNode)) { subProcess = new Transaction(); } else { subProcess = new SubProcess(); } JsonNode childShapesArray = elementNode.get(EDITOR_CHILD_SHAPES); processor.processJsonElements( childShapesArray, modelNode, subProcess, shapeMap, formMap, decisionTableMap, model ); JsonNode processDataPropertiesNode = elementNode.get(EDITOR_SHAPE_PROPERTIES).get(PROPERTY_DATA_PROPERTIES); if (processDataPropertiesNode != null) { List<ValuedDataObject> dataObjects = BpmnJsonConverterUtil.convertJsonToDataProperties( processDataPropertiesNode, subProcess ); subProcess.setDataObjects(dataObjects); subProcess.getFlowElements().addAll(dataObjects); } return subProcess; } @Override public void setFormMap(Map<String, String> formMap) { this.formMap = formMap;
} @Override public void setFormKeyMap(Map<String, ModelInfo> formKeyMap) { this.formKeyMap = formKeyMap; } @Override public void setDecisionTableMap(Map<String, String> decisionTableMap) { this.decisionTableMap = decisionTableMap; } @Override public void setDecisionTableKeyMap(Map<String, ModelInfo> decisionTableKeyMap) { this.decisionTableKeyMap = decisionTableKeyMap; } }
repos\Activiti-develop\activiti-core\activiti-json-converter\src\main\java\org\activiti\editor\language\json\converter\SubProcessJsonConverter.java
1
请完成以下Spring Boot application配置
spring.datasource.url = jdbc:mysql://localhost:3306/easykotlin spring.datasource.username = root spring.datasource.password = 111111 spring.datasource.driver-class-name=com.mysql.jdbc.Driver # Specify the DBMS spring.jpa.database = MYSQL # Keep the connection alive if idle for a long time (needed in production) spring.datasource.testWhileIdle = true spring.datasource.validationQuery = SELECT 1 # Show or not log for each sql query spring.jpa.show-sql = true # Hibernate ddl auto (create, create-drop, update) spring.jpa.hibernate.ddl-auto = update # Naming strategy spring
.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy # The SQL dialect makes Hibernate generate better SQL for the chosen database spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect server.port=7000
repos\Spring-Boot-In-Action-master\kotlin_with_springbt\src\main\resources\application.properties
2
请完成以下Java代码
public void setDHL_Shipper_Config_ID (final int DHL_Shipper_Config_ID) { if (DHL_Shipper_Config_ID < 1) set_ValueNoCheck (COLUMNNAME_DHL_Shipper_Config_ID, null); else set_ValueNoCheck (COLUMNNAME_DHL_Shipper_Config_ID, DHL_Shipper_Config_ID); } @Override public int getDHL_Shipper_Config_ID() { return get_ValueAsInt(COLUMNNAME_DHL_Shipper_Config_ID); } @Override public org.compiere.model.I_M_Shipper getM_Shipper() { return get_ValueAsPO(COLUMNNAME_M_Shipper_ID, org.compiere.model.I_M_Shipper.class); } @Override public void setM_Shipper(final org.compiere.model.I_M_Shipper M_Shipper) { set_ValueFromPO(COLUMNNAME_M_Shipper_ID, org.compiere.model.I_M_Shipper.class, M_Shipper); } @Override public void setM_Shipper_ID (final int M_Shipper_ID) { if (M_Shipper_ID < 1) set_Value (COLUMNNAME_M_Shipper_ID, null); else set_Value (COLUMNNAME_M_Shipper_ID, M_Shipper_ID);
} @Override public int getM_Shipper_ID() { return get_ValueAsInt(COLUMNNAME_M_Shipper_ID); } @Override public void setSignature (final @Nullable java.lang.String Signature) { set_Value (COLUMNNAME_Signature, Signature); } @Override public java.lang.String getSignature() { return get_ValueAsString(COLUMNNAME_Signature); } @Override public void setUserName (final @Nullable java.lang.String UserName) { set_Value (COLUMNNAME_UserName, UserName); } @Override public java.lang.String getUserName() { return get_ValueAsString(COLUMNNAME_UserName); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.dhl\src\main\java-gen\de\metas\shipper\gateway\dhl\model\X_DHL_Shipper_Config.java
1
请完成以下Java代码
public Optional<InventoryId> execute() { final Inventory inventoryHeader = createAndCompleteInventory(); if (inventoryHeader == null) { return Optional.empty(); } updateHUWeights(); return Optional.of(inventoryHeader.getId()); } @Nullable private Inventory createAndCompleteInventory() { final Quantity targetWeightNet = Quantity.of(targetWeight.getWeightNet(), targetWeight.getWeightNetUOM()); final UpdateHUQtyRequest updateHUQtyRequest = UpdateHUQtyRequest.builder() .qty(targetWeightNet) .huId(huId) .build(); return huQtyService.updateQty(updateHUQtyRequest); } private void updateHUWeights() { final I_M_HU hu = handlingUnitsBL.getById(huId); final IWeightable huAttributes = getHUAttributes(hu); huAttributes.setWeightTareAdjust(targetWeight.getWeightTareAdjust()); huAttributes.setWeightGross(targetWeight.getWeightGross());
huAttributes.setWeightNet(targetWeight.getWeightNet()); huAttributes.setWeightNetNoPropagate(targetWeight.getWeightNet()); } private IWeightable getHUAttributes(final I_M_HU hu) { final IHUContextFactory huContextFactory = Services.get(IHUContextFactory.class); final IAttributeStorage huAttributes = huContextFactory .createMutableHUContext() .getHUAttributeStorageFactory() .getAttributeStorage(hu); huAttributes.setSaveOnChange(true); return Weightables.wrap(huAttributes); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\weighting\WeightHUCommand.java
1
请完成以下Java代码
private final static LastErrorsInstance getLastErrorsInstance() { final Properties ctx = Env.getCtx(); return Env.get(ctx, LASTERRORINSTANCE_CTXKEY, LastErrorsInstance::new); } /** * Holds last error/exception, warning and info. * * @author tsa */ @ThreadSafe @SuppressWarnings("serial") private static class LastErrorsInstance implements Serializable { private ValueNamePair lastError; private Throwable lastException; private ValueNamePair lastWarning; private LastErrorsInstance() { super(); } @Override public synchronized String toString() { final StringBuilder sb = new StringBuilder(getClass().getSimpleName()).append("["); sb.append("lastError=").append(lastError); sb.append(", lastException=").append(lastException); sb.append(", lastWarning=").append(lastWarning); sb.append("]"); return sb.toString(); } public synchronized ValueNamePair getLastErrorAndReset() { final ValueNamePair lastErrorToReturn = lastError; lastError = null; return lastErrorToReturn; } public synchronized void setLastError(final ValueNamePair lastError) { this.lastError = lastError; }
public synchronized Throwable getLastExceptionAndReset() { final Throwable lastExceptionAndClear = lastException; lastException = null; return lastExceptionAndClear; } public synchronized void setLastException(final Throwable lastException) { this.lastException = lastException; } public synchronized ValueNamePair getLastWarningAndReset() { final ValueNamePair lastWarningToReturn = lastWarning; lastWarning = null; return lastWarningToReturn; } public synchronized void setLastWarning(final ValueNamePair lastWarning) { this.lastWarning = lastWarning; } public synchronized void reset() { lastError = null; lastException = null; lastWarning = null; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\logging\MetasfreshLastError.java
1
请完成以下Java代码
public void setSpaceH (int spaceH) { m_spaceH = spaceH; } // setSpaceH /** * Get Horizontal Space (top, between rows, button) * @return spaceH horizontal space (top, between rows, button) */ public int getSpaceH() { return m_spaceH; } // getSpaceH /** * Set Vertical Space (left, between columns, right)
* @param spaceV vertical space (left, between columns, right) */ public void setSpaceV(int spaceV) { m_spaceV = spaceV; } // setSpaceV /** * Get Vertical Space (left, between columns, right) * @return spaceV vertical space (left, between columns, right) */ public int getSpaceV() { return m_spaceV; } // getSpaceV } // ALayout
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\apps\ALayout.java
1
请完成以下Java代码
public ISqlQueryFilter asSqlQueryFilter() { if (!isPureSql()) { throw new IllegalStateException("Cannot convert to pure SQL filter when this filter is not pure SQL: " + this); } return this; } @Override public ISqlQueryFilter asPartialSqlQueryFilter() { return partialSqlQueryFilter; } @Override public IQueryFilter<T> asPartialNonSqlFilterOrNull() { final List<IQueryFilter<T>> nonSqlFilters = getNonSqlFiltersToUse(); if (nonSqlFilters == null || nonSqlFilters.isEmpty()) { return null;
} return partialNonSqlQueryFilter; } @Override public CompositeQueryFilter<T> allowSqlFilters(final boolean allowSqlFilters) { if (this._allowSqlFilters == allowSqlFilters) { return this; } this._allowSqlFilters = allowSqlFilters; _compiled = false; return this; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\dao\impl\CompositeQueryFilter.java
1
请完成以下Java代码
public class FormFieldValidationException extends FormException { private static final long serialVersionUID = 1L; /** optional object for detailing the nature of the validation error */ protected Object detail; public FormFieldValidationException() { super(); } public FormFieldValidationException(Object detail) { super(); this.detail = detail; } public FormFieldValidationException(Object detail, String message, Throwable cause) { super(message, cause);
this.detail = detail; } public FormFieldValidationException(Object detail, String message) { super(message); this.detail = detail; } public FormFieldValidationException(Object detail, Throwable cause) { super(cause); this.detail = detail; } @SuppressWarnings("unchecked") public <T> T getDetail() { return (T) detail; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\form\validator\FormFieldValidationException.java
1
请完成以下Java代码
protected void deployBpmPlatform(LifecycleEvent event) { final StandardServer server = (StandardServer) event.getSource(); containerDelegate.getServiceContainer().createDeploymentOperation("deploy BPM platform") .addAttachment(TomcatAttachments.SERVER, server) .addStep(new TomcatParseBpmPlatformXmlStep()) .addStep(new DiscoverBpmPlatformPluginsStep()) .addStep(new StartManagedThreadPoolStep()) .addStep(new StartJobExecutorStep()) .addStep(new PlatformXmlStartProcessEnginesStep()) .execute(); LOG.camundaBpmPlatformSuccessfullyStarted(server.getServerInfo()); } protected void undeployBpmPlatform(LifecycleEvent event) {
final StandardServer server = (StandardServer) event.getSource(); containerDelegate.getServiceContainer().createUndeploymentOperation("undeploy BPM platform") .addAttachment(TomcatAttachments.SERVER, server) .addStep(new StopJobExecutorStep()) .addStep(new StopManagedThreadPoolStep()) .addStep(new StopProcessApplicationsStep()) .addStep(new StopProcessEnginesStep()) .addStep(new UnregisterBpmPlatformPluginsStep()) .execute(); LOG.camundaBpmPlatformStopped(server.getServerInfo()); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\container\impl\tomcat\TomcatBpmPlatformBootstrap.java
1
请完成以下Java代码
public WordVectorModel train(String trainFileName, String modelFileName) { Config settings = new Config(); settings.setInputFile(trainFileName); settings.setLayer1Size(layerSize); settings.setUseContinuousBagOfWords(type == NeuralNetworkType.CBOW); settings.setUseHierarchicalSoftmax(useHierarchicalSoftmax); settings.setNegative(negativeSamples); settings.setNumThreads(numThreads); settings.setAlpha(initialLearningRate == null ? type.getDefaultInitialLearningRate() : initialLearningRate); settings.setSample(downSampleRate); settings.setWindow(windowSize); settings.setIter(iterations); settings.setMinCount(minFrequency); settings.setOutputFile(modelFileName); Word2VecTraining model = new Word2VecTraining(settings); final long timeStart = System.currentTimeMillis(); // if (callback == null) // { // callback = new TrainingCallback() // { // public void corpusLoading(float percent) // { // System.out.printf("\r加载训练语料:%.2f%%", percent); // } // // public void corpusLoaded(int vocWords, int trainWords, int totalWords) // { // System.out.println(); // System.out.printf("词表大小:%d\n", vocWords); // System.out.printf("训练词数:%d\n", trainWords); // System.out.printf("语料词数:%d\n", totalWords); // } // // public void training(float alpha, float progress) // { // System.out.printf("\r学习率:%.6f 进度:%.2f%%", alpha, progress); // long timeNow = System.currentTimeMillis(); // long costTime = timeNow - timeStart + 1;
// progress /= 100; // String etd = Utility.humanTime((long) (costTime / progress * (1.f - progress))); // if (etd.length() > 0) System.out.printf(" 剩余时间:%s", etd); // System.out.flush(); // } // }; // } settings.setCallback(callback); try { model.trainModel(); System.out.println(); System.out.printf("训练结束,一共耗时:%s\n", Utility.humanTime(System.currentTimeMillis() - timeStart)); return new WordVectorModel(modelFileName); } catch (IOException e) { Predefine.logger.warning("训练过程中发生IO异常\n" + TextUtility.exceptionToString(e)); } return null; } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\mining\word2vec\Word2VecTrainer.java
1
请完成以下Java代码
public class BpmnParser { /** * The namepace of the BPMN 2.0 diagram interchange elements. */ public static final String BPMN_DI_NS = "http://www.omg.org/spec/BPMN/20100524/DI"; /** * The namespace of the BPMN 2.0 diagram common elements. */ public static final String BPMN_DC_NS = "http://www.omg.org/spec/DD/20100524/DC"; /** * The namespace of the generic OMG DI elements (don't ask me why they didn't use the BPMN_DI_NS ...) */ public static final String OMG_DI_NS = "http://www.omg.org/spec/DD/20100524/DI"; protected ActivityBehaviorFactory activityBehaviorFactory; protected ListenerFactory listenerFactory; protected BpmnParseFactory bpmnParseFactory; protected BpmnParseHandlers bpmnParserHandlers; /** * Creates a new {@link BpmnParse} instance that can be used to parse only one BPMN 2.0 process definition. */ public BpmnParse createParse() { return bpmnParseFactory.createBpmnParse(this); } public ActivityBehaviorFactory getActivityBehaviorFactory() { return activityBehaviorFactory; }
public void setActivityBehaviorFactory(ActivityBehaviorFactory activityBehaviorFactory) { this.activityBehaviorFactory = activityBehaviorFactory; } public ListenerFactory getListenerFactory() { return listenerFactory; } public void setListenerFactory(ListenerFactory listenerFactory) { this.listenerFactory = listenerFactory; } public BpmnParseFactory getBpmnParseFactory() { return bpmnParseFactory; } public void setBpmnParseFactory(BpmnParseFactory bpmnParseFactory) { this.bpmnParseFactory = bpmnParseFactory; } public BpmnParseHandlers getBpmnParserHandlers() { return bpmnParserHandlers; } public void setBpmnParserHandlers(BpmnParseHandlers bpmnParserHandlers) { this.bpmnParserHandlers = bpmnParserHandlers; } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\bpmn\parser\BpmnParser.java
1
请完成以下Java代码
public Long getPznBlock() { return pznBlock; } /** * Sets the value of the pznBlock property. * * @param value * allowed object is * {@link Long } * */ public void setPznBlock(Long value) { this.pznBlock = value; } /** * Gets the value of the id property. * * @return * possible object is * {@link String } * */ public String getId() {
return id; } /** * Sets the value of the id property. * * @param value * allowed object is * {@link String } * */ public void setId(String value) { this.id = value; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.msv3.schema.v1\src\main\java-xjc\de\metas\vertical\pharma\vendor\gateway\msv3\schema\v1\VerfuegbarkeitsanfrageBulk.java
1
请完成以下Java代码
public void setAD_Process_CustomQuery_ID (final int AD_Process_CustomQuery_ID) { if (AD_Process_CustomQuery_ID < 1) set_Value (COLUMNNAME_AD_Process_CustomQuery_ID, null); else set_Value (COLUMNNAME_AD_Process_CustomQuery_ID, AD_Process_CustomQuery_ID); } @Override public int getAD_Process_CustomQuery_ID() { return get_ValueAsInt(COLUMNNAME_AD_Process_CustomQuery_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 setIsAdditionalCustomQuery (final boolean IsAdditionalCustomQuery) { set_Value (COLUMNNAME_IsAdditionalCustomQuery, IsAdditionalCustomQuery); }
@Override public boolean isAdditionalCustomQuery() { return get_ValueAsBoolean(COLUMNNAME_IsAdditionalCustomQuery); } @Override public void setLeichMehl_PluFile_ConfigGroup_ID (final int LeichMehl_PluFile_ConfigGroup_ID) { if (LeichMehl_PluFile_ConfigGroup_ID < 1) set_ValueNoCheck (COLUMNNAME_LeichMehl_PluFile_ConfigGroup_ID, null); else set_ValueNoCheck (COLUMNNAME_LeichMehl_PluFile_ConfigGroup_ID, LeichMehl_PluFile_ConfigGroup_ID); } @Override public int getLeichMehl_PluFile_ConfigGroup_ID() { return get_ValueAsInt(COLUMNNAME_LeichMehl_PluFile_ConfigGroup_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.externalsystem\src\main\java-gen\de\metas\externalsystem\model\X_LeichMehl_PluFile_ConfigGroup.java
1
请完成以下Java代码
public class X_M_ShipmentSchedule_Recompute extends org.compiere.model.PO implements I_M_ShipmentSchedule_Recompute, org.compiere.model.I_Persistent { private static final long serialVersionUID = 1046235302L; /** Standard Constructor */ public X_M_ShipmentSchedule_Recompute (final Properties ctx, final int M_ShipmentSchedule_Recompute_ID, @Nullable final String trxName) { super (ctx, M_ShipmentSchedule_Recompute_ID, trxName); } /** Load Constructor */ public X_M_ShipmentSchedule_Recompute (final Properties ctx, final ResultSet rs, @Nullable final String trxName) { super (ctx, rs, trxName); } /** Load Meta Data */ @Override protected org.compiere.model.POInfo initPO(final Properties ctx) { return org.compiere.model.POInfo.getPOInfo(Table_Name); } @Override public org.compiere.model.I_AD_PInstance getAD_PInstance() { return get_ValueAsPO(COLUMNNAME_AD_PInstance_ID, org.compiere.model.I_AD_PInstance.class); } @Override public void setAD_PInstance(final org.compiere.model.I_AD_PInstance AD_PInstance) { set_ValueFromPO(COLUMNNAME_AD_PInstance_ID, org.compiere.model.I_AD_PInstance.class, AD_PInstance); } @Override public void setAD_PInstance_ID (final int AD_PInstance_ID) { if (AD_PInstance_ID < 1) set_Value (COLUMNNAME_AD_PInstance_ID, null); else set_Value (COLUMNNAME_AD_PInstance_ID, AD_PInstance_ID); } @Override public int getAD_PInstance_ID() { return get_ValueAsInt(COLUMNNAME_AD_PInstance_ID); } @Override public void setC_Async_Batch_ID (final int C_Async_Batch_ID) { if (C_Async_Batch_ID < 1) set_Value (COLUMNNAME_C_Async_Batch_ID, null); else set_Value (COLUMNNAME_C_Async_Batch_ID, C_Async_Batch_ID); } @Override public int getC_Async_Batch_ID() {
return get_ValueAsInt(COLUMNNAME_C_Async_Batch_ID); } @Override public void setChunkUUID (final @Nullable java.lang.String ChunkUUID) { set_Value (COLUMNNAME_ChunkUUID, ChunkUUID); } @Override public java.lang.String getChunkUUID() { return get_ValueAsString(COLUMNNAME_ChunkUUID); } @Override public de.metas.inoutcandidate.model.I_M_ShipmentSchedule getM_ShipmentSchedule() { return get_ValueAsPO(COLUMNNAME_M_ShipmentSchedule_ID, de.metas.inoutcandidate.model.I_M_ShipmentSchedule.class); } @Override public void setM_ShipmentSchedule(final de.metas.inoutcandidate.model.I_M_ShipmentSchedule M_ShipmentSchedule) { set_ValueFromPO(COLUMNNAME_M_ShipmentSchedule_ID, de.metas.inoutcandidate.model.I_M_ShipmentSchedule.class, M_ShipmentSchedule); } @Override public void setM_ShipmentSchedule_ID (final int M_ShipmentSchedule_ID) { if (M_ShipmentSchedule_ID < 1) set_Value (COLUMNNAME_M_ShipmentSchedule_ID, null); else set_Value (COLUMNNAME_M_ShipmentSchedule_ID, M_ShipmentSchedule_ID); } @Override public int getM_ShipmentSchedule_ID() { return get_ValueAsInt(COLUMNNAME_M_ShipmentSchedule_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\de\metas\inoutcandidate\model\X_M_ShipmentSchedule_Recompute.java
1
请完成以下Java代码
protected final void setNotConfigurable() { _configurable = false; } /** * Makes sure producer is in configurable state. If not, and exception will be thrown. */ protected final void assertConfigurable() { if (!_configurable) { throw new HUException("This producer is not configurable anymore: " + this); } } @Override public final IHUProducerAllocationDestination setHUClearanceStatusInfo(final ClearanceStatusInfo huClearanceStatusInfo) { assertConfigurable(); _huClearanceStatusInfo = huClearanceStatusInfo; return this; } public final ClearanceStatusInfo getHUClearanceStatusInfo() { return _huClearanceStatusInfo; } private void destroyCurrentHU(final HUListCursor currentHUCursor, final IHUContext huContext) { final I_M_HU hu = currentHUCursor.current(); if (hu == null) { return; // shall not happen }
currentHUCursor.closeCurrent(); // close the current position of this cursor // since _createdNonAggregateHUs is just a subset of _createdHUs, we don't know if 'hu' was in there to start with. All we care is that it's not in _createdNonAggregateHUs after this method. _createdNonAggregateHUs.remove(hu); final boolean removedFromCreatedHUs = _createdHUs.remove(hu); Check.assume(removedFromCreatedHUs, "Cannot destroy {} because it wasn't created by us", hu); // Delete only those HUs which were internally created by THIS producer if (DYNATTR_Producer.getValue(hu) == this) { final Supplier<IAutoCloseable> getDontDestroyParentLUClosable = () -> { final I_M_HU lu = handlingUnitsBL.getLoadingUnitHU(hu); return lu != null ? huContext.temporarilyDontDestroyHU(HuId.ofRepoId(lu.getM_HU_ID())) : () -> { }; }; try (final IAutoCloseable ignored = getDontDestroyParentLUClosable.get()) { handlingUnitsBL.destroyIfEmptyStorage(huContext, hu); } } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\allocation\impl\AbstractProducerDestination.java
1
请完成以下Java代码
public void setPostalCode (final @Nullable java.lang.String PostalCode) { set_Value (COLUMNNAME_PostalCode, PostalCode); } @Override public java.lang.String getPostalCode() { return get_ValueAsString(COLUMNNAME_PostalCode); } @Override public void setRecipientBankCountryId (final int RecipientBankCountryId) { set_Value (COLUMNNAME_RecipientBankCountryId, RecipientBankCountryId); } @Override public int getRecipientBankCountryId() { return get_ValueAsInt(COLUMNNAME_RecipientBankCountryId); } @Override public void setRecipientCountryId (final int RecipientCountryId) { set_Value (COLUMNNAME_RecipientCountryId, RecipientCountryId); } @Override public int getRecipientCountryId() { return get_ValueAsInt(COLUMNNAME_RecipientCountryId); } /** * RecipientType AD_Reference_ID=541372 * Reference name: RecipientTypeList */ public static final int RECIPIENTTYPE_AD_Reference_ID=541372; /** COMPANY = COMPANY */ public static final String RECIPIENTTYPE_COMPANY = "COMPANY"; /** INDIVIDUAL = INDIVIDUAL */ public static final String RECIPIENTTYPE_INDIVIDUAL = "INDIVIDUAL"; @Override public void setRecipientType (final java.lang.String RecipientType) { set_Value (COLUMNNAME_RecipientType, RecipientType); } @Override public java.lang.String getRecipientType() { return get_ValueAsString(COLUMNNAME_RecipientType); } @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); } @Override public void setRegionName (final @Nullable java.lang.String RegionName) { set_Value (COLUMNNAME_RegionName, RegionName); } @Override public java.lang.String getRegionName() { return get_ValueAsString(COLUMNNAME_RegionName); } @Override public void setRevolut_Payment_Export_ID (final int Revolut_Payment_Export_ID) { if (Revolut_Payment_Export_ID < 1) set_ValueNoCheck (COLUMNNAME_Revolut_Payment_Export_ID, null); else set_ValueNoCheck (COLUMNNAME_Revolut_Payment_Export_ID, Revolut_Payment_Export_ID); } @Override public int getRevolut_Payment_Export_ID() { return get_ValueAsInt(COLUMNNAME_Revolut_Payment_Export_ID); } @Override public void setRoutingNo (final @Nullable java.lang.String RoutingNo) { set_Value (COLUMNNAME_RoutingNo, RoutingNo); } @Override public java.lang.String getRoutingNo() { return get_ValueAsString(COLUMNNAME_RoutingNo); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.revolut\src\main\java-gen\de\metas\payment\revolut\model\X_Revolut_Payment_Export.java
1
请完成以下Java代码
public List<VariableInstanceDto> getVariableInstances(UriInfo uriInfo, Integer firstResult, Integer maxResults, boolean deserializeObjectValues) { VariableInstanceQueryDto queryDto = new VariableInstanceQueryDto(getObjectMapper(), uriInfo.getQueryParameters()); return queryVariableInstances(queryDto, firstResult, maxResults, deserializeObjectValues); } @Override public List<VariableInstanceDto> queryVariableInstances(VariableInstanceQueryDto queryDto, Integer firstResult, Integer maxResults, boolean deserializeObjectValues) { ProcessEngine engine = getProcessEngine(); queryDto.setObjectMapper(getObjectMapper()); VariableInstanceQuery query = queryDto.toQuery(engine); // disable binary fetching by default. query.disableBinaryFetching(); // disable custom object fetching by default. Cannot be done to not break existing API if (!deserializeObjectValues) { query.disableCustomObjectDeserialization(); } List<VariableInstance> matchingInstances = QueryUtil.list(query, firstResult, maxResults); List<VariableInstanceDto> instanceResults = new ArrayList<>(); for (VariableInstance instance : matchingInstances) { VariableInstanceDto resultInstance = VariableInstanceDto.fromVariableInstance(instance); instanceResults.add(resultInstance); } return instanceResults; } @Override
public CountResultDto getVariableInstancesCount(UriInfo uriInfo) { VariableInstanceQueryDto queryDto = new VariableInstanceQueryDto(getObjectMapper(), uriInfo.getQueryParameters()); return queryVariableInstancesCount(queryDto); } @Override public CountResultDto queryVariableInstancesCount(VariableInstanceQueryDto queryDto) { ProcessEngine engine = getProcessEngine(); queryDto.setObjectMapper(getObjectMapper()); VariableInstanceQuery query = queryDto.toQuery(engine); long count = query.count(); CountResultDto result = new CountResultDto(); result.setCount(count); return result; } }
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\impl\VariableInstanceRestServiceImpl.java
1
请在Spring Boot框架中完成以下Java代码
public class WearableInvalidEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "name") private String Name; @Column(name = "price") private BigDecimal Price; @Column(name = "sensor_type") private String SensorType; @Column(name = "popularity_index") private Integer PopularityIndex; public Long getId() {
return id; } public String getName() { return Name; } public BigDecimal getPrice() { return Price; } public String getSensorType() { return SensorType; } public Integer getPopularityIndex() { return PopularityIndex; } }
repos\tutorials-master\persistence-modules\spring-data-jpa-query-5\src\main\java\com\baeldung\spring\data\jpa\filtering\WearableInvalidEntity.java
2