instruction
string
input
string
output
string
source_file
string
priority
int64
请完成以下Java代码
private static UserId getPlannerIdOrNull( @NonNull final PPOrderCreateRequest request, @Nullable final ProductPlanning productPlanning) { if (request.getPlannerId() != null) { return request.getPlannerId(); } if (productPlanning != null) { final UserId plannerId = productPlanning.getPlannerId(); if (plannerId != null) { return plannerId; } } // default: return null; } @NonNull private ProductBOMId getBOMId(@Nullable final ProductPlanning productPlanning) { if (request.getBomId() != null) { return request.getBomId(); } final Optional<ProductBOMId> productBOMIdFromPlanning = Optional.ofNullable(productPlanning) .map(ProductPlanning::getBomVersionsId) .filter(Objects::nonNull) .flatMap(bomsRepo::getLatestBOMByVersion); if (productBOMIdFromPlanning.isPresent()) { return productBOMIdFromPlanning.get(); } final ProductId productId = request.getProductId(); return bomsRepo.getDefaultBOMIdByProductId(productId) .orElseThrow(() -> new AdempiereException("@NotFound@ @PP_Product_BOM_ID@") .appendParametersToMessage() .setParameter("request", request) .setParameter("productPlanning", productPlanning)); } private PPRoutingId getRoutingId(@Nullable final ProductPlanning productPlanning) { if (request.getRoutingId() != null) { return request.getRoutingId(); } if (productPlanning != null) { final PPRoutingId routingId = productPlanning.getWorkflowId(); if (routingId != null) { return routingId; } }
return PPRoutingId.NONE; } @Nullable private BPartnerId getCustomerIdOrNull(@NonNull final PPOrderCreateRequest request) { if (request.getCustomerId() != null) { return request.getCustomerId(); } else if (request.getSalesOrderLineId() != null) { final I_C_OrderLine salesOrderLine = ordersRepo.getOrderLineById(request.getSalesOrderLineId()); return BPartnerId.ofRepoIdOrNull(salesOrderLine.getC_BPartner_ID()); } else { return null; } } private DocTypeId getDocTypeId( @NonNull final PPOrderDocBaseType docBaseType, @NonNull final ClientAndOrgId clientAndOrgId) { return docTypesRepo.getDocTypeId(DocTypeQuery.builder() .docBaseType(docBaseType.getCode()) .adClientId(clientAndOrgId.getClientId().getRepoId()) .adOrgId(clientAndOrgId.getOrgId().getRepoId()) .build()); } private void setQtyRequired( @NonNull final I_PP_Order order, @NonNull final Quantity qty) { final Quantity qtyRounded = qty.roundToUOMPrecision(); order.setQtyEntered(qtyRounded.toBigDecimal()); ppOrderBOMBL.setQuantities(order, PPOrderQuantities.ofQtyRequiredToProduce(qtyRounded)); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\api\impl\CreateOrderCommand.java
1
请完成以下Java代码
public List<I_SEPA_Export_Line> retrieveLines(@NonNull final I_SEPA_Export doc) { return queryBL.createQueryBuilder(I_SEPA_Export_Line.class) .addOnlyActiveRecordsFilter() .addEqualsFilter(I_SEPA_Export_Line.COLUMNNAME_IsError, false) .addEqualsFilter(I_SEPA_Export_Line.COLUMNNAME_SEPA_Export_ID, doc.getSEPA_Export_ID()) .orderBy() .addColumn(I_SEPA_Export_Line.COLUMNNAME_C_Currency_ID) .addColumn(I_SEPA_Export_Line.COLUMNNAME_SEPA_Export_Line_ID).endOrderBy() .create() .list(); } @Override public List<I_SEPA_Export_Line> retrieveLinesChangeRule(Properties ctx, String trxName) { // // Placeholder for future functionality. return Collections.emptyList(); }
@NonNull public List<I_SEPA_Export_Line_Ref> retrieveLineReferences(@NonNull final I_SEPA_Export_Line line) { return toLineRefSqlQuery(line) .list(); } @NonNull private IQuery<I_SEPA_Export_Line_Ref> toLineRefSqlQuery(@NonNull final I_SEPA_Export_Line line) { return queryBL.createQueryBuilder(I_SEPA_Export_Line_Ref.class) .addOnlyActiveRecordsFilter() .addEqualsFilter(I_SEPA_Export_Line_Ref.COLUMNNAME_SEPA_Export_Line_ID, line.getSEPA_Export_Line_ID()) .addEqualsFilter(I_SEPA_Export_Line_Ref.COLUMNNAME_SEPA_Export_ID, line.getSEPA_Export_ID()) .create(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.sepa\base\src\main\java\de\metas\payment\sepa\api\impl\SEPADocumentDAO.java
1
请完成以下Java代码
public void setPOBox (final @Nullable java.lang.String POBox) { set_ValueNoCheck (COLUMNNAME_POBox, POBox); } @Override public java.lang.String getPOBox() { return get_ValueAsString(COLUMNNAME_POBox); } @Override public void setPostal (final @Nullable java.lang.String Postal) { set_ValueNoCheck (COLUMNNAME_Postal, Postal); } @Override public java.lang.String getPostal() { return get_ValueAsString(COLUMNNAME_Postal); } @Override public void setPostal_Add (final @Nullable java.lang.String Postal_Add) { set_ValueNoCheck (COLUMNNAME_Postal_Add, Postal_Add); } @Override public java.lang.String getPostal_Add() { return get_ValueAsString(COLUMNNAME_Postal_Add); } @Override public void setRegionName (final @Nullable java.lang.String RegionName) { set_ValueNoCheck (COLUMNNAME_RegionName, RegionName);
} @Override public java.lang.String getRegionName() { return get_ValueAsString(COLUMNNAME_RegionName); } @Override public void setStreet (final @Nullable java.lang.String Street) { set_Value (COLUMNNAME_Street, Street); } @Override public java.lang.String getStreet() { return get_ValueAsString(COLUMNNAME_Street); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Location.java
1
请完成以下Java代码
public void setIsPublic (boolean IsPublic) { set_Value (COLUMNNAME_IsPublic, Boolean.valueOf(IsPublic)); } /** Get Public. @return Public can read entry */ public boolean isPublic () { Object oo = get_Value(COLUMNNAME_IsPublic); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Public Write. @param IsPublicWrite Public can write entries */ public void setIsPublicWrite (boolean IsPublicWrite) { set_Value (COLUMNNAME_IsPublicWrite, Boolean.valueOf(IsPublicWrite)); } /** Get Public Write. @return Public can write entries */ public boolean isPublicWrite () { Object oo = get_Value(COLUMNNAME_IsPublicWrite); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Knowldge Type. @param K_Type_ID Knowledge Type
*/ public void setK_Type_ID (int K_Type_ID) { if (K_Type_ID < 1) set_ValueNoCheck (COLUMNNAME_K_Type_ID, null); else set_ValueNoCheck (COLUMNNAME_K_Type_ID, Integer.valueOf(K_Type_ID)); } /** Get Knowldge Type. @return Knowledge Type */ public int getK_Type_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_K_Type_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()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_K_Type.java
1
请完成以下Java代码
public void setRequireVV (boolean RequireVV) { set_Value (COLUMNNAME_RequireVV, Boolean.valueOf(RequireVV)); } /** Get Require CreditCard Verification Code. @return Require 3/4 digit Credit Verification Code */ @Override public boolean isRequireVV () { Object oo = get_Value(COLUMNNAME_RequireVV); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set User ID. @param UserID User ID or account number */ @Override public void setUserID (java.lang.String UserID) { set_Value (COLUMNNAME_UserID, UserID); } /** Get User ID. @return User ID or account number */ @Override public java.lang.String getUserID ()
{ return (java.lang.String)get_Value(COLUMNNAME_UserID); } /** Set Vendor ID. @param VendorID Vendor ID for the Payment Processor */ @Override public void setVendorID (java.lang.String VendorID) { set_Value (COLUMNNAME_VendorID, VendorID); } /** Get Vendor ID. @return Vendor ID for the Payment Processor */ @Override public java.lang.String getVendorID () { return (java.lang.String)get_Value(COLUMNNAME_VendorID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_PaymentProcessor.java
1
请完成以下Java代码
protected void updateAndValidateImportRecordsImpl() { } @Override protected String getImportOrderBySql() { return I_I_Postal.COLUMNNAME_Postal; } @Override public I_I_Postal retrieveImportRecord(final Properties ctx, final ResultSet rs) { return new X_I_Postal(ctx, rs, ITrx.TRXNAME_ThreadInherited); } @Override protected ImportRecordResult importRecord( @NonNull final IMutable<Object> state_NOTUSED, @NonNull final I_I_Postal importRecord, final boolean isInsertOnly_NOTUSED) { return importPostalCode(importRecord); } private ImportRecordResult importPostalCode(@NonNull final I_I_Postal importRecord) { // the current handling for duplicates (postal code + country) is nonexistent. // we blindly try to insert in db, and if there are unique constraints failing the records will automatically be marked as failed. //noinspection UnusedAssignment ImportRecordResult importResult = ImportRecordResult.Nothing; final I_C_Postal cPostal = createNewCPostalCode(importRecord); importResult = ImportRecordResult.Inserted; importRecord.setC_Postal_ID(cPostal.getC_Postal_ID()); InterfaceWrapperHelper.save(importRecord); return importResult;
} private I_C_Postal createNewCPostalCode(final I_I_Postal importRecord) { final I_C_Postal cPostal = InterfaceWrapperHelper.create(getCtx(), I_C_Postal.class, ITrx.TRXNAME_ThreadInherited); cPostal.setC_Country(Services.get(ICountryDAO.class).retrieveCountryByCountryCode(importRecord.getCountryCode())); cPostal.setCity(importRecord.getCity()); cPostal.setPostal(importRecord.getPostal()); cPostal.setRegionName(importRecord.getRegionName()); // these 2 are not yet used // importRecord.getValidFrom() // importRecord.getValidTo() InterfaceWrapperHelper.save(cPostal); return cPostal; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\location\impexp\PostalCodeImportProcess.java
1
请完成以下Java代码
public int getR_Project_Status_ID() { return get_ValueAsInt(COLUMNNAME_R_Project_Status_ID); } @Override public void setSalesRep_ID (final int SalesRep_ID) { if (SalesRep_ID < 1) set_Value (COLUMNNAME_SalesRep_ID, null); else set_Value (COLUMNNAME_SalesRep_ID, SalesRep_ID); } @Override public int getSalesRep_ID() { return get_ValueAsInt(COLUMNNAME_SalesRep_ID); } @Override public void setstartdatetime (final @Nullable java.sql.Timestamp startdatetime)
{ set_Value (COLUMNNAME_startdatetime, startdatetime); } @Override public java.sql.Timestamp getstartdatetime() { return get_ValueAsTimestamp(COLUMNNAME_startdatetime); } @Override public void setValue (final java.lang.String Value) { set_ValueNoCheck (COLUMNNAME_Value, Value); } @Override public java.lang.String getValue() { return get_ValueAsString(COLUMNNAME_Value); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Project.java
1
请在Spring Boot框架中完成以下Java代码
public final class HttpMessageConvertersAutoConfiguration { static final String PREFERRED_MAPPER_PROPERTY = "spring.http.converters.preferred-json-mapper"; @Bean @Order(0) @SuppressWarnings("deprecation") ClientHttpMessageConvertersCustomizer clientConvertersCustomizer( ObjectProvider<HttpMessageConverters> legacyConverters, ObjectProvider<HttpMessageConverter<?>> converters) { return new DefaultClientHttpMessageConvertersCustomizer(legacyConverters.getIfAvailable(), converters.orderedStream().toList()); } @Bean @Order(0) @SuppressWarnings("deprecation") ServerHttpMessageConvertersCustomizer serverConvertersCustomizer( ObjectProvider<HttpMessageConverters> legacyConverters, ObjectProvider<HttpMessageConverter<?>> converters) { return new DefaultServerHttpMessageConvertersCustomizer(legacyConverters.getIfAvailable(), converters.orderedStream().toList()); } @Configuration(proxyBeanMethods = false) @EnableConfigurationProperties(HttpMessageConvertersProperties.class) protected static class StringHttpMessageConverterConfiguration { @Bean @ConditionalOnMissingBean(StringHttpMessageConverter.class) StringHttpMessageConvertersCustomizer stringHttpMessageConvertersCustomizer( HttpMessageConvertersProperties properties) { return new StringHttpMessageConvertersCustomizer(properties); } } static class StringHttpMessageConvertersCustomizer implements ClientHttpMessageConvertersCustomizer, ServerHttpMessageConvertersCustomizer { StringHttpMessageConverter converter; StringHttpMessageConvertersCustomizer(HttpMessageConvertersProperties properties) { this.converter = new StringHttpMessageConverter(properties.getStringEncodingCharset()); this.converter.setWriteAcceptCharset(false); } @Override public void customize(ClientBuilder builder) {
builder.withStringConverter(this.converter); } @Override public void customize(ServerBuilder builder) { builder.withStringConverter(this.converter); } } static class NotReactiveWebApplicationCondition extends NoneNestedConditions { NotReactiveWebApplicationCondition() { super(ConfigurationPhase.PARSE_CONFIGURATION); } @ConditionalOnWebApplication(type = Type.REACTIVE) private static final class ReactiveWebApplication { } } }
repos\spring-boot-4.0.1\module\spring-boot-http-converter\src\main\java\org\springframework\boot\http\converter\autoconfigure\HttpMessageConvertersAutoConfiguration.java
2
请完成以下Java代码
public CaseFileItem getContext() { return contextRefAttribute.getReferenceTargetElement(this); } public void setContext(CaseFileItem caseFileItem) { contextRefAttribute.setReferenceTargetElement(this, caseFileItem); } public Collection<ConditionExpression> getConditions() { return conditionChild.get(this); } public ConditionExpression getCondition() { return conditionChild.getChild(this); } public void setCondition(ConditionExpression condition) { conditionChild.setChild(this, condition); } public static void registerType(ModelBuilder modelBuilder) { ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(IfPart.class, CMMN_ELEMENT_IF_PART) .namespaceUri(CMMN11_NS) .extendsType(CmmnElement.class) .instanceProvider(new ModelTypeInstanceProvider<IfPart>() {
public IfPart newInstance(ModelTypeInstanceContext instanceContext) { return new IfPartImpl(instanceContext); } }); contextRefAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_CONTEXT_REF) .idAttributeReference(CaseFileItem.class) .build(); SequenceBuilder sequenceBuilder = typeBuilder.sequence(); conditionChild = sequenceBuilder.element(ConditionExpression.class) .build(); typeBuilder.build(); } }
repos\camunda-bpm-platform-master\model-api\cmmn-model\src\main\java\org\camunda\bpm\model\cmmn\impl\instance\IfPartImpl.java
1
请完成以下Java代码
protected String doIt() { final int recordId = getRecord_ID(); if (recordId <= 0) { throw new AdempiereException(MSG_NO_SELECTION); } final I_C_PaySelection paySelection = paySelectionDAO.getById(PaySelectionId.ofRepoId(recordId)) .orElseThrow(() -> new AdempiereException("@NotFound@ @C_PaySelection_ID@ (ID=" + recordId + ")")); // // First, generate the SEPA export as an intermediary step, to use the old framework. final I_SEPA_Export sepaExport = sepaDocumentBL.createSEPAExportFromPaySelection(paySelection, isGroupTransactions); final SEPAExportContext exportContext = SEPAExportContext.builder() .referenceAsEndToEndId(referenceAsEndToEndId) .build(); //
// After the export header and lines have been created, marshal the document. final SEPACreditTransferXML xml = sepaDocumentBL.exportCreditTransferXML(sepaExport, exportContext); paySelection.setLastSepaExport(SystemTime.asTimestamp()); paySelection.setLastSepaExportBy_ID(getAD_User_ID()); InterfaceWrapperHelper.saveRecord(paySelection); getResult().setReportData(ReportResultData.builder() .reportFilename(xml.getFilename()) .reportContentType(xml.getContentType()) .reportData(new ByteArrayResource(xml.getContent())) .build()); return MSG_OK; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.sepa\base\src\main\java\de\metas\payment\sepa\process\C_PaySelection_SEPA_XmlExport.java
1
请完成以下Java代码
public void updateExecutionSuspensionStateByProcessDefinitionKey(String processDefinitionKey, SuspensionState suspensionState) { Map<String, Object> parameters = new HashMap<>(); parameters.put("processDefinitionKey", processDefinitionKey); parameters.put("isTenantIdSet", false); parameters.put("suspensionState", suspensionState.getStateCode()); getDbEntityManager().update(ExecutionEntity.class, "updateExecutionSuspensionStateByParameters", configureParameterizedQuery(parameters)); } public void updateExecutionSuspensionStateByProcessDefinitionKeyAndTenantId(String processDefinitionKey, String tenantId, SuspensionState suspensionState) { Map<String, Object> parameters = new HashMap<>(); parameters.put("processDefinitionKey", processDefinitionKey); parameters.put("isTenantIdSet", true); parameters.put("tenantId", tenantId); parameters.put("suspensionState", suspensionState.getStateCode()); getDbEntityManager().update(ExecutionEntity.class, "updateExecutionSuspensionStateByParameters", configureParameterizedQuery(parameters)); } // helper /////////////////////////////////////////////////////////// protected void createDefaultAuthorizations(ExecutionEntity execution) { if(execution.isProcessInstanceExecution() && isAuthorizationEnabled()) {
ResourceAuthorizationProvider provider = getResourceAuthorizationProvider(); AuthorizationEntity[] authorizations = provider.newProcessInstance(execution); saveDefaultAuthorizations(authorizations); } } protected void configureQuery(AbstractQuery<?, ?> query) { getAuthorizationManager().configureExecutionQuery(query); getTenantManager().configureQuery(query); } protected ListQueryParameterObject configureParameterizedQuery(Object parameter) { return getTenantManager().configureQuery(parameter); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\ExecutionManager.java
1
请完成以下Java代码
private void startScheduledFutureIfApplies() { // Does not apply if (onPollingEventsSupplier == null) { return; } // // Check if the producer was already scheduled if (scheduledFuture != null) { return; } // // Schedule producer final long initialDelayMillis = 1000; final long periodMillis = 1000; scheduledFuture = scheduler.scheduleAtFixedRate(this::pollAndPublish, initialDelayMillis, periodMillis, TimeUnit.MILLISECONDS); logger.trace("{}: start producing using initialDelayMillis={}, periodMillis={}", this, initialDelayMillis, periodMillis); } private void stopScheduledFuture() { if (scheduledFuture == null) { return; } try { scheduledFuture.cancel(true); } catch (final Exception ex) {
logger.warn("{}: Failed stopping scheduled future: {}. Ignored and considering it as stopped", this, scheduledFuture, ex); } scheduledFuture = null; } private void pollAndPublish() { if (onPollingEventsSupplier == null) { return; } try { final List<?> events = onPollingEventsSupplier.produceEvents(); if (events != null && !events.isEmpty()) { for (final Object event : events) { websocketSender.convertAndSend(topicName, event); logger.trace("Event sent to {}: {}", topicName, event); } } else { logger.trace("Got no events from {}", onPollingEventsSupplier); } } catch (final Exception ex) { logger.warn("Failed producing event for {}. Ignored.", this, ex); } } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.util.web\src\main\java\de\metas\websocket\producers\WebSocketProducersRegistry.java
1
请完成以下Java代码
public void createASI() { final Object sourceModel = getSourceModel(); final IAttributeSetInstanceAware asiAware = attributeSetInstanceAwareFactoryService.createOrNull(sourceModel); if (asiAware == null) { return; } if (asiAware.getM_Product_ID() <= 0) { return; } final AttributeId ageAttributeId = attributesRepo.retrieveActiveAttributeIdByValueOrNull(HUAttributeConstants.ATTR_Age); if (ageAttributeId == null) { return; } final ProductId productId = ProductId.ofRepoId(asiAware.getM_Product_ID()); final I_M_Attribute attribute = attributesBL.getAttributeOrNull(productId, ageAttributeId); if (attribute == null) { return; } attributeSetInstanceBL.getCreateASI(asiAware); final AttributeSetInstanceId asiId = AttributeSetInstanceId.ofRepoIdOrNone(asiAware.getM_AttributeSetInstance_ID());
final I_M_AttributeInstance ai = attributeSetInstanceBL.getAttributeInstance(asiId, ageAttributeId); if (ai != null) { // If it was set, just leave it as it is return; } attributeSetInstanceBL.getCreateAttributeInstance(asiId, ageAttributeId); attributeSetInstanceBL.setAttributeInstanceValue(asiId, ageAttributeId, ageAttributesService.computeDefaultAgeOrNull()); } private @NonNull Object getSourceModel() { Check.assumeNotNull(sourceModel, "sourceModel not null"); return sourceModel; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.fresh\de.metas.fresh.base\src\main\java\org\adempiere\mm\attributes\api\impl\AgeAttributeCreator.java
1
请完成以下Java代码
public class DataSource { private static HikariConfig config = new HikariConfig(); private static HikariDataSource ds; static { // config = new HikariConfig("datasource.properties"); // Properties props = new Properties(); // props.setProperty("dataSourceClassName", "org.h2.Driver"); // props.setProperty("dataSource.user", ""); // props.setProperty("dataSource.password", ""); // props.put("dataSource.logWriter", new PrintWriter(System.out)); // config = new HikariConfig(props); config.setJdbcUrl("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;INIT=runscript from 'classpath:/db.sql'"); config.setUsername(""); config.setPassword(""); config.addDataSourceProperty("cachePrepStmts", "true"); config.addDataSourceProperty("prepStmtCacheSize", "250");
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); ds = new HikariDataSource(config); // ds.setJdbcUrl("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;INIT=runscript from 'classpath:/db.sql'"); // ds.setUsername(""); // ds.setPassword(""); } private DataSource() { } public static Connection getConnection() throws SQLException { return ds.getConnection(); } }
repos\tutorials-master\libraries-data-db\src\main\java\com\baeldung\libraries\hikaricp\DataSource.java
1
请在Spring Boot框架中完成以下Java代码
public boolean hasDraftJobsUsingPickingSlot( @NonNull final PickingSlotId pickingSlotId, @Nullable final PickingJobId excludePickingJobId) { final IQueryBuilder<I_M_Picking_Job> queryBuilder = queryBL .createQueryBuilder(I_M_Picking_Job.class) .addEqualsFilter(I_M_Picking_Job.COLUMNNAME_DocStatus, PickingJobDocStatus.Drafted.getCode()) .addEqualsFilter(I_M_Picking_Job.COLUMNNAME_M_PickingSlot_ID, pickingSlotId); if (excludePickingJobId != null) { queryBuilder.addNotEqualsFilter(I_M_Picking_Job.COLUMNNAME_M_Picking_Job_ID, excludePickingJobId); } return queryBuilder.create().anyMatch(); } public Optional<PickingJob> getDraftBySalesOrderId( @NonNull final OrderId salesOrderId, @NonNull final PickingJobLoaderSupportingServices loadingSupportServices) { return queryBL.createQueryBuilder(I_M_Picking_Job.class) .addEqualsFilter(I_M_Picking_Job.COLUMNNAME_DocStatus, PickingJobDocStatus.Drafted.getCode()) .addEqualsFilter(I_M_Picking_Job.COLUMNNAME_C_Order_ID, salesOrderId) .create() .firstIdOnlyOptional(PickingJobId::ofRepoIdOrNull) .map(pickingJobId -> PickingJobLoaderAndSaver.forLoading(loadingSupportServices).loadById(pickingJobId)); } @NonNull public Map<ShipmentScheduleId, List<PickingJobId>> getPickingJobIdsByScheduleId( @NonNull final Set<ShipmentScheduleId> shipmentScheduleIds)
{ return queryBL.createQueryBuilder(I_M_Picking_Job_Step.class) .addInArrayFilter(I_M_Picking_Job_Step.COLUMNNAME_M_ShipmentSchedule_ID, shipmentScheduleIds) .create() .stream() .collect(Collectors.groupingBy( step -> ShipmentScheduleId.ofRepoId(step.getM_ShipmentSchedule_ID()), Collectors.mapping(step -> PickingJobId.ofRepoId(step.getM_Picking_Job_ID()), Collectors.toList()))); } @NonNull public List<PickingJob> getDraftedByPickingSlotId( @NonNull final PickingSlotId slotId, @NonNull final PickingJobLoaderSupportingServices loadingSupportServices) { final ImmutableSet<PickingJobId> pickingJobIds = queryBL.createQueryBuilder(I_M_Picking_Job.class) .addEqualsFilter(I_M_Picking_Job.COLUMNNAME_DocStatus, PickingJobDocStatus.Drafted.getCode()) .addEqualsFilter(I_M_Picking_Job.COLUMNNAME_M_PickingSlot_ID, slotId) .create() .idsAsSet(PickingJobId::ofRepoId); return PickingJobLoaderAndSaver.forLoading(loadingSupportServices) .loadByIds(pickingJobIds); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\job\repository\PickingJobRepository.java
2
请完成以下Java代码
public InvoiceId retrieveLastSalesContractInvoiceId(final BPartnerId bPartnerId) { final Optional<InvoiceId> predecessorInvoice = queryBL.createQueryBuilder(I_C_Invoice.class) .addEqualsFilter(I_C_Invoice.COLUMNNAME_C_BPartner_ID, bPartnerId.getRepoId()) .addInArrayFilter(I_C_Invoice.COLUMN_DocStatus, DocStatus.completedOrClosedStatuses()) .orderByDescending(I_C_Invoice.COLUMNNAME_DateInvoiced) .create() .idsAsSet(InvoiceId::ofRepoId) .stream() .filter(this::isContractSalesInvoice) .findFirst(); return predecessorInvoice.orElse(null); } private boolean isSubscriptionInvoiceCandidate(final I_C_Invoice_Candidate invoiceCandidate) { final int tableId = invoiceCandidate.getAD_Table_ID(); return getTableId(I_C_Flatrate_Term.class) == tableId; } public LocalDate retrieveContractEndDateForInvoiceIdOrNull(@NonNull final InvoiceId invoiceId) { final I_C_Invoice invoice = invoiceDAO.getByIdInTrx(invoiceId); final ZoneId timeZone = orgDAO.getTimeZone(OrgId.ofRepoId(invoice.getAD_Org_ID())); final List<I_C_InvoiceLine> invoiceLines = invoiceDAO.retrieveLines(invoice); final List<I_C_Invoice_Candidate> allInvoiceCands = new ArrayList<>(); for (final I_C_InvoiceLine invoiceLine : invoiceLines) { final List<I_C_Invoice_Candidate> cands = invoiceCandDAO.retrieveIcForIl(invoiceLine); allInvoiceCands.addAll(cands); } final Optional<I_C_Flatrate_Term> latestTerm = allInvoiceCands.stream()
.filter(this::isSubscriptionInvoiceCandidate) .map(I_C_Invoice_Candidate::getRecord_ID) .map(flatrateDAO::getById) .sorted((contract1, contract2) -> { final Timestamp contractEndDate1 = CoalesceUtil.coalesce(contract1.getMasterEndDate(), contract1.getEndDate()); final Timestamp contractEndDate2 = CoalesceUtil.coalesce(contract2.getMasterEndDate(), contract2.getEndDate()); if (contractEndDate1.after(contractEndDate2)) { return -1; } return 1; }) .findFirst(); if (latestTerm == null) { return null; } return TimeUtil.asLocalDate( CoalesceUtil.coalesce(latestTerm.get().getMasterEndDate(), latestTerm.get().getEndDate()), timeZone); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\invoice\ContractInvoiceService.java
1
请完成以下Java代码
public Integer getF_LEVEL() { return F_LEVEL; } public void setF_LEVEL(Integer f_LEVEL) { F_LEVEL = f_LEVEL; } public String getF_END() { return F_END; } public void setF_END(String f_END) { F_END = f_END; } public String getF_QRCANTONID() { return F_QRCANTONID; } public void setF_QRCANTONID(String f_QRCANTONID) { F_QRCANTONID = f_QRCANTONID; }
public String getF_DECLARE() { return F_DECLARE; } public void setF_DECLARE(String f_DECLARE) { F_DECLARE = f_DECLARE; } public String getF_DECLAREISEND() { return F_DECLAREISEND; } public void setF_DECLAREISEND(String f_DECLAREISEND) { F_DECLAREISEND = f_DECLAREISEND; } }
repos\SpringBootBucket-master\springboot-batch\src\main\java\com\xncoding\trans\modules\common\vo\BscCanton.java
1
请完成以下Java代码
public void setDocumentNo (java.lang.String DocumentNo) { set_Value (COLUMNNAME_DocumentNo, DocumentNo); } /** Get Nr.. @return Document sequence number of the document */ @Override public java.lang.String getDocumentNo () { return (java.lang.String)get_Value(COLUMNNAME_DocumentNo); } /** Set Datensatz-ID. @param Record_ID Direct internal record ID */ @Override public void setRecord_ID (int Record_ID) { if (Record_ID < 0) set_Value (COLUMNNAME_Record_ID, null);
else set_Value (COLUMNNAME_Record_ID, Integer.valueOf(Record_ID)); } /** Get Datensatz-ID. @return Direct internal record ID */ @Override public int getRecord_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_Record_ID); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.fresh\de.metas.fresh.base\src\main\java-gen\de\metas\fresh\model\X_RV_Prepared_And_Drafted_Documents.java
1
请在Spring Boot框架中完成以下Java代码
public Format getFormat() { return this.format; } public void setFormat(Format format) { this.format = format; } public enum Format { /** * Push metrics in text format. */ TEXT, /** * Push metrics in protobuf format. */ PROTOBUF } public enum Scheme {
/** * Use HTTP to push metrics. */ HTTP, /** * Use HTTPS to push metrics. */ HTTPS } } }
repos\spring-boot-4.0.1\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\export\prometheus\PrometheusProperties.java
2
请完成以下Java代码
public Tooltip getTooltip() { return tooltip; } public void setTooltip(Tooltip tooltip) { this.tooltip = tooltip; } public Legend getLegend() { return legend; } public void setLegend(Legend legend) { this.legend = legend; } public Grid getGrid() { return grid; } public void setGrid(Grid grid) { this.grid = grid; } public Toolbox getToolbox() { return toolbox; } public void setToolbox(Toolbox toolbox) { this.toolbox = toolbox; }
public XAxis getxAxis() { return xAxis; } public void setxAxis(XAxis xAxis) { this.xAxis = xAxis; } public YAxis getyAxis() { return yAxis; } public void setyAxis(YAxis yAxis) { this.yAxis = yAxis; } public List<Serie> getSeries() { return series; } public void setSeries(List<Serie> series) { this.series = series; } }
repos\SpringBootBucket-master\springboot-echarts\src\main\java\com\xncoding\echarts\api\model\jmh\Option.java
1
请在Spring Boot框架中完成以下Java代码
public Order getOrderNotNull() { if (order == null) { throw new RuntimeException("order cannot be null at this stage!"); } return order; } @NonNull public String getBillingBPLocationExternalIdNotNull() { if (billingBPLocationExternalId == null) { throw new RuntimeException("billingBPLocationExternalId cannot be null at this stage!"); } return billingBPLocationExternalId; } @NonNull public String getShippingBPLocationExternalIdNotNull() { if (shippingBPLocationExternalId == null) { throw new RuntimeException("shippingBPLocationExternalId cannot be null at this stage!"); } return shippingBPLocationExternalId; } public void setOrder(@NonNull final Order order) { this.order = order; importedExternalHeaderIds.add(order.getOrderId()); } @NonNull public Optional<Instant> getNextImportStartingTimestamp() { if (nextImportStartingTimestamp == null) { return Optional.empty();
} return Optional.of(nextImportStartingTimestamp.getTimestamp()); } /** * Update next import timestamp to the most current one. */ public void setNextImportStartingTimestamp(@NonNull final DateAndImportStatus dateAndImportStatus) { if (this.nextImportStartingTimestamp == null) { this.nextImportStartingTimestamp = dateAndImportStatus; return; } if (this.nextImportStartingTimestamp.isOkToImport()) { if (dateAndImportStatus.isOkToImport() && dateAndImportStatus.getTimestamp().isAfter(this.nextImportStartingTimestamp.getTimestamp())) { this.nextImportStartingTimestamp = dateAndImportStatus; return; } if (!dateAndImportStatus.isOkToImport()) { this.nextImportStartingTimestamp = dateAndImportStatus; return; } } if (!this.nextImportStartingTimestamp.isOkToImport() && !dateAndImportStatus.isOkToImport() && dateAndImportStatus.getTimestamp().isBefore(this.nextImportStartingTimestamp.getTimestamp())) { this.nextImportStartingTimestamp = dateAndImportStatus; } } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-ebay\de-metas-camel-ebay-camelroutes\src\main\java\de\metas\camel\externalsystems\ebay\EbayImportOrdersRouteContext.java
2
请在Spring Boot框架中完成以下Java代码
public class OrderService { @Autowired private OrderRepository orderRepository; @Autowired private UserRepository userRepository; private OrderService self() { return (OrderService) AopContext.currentProxy(); } public void method01() { // 查询订单 OrderDO order = orderRepository.findById(1).orElse(null); System.out.println(order); // 查询用户 UserDO user = userRepository.findById(1).orElse(null); System.out.println(user); } @Transactional // 报错,找不到事务管理器 public void method02() { // 查询订单 OrderDO order = orderRepository.findById(1).orElse(null); System.out.println(order); // 查询用户 UserDO user = userRepository.findById(1).orElse(null); System.out.println(user); } public void method03() { // 查询订单 self().method031(); // 查询用户 self().method032(); } @Transactional(transactionManager = DBConstants.TX_MANAGER_ORDERS) public void method031() { OrderDO order = orderRepository.findById(1).orElse(null); System.out.println(order); } @Transactional(transactionManager = DBConstants.TX_MANAGER_USERS)
public void method032() { UserDO user = userRepository.findById(1).orElse(null); System.out.println(user); } @Transactional(transactionManager = DBConstants.TX_MANAGER_ORDERS) public void method05() { // 查询订单 OrderDO order = orderRepository.findById(1).orElse(null); System.out.println(order); // 查询用户 self().method052(); } @Transactional(transactionManager = DBConstants.TX_MANAGER_USERS, propagation = Propagation.REQUIRES_NEW) public void method052() { UserDO user = userRepository.findById(1).orElse(null); System.out.println(user); } }
repos\SpringBoot-Labs-master\lab-17\lab-17-dynamic-datasource-springdatajpa\src\main\java\cn\iocoder\springboot\lab17\dynamicdatasource\service\OrderService.java
2
请完成以下Java代码
protected boolean isMissingTablesException(Exception e) { String exceptionMessage = e.getMessage(); if (e.getMessage() != null) { // Matches message returned from H2 if ((exceptionMessage.indexOf("Table") != -1) && (exceptionMessage.indexOf("not found") != -1)) { return true; } // Message returned from MySQL and Oracle if (((exceptionMessage.indexOf("Table") != -1 || exceptionMessage.indexOf("table") != -1)) && (exceptionMessage.indexOf("doesn't exist") != -1)) { return true; } // Message returned from Postgres if (((exceptionMessage.indexOf("relation") != -1 || exceptionMessage.indexOf("table") != -1)) && (exceptionMessage.indexOf("does not exist") != -1)) { return true; } } return false; } public <T> T getCustomMapper(Class<T> type) { return sqlSession.getMapper(type); } // query factory methods //////////////////////////////////////////////////// public DeploymentQueryImpl createDeploymentQuery() { return new DeploymentQueryImpl(); } public ModelQueryImpl createModelQueryImpl() { return new ModelQueryImpl(); } public ProcessDefinitionQueryImpl createProcessDefinitionQuery() { return new ProcessDefinitionQueryImpl(); } public ProcessInstanceQueryImpl createProcessInstanceQuery() { return new ProcessInstanceQueryImpl(); } public ExecutionQueryImpl createExecutionQuery() { return new ExecutionQueryImpl();
} public TaskQueryImpl createTaskQuery() { return new TaskQueryImpl(); } public JobQueryImpl createJobQuery() { return new JobQueryImpl(); } public HistoricProcessInstanceQueryImpl createHistoricProcessInstanceQuery() { return new HistoricProcessInstanceQueryImpl(); } public HistoricActivityInstanceQueryImpl createHistoricActivityInstanceQuery() { return new HistoricActivityInstanceQueryImpl(); } public HistoricTaskInstanceQueryImpl createHistoricTaskInstanceQuery() { return new HistoricTaskInstanceQueryImpl(); } public HistoricDetailQueryImpl createHistoricDetailQuery() { return new HistoricDetailQueryImpl(); } public HistoricVariableInstanceQueryImpl createHistoricVariableInstanceQuery() { return new HistoricVariableInstanceQueryImpl(); } // getters and setters ////////////////////////////////////////////////////// public SqlSession getSqlSession() { return sqlSession; } public DbSqlSessionFactory getDbSqlSessionFactory() { return dbSqlSessionFactory; } }
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\db\DbSqlSession.java
1
请完成以下Java代码
public int getM_PromotionLine_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_PromotionLine_ID); if (ii == null) return 0; return ii.intValue(); } /** Operation AD_Reference_ID=53294 */ public static final int OPERATION_AD_Reference_ID=53294; /** >= = >= */ public static final String OPERATION_GtEq = ">="; /** <= = <= */ public static final String OPERATION_LeEq = "<="; /** Set Operation. @param Operation Compare Operation */ public void setOperation (String Operation) { set_Value (COLUMNNAME_Operation, Operation); } /** Get Operation. @return Compare Operation */ public String getOperation () { return (String)get_Value(COLUMNNAME_Operation); } /** Set Quantity. @param Qty Quantity */ public void setQty (BigDecimal Qty) { set_Value (COLUMNNAME_Qty, Qty); } /** Get Quantity. @return Quantity */ public BigDecimal getQty () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty);
if (bd == null) return Env.ZERO; return bd; } /** Set Sequence. @param SeqNo Method of ordering records; lowest number comes first */ public void setSeqNo (int SeqNo) { set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo)); } /** Get Sequence. @return Method of ordering records; lowest number comes first */ public int getSeqNo () { Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_PromotionDistribution.java
1
请完成以下Java代码
public void afterPropertiesSet() { Assert.notEmpty(this.decisionVoters, "A list of AccessDecisionVoters is required"); Assert.notNull(this.messages, "A message source must be set"); } protected final void checkAllowIfAllAbstainDecisions() { if (!this.isAllowIfAllAbstainDecisions()) { throw new AccessDeniedException( this.messages.getMessage("AbstractAccessDecisionManager.accessDenied", "Access is denied")); } } public List<AccessDecisionVoter<?>> getDecisionVoters() { return this.decisionVoters; } public boolean isAllowIfAllAbstainDecisions() { return this.allowIfAllAbstainDecisions; } public void setAllowIfAllAbstainDecisions(boolean allowIfAllAbstainDecisions) { this.allowIfAllAbstainDecisions = allowIfAllAbstainDecisions; } @Override public void setMessageSource(MessageSource messageSource) { this.messages = new MessageSourceAccessor(messageSource); } @Override public boolean supports(ConfigAttribute attribute) { for (AccessDecisionVoter<?> voter : this.decisionVoters) { if (voter.supports(attribute)) { return true; } } return false; } /** * Iterates through all <code>AccessDecisionVoter</code>s and ensures each can support * the presented class. * <p> * If one or more voters cannot support the presented class, <code>false</code> is
* returned. * @param clazz the type of secured object being presented * @return true if this type is supported */ @Override public boolean supports(Class<?> clazz) { for (AccessDecisionVoter<?> voter : this.decisionVoters) { if (!voter.supports(clazz)) { return false; } } return true; } @Override public String toString() { return this.getClass().getSimpleName() + " [DecisionVoters=" + this.decisionVoters + ", AllowIfAllAbstainDecisions=" + this.allowIfAllAbstainDecisions + "]"; } }
repos\spring-security-main\access\src\main\java\org\springframework\security\access\vote\AbstractAccessDecisionManager.java
1
请完成以下Java代码
public void setCommission_Fact_State (final java.lang.String Commission_Fact_State) { set_ValueNoCheck (COLUMNNAME_Commission_Fact_State, Commission_Fact_State); } @Override public java.lang.String getCommission_Fact_State() { return get_ValueAsString(COLUMNNAME_Commission_Fact_State); } @Override public void setCommissionFactTimestamp (final java.lang.String CommissionFactTimestamp) { set_ValueNoCheck (COLUMNNAME_CommissionFactTimestamp, CommissionFactTimestamp); } @Override public java.lang.String getCommissionFactTimestamp() { return get_ValueAsString(COLUMNNAME_CommissionFactTimestamp);
} @Override public void setCommissionPoints (final BigDecimal CommissionPoints) { set_ValueNoCheck (COLUMNNAME_CommissionPoints, CommissionPoints); } @Override public BigDecimal getCommissionPoints() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_CommissionPoints); return bd != null ? bd : BigDecimal.ZERO; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java-gen\de\metas\contracts\commission\model\X_C_Commission_Fact.java
1
请在Spring Boot框架中完成以下Java代码
public class DataInitializer { private final @NonNull OrderRepository orders; private final @NonNull CustomerRepository customers; /** * Initializes a {@link Customer}. * * @return */ @Transactional("customerTransactionManager") public CustomerId initializeCustomer() { return customers.save(new Customer("Dave", "Matthews")).getId(); } /** * Initializes an {@link Order}.
* * @param customer must not be {@literal null}. * @return */ @Transactional("orderTransactionManager") public Order initializeOrder(CustomerId customer) { Assert.notNull(customer, "Customer identifier must not be null!"); var order = new Order(customer); order.add(new LineItem("Lakewood Guitar")); return orders.save(order); } }
repos\spring-data-examples-main\jpa\multiple-datasources\src\main\java\example\springdata\jpa\multipleds\DataInitializer.java
2
请完成以下Java代码
public IInvoiceCandInvalidUpdater setLockedBy(final ILock lockedBy) { assertNotExecuted(); icTagger.setLockedBy(lockedBy); return this; } @Override public IInvoiceCandInvalidUpdater setTaggedWithNoTag() { assertNotExecuted(); icTagger.setTaggedWithNoTag(); return this; } @Override public IInvoiceCandInvalidUpdater setTaggedWithAnyTag() { assertNotExecuted(); icTagger.setTaggedWithAnyTag(); return this; } @Override public IInvoiceCandInvalidUpdater setLimit(final int limit) { assertNotExecuted(); icTagger.setLimit(limit); return this; } @Override public IInvoiceCandInvalidUpdater setRecomputeTagToUse(final InvoiceCandRecomputeTag tag) { assertNotExecuted(); icTagger.setRecomputeTag(tag); return this; } @Override public IInvoiceCandInvalidUpdater setOnlyInvoiceCandidateIds(@NonNull final InvoiceCandidateIdsSelection onlyInvoiceCandidateIds) { assertNotExecuted(); icTagger.setOnlyInvoiceCandidateIds(onlyInvoiceCandidateIds); return this; } private int getItemsPerBatch() { return sysConfigBL.getIntValue(SYSCONFIG_ItemsPerBatch, DEFAULT_ItemsPerBatch); } /** * IC update result. * * @author metas-dev <dev@metasfresh.com> */ private static final class ICUpdateResult { private int countOk = 0; private int countErrors = 0; public void addInvoiceCandidate() { countOk++; } public void incrementErrorsCount() { countErrors++; }
@Override public String toString() { return getSummary(); } public String getSummary() { return "Updated " + countOk + " invoice candidates, " + countErrors + " errors"; } } /** * IC update exception handler */ private final class ICTrxItemExceptionHandler extends FailTrxItemExceptionHandler { private final ICUpdateResult result; public ICTrxItemExceptionHandler(@NonNull final ICUpdateResult result) { this.result = result; } /** * Resets the given IC to its old values, and sets an error flag in it. */ @Override public void onItemError(final Throwable e, final Object item) { result.incrementErrorsCount(); final I_C_Invoice_Candidate ic = InterfaceWrapperHelper.create(item, I_C_Invoice_Candidate.class); // gh #428: don't discard changes that were already made, because they might include a change of QtyInvoice. // in that case, a formerly Processed IC might need to be flagged as unprocessed. // if we discard all changes in this case, then we will have IsError='Y' and also an error message in the IC, // but the user will probably ignore it, because the IC is still flagged as processed. invoiceCandBL.setError(ic, e); // invoiceCandBL.discardChangesAndSetError(ic, e); invoiceCandDAO.save(ic); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\api\impl\InvoiceCandInvalidUpdater.java
1
请完成以下Java代码
public int getPA_MeasureCalc_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_PA_MeasureCalc_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Product Column. @param ProductColumn Fully qualified Product column (M_Product_ID) */ public void setProductColumn (String ProductColumn) { set_Value (COLUMNNAME_ProductColumn, ProductColumn); } /** Get Product Column. @return Fully qualified Product column (M_Product_ID) */ public String getProductColumn () { return (String)get_Value(COLUMNNAME_ProductColumn); } /** Set Sql SELECT. @param SelectClause SQL SELECT clause */ public void setSelectClause (String SelectClause) { set_Value (COLUMNNAME_SelectClause, SelectClause); } /** Get Sql SELECT. @return SQL SELECT clause */ public String getSelectClause () { return (String)get_Value(COLUMNNAME_SelectClause); }
/** Set Sql WHERE. @param WhereClause Fully qualified SQL WHERE clause */ public void setWhereClause (String WhereClause) { set_Value (COLUMNNAME_WhereClause, WhereClause); } /** Get Sql WHERE. @return Fully qualified SQL WHERE clause */ public String getWhereClause () { return (String)get_Value(COLUMNNAME_WhereClause); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_PA_MeasureCalc.java
1
请完成以下Java代码
public String getName() { return name; } @Override public void setName(String name) { this.name = name; } @Override public void setDescription(String description) { this.description = description; } @Override public String getDescription() { return description; } @Override public String getDeploymentId() { return deploymentId; } @Override public void setDeploymentId(String deploymentId) { this.deploymentId = deploymentId; } @Override public String getResourceName() { return resourceName; } @Override public void setResourceName(String resourceName) { this.resourceName = resourceName; } @Override public String getTenantId() {
return tenantId; } @Override public void setTenantId(String tenantId) { this.tenantId = tenantId; } @Override public String getCategory() { return category; } @Override public void setCategory(String category) { this.category = category; } @Override public String toString() { return "EventDefinitionEntity[" + id + "]"; } }
repos\flowable-engine-main\modules\flowable-event-registry\src\main\java\org\flowable\eventregistry\impl\persistence\entity\EventDefinitionEntityImpl.java
1
请完成以下Java代码
public void setChequeNo (String ChequeNo) { set_Value (COLUMNNAME_ChequeNo, ChequeNo); } /** Get Cheque No. @return Cheque No */ public String getChequeNo () { return (String)get_Value(COLUMNNAME_ChequeNo); } /** Set Black List Cheque. @param U_BlackListCheque_ID Black List Cheque */ public void setU_BlackListCheque_ID (int U_BlackListCheque_ID) { if (U_BlackListCheque_ID < 1)
set_ValueNoCheck (COLUMNNAME_U_BlackListCheque_ID, null); else set_ValueNoCheck (COLUMNNAME_U_BlackListCheque_ID, Integer.valueOf(U_BlackListCheque_ID)); } /** Get Black List Cheque. @return Black List Cheque */ public int getU_BlackListCheque_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_U_BlackListCheque_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_BlackListCheque.java
1
请完成以下Java代码
public static FlowableEntityEvent createCaseBusinessStatusUpdatedEvent(CaseInstance caseInstance, String oldBusinessStatus, String newBusinessStatus) { return new FlowableCaseBusinessStatusUpdatedEventImpl(caseInstance, oldBusinessStatus, newBusinessStatus); } public static FlowableEntityEvent createTaskCreatedEvent(Task task) { FlowableEntityEventImpl event = new FlowableEntityEventImpl(task, FlowableEngineEventType.TASK_CREATED); event.setScopeId(task.getScopeId()); event.setScopeDefinitionId(task.getScopeDefinitionId()); event.setScopeType(task.getScopeType()); event.setSubScopeId(task.getId()); return event; } public static FlowableEntityEvent createTaskAssignedEvent(Task task) { FlowableEntityEventImpl event = new FlowableEntityEventImpl(task, FlowableEngineEventType.TASK_ASSIGNED);
event.setScopeId(task.getScopeId()); event.setScopeDefinitionId(task.getScopeDefinitionId()); event.setScopeType(task.getScopeType()); event.setSubScopeId(task.getId()); return event; } public static FlowableEntityEvent createTaskCompletedEvent(Task task) { FlowableEntityEventImpl event = new FlowableEntityEventImpl(task, FlowableEngineEventType.TASK_COMPLETED); event.setScopeId(task.getScopeId()); event.setScopeDefinitionId(task.getScopeDefinitionId()); event.setScopeType(task.getScopeType()); event.setSubScopeId(task.getId()); return event; } }
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\event\FlowableCmmnEventBuilder.java
1
请完成以下Java代码
public boolean isCompleteable() { return completeable; } public String getTenantId() { return tenantId; } public String getTenantIdLike() { return tenantIdLike; } public String getTenantIdLikeIgnoreCase() { return tenantIdLikeIgnoreCase; } public boolean isWithoutTenantId() { return withoutTenantId; } public String getActivePlanItemDefinitionId() { return activePlanItemDefinitionId; } public Set<String> getActivePlanItemDefinitionIds() { return activePlanItemDefinitionIds; } public String getInvolvedUser() { return involvedUser; } public IdentityLinkQueryObject getInvolvedUserIdentityLink() { return involvedUserIdentityLink; } public IdentityLinkQueryObject getInvolvedGroupIdentityLink() { return involvedGroupIdentityLink; } public Set<String> getInvolvedGroups() { return involvedGroups; } public boolean isIncludeCaseVariables() { return includeCaseVariables; } public Collection<String> getVariableNamesToInclude() { return variableNamesToInclude; } public boolean isNeedsCaseDefinitionOuterJoin() { if (isNeedsPaging()) { if (AbstractEngineConfiguration.DATABASE_TYPE_ORACLE.equals(databaseType) || AbstractEngineConfiguration.DATABASE_TYPE_DB2.equals(databaseType) || AbstractEngineConfiguration.DATABASE_TYPE_MSSQL.equals(databaseType)) { // When using oracle, db2 or mssql we don't need outer join for the process definition join. // It is not needed because the outer join order by is done by the row number instead
return false; } } return hasOrderByForColumn(CaseInstanceQueryProperty.CASE_DEFINITION_KEY.getName()); } public List<CaseInstanceQueryImpl> getOrQueryObjects() { return orQueryObjects; } public List<List<String>> getSafeCaseInstanceIds() { return safeCaseInstanceIds; } public void setSafeCaseInstanceIds(List<List<String>> safeCaseInstanceIds) { this.safeCaseInstanceIds = safeCaseInstanceIds; } public List<List<String>> getSafeInvolvedGroups() { return safeInvolvedGroups; } public void setSafeInvolvedGroups(List<List<String>> safeInvolvedGroups) { this.safeInvolvedGroups = safeInvolvedGroups; } }
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\runtime\CaseInstanceQueryImpl.java
1
请完成以下Java代码
private ImportRecordResult importOrUpdateBPartner(final BPartnerImportContext context) { final ImportRecordResult bpartnerImportResult; // We don't have a previous C_BPartner_ID // => create or update existing BPartner from this line final boolean bpartnerExists = context.isCurrentBPartnerIdSet(); if (context.isInsertOnly() && bpartnerExists) { // #4994 do not update existing entries return ImportRecordResult.Nothing; } bpartnerImportResult = bpartnerExists ? ImportRecordResult.Updated : ImportRecordResult.Inserted; bpartnerImporter.importRecord(context); return bpartnerImportResult; } private void createUpdateInterestArea(final I_I_BPartner importRecord) { final int interestAreaId = importRecord.getR_InterestArea_ID(); if (interestAreaId <= 0) { return; } final int adUserId = importRecord.getAD_User_ID(); if (adUserId <= 0) { return; } final MContactInterest ci = MContactInterest.get(getCtx(), interestAreaId, adUserId, true, // active ITrx.TRXNAME_ThreadInherited); ci.save(); // don't subscribe or re-activate
} @Override public Class<I_I_BPartner> getImportModelClass() { return I_I_BPartner.class; } @Override public String getImportTableName() { return I_I_BPartner.Table_Name; } @Override protected String getImportOrderBySql() { // gody: 20070113 - Order so the same values are consecutive. return I_I_BPartner.COLUMNNAME_BPValue + ", " + I_I_BPartner.COLUMNNAME_GlobalId + ", " + I_I_BPartner.COLUMNNAME_I_BPartner_ID; } @Override protected String getTargetTableName() { return I_C_BPartner.Table_Name; } @Override public I_I_BPartner retrieveImportRecord(final Properties ctx, final ResultSet rs) throws SQLException { return new X_I_BPartner(ctx, rs, ITrx.TRXNAME_ThreadInherited); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\bpartner\impexp\BPartnerImportProcess.java
1
请完成以下Java代码
public final Optional<Path> getFilePathIfPresent() {return Optional.ofNullable(getFilePathOrNull());} @Nullable private synchronized Path getFilePathOrNull() {return _path;} public static Path getMigrationScriptDirectory() { final Path migrationScriptsDirectory = _migrationScriptsDirectory; return migrationScriptsDirectory != null ? migrationScriptsDirectory : getDefaultMigrationScriptDirectory(); } private static Path getDefaultMigrationScriptDirectory() { return Paths.get(Ini.getMetasfreshHome(), "migration_scripts"); } public static void setMigrationScriptDirectory(@NonNull final Path path) { _migrationScriptsDirectory = path; logger.info("Set migration scripts directory: {}", path); } /** * Appends given SQL statement. * <p> * If this method is called within a database transaction then the SQL statement will not be written to file directly, * but it will be collected and written when the transaction is committed. */ public synchronized void appendSqlStatement(@NonNull final Sql sqlStatement) { collectorFactory.collect(sqlStatement); } public synchronized void appendSqlStatements(@NonNull final SqlBatch sqlBatch) { sqlBatch.streamSqls().forEach(collectorFactory::collect);
} private synchronized void appendNow(final String sqlStatements) { if (sqlStatements == null || sqlStatements.isEmpty()) { return; } try { final Path path = getCreateFilePath(); FileUtil.writeString(path, sqlStatements, CHARSET, StandardOpenOption.CREATE, StandardOpenOption.APPEND); } catch (final IOException ex) { logger.error("Failed writing to {}:\n {}", this, sqlStatements, ex); close(); // better to close the file ... so, next time a new one will be created } } /** * Close underling file. * <p> * Next time, {@link #appendSqlStatement(Sql)} will be called, a new file will be created, so it's safe to call this method as many times as needed. */ public synchronized void close() { watcher.addLog("Closed migration script: " + _path); _path = null; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\migration\logger\MigrationScriptFileLogger.java
1
请完成以下Java代码
public int getSEPA_Export_Line_Retry_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_SEPA_Export_Line_Retry_ID); if (ii == null) return 0; return ii.intValue(); } /** Set SEPA_MandateRefNo. @param SEPA_MandateRefNo SEPA_MandateRefNo */ @Override public void setSEPA_MandateRefNo (java.lang.String SEPA_MandateRefNo) { set_Value (COLUMNNAME_SEPA_MandateRefNo, SEPA_MandateRefNo); } /** Get SEPA_MandateRefNo. @return SEPA_MandateRefNo */ @Override public java.lang.String getSEPA_MandateRefNo () { return (java.lang.String)get_Value(COLUMNNAME_SEPA_MandateRefNo); } /** Set StructuredRemittanceInfo. @param StructuredRemittanceInfo Structured Remittance Information */ @Override public void setStructuredRemittanceInfo (java.lang.String StructuredRemittanceInfo) { set_Value (COLUMNNAME_StructuredRemittanceInfo, StructuredRemittanceInfo); } /** Get StructuredRemittanceInfo. @return Structured Remittance Information */ @Override public java.lang.String getStructuredRemittanceInfo () { return (java.lang.String)get_Value(COLUMNNAME_StructuredRemittanceInfo); } /** Set Swift code. @param SwiftCode Swift Code or BIC
*/ @Override public void setSwiftCode (java.lang.String SwiftCode) { set_Value (COLUMNNAME_SwiftCode, SwiftCode); } /** Get Swift code. @return Swift Code or BIC */ @Override public java.lang.String getSwiftCode () { return (java.lang.String)get_Value(COLUMNNAME_SwiftCode); } @Override public void setIsGroupLine (final boolean IsGroupLine) { set_Value (COLUMNNAME_IsGroupLine, IsGroupLine); } @Override public boolean isGroupLine() { return get_ValueAsBoolean(COLUMNNAME_IsGroupLine); } @Override public void setNumberOfReferences (final int NumberOfReferences) { set_Value (COLUMNNAME_NumberOfReferences, NumberOfReferences); } @Override public int getNumberOfReferences() { return get_ValueAsInt(COLUMNNAME_NumberOfReferences); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.sepa\base\src\main\java-gen\de\metas\payment\sepa\model\X_SEPA_Export_Line.java
1
请完成以下Java代码
public Object getValue(ELContext context, Object base, Object property) { if (base == null) { // according to javadoc, can only be a String String key = (String) property; for (String name : delegateMap.keySet()) { if (name.equalsIgnoreCase(key)) { context.setPropertyResolved(true); return delegateMap.get(name); } } for (String name : activityBehaviourMap.keySet()) { if (name.equalsIgnoreCase(key)) { context.setPropertyResolved(true); return activityBehaviourMap.get(name); } } } return null; } @SuppressWarnings("rawtypes") public void bindService(JavaDelegate delegate, Map props) { String name = (String) props.get("osgi.service.blueprint.compname"); delegateMap.put(name, delegate); LOGGER.info("added Flowable service to delegate cache {}", name); } @SuppressWarnings("rawtypes") public void unbindService(JavaDelegate delegate, Map props) { String name = (String) props.get("osgi.service.blueprint.compname"); if (delegateMap.containsKey(name)) { delegateMap.remove(name); } LOGGER.info("removed Flowable service from delegate cache {}", name); }
@SuppressWarnings("rawtypes") public void bindActivityBehaviourService(ActivityBehavior delegate, Map props) { String name = (String) props.get("osgi.service.blueprint.compname"); activityBehaviourMap.put(name, delegate); LOGGER.info("added Flowable service to activity behaviour cache {}", name); } @SuppressWarnings("rawtypes") public void unbindActivityBehaviourService(ActivityBehavior delegate, Map props) { String name = (String) props.get("osgi.service.blueprint.compname"); if (activityBehaviourMap.containsKey(name)) { activityBehaviourMap.remove(name); } LOGGER.info("removed Flowable service from activity behaviour cache {}", name); } @Override public boolean isReadOnly(ELContext context, Object base, Object property) { return true; } @Override public void setValue(ELContext context, Object base, Object property, Object value) { } @Override public Class<?> getCommonPropertyType(ELContext context, Object arg) { return Object.class; } @Override public Class<?> getType(ELContext context, Object arg1, Object arg2) { return Object.class; } }
repos\flowable-engine-main\modules\flowable-osgi\src\main\java\org\flowable\osgi\blueprint\BlueprintELResolver.java
1
请完成以下Java代码
public class JobExecutorXmlImpl implements JobExecutorXml { protected List<JobAcquisitionXml> jobAcquisitions; protected String jobExecutorClass; protected Map<String, String> properties; public List<JobAcquisitionXml> getJobAcquisitions() { return jobAcquisitions; } public void setJobAcquisitions(List<JobAcquisitionXml> jobAcquisitions) { this.jobAcquisitions = jobAcquisitions; } public String getJobExecutorClass() {
return jobExecutorClass; } public void setJobExecutorClass(String jobExecutorClass) { this.jobExecutorClass = jobExecutorClass; } public void setProperties(Map<String, String> properties){ this.properties = properties; } public Map<String, String> getProperties() { return properties; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\container\impl\metadata\JobExecutorXmlImpl.java
1
请完成以下Java代码
public String getSubject() { return subject; } public void setSubject(String subject) { this.subject = subject; } public String getPlainContent() { return plainContent; } public void setPlainContent(String plainContent) { this.plainContent = plainContent; } public String getHtmlContent() { return htmlContent; } public void setHtmlContent(String htmlContent) { this.htmlContent = htmlContent; } public Charset getCharset() { return charset; } public void setCharset(Charset charset) { this.charset = charset; } public Collection<DataSource> getAttachments() { return attachments; } public void setAttachments(Collection<DataSource> attachments) { this.attachments = attachments; }
public void addAttachment(DataSource attachment) { if (attachments == null) { attachments = new ArrayList<>(); } attachments.add(attachment); } public Map<String, String> getHeaders() { return headers; } public void setHeaders(Map<String, String> headers) { this.headers = headers; } public void addHeader(String name, String value) { if (headers == null) { headers = new LinkedHashMap<>(); } headers.put(name, value); } }
repos\flowable-engine-main\modules\flowable-mail\src\main\java\org\flowable\mail\common\api\MailMessage.java
1
请完成以下Java代码
public Builder setLayout(final ProcessLayout layout) { this.layout = layout; return this; } private ProcessLayout getLayout() { Check.assumeNotNull(layout, "Parameter layout is not null"); return layout; } public Builder setStartProcessDirectly(final boolean startProcessDirectly) { this.startProcessDirectly = startProcessDirectly; return this; } private boolean isStartProcessDirectly() { if (startProcessDirectly != null) {
return startProcessDirectly; } else { return computeIsStartProcessDirectly(); } } private boolean computeIsStartProcessDirectly() { return (getParametersDescriptor() == null || getParametersDescriptor().getFields().isEmpty()) && TranslatableStrings.isEmpty(getLayout().getDescription()); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\process\descriptor\ProcessDescriptor.java
1
请在Spring Boot框架中完成以下Java代码
public void cleanUp() { if (ttlTaskExecutionEnabled) { PageLink tenantsBatchRequest = new PageLink(10_000, 0); PageData<TenantId> tenantsIds; do { tenantsIds = tenantService.findTenantsIds(tenantsBatchRequest); for (TenantId tenantId : tenantsIds.getData()) { if (!partitionService.resolve(ServiceType.TB_CORE, tenantId, tenantId).isMyPartition()) { continue; } Optional<DefaultTenantProfileConfiguration> tenantProfileConfiguration = tenantProfileCache.get(tenantId).getProfileConfiguration(); if (tenantProfileConfiguration.isEmpty() || tenantProfileConfiguration.get().getRpcTtlDays() == 0) { continue; } long ttl = TimeUnit.DAYS.toMillis(tenantProfileConfiguration.get().getRpcTtlDays());
long expirationTime = System.currentTimeMillis() - ttl; int totalRemoved = rpcDao.deleteOutdatedRpcByTenantId(tenantId, expirationTime); if (totalRemoved > 0) { log.info("Removed {} outdated rpc(s) for tenant {} older than {}", totalRemoved, tenantId, new Date(expirationTime)); } } tenantsBatchRequest = tenantsBatchRequest.nextPageLink(); } while (tenantsIds.hasNext()); } } }
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\ttl\rpc\RpcCleanUpService.java
2
请完成以下Java代码
public MapFormat setRightBrace(final String delimiter) { rightDelimiter = delimiter; return this; } /** * Sets argument map This map should contain key-value pairs with key values used in formatted string expression. If value for key was not found, formatter leave key unchanged (except if you've * set setThrowExceptionIfKeyWasNotFound(true), then it fires IllegalArgumentException. * * @param map the argument map * @return */ public MapFormat setArguments(final Map<String, ?> map) { if (map == null) { _argumentsMap = Collections.emptyMap(); } else { _argumentsMap = new HashMap<>(map); } return this; } /** Pre-compiled pattern */ private static final class Pattern { private static final int BUFSIZE = 255; /** Offsets to {} expressions */ private final int[] offsets; /** Keys enclosed by {} brackets */ private final String[] arguments; /** Max used offset */ private int maxOffset; private final String patternPrepared; public Pattern(final String patternStr, final String leftDelimiter, final String rightDelimiter, final boolean exactMatch) { super(); int idx = 0; int offnum = -1; final StringBuffer outpat = new StringBuffer(); offsets = new int[BUFSIZE]; arguments = new String[BUFSIZE]; maxOffset = -1; while (true) { int rightDelimiterIdx = -1; final int leftDelimiterIdx = patternStr.indexOf(leftDelimiter, idx); if (leftDelimiterIdx >= 0) { rightDelimiterIdx = patternStr.indexOf(rightDelimiter, leftDelimiterIdx + leftDelimiter.length()); } else { break; } if (++offnum >= BUFSIZE) { throw new IllegalArgumentException("TooManyArguments"); } if (rightDelimiterIdx < 0) { if (exactMatch) { throw new IllegalArgumentException("UnmatchedBraces"); }
else { break; } } outpat.append(patternStr.substring(idx, leftDelimiterIdx)); offsets[offnum] = outpat.length(); arguments[offnum] = patternStr.substring(leftDelimiterIdx + leftDelimiter.length(), rightDelimiterIdx); idx = rightDelimiterIdx + rightDelimiter.length(); maxOffset++; } outpat.append(patternStr.substring(idx)); patternPrepared = outpat.toString(); } public String substring(final int beginIndex, final int endIndex) { return patternPrepared.substring(beginIndex, endIndex); } public int length() { return patternPrepared.length(); } public int getMaxOffset() { return maxOffset; } public int getOffsetIndex(final int i) { return offsets[i]; } public String getArgument(final int i) { return arguments[i]; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.printing.client\src\main\java\de\metas\printing\client\util\MapFormat.java
1
请完成以下Java代码
public class MAssetTransfer extends X_A_Asset_Transfer { /** * */ private static final long serialVersionUID = 6542200284709386238L; /** * Default ConstructorX_A_Asset_Group_Acct * @param ctx context * @param M_InventoryLine_ID line */ public MAssetTransfer (Properties ctx, int X_A_Asset_Transfer_ID, String trxName) { super (ctx,X_A_Asset_Transfer_ID, trxName); if (X_A_Asset_Transfer_ID == 0) { // }
} // MAssetAddition /** * Load Constructor * @param ctx context * @param rs result set */ public MAssetTransfer (Properties ctx, ResultSet rs, String trxName) { super (ctx, rs, trxName); } // MInventoryLine } // MAssetAddition
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MAssetTransfer.java
1
请完成以下Java代码
public class CellBordersHandler { public void setRegionBorder(CellRangeAddress region, Sheet sheet, BorderStyle borderStyle) { RegionUtil.setBorderTop(borderStyle, region, sheet); RegionUtil.setBorderBottom(borderStyle, region, sheet); RegionUtil.setBorderLeft(borderStyle, region, sheet); RegionUtil.setBorderRight(borderStyle, region, sheet); } public void setRegionBorderWithColor(CellRangeAddress region, Sheet sheet, BorderStyle borderStyle, short color) { RegionUtil.setTopBorderColor(color, region, sheet); RegionUtil.setBottomBorderColor(color, region, sheet); RegionUtil.setLeftBorderColor(color, region, sheet); RegionUtil.setRightBorderColor(color, region, sheet); RegionUtil.setBorderTop(borderStyle, region, sheet); RegionUtil.setBorderBottom(borderStyle, region, sheet);
RegionUtil.setBorderLeft(borderStyle, region, sheet); RegionUtil.setBorderRight(borderStyle, region, sheet); } public void setCrazyBorder(CellRangeAddress region, Sheet sheet) { RegionUtil.setTopBorderColor(IndexedColors.RED.index, region, sheet); RegionUtil.setBottomBorderColor(IndexedColors.GREEN.index, region, sheet); RegionUtil.setLeftBorderColor(IndexedColors.BLUE.index, region, sheet); RegionUtil.setRightBorderColor(IndexedColors.VIOLET.index, region, sheet); RegionUtil.setBorderTop(BorderStyle.DASH_DOT, region, sheet); RegionUtil.setBorderBottom(BorderStyle.DOUBLE, region, sheet); RegionUtil.setBorderLeft(BorderStyle.DOTTED, region, sheet); RegionUtil.setBorderRight(BorderStyle.SLANTED_DASH_DOT, region, sheet); } }
repos\tutorials-master\apache-poi-4\src\main\java\com\baeldung\poi\excel\cellstyle\CellBordersHandler.java
1
请完成以下Java代码
public void setMake(String make) { this.make = make; } public void setModel(String model) { this.model = model; } public void setYear(int year) { this.year = year; } public List<ManufacturingPlantDto> getManufacturingPlantDtos() { return manufacturingPlantDtos; } public void setManufacturingPlantDtos(List<ManufacturingPlantDto> manufacturingPlantDtos) { this.manufacturingPlantDtos = manufacturingPlantDtos; } public int getNumberOfSeats() { return numberOfSeats; } public void setNumberOfSeats(int numberOfSeats) {
this.numberOfSeats = numberOfSeats; } public String getMake() { return make; } public String getModel() { return model; } public int getYear() { return year; } }
repos\tutorials-master\mapstruct-2\src\main\java\com\baeldung\list\entity\CarDto.java
1
请完成以下Java代码
public ITranslatableString getCaption() { return caption; } public String getCaption(final String adLanguage) { return caption.translate(adLanguage); } public ITranslatableString getDescription() { return description; } public String getDescription(final String adLanguage) { return description.translate(adLanguage); } public List<DocumentLayoutElementDescriptor> getElements() { return elements; } public static final class Builder { private ProcessId processId; private PanelLayoutType layoutType = PanelLayoutType.Panel; private ITranslatableString caption; private ITranslatableString description; private final List<DocumentLayoutElementDescriptor> elements = new ArrayList<>(); private Builder() { super(); } public ProcessLayout build() { return new ProcessLayout(this); } @Override public String toString() { return MoreObjects.toStringHelper(this) .add("processId", processId) .add("caption", caption) .add("elements-count", elements.size()) .toString(); } public Builder setProcessId(final ProcessId processId) { this.processId = processId; return this; } public Builder setLayoutType(final PanelLayoutType layoutType) {
this.layoutType = layoutType; return this; } public Builder setCaption(final ITranslatableString caption) { this.caption = caption; return this; } public Builder setDescription(final ITranslatableString description) { this.description = description; return this; } public ITranslatableString getDescription() { return description; } public Builder addElement(final DocumentLayoutElementDescriptor element) { Check.assumeNotNull(element, "Parameter element is not null"); elements.add(element); return this; } public Builder addElement(final DocumentFieldDescriptor processParaDescriptor) { Check.assumeNotNull(processParaDescriptor, "Parameter processParaDescriptor is not null"); final DocumentLayoutElementDescriptor element = DocumentLayoutElementDescriptor.builder() .setCaption(processParaDescriptor.getCaption()) .setDescription(processParaDescriptor.getDescription()) .setWidgetType(processParaDescriptor.getWidgetType()) .setAllowShowPassword(processParaDescriptor.isAllowShowPassword()) .barcodeScannerType(processParaDescriptor.getBarcodeScannerType()) .addField(DocumentLayoutElementFieldDescriptor.builder(processParaDescriptor.getFieldName()) .setLookupInfos(processParaDescriptor.getLookupDescriptor().orElse(null)) .setPublicField(true) .setSupportZoomInto(processParaDescriptor.isSupportZoomInto())) .build(); addElement(element); return this; } public Builder addElements(@Nullable final DocumentEntityDescriptor parametersDescriptor) { if (parametersDescriptor != null) { parametersDescriptor.getFields().forEach(this::addElement); } return this; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\process\descriptor\ProcessLayout.java
1
请完成以下Java代码
public I_M_HU_PI getM_LU_HU_PI() { return null; } @Override public I_M_HU_PI getM_TU_HU_PI() { return null; } @Override public boolean isInfiniteQtyTUsPerLU() { return true; } @Override public BigDecimal getQtyTUsPerLU() { return null; } @Override public boolean isInfiniteQtyCUsPerTU() { return false; } @Override public BigDecimal getQtyCUsPerTU() { final IHUProductStorage huProductStorage = getHUProductStorage(); if (huProductStorage == null)
{ return null; } return huProductStorage.getQty().toBigDecimal(); } @Override public I_C_UOM getQtyCUsPerTU_UOM() { final IHUProductStorage huProductStorage = getHUProductStorage(); if (huProductStorage == null) { return null; } return huProductStorage.getC_UOM(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\util\VHUPackingInfo.java
1
请完成以下Java代码
public String getId() { return id; } public void setId(String id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public DateTime getCreated() { return created; } public void setCreated(DateTime created) { this.created = created; } public DateTime getUpdated() { return updated; } public void setUpdated(DateTime updated) { this.updated = updated; } @Override public int hashCode() { int hash = 1; if (id != null) { hash = hash * 31 + id.hashCode();
} if (firstName != null) { hash = hash * 31 + firstName.hashCode(); } if (lastName != null) { hash = hash * 31 + lastName.hashCode(); } return hash; } @Override public boolean equals(Object obj) { if ((obj == null) || (obj.getClass() != this.getClass())) return false; if (obj == this) return true; Person other = (Person) obj; return this.hashCode() == other.hashCode(); } }
repos\tutorials-master\persistence-modules\spring-data-couchbase-2\src\main\java\com\baeldung\spring\data\couchbase\model\Person.java
1
请完成以下Java代码
public void setQtyProjected(final BigDecimal qtyProjected) { this.qtyProjected = qtyProjected; } @Override public BigDecimal getPercentage() { return percentage; } @Override public void setPercentage(final BigDecimal percentage) { this.percentage = percentage; } @Override public boolean isNegateQtyInReport() { return negateQtyInReport; } @Override public void setNegateQtyInReport(final boolean negateQtyInReport) { this.negateQtyInReport = negateQtyInReport; } @Override public String getComponentType() { return componentType; } @Override public void setComponentType(final String componentType) { this.componentType = componentType; } @Override public String getVariantGroup() {
return variantGroup; } @Override public void setVariantGroup(final String variantGroup) { this.variantGroup = variantGroup; } @Override public IHandlingUnitsInfo getHandlingUnitsInfo() { return handlingUnitsInfo; } @Override public void setHandlingUnitsInfo(final IHandlingUnitsInfo handlingUnitsInfo) { this.handlingUnitsInfo = handlingUnitsInfo; } @Override public void setHandlingUnitsInfoProjected(final IHandlingUnitsInfo handlingUnitsInfo) { handlingUnitsInfoProjected = handlingUnitsInfo; } @Override public IHandlingUnitsInfo getHandlingUnitsInfoProjected() { return handlingUnitsInfoProjected; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java\de\metas\materialtracking\qualityBasedInvoicing\impl\QualityInspectionLine.java
1
请在Spring Boot框架中完成以下Java代码
public class DocumentZoomIntoInfo { public static DocumentZoomIntoInfo of(final String tableName, final int id) { final Integer idObj = id >= 0 ? id : null; return builder().tableName(tableName).recordId(idObj).build(); } @NonNull String tableName; Integer recordId; WindowId windowId; @SuppressWarnings("OptionalUsedAsFieldOrParameterType") public DocumentZoomIntoInfo overrideWindowIdIfPossible(@Nullable final Optional<WindowId> windowId) { if (windowId == null || !windowId.isPresent()) { return this; } return toBuilder().windowId(windowId.get()).build(); } public DocumentZoomIntoInfo overrideWindowIdIfPossible(@NonNull final CustomizedWindowInfoMap customizedWindowInfoMap) { if (this.windowId == null) { return this; } final AdWindowId adWindowId = this.windowId.toAdWindowIdOrNull(); if (adWindowId == null) { return this; }
final WindowId customizedWindowId = customizedWindowInfoMap .getCustomizedWindowInfo(adWindowId) .map(CustomizedWindowInfo::getCustomizationWindowId) .map(WindowId::of) .orElse(null); if (customizedWindowId == null) { return this; } return !WindowId.equals(this.windowId, customizedWindowId) ? toBuilder().windowId(customizedWindowId).build() : this; } public boolean isRecordIdPresent() { return recordId != null; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\model\lookup\zoom_into\DocumentZoomIntoInfo.java
2
请完成以下Java代码
ConcurrentKafkaListenerContainerFactory<?, ?> fromCache(@Nullable KafkaListenerContainerFactory<?> factoryFromKafkaListenerAnnotation, Configuration config) { synchronized (this.cacheMap) { return this.cacheMap.get(cacheKey(factoryFromKafkaListenerAnnotation, config)); } } private Key cacheKey(@Nullable KafkaListenerContainerFactory<?> factoryFromKafkaListenerAnnotation, Configuration config) { return new Key(factoryFromKafkaListenerAnnotation, config); } static class Key { private final @Nullable KafkaListenerContainerFactory<?> factoryFromKafkaListenerAnnotation; private final Configuration config; Key(@Nullable KafkaListenerContainerFactory<?> factoryFromKafkaListenerAnnotation, Configuration config) { this.factoryFromKafkaListenerAnnotation = factoryFromKafkaListenerAnnotation; this.config = config; } @Override public boolean equals(Object o) { if (this == o) {
return true; } if (o == null || getClass() != o.getClass()) { return false; } Key key = (Key) o; return Objects.equals(this.factoryFromKafkaListenerAnnotation, key.factoryFromKafkaListenerAnnotation) && Objects.equals(this.config, key.config); } @Override public int hashCode() { return Objects.hash(this.factoryFromKafkaListenerAnnotation, this.config); } } } }
repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\retrytopic\ListenerContainerFactoryResolver.java
1
请完成以下Java代码
public int getS_ResourceType_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_S_ResourceType_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Endzeitpunkt. @param TimeSlotEnd Time when timeslot ends */ @Override public void setTimeSlotEnd (java.sql.Timestamp TimeSlotEnd) { set_Value (COLUMNNAME_TimeSlotEnd, TimeSlotEnd); } /** Get Endzeitpunkt. @return Time when timeslot ends */ @Override public java.sql.Timestamp getTimeSlotEnd () { return (java.sql.Timestamp)get_Value(COLUMNNAME_TimeSlotEnd); } /** Set Startzeitpunkt. @param TimeSlotStart Time when timeslot starts */ @Override public void setTimeSlotStart (java.sql.Timestamp TimeSlotStart) { set_Value (COLUMNNAME_TimeSlotStart, TimeSlotStart); } /** Get Startzeitpunkt. @return Time when timeslot starts */
@Override public java.sql.Timestamp getTimeSlotStart () { return (java.sql.Timestamp)get_Value(COLUMNNAME_TimeSlotStart); } /** 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_S_ResourceType.java
1
请完成以下Java代码
public <CollectedType> IQueryBuilder<CollectedType> andCollect( @NonNull final String columnName, @NonNull Class<CollectedType> collectedType) { final IQuery<T> query = create(); String tableName = InterfaceWrapperHelper.getTableNameOrNull(collectedType); Check.assumeNotEmpty(tableName, "TableName not found for column={} and collectedType={}", columnName, collectedType); final String keyColumnName = InterfaceWrapperHelper.getKeyColumnName(tableName); return new QueryBuilder<>(collectedType, null) // tableName=null .setContext(ctx, trxName) .addInSubQueryFilter(keyColumnName, columnName, query); } @Override public <ChildType> IQueryBuilder<ChildType> andCollectChildren( @NonNull final String linkColumnNameInChildTable, @NonNull final Class<ChildType> childType) { final String thisIDColumnName = getKeyColumnName(); final IQuery<T> thisQuery = create(); return new QueryBuilder<>(childType, null) // tableName=null .setContext(ctx, trxName) .addInSubQueryFilter(linkColumnNameInChildTable, thisIDColumnName, thisQuery); } @Override public IQueryBuilder<T> setJoinOr() { filters.setJoinOr(); return this; }
@Override public IQueryBuilder<T> setJoinAnd() { filters.setJoinAnd(); return this; } @Override public <TargetModelType> QueryAggregateBuilder<T, TargetModelType> aggregateOnColumn(final ModelColumn<T, TargetModelType> column) { return aggregateOnColumn(column.getColumnName(), column.getColumnModelType()); } @Override public <TargetModelType> QueryAggregateBuilder<T, TargetModelType> aggregateOnColumn(final String collectOnColumnName, final Class<TargetModelType> targetModelType) { return new QueryAggregateBuilder<>( this, collectOnColumnName, targetModelType); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\dao\impl\QueryBuilder.java
1
请完成以下Java代码
public class ShipmentCandidatesViewFactory implements IViewFactory { public static final String WINDOWID_String = "540674"; // FIXME: HARDCODED public static final WindowId WINDOWID = WindowId.fromJson(WINDOWID_String); private final IShipmentScheduleBL shipmentScheduleBL; private final ShipmentCandidateRowsRepository rowsRepo; public ShipmentCandidatesViewFactory( @NonNull final IShipmentScheduleBL shipmentScheduleBL, @NonNull final LookupDataSourceFactory lookupDataSourceFactory) { this.shipmentScheduleBL = shipmentScheduleBL; this.rowsRepo = ShipmentCandidateRowsRepository.builder() .shipmentScheduleBL(shipmentScheduleBL) .lookupDataSourceFactory(lookupDataSourceFactory) .build(); } @Override public ViewLayout getViewLayout(WindowId windowId, JSONViewDataType viewDataType, ViewProfileId profileId) { return ViewLayout.builder() .setWindowId(WINDOWID) .setCaption(Services.get(IMsgBL.class).translatable("M_ShipmentSchedule_ID")) .setAllowOpeningRowDetails(false) .allowViewCloseAction(ViewCloseAction.CANCEL)
.allowViewCloseAction(ViewCloseAction.DONE) .addElementsFromViewRowClass(ShipmentCandidateRow.class, viewDataType) .build(); } @Override public ShipmentCandidatesView createView(@NonNull final CreateViewRequest request) { final ViewId viewId = request.getViewId(); viewId.assertWindowId(WINDOWID); final Set<ShipmentScheduleId> shipmentScheduleIds = ShipmentScheduleId.fromIntSet(request.getFilterOnlyIds()); final ShipmentCandidateRows rows = rowsRepo.getByShipmentScheduleIds(shipmentScheduleIds); return ShipmentCandidatesView.builder() .shipmentScheduleBL(shipmentScheduleBL) // .viewId(viewId) .rows(rows) .build(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\shipment_candidates_editor\ShipmentCandidatesViewFactory.java
1
请完成以下Java代码
public BigDecimal getSalePriceOld() { return salePriceOld; } public void setSalePriceOld(BigDecimal salePriceOld) { this.salePriceOld = salePriceOld; } public BigDecimal getSalePriceNew() { return salePriceNew; } public void setSalePriceNew(BigDecimal salePriceNew) { this.salePriceNew = salePriceNew; } public Integer getGiftPointOld() { return giftPointOld; } public void setGiftPointOld(Integer giftPointOld) { this.giftPointOld = giftPointOld; } public Integer getGiftPointNew() { return giftPointNew; } public void setGiftPointNew(Integer giftPointNew) { this.giftPointNew = giftPointNew; } public Integer getUsePointLimitOld() { return usePointLimitOld; } public void setUsePointLimitOld(Integer usePointLimitOld) { this.usePointLimitOld = usePointLimitOld; } public Integer getUsePointLimitNew() { return usePointLimitNew; } public void setUsePointLimitNew(Integer usePointLimitNew) { this.usePointLimitNew = usePointLimitNew; } public String getOperateMan() { return operateMan; }
public void setOperateMan(String operateMan) { this.operateMan = operateMan; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); sb.append(", productId=").append(productId); sb.append(", priceOld=").append(priceOld); sb.append(", priceNew=").append(priceNew); sb.append(", salePriceOld=").append(salePriceOld); sb.append(", salePriceNew=").append(salePriceNew); sb.append(", giftPointOld=").append(giftPointOld); sb.append(", giftPointNew=").append(giftPointNew); sb.append(", usePointLimitOld=").append(usePointLimitOld); sb.append(", usePointLimitNew=").append(usePointLimitNew); sb.append(", operateMan=").append(operateMan); sb.append(", createTime=").append(createTime); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); } }
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\PmsProductOperateLog.java
1
请在Spring Boot框架中完成以下Java代码
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) { hints.resources().registerPattern("db/changelog/**"); } } /** * Adapts {@link LiquibaseProperties} to {@link LiquibaseConnectionDetails}. */ static final class PropertiesLiquibaseConnectionDetails implements LiquibaseConnectionDetails { private final LiquibaseProperties properties; PropertiesLiquibaseConnectionDetails(LiquibaseProperties properties) { this.properties = properties; } @Override public @Nullable String getUsername() { return this.properties.getUser(); } @Override public @Nullable String getPassword() { return this.properties.getPassword(); } @Override public @Nullable String getJdbcUrl() { return this.properties.getUrl(); } @Override public @Nullable String getDriverClassName() { String driverClassName = this.properties.getDriverClassName(); return (driverClassName != null) ? driverClassName : LiquibaseConnectionDetails.super.getDriverClassName();
} } @FunctionalInterface interface SpringLiquibaseCustomizer { /** * Customize the given {@link SpringLiquibase} instance. * @param springLiquibase the instance to configure */ void customize(SpringLiquibase springLiquibase); } }
repos\spring-boot-4.0.1\module\spring-boot-liquibase\src\main\java\org\springframework\boot\liquibase\autoconfigure\LiquibaseAutoConfiguration.java
2
请完成以下Java代码
public Collection<RuleChain> findByTenantIdAndTypeAndName(TenantId tenantId, RuleChainType type, String name) { return DaoUtil.convertDataList(ruleChainRepository.findByTenantIdAndTypeAndName(tenantId.getId(), type, name)); } @Override public List<RuleChain> findRuleChainsByTenantIdAndIds(UUID tenantId, List<UUID> ruleChainIds) { return DaoUtil.convertDataList(ruleChainRepository.findRuleChainsByTenantIdAndIdIn(tenantId, ruleChainIds)); } @Override public Long countByTenantId(TenantId tenantId) { return ruleChainRepository.countByTenantId(tenantId.getId()); } @Override public RuleChain findByTenantIdAndExternalId(UUID tenantId, UUID externalId) { return DaoUtil.getData(ruleChainRepository.findByTenantIdAndExternalId(tenantId, externalId)); } @Override public PageData<RuleChain> findByTenantId(UUID tenantId, PageLink pageLink) { return findRuleChainsByTenantId(tenantId, pageLink); } @Override public RuleChainId getExternalIdByInternal(RuleChainId internalId) { return Optional.ofNullable(ruleChainRepository.getExternalIdById(internalId.getId())) .map(RuleChainId::new).orElse(null); } @Override public RuleChain findDefaultEntityByTenantId(UUID tenantId) { return findRootRuleChainByTenantIdAndType(tenantId, RuleChainType.CORE); } @Override
public PageData<RuleChain> findAllByTenantId(TenantId tenantId, PageLink pageLink) { return findRuleChainsByTenantId(tenantId.getId(), pageLink); } @Override public List<EntityInfo> findByTenantIdAndResource(TenantId tenantId, String reference, int limit) { return ruleChainRepository.findRuleChainsByTenantIdAndResource(tenantId.getId(), reference, PageRequest.of(0, limit)); } @Override public List<EntityInfo> findByResource(String reference, int limit) { return ruleChainRepository.findRuleChainsByResource(reference, PageRequest.of(0, limit)); } @Override public List<RuleChainFields> findNextBatch(UUID id, int batchSize) { return ruleChainRepository.findNextBatch(id, Limit.of(batchSize)); } @Override public EntityType getEntityType() { return EntityType.RULE_CHAIN; } }
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\sql\rule\JpaRuleChainDao.java
1
请在Spring Boot框架中完成以下Java代码
public static void main(String[] args) throws Exception{ //String in1pathString = PosterUtil.class.getResource("/static/css/fonts/simkai.ttf").getFile(); //System.out.printf(in1pathString); test(); } public static byte[] test() throws IOException, IllegalAccessException, FontFormatException { // 测试注解, 这里读取图片如果不成功,请查看target 或者 out 目录下是否加载了资源。 如需使用,请引入spring core依赖 BufferedImage background = ImageIO.read(new URL("http://image.liuhaihua.cn/bg.jpg")); File file2= new File("/Users/liuhaihua/Downloads/2.jpg"); BufferedImage mainImage = ImageIO.read(file2); BufferedImage siteSlogon = ImageIO.read(new URL("http://image.liuhaihua.cn/site.jpg")); BufferedImage xx = ImageIO.read(new URL("http://image.liuhaihua.cn/xx.jpg")); File file5= new File("/Users/liuhaihua/IdeaProjects/springboot-demo/poster/src/main/resources/image/wx_300px.png"); BufferedImage qrcode = ImageIO.read(file5); SamplePoster poster = SamplePoster.builder() .backgroundImage(background)
.postQrcode(qrcode) .xuxian(xx) .siteSlogon(siteSlogon) .postTitle("Java generate poster in 5 miniutes") .postDate("2022年11月14日 pm1:23 Author:Harries") .posttitleDesc("Demand Background\u200B We often encounter such a demand in multi-terminal application development: when users browse products, they feel good and want to share them with friends. At this time, the terminal (Android, Apple, H5, etc.) generates a beautiful product poster and shares it with others through WeChat or other channels. You may also encounter the demand: make a personal business card and print it out or share it with others. The effect is probably like this: It may also be like this (the above pictures are all mine...") .mainImage(mainImage) .build(); PosterDefaultImpl<SamplePoster> impl = new PosterDefaultImpl<>(); BufferedImage test = impl.annotationDrawPoster(poster).draw(null); //ImageIO.write(test,"png",new FileOutputStream("/Users/liuhaihua/annTest.png")); ByteArrayOutputStream stream = new ByteArrayOutputStream(); ImageIO.write(test, "png", stream); return stream.toByteArray(); } }
repos\springboot-demo-master\poster\src\main\java\com\et\poster\service\PosterUtil.java
2
请在Spring Boot框架中完成以下Java代码
public static boolean equals(@Nullable final BPartnerInfo o1, @Nullable final BPartnerInfo o2) { return Objects.equals(o1, o2); } public DocumentLocation toDocumentLocation() { return DocumentLocation.builder() .bpartnerId(bpartnerId) .bpartnerLocationId(bpartnerLocationId) .contactId(contactId) .locationId(locationId) .build(); } public BPartnerInfo withLocationId(@Nullable final LocationId locationId) { return !LocationId.equals(this.locationId, locationId) ? toBuilder().locationId(locationId).build() : this; }
public BPartnerInfo withContactId(@Nullable final BPartnerContactId contactId) { return !BPartnerContactId.equals(this.contactId, contactId) ? toBuilder().contactId(contactId).build() : this; } public BPartnerLocationAndCaptureId toBPartnerLocationAndCaptureId() { if (bpartnerLocationId == null) { throw new AdempiereException("Cannot convert " + this + " to " + BPartnerLocationAndCaptureId.class.getSimpleName() + " because bpartnerLocationId is null"); } return BPartnerLocationAndCaptureId.of(bpartnerLocationId, locationId); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\bpartner\service\BPartnerInfo.java
2
请完成以下Java代码
public void setActive(final Boolean active) { this.active = active; this.activeSet = true; } public void setName(final String name) { this.name = name; this.nameSet = true; } public void setName2(final String name2) { this.name2 = name2; this.name2Set = true; } public void setName3(final String name3) { this.name3 = name3; this.name3Set = true; } public void setCompanyName(final String companyName) { this.companyName = companyName; this.companyNameSet = true; } public void setLookupLabel(@Nullable final String lookupLabel) { this.lookupLabel = lookupLabel; this.lookupLabelSet = true; } public void setVendor(final Boolean vendor) { this.vendor = vendor; this.vendorSet = true; } public void setCustomer(final Boolean customer) { this.customer = customer; this.customerSet = true; } public void setParentId(final JsonMetasfreshId parentId) { this.parentId = parentId; this.parentIdSet = true; } public void setPhone(final String phone) { this.phone = phone; this.phoneSet = true; } public void setLanguage(final String language) { this.language = language; this.languageSet = true; } public void setInvoiceRule(final JsonInvoiceRule invoiceRule) { this.invoiceRule = invoiceRule; this.invoiceRuleSet = true; } public void setPOInvoiceRule(final JsonInvoiceRule invoiceRule) { this.poInvoiceRule = invoiceRule; this.poInvoiceRuleSet = true; } public void setUrl(final String url) { this.url = url; this.urlSet = true; } public void setUrl2(final String url2) { this.url2 = url2; this.url2Set = true;
} public void setUrl3(final String url3) { this.url3 = url3; this.url3Set = true; } public void setGroup(final String group) { this.group = group; this.groupSet = true; } public void setGlobalId(final String globalId) { this.globalId = globalId; this.globalIdset = true; } public void setSyncAdvise(final SyncAdvise syncAdvise) { this.syncAdvise = syncAdvise; this.syncAdviseSet = true; } public void setVatId(final String vatId) { this.vatId = vatId; this.vatIdSet = true; } public void setMemo(final String memo) { this.memo = memo; this.memoIsSet = true; } public void setPriceListId(@Nullable final JsonMetasfreshId priceListId) { if (JsonMetasfreshId.toValue(priceListId) != null) { this.priceListId = priceListId; this.priceListIdSet = true; } } }
repos\metasfresh-new_dawn_uat\misc\de-metas-common\de-metas-common-bpartner\src\main\java\de\metas\common\bpartner\v2\request\JsonRequestBPartner.java
1
请完成以下Java代码
String rewrite(String value, String regexp, String replacement) { return value.replaceAll(regexp, replacement.replace("$\\", "$")); } public static class Config extends AbstractGatewayFilterFactory.NameConfig { private @Nullable String regexp; private @Nullable String replacement; public @Nullable String getRegexp() { return regexp; } public Config setRegexp(String regexp) { this.regexp = regexp;
return this; } public @Nullable String getReplacement() { return replacement; } public Config setReplacement(String replacement) { this.replacement = replacement; return this; } } }
repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webflux\src\main\java\org\springframework\cloud\gateway\filter\factory\RewriteResponseHeaderGatewayFilterFactory.java
1
请完成以下Java代码
public LookupValuesList getParameterLookupValues(final String parameterName) { return parameters.getFieldLookupValues(parameterName); } @Override public LookupValuesPage getParameterLookupValuesForQuery(final String parameterName, final String query) { return parameters.getFieldLookupValuesForQuery(parameterName, query); } @Override public void processParameterValueChanges(final List<JSONDocumentChangedEvent> events, final ReasonSupplier reason) { parameters.processValueChanges(events, reason); } public void setCopies(final int copies) { parameters.processValueChange(PARAM_Copies, copies, ReasonSupplier.NONE, DocumentFieldLogicExpressionResultRevaluator.ALWAYS_RETURN_FALSE); } public PrintCopies getCopies() { return PrintCopies.ofInt(parameters.getFieldView(PARAM_Copies).getValueAsInt(0)); }
public AdProcessId getJasperProcess_ID() { final IDocumentFieldView field = parameters.getFieldViewOrNull(PARAM_AD_Process_ID); if (field != null) { final int processId = field.getValueAsInt(0); if (processId > 0) { return AdProcessId.ofRepoId(processId); } } return null; } public boolean isPrintPreview() { final IDocumentFieldView field = parameters.getFieldViewOrNull(PARAM_IsPrintPreview); if (field != null) { return field.getValueAsBoolean(); } return true; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\report\HUReportProcessInstance.java
1
请在Spring Boot框架中完成以下Java代码
private static class DataImportConfigsCollection { private final ImmutableMap<DataImportConfigId, DataImportConfig> configsById; private final ImmutableMap<String, DataImportConfig> configsByInternalName; public DataImportConfigsCollection(final Collection<DataImportConfig> configs) { configsById = Maps.uniqueIndex(configs, DataImportConfig::getId); configsByInternalName = configs.stream() .filter(config -> config.getInternalName() != null) .collect(GuavaCollectors.toImmutableMapByKey(DataImportConfig::getInternalName)); } public DataImportConfig getById(@NonNull final DataImportConfigId id) {
final DataImportConfig config = configsById.get(id); if (config == null) { throw new AdempiereException("@NotFound@ @C_DataConfig_ID@: " + id); } return config; } public Optional<DataImportConfig> getByInternalName(final String internalName) { Check.assumeNotEmpty(internalName, "internalName is not empty"); return Optional.ofNullable(configsByInternalName.get(internalName)); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\impexp\config\DataImportConfigRepository.java
2
请完成以下Java代码
public int getExternalSystem_Config_ID() { return get_ValueAsInt(COLUMNNAME_ExternalSystem_Config_ID); } @Override public void setHostKey (final @Nullable java.lang.String HostKey) { set_ValueNoCheck (COLUMNNAME_HostKey, HostKey); } @Override public java.lang.String getHostKey() { return get_ValueAsString(COLUMNNAME_HostKey); } @Override public void setIPP_URL (final @Nullable java.lang.String IPP_URL) { set_Value (COLUMNNAME_IPP_URL, IPP_URL); } @Override public java.lang.String getIPP_URL() { return get_ValueAsString(COLUMNNAME_IPP_URL); } @Override public void setName (final java.lang.String Name) { set_ValueNoCheck (COLUMNNAME_Name, Name); }
@Override public java.lang.String getName() { return get_ValueAsString(COLUMNNAME_Name); } /** * OutputType AD_Reference_ID=540632 * Reference name: OutputType */ public static final int OUTPUTTYPE_AD_Reference_ID=540632; /** Attach = Attach */ public static final String OUTPUTTYPE_Attach = "Attach"; /** Store = Store */ public static final String OUTPUTTYPE_Store = "Store"; /** Queue = Queue */ public static final String OUTPUTTYPE_Queue = "Queue"; /** Frontend = Frontend */ public static final String OUTPUTTYPE_Frontend = "Frontend"; @Override public void setOutputType (final java.lang.String OutputType) { set_Value (COLUMNNAME_OutputType, OutputType); } @Override public java.lang.String getOutputType() { return get_ValueAsString(COLUMNNAME_OutputType); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.printing\de.metas.printing.base\src\main\java-gen\de\metas\printing\model\X_AD_PrinterHW.java
1
请完成以下Java代码
public CaseSentryPartQueryImpl orderBySentryId() { orderBy(CaseSentryPartQueryProperty.SENTRY_ID); return this; } public CaseSentryPartQueryImpl orderBySource() { orderBy(CaseSentryPartQueryProperty.SOURCE); return this; } // results //////////////////////////////////////////// public long executeCount(CommandContext commandContext) { checkQueryOk(); return commandContext .getCaseSentryPartManager() .findCaseSentryPartCountByQueryCriteria(this); } public List<CaseSentryPartEntity> executeList(CommandContext commandContext, Page page) { checkQueryOk(); List<CaseSentryPartEntity> result = commandContext .getCaseSentryPartManager() .findCaseSentryPartByQueryCriteria(this, page); return result; } // getters ///////////////////////////////////////////// public String getId() { return id; } public String getCaseInstanceId() { return caseInstanceId; } public String getCaseExecutionId() { return caseExecutionId; }
public String getSentryId() { return sentryId; } public String getType() { return type; } public String getSourceCaseExecutionId() { return sourceCaseExecutionId; } public String getStandardEvent() { return standardEvent; } public String getVariableEvent() { return variableEvent; } public String getVariableName() { return variableName; } public boolean isSatisfied() { return satisfied; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmmn\entity\runtime\CaseSentryPartQueryImpl.java
1
请在Spring Boot框架中完成以下Java代码
public class OrderEntity { @PrimaryKey private UUID id; private OrderStatus status; private List<OrderItemEntity> orderItemEntities; private BigDecimal price; public OrderEntity(UUID id, OrderStatus status, List<OrderItemEntity> orderItemEntities, BigDecimal price) { this.id = id; this.status = status; this.orderItemEntities = orderItemEntities; this.price = price; } public OrderEntity() { } public OrderEntity(Order order) { this.id = order.getId(); this.price = order.getPrice(); this.status = order.getStatus(); this.orderItemEntities = order.getOrderItems() .stream() .map(OrderItemEntity::new) .collect(Collectors.toList()); } public Order toOrder() { List<OrderItem> orderItems = orderItemEntities.stream() .map(OrderItemEntity::toOrderItem) .collect(Collectors.toList()); List<Product> namelessProducts = orderItems.stream() .map(orderItem -> new Product(orderItem.getProductId(), orderItem.getPrice(), "")) .collect(Collectors.toList()); Order order = new Order(id, namelessProducts.remove(0)); namelessProducts.forEach(product -> order.addOrder(product)); if (status == OrderStatus.COMPLETED) {
order.complete(); } return order; } public UUID getId() { return id; } public OrderStatus getStatus() { return status; } public List<OrderItemEntity> getOrderItems() { return orderItemEntities; } public BigDecimal getPrice() { return price; } }
repos\tutorials-master\patterns-modules\ddd\src\main\java\com\baeldung\dddhexagonalspring\infrastracture\repository\cassandra\OrderEntity.java
2
请完成以下Java代码
public Map<DocumentId, ShipmentCandidateRow> getDocumentId2TopLevelRows() { return rowIds.stream() .map(rowsById::get) .collect(GuavaCollectors.toImmutableMapByKey(ShipmentCandidateRow::getId)); } @Override public DocumentIdsSelection getDocumentIdsToInvalidate(final TableRecordReferenceSet recordRefs) { return DocumentIdsSelection.EMPTY; } @Override public void invalidateAll() { // nothing } @Override public void patchRow( final RowEditingContext ctx, final List<JSONDocumentChangedEvent> fieldChangeRequests) { final ShipmentCandidateRowUserChangeRequest userChanges = toUserChangeRequest(fieldChangeRequests); changeRow(ctx.getRowId(), row -> row.withChanges(userChanges)); } private static ShipmentCandidateRowUserChangeRequest toUserChangeRequest(@NonNull final List<JSONDocumentChangedEvent> fieldChangeRequests) { Check.assumeNotEmpty(fieldChangeRequests, "fieldChangeRequests is not empty"); final ShipmentCandidateRowUserChangeRequestBuilder builder = ShipmentCandidateRowUserChangeRequest.builder(); for (final JSONDocumentChangedEvent fieldChangeRequest : fieldChangeRequests) { final String fieldName = fieldChangeRequest.getPath(); if (ShipmentCandidateRow.FIELD_qtyToDeliverUserEntered.equals(fieldName)) { builder.qtyToDeliverUserEntered(fieldChangeRequest.getValueAsBigDecimal()); } else if (ShipmentCandidateRow.FIELD_qtyToDeliverCatchOverride.equals(fieldName)) { builder.qtyToDeliverCatchOverride(fieldChangeRequest.getValueAsBigDecimal()); } else if (ShipmentCandidateRow.FIELD_asi.equals(fieldName)) { builder.asi(fieldChangeRequest.getValueAsIntegerLookupValue()); } } return builder.build(); }
private void changeRow( @NonNull final DocumentId rowId, @NonNull final UnaryOperator<ShipmentCandidateRow> mapper) { if (!rowIds.contains(rowId)) { throw new EntityNotFoundException(rowId.toJson()); } rowsById.compute(rowId, (key, oldRow) -> { if (oldRow == null) { throw new EntityNotFoundException(rowId.toJson()); } return mapper.apply(oldRow); }); } Optional<ShipmentScheduleUserChangeRequestsList> createShipmentScheduleUserChangeRequestsList() { final ImmutableList<ShipmentScheduleUserChangeRequest> userChanges = rowsById.values() .stream() .map(row -> row.createShipmentScheduleUserChangeRequest().orElse(null)) .filter(Objects::nonNull) .collect(ImmutableList.toImmutableList()); return !userChanges.isEmpty() ? Optional.of(ShipmentScheduleUserChangeRequestsList.of(userChanges)) : Optional.empty(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\shipment_candidates_editor\ShipmentCandidateRows.java
1
请完成以下Java代码
static void setUseFrameworkRetry(boolean useFrameworkRetry) { RetryFilterFunctions.useFrameworkRetry = useFrameworkRetry; } /** * If spring retry is on the classpath and we do not force the use of Framework retry * then we will use Spring Retry. */ private static boolean useSpringRetry() { boolean useSpringRetry = USE_SPRING_RETRY && !useFrameworkRetry; if (log.isDebugEnabled()) { log.debug(LogMessage.format( "Retry filter selection: Spring Retry on classpath=%s, useFrameworkRetry=%s, selected filter=%s", USE_SPRING_RETRY, useFrameworkRetry, useSpringRetry ? "GatewayRetryFilterFunctions" : "FrameworkRetryFilterFunctions")); } return useSpringRetry; } public static class FilterSupplier extends SimpleFilterSupplier { public FilterSupplier() { super(RetryFilterFunctions.class); } } public static class RetryConfig { private int retries = 3; private Set<HttpStatus.Series> series = new HashSet<>(List.of(HttpStatus.Series.SERVER_ERROR)); private Set<Class<? extends Throwable>> exceptions = new HashSet<>( List.of(IOException.class, TimeoutException.class, RetryException.class)); private Set<HttpMethod> methods = new HashSet<>(List.of(HttpMethod.GET)); private boolean cacheBody = false; public int getRetries() { return retries; } public RetryConfig setRetries(int retries) { this.retries = retries; return this; } public Set<HttpStatus.Series> getSeries() { return series; } public RetryConfig setSeries(Set<HttpStatus.Series> series) { this.series = series; return this; } public RetryConfig addSeries(HttpStatus.Series... series) { this.series.addAll(Arrays.asList(series)); return this; } public Set<Class<? extends Throwable>> getExceptions() { return exceptions; } public RetryConfig setExceptions(Set<Class<? extends Throwable>> exceptions) { this.exceptions = exceptions; return this; } public RetryConfig addExceptions(Class<? extends Throwable>... exceptions) { this.exceptions.addAll(Arrays.asList(exceptions)); return this; } public Set<HttpMethod> getMethods() { return methods; } public RetryConfig setMethods(Set<HttpMethod> methods) { this.methods = methods; return this;
} public RetryConfig addMethods(HttpMethod... methods) { this.methods.addAll(Arrays.asList(methods)); return this; } public boolean isCacheBody() { return cacheBody; } public RetryConfig setCacheBody(boolean cacheBody) { this.cacheBody = cacheBody; return this; } } public static class RetryException extends NestedRuntimeException { private final ServerRequest request; private final ServerResponse response; RetryException(ServerRequest request, ServerResponse response) { super(null); this.request = request; this.response = response; } public ServerRequest getRequest() { return request; } public ServerResponse getResponse() { return response; } } }
repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webmvc\src\main\java\org\springframework\cloud\gateway\server\mvc\filter\RetryFilterFunctions.java
1
请在Spring Boot框架中完成以下Java代码
private I_AD_Workflow getTargetWorkflow() { return Check.assumeNotNull(getParentModel(I_AD_Workflow.class), "target workflow is not null"); } private void cloneWFNodeProductsForWFNode(@NonNull final I_AD_WF_Node toWFNode, @NonNull final I_AD_WF_Node fromWFNode) { getWFNodeProductsByWorkflowIdAndWFNodeId(WorkflowId.ofRepoId(fromWFNode.getAD_Workflow_ID()), WFNodeId.ofRepoId(fromWFNode.getAD_WF_Node_ID())) .forEach(wfNodeProduct -> cloneWFNodeProductAndSetNewWorkflowAndWFNode(wfNodeProduct, WFNodeId.ofRepoId(toWFNode.getAD_WF_Node_ID()), WorkflowId.ofRepoId(toWFNode.getAD_Workflow_ID()))); } public ImmutableList<I_PP_WF_Node_Product> getWFNodeProductsByWorkflowIdAndWFNodeId( @NonNull final WorkflowId fromWorkflowId, @NonNull final WFNodeId fromWFNodeId) { return queryBL.createQueryBuilder(I_PP_WF_Node_Product.class) .addEqualsFilter(I_PP_WF_Node_Product.COLUMNNAME_AD_Workflow_ID, fromWorkflowId.getRepoId()) .addEqualsFilter(I_PP_WF_Node_Product.COLUMNNAME_AD_WF_Node_ID, fromWFNodeId.getRepoId()) .create()
.stream() .collect(ImmutableList.toImmutableList()); } private void cloneWFNodeProductAndSetNewWorkflowAndWFNode( final @NonNull I_PP_WF_Node_Product wfNodeProduct, final @NonNull WFNodeId toWFNodeId, final @NonNull WorkflowId toWorkflowId) { final I_PP_WF_Node_Product newWFNodeProduct = InterfaceWrapperHelper.newInstance(I_PP_WF_Node_Product.class); InterfaceWrapperHelper.copyValues(wfNodeProduct, newWFNodeProduct); newWFNodeProduct.setAD_WF_Node_ID(toWFNodeId.getRepoId()); newWFNodeProduct.setAD_Workflow_ID(toWorkflowId.getRepoId()); InterfaceWrapperHelper.saveRecord(newWFNodeProduct); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\workflow\service\impl\AD_WF_Node_CopyRecordSupport.java
2
请完成以下Java代码
public class DeleteAttachmentCmd implements Command<Object>, Serializable { private static final long serialVersionUID = 1L; protected String attachmentId; public DeleteAttachmentCmd(String attachmentId) { this.attachmentId = attachmentId; } public Object execute(CommandContext commandContext) { AttachmentEntity attachment = commandContext.getAttachmentEntityManager().findById(attachmentId); String processInstanceId = attachment.getProcessInstanceId(); String processDefinitionId = null; if (attachment.getProcessInstanceId() != null) { ExecutionEntity process = commandContext.getExecutionEntityManager().findById(processInstanceId); if (process != null) { processDefinitionId = process.getProcessDefinitionId(); } } executeInternal(commandContext, attachment, processInstanceId, processDefinitionId); return null; } protected void executeInternal( CommandContext commandContext, AttachmentEntity attachment, String processInstanceId, String processDefinitionId ) { commandContext.getAttachmentEntityManager().delete(attachment, false); if (attachment.getContentId() != null) {
commandContext.getByteArrayEntityManager().deleteByteArrayById(attachment.getContentId()); } if (attachment.getTaskId() != null) { commandContext .getHistoryManager() .createAttachmentComment( attachment.getTaskId(), attachment.getProcessInstanceId(), attachment.getName(), false ); } if (commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) { commandContext .getProcessEngineConfiguration() .getEventDispatcher() .dispatchEvent( ActivitiEventBuilder.createEntityEvent( ActivitiEventType.ENTITY_DELETED, attachment, processInstanceId, processInstanceId, processDefinitionId ) ); } } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\cmd\DeleteAttachmentCmd.java
1
请完成以下Java代码
public int getCM_Ad_Cat_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_CM_Ad_Cat_ID); if (ii == null) return 0; return ii.intValue(); } public I_CM_WebProject getCM_WebProject() throws RuntimeException { return (I_CM_WebProject)MTable.get(getCtx(), I_CM_WebProject.Table_Name) .getPO(getCM_WebProject_ID(), get_TrxName()); } /** Set Web Project. @param CM_WebProject_ID A web project is the main data container for Containers, URLs, Ads, Media etc. */ public void setCM_WebProject_ID (int CM_WebProject_ID) { if (CM_WebProject_ID < 1) set_Value (COLUMNNAME_CM_WebProject_ID, null); else set_Value (COLUMNNAME_CM_WebProject_ID, Integer.valueOf(CM_WebProject_ID)); } /** Get Web Project. @return A web project is the main data container for Containers, URLs, Ads, Media etc. */ public int getCM_WebProject_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_CM_WebProject_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Description. @param Description Optional short description of the record */ public void setDescription (String Description) { set_Value (COLUMNNAME_Description, Description); } /** Get Description. @return Optional short description of the record */
public String getDescription () { return (String)get_Value(COLUMNNAME_Description); } /** Set Comment/Help. @param Help Comment or Hint */ public void setHelp (String Help) { set_Value (COLUMNNAME_Help, Help); } /** Get Comment/Help. @return Comment or Hint */ public String getHelp () { return (String)get_Value(COLUMNNAME_Help); } /** Set Name. @param Name Alphanumeric identifier of the entity */ public void setName (String Name) { set_Value (COLUMNNAME_Name, Name); } /** Get Name. @return Alphanumeric identifier of the entity */ public String getName () { return (String)get_Value(COLUMNNAME_Name); } /** Get Record ID/ColumnName @return ID/ColumnName pair */ public KeyNamePair getKeyNamePair() { return new KeyNamePair(get_ID(), getName()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_CM_Ad_Cat.java
1
请在Spring Boot框架中完成以下Java代码
public static class SslEnvironmentPostProcessor implements EnvironmentPostProcessor { @Override public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { Optional.of(environment) .filter(this::isEnabled) .filter(SslAutoConfiguration::isSslNotConfigured) .map(SslAutoConfiguration::resolveTrustedKeyStore) .filter(StringUtils::hasText) .ifPresent(trustedKeyStore -> configureSsl(environment, trustedKeyStore)); } private PropertySource<?> newPropertySource(String name, Properties properties) { return new PropertiesPropertySource(name, properties); } private boolean isEnabled(Environment environment) { return environment.getProperty(SECURITY_SSL_ENVIRONMENT_POST_PROCESSOR_ENABLED_PROPERTY, Boolean.class, true); } private void configureSsl(ConfigurableEnvironment environment, String trustedKeyStore) { Properties gemfireSslProperties = new Properties(); gemfireSslProperties.setProperty(SECURITY_SSL_KEYSTORE_PROPERTY, trustedKeyStore); gemfireSslProperties.setProperty(SECURITY_SSL_TRUSTSTORE_PROPERTY, trustedKeyStore); environment.getPropertySources() .addFirst(newPropertySource(GEMFIRE_SSL_PROPERTY_SOURCE_NAME, gemfireSslProperties)); } } static class EnableSslCondition extends AllNestedConditions { public EnableSslCondition() { super(ConfigurationPhase.PARSE_CONFIGURATION); } @ConditionalOnProperty(name = SECURITY_SSL_ENVIRONMENT_POST_PROCESSOR_ENABLED_PROPERTY, havingValue = "true", matchIfMissing = true) static class SpringBootDataGemFireSecuritySslEnvironmentPostProcessorEnabled { } @Conditional(SslTriggersCondition.class) static class AnySslTriggerCondition { }
} static class SslTriggersCondition extends AnyNestedCondition { public SslTriggersCondition() { super(ConfigurationPhase.PARSE_CONFIGURATION); } @Conditional(TrustedKeyStoreIsPresentCondition.class) static class TrustedKeyStoreCondition { } @ConditionalOnProperty(prefix = SECURITY_SSL_PROPERTY_PREFIX, name = { "keystore", "truststore" }) static class SpringDataGemFireSecuritySslKeyStoreAndTruststorePropertiesSet { } @ConditionalOnProperty(SECURITY_SSL_USE_DEFAULT_CONTEXT) static class SpringDataGeodeSslUseDefaultContextPropertySet { } @ConditionalOnProperty({ GEMFIRE_SSL_KEYSTORE_PROPERTY, GEMFIRE_SSL_TRUSTSTORE_PROPERTY }) static class ApacheGeodeSslKeyStoreAndTruststorePropertiesSet { } } static class TrustedKeyStoreIsPresentCondition implements Condition { @Override public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { Environment environment = context.getEnvironment(); return locateKeyStoreInClassPath(environment).isPresent() || locateKeyStoreInFileSystem(environment).isPresent() || locateKeyStoreInUserHome(environment).isPresent(); } } }
repos\spring-boot-data-geode-main\spring-geode-project\spring-geode-autoconfigure\src\main\java\org\springframework\geode\boot\autoconfigure\SslAutoConfiguration.java
2
请完成以下Java代码
public DmnHistoricDecisionExecutionQuery withoutTenantId() { this.withoutTenantId = true; return this; } // sorting //////////////////////////////////////////// @Override public DmnHistoricDecisionExecutionQuery orderByStartTime() { return orderBy(HistoricDecisionExecutionQueryProperty.START_TIME); } @Override public DmnHistoricDecisionExecutionQuery orderByEndTime() { return orderBy(HistoricDecisionExecutionQueryProperty.END_TIME); } @Override public DmnHistoricDecisionExecutionQuery orderByTenantId() { return orderBy(HistoricDecisionExecutionQueryProperty.TENANT_ID); } // results //////////////////////////////////////////// @Override public long executeCount(CommandContext commandContext) { return CommandContextUtil.getHistoricDecisionExecutionEntityManager().findHistoricDecisionExecutionCountByQueryCriteria(this); } @Override public List<DmnHistoricDecisionExecution> executeList(CommandContext commandContext) { return CommandContextUtil.getHistoricDecisionExecutionEntityManager().findHistoricDecisionExecutionsByQueryCriteria(this); } @Override public void delete() { if (commandExecutor != null) { commandExecutor.execute(new DeleteHistoricDecisionExecutionsByQueryCmd(this)); } else { new DeleteHistoricDecisionExecutionsByQueryCmd(this).execute(Context.getCommandContext()); } } @Override @Deprecated public void deleteWithRelatedData() { delete(); } // getters //////////////////////////////////////////// @Override public String getId() { return id; } public Set<String> getIds() { return ids; } public String getDecisionDefinitionId() { return decisionDefinitionId; } public String getDeploymentId() { return deploymentId; } public String getDecisionKey() { return decisionKey; } public String getInstanceId() { return instanceId; }
public String getExecutionId() { return executionId; } public String getActivityId() { return activityId; } public String getScopeType() { return scopeType; } public boolean isWithoutScopeType() { return withoutScopeType; } public String getProcessInstanceIdWithChildren() { return processInstanceIdWithChildren; } public String getCaseInstanceIdWithChildren() { return caseInstanceIdWithChildren; } public Boolean getFailed() { return failed; } public String getTenantId() { return tenantId; } public String getTenantIdLike() { return tenantIdLike; } public boolean isWithoutTenantId() { return withoutTenantId; } }
repos\flowable-engine-main\modules\flowable-dmn-engine\src\main\java\org\flowable\dmn\engine\impl\HistoricDecisionExecutionQueryImpl.java
1
请在Spring Boot框架中完成以下Java代码
public static int createShipment(ShippingRequest shippingRequest) { String orderId = shippingRequest.getOrderId(); Shipment shipment = new Shipment(); shipment.setOrderId(orderId); shipment.setDeliveryAddress(shippingRequest.getDeliveryAddress()); shipment.setDeliveryInstructions(shippingRequest.getDeliveryInstructions()); int driverId = findDriver(); shipment.setDriverId(driverId); if (!shipmentDAO.insertShipment(shipment)) { log.error("Shipment creation for order {} failed.", orderId); return 0; } Driver driver = new Driver(); driver.setName(""); shipmentDAO.readDriver(driverId, driver); if (driver.getName().isBlank()) { log.error("Shipment creation for order {} failed as driver in the area is not available.", orderId); shipmentDAO.cancelShipment(orderId); return 0; }
else { log.info("Assigned driver {} to order with id: {}", driverId, orderId); shipmentDAO.confirmShipment(orderId); } return driverId; } public static void cancelDelivery(String orderId) { shipmentDAO.cancelShipment(orderId); } private static int findDriver() { Random random = new Random(); int driverId = 0; int counter = 0; while (counter < 10) { driverId = random.nextInt(4); if(driverId !=0) break; counter += 1; } return driverId; } }
repos\tutorials-master\microservices-modules\saga-pattern\src\main\java\io\orkes\example\saga\service\ShipmentService.java
2
请完成以下Java代码
private void validateCandidateOutOfTrx(@NonNull final I_C_OLCand candidate) { olCandValidatorService.setValidationProcessInProgress(true); try { final I_C_OLCand validatedOlCand = trxManager.callInNewTrx(() -> { final I_C_OLCand cand = olCandValidatorService.validate(candidate); saveRecord(cand); return cand; }); if (validatedOlCand.isError()) { throw new AdempiereException("Fail to validate candidate.") .appendParametersToMessage() .setParameter("C_OLCand_ID", candidate.getC_OLCand_ID()); } } finally { olCandValidatorService.setValidationProcessInProgress(false); } } @Nullable @VisibleForTesting I_C_Order getOrder() { return order; } private void setBPSalesRepIdToOrder(@NonNull final I_C_Order order, @NonNull final OLCand olCand) { switch (olCand.getAssignSalesRepRule()) { case Candidate: order.setC_BPartner_SalesRep_ID(BPartnerId.toRepoId(olCand.getSalesRepId()));
break; case BPartner: order.setC_BPartner_SalesRep_ID(BPartnerId.toRepoId(olCand.getSalesRepInternalId())); break; case CandidateFirst: final int salesRepInt = Optional.ofNullable(olCand.getSalesRepId()) .map(BPartnerId::getRepoId) .orElseGet(() -> BPartnerId.toRepoId(olCand.getSalesRepInternalId())); order.setC_BPartner_SalesRep_ID(salesRepInt); break; default: throw new AdempiereException("Unsupported SalesRepFrom type") .appendParametersToMessage() .setParameter("salesRepFrom", olCand.getAssignSalesRepRule()); } } private void setExternalBPartnerInfo(@NonNull final I_C_OrderLine orderLine, @NonNull final OLCand candidate) { orderLine.setExternalSeqNo(candidate.getLine()); final I_C_OLCand olCand = candidate.unbox(); orderLine.setBPartner_QtyItemCapacity(olCand.getQtyItemCapacity()); final UomId uomId = UomId.ofRepoIdOrNull(olCand.getC_UOM_ID()); if (uomId != null) { orderLine.setC_UOM_BPartner_ID(uomId.getRepoId()); orderLine.setQtyEnteredInBPartnerUOM(olCandEffectiveValuesBL.getEffectiveQtyEntered(olCand)); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.salescandidate.base\src\main\java\de\metas\ordercandidate\api\OLCandOrderFactory.java
1
请完成以下Java代码
public int getPeriodNo () { Integer ii = (Integer)get_Value(COLUMNNAME_PeriodNo); if (ii == null) return 0; return ii.intValue(); } /** Set Period Status. @param PeriodStatus Current state of this period */ public void setPeriodStatus (String PeriodStatus) { set_Value (COLUMNNAME_PeriodStatus, PeriodStatus); } /** Get Period Status. @return Current state of this period */ public String getPeriodStatus () { return (String)get_Value(COLUMNNAME_PeriodStatus); } /** Set Processed. @param Processed The document has been processed */ public void setProcessed (boolean Processed) { set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed)); } /** Get Processed. @return The document has been processed */ public boolean isProcessed () { Object oo = get_Value(COLUMNNAME_Processed); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false;
} /** Set Process Now. @param Processing Process Now */ public void setProcessing (boolean Processing) { set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing)); } /** Get Process Now. @return Process Now */ public boolean isProcessing () { Object oo = get_Value(COLUMNNAME_Processing); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Start Date. @param StartDate First effective day (inclusive) */ public void setStartDate (Timestamp StartDate) { set_Value (COLUMNNAME_StartDate, StartDate); } /** Get Start Date. @return First effective day (inclusive) */ public Timestamp getStartDate () { return (Timestamp)get_Value(COLUMNNAME_StartDate); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_HR_Period.java
1
请完成以下Java代码
private void createQuadrants() { Region region; for (int i = 0; i < 4; i++) { region = this.area.getQuadrant(i); quadTrees.add(new QuadTree(region)); } } public List<Point> search(Region searchRegion, List<Point> matches, String depthIndicator) { searchTraversePath = new StringBuilder(); if (matches == null) { matches = new ArrayList<Point>(); searchTraversePath.append(depthIndicator) .append("Search Boundary =") .append(searchRegion) .append("\n"); } if (!this.area.doesOverlap(searchRegion)) { return matches; } else { for (Point point : points) { if (searchRegion.containsPoint(point)) { searchTraversePath.append(depthIndicator) .append("Found match " + point) .append("\n"); matches.add(point); } } if (this.quadTrees.size() > 0) { for (int i = 0; i < 4; i++) { searchTraversePath.append(depthIndicator) .append("Q") .append(i) .append("-->") .append(quadTrees.get(i).area) .append("\n"); quadTrees.get(i) .search(searchRegion, matches, depthIndicator + "\t"); this.searchTraversePath.append(quadTrees.get(i) .printSearchTraversePath()); } }
} return matches; } public String printTree(String depthIndicator) { String str = ""; if (depthIndicator == "") { str += "Root-->" + area.toString() + "\n"; } for (Point point : points) { str += depthIndicator + point.toString() + "\n"; } for (int i = 0; i < quadTrees.size(); i++) { str += depthIndicator + "Q" + String.valueOf(i) + "-->" + quadTrees.get(i).area.toString() + "\n"; str += quadTrees.get(i) .printTree(depthIndicator + "\t"); } return str; } public String printSearchTraversePath() { return searchTraversePath.toString(); } }
repos\tutorials-master\algorithms-modules\algorithms-searching\src\main\java\com\baeldung\algorithms\quadtree\QuadTree.java
1
请完成以下Java代码
public class KerberosLdapContextSource extends DefaultSpringSecurityContextSource implements InitializingBean { private Configuration loginConfig; /** * Instantiates a new kerberos ldap context source. * @param url the url */ public KerberosLdapContextSource(String url) { super(url); } /** * Instantiates a new kerberos ldap context source. * @param urls the urls * @param baseDn the base dn */ public KerberosLdapContextSource(List<String> urls, String baseDn) { super(urls, baseDn); } @Override public void afterPropertiesSet() /* throws Exception */ { // org.springframework.ldap.core.support.AbstractContextSource in 4.x // doesn't throw Exception for its InitializingBean method, so // we had to remove it from here also. Addition to that // we need to catch super call and re-throw. try { super.afterPropertiesSet(); } catch (Exception ex) { throw new RuntimeException(ex); } Assert.notNull(this.loginConfig, "loginConfig must be specified"); } @SuppressWarnings("unchecked") @Override protected DirContext getDirContextInstance(final @SuppressWarnings("rawtypes") Hashtable environment) throws NamingException { environment.put(Context.SECURITY_AUTHENTICATION, "GSSAPI"); Subject serviceSubject = login(); final NamingException[] suppressedException = new NamingException[] { null }; DirContext dirContext = Subject.doAs(serviceSubject, new PrivilegedAction<>() { @Override public DirContext run() { try { return KerberosLdapContextSource.super.getDirContextInstance(environment); } catch (NamingException ex) { suppressedException[0] = ex; return null; } } });
if (suppressedException[0] != null) { throw suppressedException[0]; } return dirContext; } /** * The login configuration to get the serviceSubject from LoginContext * @param loginConfig the login config */ public void setLoginConfig(Configuration loginConfig) { this.loginConfig = loginConfig; } private Subject login() throws AuthenticationException { try { LoginContext lc = new LoginContext(KerberosLdapContextSource.class.getSimpleName(), null, null, this.loginConfig); lc.login(); return lc.getSubject(); } catch (LoginException ex) { AuthenticationException ae = new AuthenticationException(ex.getMessage()); ae.initCause(ex); throw ae; } } }
repos\spring-security-main\kerberos\kerberos-client\src\main\java\org\springframework\security\kerberos\client\ldap\KerberosLdapContextSource.java
1
请完成以下Java代码
public <T> T[] toArray(T[] a) { throw new UnsupportedOperationException(); } @Override public boolean add(Entry<String, V> stringVEntry) { throw new UnsupportedOperationException(); } @Override public boolean remove(Object o) { throw new UnsupportedOperationException(); } @Override public boolean containsAll(Collection<?> c) { throw new UnsupportedOperationException(); } @Override public boolean addAll(Collection<? extends Entry<String, V>> c) { throw new UnsupportedOperationException(); } @Override public boolean retainAll(Collection<?> c) { throw new UnsupportedOperationException(); }
@Override public boolean removeAll(Collection<?> c) { throw new UnsupportedOperationException(); } @Override public void clear() { MutableDoubleArrayTrie.this.clear(); } }; } @Override public Iterator<Entry<String, V>> iterator() { return entrySet().iterator(); } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\collection\trie\datrie\MutableDoubleArrayTrie.java
1
请完成以下Java代码
public List<IOParameter> getInParameters() { return inParameters; } @Override public void addInParameter(IOParameter inParameter) { if (inParameters == null) { inParameters = new ArrayList<>(); } inParameters.add(inParameter); } @Override public void setInParameters(List<IOParameter> inParameters) { this.inParameters = inParameters; } @Override public ScriptServiceTask clone() { ScriptServiceTask clone = new ScriptServiceTask(); clone.setValues(this);
return clone; } public void setValues(ScriptServiceTask otherElement) { super.setValues(otherElement); setDoNotIncludeVariables(otherElement.isDoNotIncludeVariables()); inParameters = null; if (otherElement.getInParameters() != null && !otherElement.getInParameters().isEmpty()) { inParameters = new ArrayList<>(); for (IOParameter parameter : otherElement.getInParameters()) { inParameters.add(parameter.clone()); } } } }
repos\flowable-engine-main\modules\flowable-cmmn-model\src\main\java\org\flowable\cmmn\model\ScriptServiceTask.java
1
请完成以下Java代码
protected void checkInvalidDefinitionId(String definitionId) { ensureNotNull("Invalid camunda form definition id", "camundaFormDefinitionId", definitionId); } @Override protected void checkDefinitionFound(String definitionId, CamundaFormDefinitionEntity definition) { ensureNotNull("no deployed camunda form definition found with id '" + definitionId + "'", "camundaFormDefinition", definition); } @Override protected void checkInvalidDefinitionByKey(String definitionKey, CamundaFormDefinitionEntity definition) { ensureNotNull("no deployed camunda form definition found with key '" + definitionKey + "'", "camundaFormDefinition", definition); } @Override protected void checkInvalidDefinitionByKeyAndTenantId(String definitionKey, String tenantId, CamundaFormDefinitionEntity definition) { ensureNotNull("no deployed camunda form definition found with key '" + definitionKey + "' and tenant-id '" + tenantId + "'", "camundaFormDefinition", definition); } @Override protected void checkInvalidDefinitionByKeyVersionAndTenantId(String definitionKey, Integer definitionVersion, String tenantId, CamundaFormDefinitionEntity definition) { ensureNotNull("no deployed camunda form definition found with key '" + definitionKey + "', version '" + definitionVersion
+ "' and tenant-id '" + tenantId + "'", "camundaFormDefinition", definition); } @Override protected void checkInvalidDefinitionByKeyVersionTagAndTenantId(String definitionKey, String definitionVersionTag, String tenantId, CamundaFormDefinitionEntity definition) { // version tag is currently not supported for CamundaFormDefinition } @Override protected void checkInvalidDefinitionByDeploymentAndKey(String deploymentId, String definitionKey, CamundaFormDefinitionEntity definition) { ensureNotNull("no deployed camunda form definition found with key '" + definitionKey + "' in deployment '" + deploymentId + "'", "camundaFormDefinition", definition); } @Override protected void checkInvalidDefinitionWasCached(String deploymentId, String definitionId, CamundaFormDefinitionEntity definition) { ensureNotNull("deployment '" + deploymentId + "' didn't put camunda form definition '" + definitionId + "' in the cache", "cachedProcessDefinition", definition); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\deploy\cache\CamundaFormDefinitionCache.java
1
请完成以下Java代码
public String getUOMSymbol(@NonNull final UomId uomId) { final I_C_UOM uom = uomsRepo.getById(uomId); return uom.getUOMSymbol(); } public List<I_C_BPartner_Product> getBPartnerProductRecords(Set<ProductId> productIds) { return partnerProductsRepo.retrieveForProductIds(productIds); } public JsonCreatedUpdatedInfo extractCreatedUpdatedInfo(final I_M_Product record) { return JsonCreatedUpdatedInfo.builder() .created(TimeUtil.asZonedDateTime(record.getCreated())) .createdBy(UserId.optionalOfRepoId(record.getCreatedBy()).orElse(UserId.SYSTEM)) .updated(TimeUtil.asZonedDateTime(record.getUpdated())) .updatedBy(UserId.optionalOfRepoId(record.getUpdatedBy()).orElse(UserId.SYSTEM)) .build(); } public Stream<I_M_Product_Category> streamAllProductCategories()
{ return productsRepo.streamAllProductCategories(); } public JsonCreatedUpdatedInfo extractCreatedUpdatedInfo(final I_M_Product_Category record) { return JsonCreatedUpdatedInfo.builder() .created(TimeUtil.asZonedDateTime(record.getCreated())) .createdBy(UserId.optionalOfRepoId(record.getCreatedBy()).orElse(UserId.SYSTEM)) .updated(TimeUtil.asZonedDateTime(record.getUpdated())) .updatedBy(UserId.optionalOfRepoId(record.getUpdatedBy()).orElse(UserId.SYSTEM)) .build(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\v1\product\ProductsServicesFacade.java
1
请完成以下Java代码
public void afterSessionsFlush(CommandContext commandContext) { // nothing to do } @Override public Integer order() { return 500; } @Override public boolean multipleAllowed() { return false; } public LoggingSession getLoggingSession() { return loggingSession; } public void setLoggingSession(LoggingSession loggingSession) { this.loggingSession = loggingSession;
} public LoggingListener getLoggingListener() { return loggingListener; } public void setLoggingListener(LoggingListener loggingListener) { this.loggingListener = loggingListener; } public String getEngineType() { return engineType; } public void setEngineType(String engineType) { this.engineType = engineType; } }
repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\logging\LoggingSessionCommandContextCloseListener.java
1
请完成以下Java代码
protected void handleConstraints(Process process, Activity activity, List<ValidationError> errors) { if (activity.getId() != null && activity.getId().length() > ID_MAX_LENGTH) { Map<String, String> params = new HashMap<>(); params.put("maxLength", String.valueOf(ID_MAX_LENGTH)); addError(errors, Problems.FLOW_ELEMENT_ID_TOO_LONG, process, activity, params); } } protected void handleMultiInstanceLoopCharacteristics( Process process, Activity activity, List<ValidationError> errors ) { MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = activity.getLoopCharacteristics(); if (multiInstanceLoopCharacteristics != null) { if ( StringUtils.isEmpty(multiInstanceLoopCharacteristics.getLoopCardinality()) && StringUtils.isEmpty(multiInstanceLoopCharacteristics.getInputDataItem()) ) { addError(errors, Problems.MULTI_INSTANCE_MISSING_COLLECTION, process, activity); } } } protected void handleDataAssociations(Process process, Activity activity, List<ValidationError> errors) { if (activity.getDataInputAssociations() != null) {
for (DataAssociation dataAssociation : activity.getDataInputAssociations()) { if (StringUtils.isEmpty(dataAssociation.getTargetRef())) { addError(errors, Problems.DATA_ASSOCIATION_MISSING_TARGETREF, process, activity); } } } if (activity.getDataOutputAssociations() != null) { for (DataAssociation dataAssociation : activity.getDataOutputAssociations()) { if (StringUtils.isEmpty(dataAssociation.getTargetRef())) { addError(errors, Problems.DATA_ASSOCIATION_MISSING_TARGETREF, process, activity); } } } } }
repos\Activiti-develop\activiti-core\activiti-process-validation\src\main\java\org\activiti\validation\validator\impl\FlowElementValidator.java
1
请完成以下Java代码
public abstract class AbstractReencryptMojo extends AbstractFileJasyptMojo { /** {@inheritDoc} */ protected void run(final EncryptionService newService, final Path path, String encryptPrefix, String encryptSuffix, String decryptPrefix, String decryptSuffix) throws MojoExecutionException { String decryptedContents = decrypt(path, encryptPrefix, encryptSuffix, decryptPrefix, decryptSuffix); log.info("Re-encrypting file " + path); try { String encryptedContents = newService.encrypt(decryptedContents, encryptPrefix, encryptSuffix, decryptPrefix, decryptSuffix); FileService.write(path, encryptedContents); } catch (Exception e) { throw new MojoExecutionException("Error Re-encrypting: " + e.getMessage(), e); } } private String decrypt(final Path path, String encryptPrefix, String encryptSuffix, String decryptPrefix, String decryptSuffix) throws MojoExecutionException { log.info("Decrypting file " + path); try { String contents = FileService.read(path); return getOldEncryptionService().decrypt(contents, encryptPrefix, encryptSuffix, decryptPrefix, decryptSuffix); } catch (Exception e) { throw new MojoExecutionException("Error Decrypting: " + e.getMessage(), e); } } private EncryptionService getOldEncryptionService() { JasyptEncryptorConfigurationProperties properties = new JasyptEncryptorConfigurationProperties();
configure(properties); StringEncryptor encryptor = new StringEncryptorBuilder(properties, "jasypt.plugin.old").build(); return new EncryptionService(encryptor); } /** * <p>configure.</p> * * @param properties a {@link com.ulisesbocchio.jasyptspringboot.properties.JasyptEncryptorConfigurationProperties} object */ protected abstract void configure(JasyptEncryptorConfigurationProperties properties); /** * <p>setIfNotNull.</p> * * @param setter a {@link java.util.function.Consumer} object * @param value a T object * @param <T> a T class */ protected <T> void setIfNotNull(Consumer<T> setter, T value) { if (value != null) { setter.accept(value); } } }
repos\jasypt-spring-boot-master\jasypt-maven-plugin\src\main\java\com\ulisesbocchio\jasyptmavenplugin\mojo\AbstractReencryptMojo.java
1
请在Spring Boot框架中完成以下Java代码
public List<IPackingItem> removeBySlot(@NonNull final PackingSlot slot) { return items.removeAll(slot); } public void removeUnpackedItem(@NonNull final IPackingItem itemToRemove) { final boolean removed = items.remove(PackingSlot.UNPACKED, itemToRemove); if (!removed) { throw new AdempiereException("Unpacked item " + itemToRemove + " was not found in: " + items.get(PackingSlot.UNPACKED)); } } /** * Append given <code>itemPacked</code> to existing packed items * * @param slot * @param packedItem */ public void appendPackedItem(@NonNull final PackingSlot slot, @NonNull final IPackingItem packedItem) { for (final IPackingItem item : items.get(slot)) { // add new item into the list only if is a real new item // NOTE: should be only one item with same grouping key if (PackingItemGroupingKey.equals(item.getGroupingKey(), packedItem.getGroupingKey())) { item.addParts(packedItem); return; } } // // No matching existing packed item where our item could be added was found // => add it here as a new item
addItem(slot, packedItem); } /** * * @return true if there exists at least one packed item */ public boolean hasPackedItems() { return streamPackedItems().findAny().isPresent(); } public boolean hasPackedItemsMatching(@NonNull final Predicate<IPackingItem> predicate) { return streamPackedItems().anyMatch(predicate); } public Stream<IPackingItem> streamPackedItems() { return items .entries() .stream() .filter(e -> !e.getKey().isUnpacked()) .map(e -> e.getValue()); } /** * * @return true if there exists at least one unpacked item */ public boolean hasUnpackedItems() { return !items.get(PackingSlot.UNPACKED).isEmpty(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\picking\service\PackingItemsMap.java
2
请完成以下Java代码
public static void removeJobExecutorContext() { jobExecutorContextThreadLocal.remove(); } public static ProcessApplicationReference getCurrentProcessApplication() { Deque<ProcessApplicationReference> stack = getStack(processApplicationContext); if(stack.isEmpty()) { return null; } else { return stack.peek(); } } public static void setCurrentProcessApplication(ProcessApplicationReference reference) { Deque<ProcessApplicationReference> stack = getStack(processApplicationContext); stack.push(reference); } public static void removeCurrentProcessApplication() { Deque<ProcessApplicationReference> stack = getStack(processApplicationContext); stack.pop(); } /** * Use {@link #executeWithinProcessApplication(Callable, ProcessApplicationReference, InvocationContext)} * instead if an {@link InvocationContext} is available. */ public static <T> T executeWithinProcessApplication(Callable<T> callback, ProcessApplicationReference processApplicationReference) { return executeWithinProcessApplication(callback, processApplicationReference, null); } public static <T> T executeWithinProcessApplication(Callable<T> callback, ProcessApplicationReference processApplicationReference, InvocationContext invocationContext) { String paName = processApplicationReference.getName(); try { ProcessApplicationInterface processApplication = processApplicationReference.getProcessApplication(); setCurrentProcessApplication(processApplicationReference); try { // wrap callback ProcessApplicationClassloaderInterceptor<T> wrappedCallback = new ProcessApplicationClassloaderInterceptor<T>(callback);
// execute wrapped callback return processApplication.execute(wrappedCallback, invocationContext); } catch (Exception e) { // unwrap exception if(e.getCause() != null && e.getCause() instanceof RuntimeException) { throw (RuntimeException) e.getCause(); }else { throw new ProcessEngineException("Unexpected exeption while executing within process application ", e); } } finally { removeCurrentProcessApplication(); } } catch (ProcessApplicationUnavailableException e) { throw new ProcessEngineException("Cannot switch to process application '"+paName+"' for execution: "+e.getMessage(), e); } } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\context\Context.java
1
请完成以下Java代码
public class Permission implements Serializable { private static final long serialVersionUID = 2079120477173696231L; private Integer id; private String name; private String permissionUrl; private String method; private String description; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPermissionUrl() { return permissionUrl; } public void setPermissionUrl(String permissionUrl) { this.permissionUrl = permissionUrl; } public String getMethod() { return method; }
public void setMethod(String method) { this.method = method; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } @Override public String toString() { return "Permission{" + "id=" + id + ", name=" + name + ", permissionUrl=" + permissionUrl + ", method=" + method + ", description=" + description + '}'; } }
repos\springBoot-master\springboot-dubbo\abel-user-api\src\main\java\cn\abel\user\models\Permission.java
1
请在Spring Boot框架中完成以下Java代码
public class EventController { @Autowired private EventService eventService; @RequestMapping(method = RequestMethod.GET) public List<Event> list(HttpServletRequest request) { return eventService.getByMap(null); } @RequestMapping(value = "/{id}", method = RequestMethod.GET) public Event detail(@PathVariable Integer id) { return eventService.getById(id); }
@RequestMapping(method = RequestMethod.POST) public Event create(@RequestBody Event event) { return eventService.create(event); } @RequestMapping(method = RequestMethod.PUT) public Event update(@RequestBody Event event) { return eventService.update(event); } @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) public int delete(@PathVariable Integer id) { return eventService.delete(id); } }
repos\springBoot-master\springboot-shiro\src\main\java\com\us\controller\EventController.java
2
请完成以下Java代码
public void setIsRfQResponseAccepted (boolean IsRfQResponseAccepted) { set_ValueNoCheck (COLUMNNAME_IsRfQResponseAccepted, Boolean.valueOf(IsRfQResponseAccepted)); } /** Get Responses Accepted. @return Are Resonses to the Request for Quotation accepted */ @Override public boolean isRfQResponseAccepted () { Object oo = get_Value(COLUMNNAME_IsRfQResponseAccepted); 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_ValueNoCheck (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); } /** * QuoteType AD_Reference_ID=314 * Reference name: C_RfQ QuoteType */ public static final int QUOTETYPE_AD_Reference_ID=314; /** Quote Total only = T */ public static final String QUOTETYPE_QuoteTotalOnly = "T"; /** Quote Selected Lines = S */ public static final String QUOTETYPE_QuoteSelectedLines = "S"; /** Quote All Lines = A */ public static final String QUOTETYPE_QuoteAllLines = "A"; /** Set RfQ Type. @param QuoteType Request for Quotation Type */ @Override public void setQuoteType (java.lang.String QuoteType) { set_ValueNoCheck (COLUMNNAME_QuoteType, QuoteType); } /** Get RfQ Type. @return Request for Quotation Type */ @Override public java.lang.String getQuoteType ()
{ return (java.lang.String)get_Value(COLUMNNAME_QuoteType); } @Override public org.compiere.model.I_AD_User getSalesRep() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_SalesRep_ID, org.compiere.model.I_AD_User.class); } @Override public void setSalesRep(org.compiere.model.I_AD_User SalesRep) { set_ValueFromPO(COLUMNNAME_SalesRep_ID, org.compiere.model.I_AD_User.class, SalesRep); } /** Set Aussendienst. @param SalesRep_ID Aussendienst */ @Override public void setSalesRep_ID (int SalesRep_ID) { if (SalesRep_ID < 1) set_ValueNoCheck (COLUMNNAME_SalesRep_ID, null); else set_ValueNoCheck (COLUMNNAME_SalesRep_ID, Integer.valueOf(SalesRep_ID)); } /** Get Aussendienst. @return Aussendienst */ @Override public int getSalesRep_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_SalesRep_ID); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.rfq\src\main\java-gen\de\metas\rfq\model\X_RV_C_RfQ_UnAnswered.java
1
请完成以下Java代码
public class HistoricBatchResourceImpl implements HistoricBatchResource { protected ProcessEngine processEngine; protected String batchId; public HistoricBatchResourceImpl(ProcessEngine processEngine, String batchId) { this.processEngine = processEngine; this.batchId = batchId; } public HistoricBatchDto getHistoricBatch() { HistoricBatch batch = processEngine.getHistoryService() .createHistoricBatchQuery() .batchId(batchId) .singleResult(); if (batch == null) { throw new InvalidRequestException(Status.NOT_FOUND, "Historic batch with id '" + batchId + "' does not exist"); }
return HistoricBatchDto.fromBatch(batch); } public void deleteHistoricBatch() { try { processEngine.getHistoryService() .deleteHistoricBatch(batchId); } catch (BadUserRequestException e) { throw new InvalidRequestException(Status.BAD_REQUEST, e, "Unable to delete historic batch with id '" + batchId + "'"); } } }
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\sub\history\impl\HistoricBatchResourceImpl.java
1
请完成以下Java代码
private MEXPFormat fetchExportFormat(final Properties ctx, final String exportFormatName, final String trxName) { MEXPFormat expFormat = MEXPFormat.getFormatByValueAD_Client_IDAndVersion(ctx, exportFormatName, expClientId.getRepoId(), "*", // version trxName); if (expFormat == null) { expFormat = MEXPFormat.getFormatByValueAD_Client_IDAndVersion(ctx, exportFormatName, 0, // AD_Client_ID "*", // version trxName); } if (expFormat == null) { throw new AdempiereException("@NotFound@ @EXP_Format_ID@ (@Value@: " + exportFormatName + ")");
} return expFormat; } @Override public T getDocument() { return document; } @Override public final String getTableIdentifier() { return tableIdentifier; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.edi\src\main\java\de\metas\edi\process\export\impl\AbstractExport.java
1
请完成以下Java代码
public class BaseResponse<T> { /** * 是否成功 */ private boolean success; /** * 说明 */ private String msg; /** * 返回数据 */ private T data; public BaseResponse() { } public BaseResponse(boolean success, String msg, T data) { this.success = success; this.msg = msg; this.data = data; }
public boolean isSuccess() { return success; } public void setSuccess(boolean success) { this.success = success; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public T getData() { return data; } public void setData(T data) { this.data = data; } }
repos\SpringBootBucket-master\springboot-echarts\src\main\java\com\xncoding\echarts\api\model\BaseResponse.java
1
请完成以下Spring Boot application配置
server.port=8099 ms.db.driverClassName=com.mysql.jdbc.Driver ms.db.url=jdbc:mysql://localhost:3306/abeldb?sprepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&
allowMultiQueries=true ms.db.username=root ms.db.password=admin ms.db.maxActive=500
repos\springBoot-master\springboot-swagger-ui\src\main\resources\application.properties
2
请完成以下Java代码
public class ProcessDefinitionImpl extends ApplicationElementImpl implements ProcessDefinition { private String id; private String name; private String description; private int version; private String key; private String formKey; private String category; @Override public String getId() { return id; } public void setId(String id) { this.id = id; } @Override public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String getKey() { return key; } public void setKey(String key) { this.key = key; } @Override public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } @Override public int getVersion() { return version; } public void setVersion(int version) { this.version = version; } @Override public String getFormKey() { return formKey; } public void setFormKey(String formKey) { this.formKey = formKey; } @Override public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } @Override
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } ProcessDefinitionImpl that = (ProcessDefinitionImpl) o; return ( version == that.version && Objects.equals(id, that.id) && Objects.equals(name, that.name) && Objects.equals(description, that.description) && Objects.equals(key, that.key) && Objects.equals(formKey, that.formKey) ); } @Override public int hashCode() { return Objects.hash(super.hashCode(), id, name, description, version, key, formKey); } @Override public String toString() { return ( "ProcessDefinition{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", key='" + key + '\'' + ", description='" + description + '\'' + ", formKey='" + formKey + '\'' + ", version=" + version + '}' ); } }
repos\Activiti-develop\activiti-core\activiti-api-impl\activiti-api-process-model-impl\src\main\java\org\activiti\api\runtime\model\impl\ProcessDefinitionImpl.java
1
请在Spring Boot框架中完成以下Java代码
public class WEBUI_M_HU_MoveToDirectWarehouse_Mass extends HUEditorProcessTemplate { // services private final transient IHandlingUnitsDAO handlingUnitsDAO = Services.get(IHandlingUnitsDAO.class); @Autowired private DocumentCollection documentsCollection; // parameters private int p_M_Warehouse_ID = -1; // the source warehouse private String p_huWhereClause = null; private Instant p_MovementDate = null; private String p_Description = null; @Override protected void prepare() { final IRangeAwareParams parameterAsIParams = getParameterAsIParams(); p_M_Warehouse_ID = parameterAsIParams.getParameterAsInt("M_Warehouse_ID", -1); p_huWhereClause = parameterAsIParams.getParameterAsString("WhereClause"); p_MovementDate = parameterAsIParams.getParameterAsInstant("MovementDate"); p_Description = parameterAsIParams.getParameterAsString("Description"); } @Override @RunOutOfTrx protected final String doIt() { HUMoveToDirectWarehouseService.newInstance() .setDocumentsCollection(documentsCollection) .setHUView(getView()) .setMovementDate(p_MovementDate) .setDescription(p_Description) .setFailOnFirstError(false) .setLoggable(this) .move(retrieveHUs());
return MSG_OK; } /** * @return HUs that will be moved */ protected Iterator<I_M_HU> retrieveHUs() { final IHUQueryBuilder huQueryBuilder = handlingUnitsDAO.createHUQueryBuilder() .setContext(getCtx(), ITrx.TRXNAME_None); // Only top level HUs huQueryBuilder.setOnlyTopLevelHUs(); // Only Active HUs huQueryBuilder.addHUStatusToInclude(X_M_HU.HUSTATUS_Active); // Only for preselected warehouse if (p_M_Warehouse_ID > 0) { huQueryBuilder.addOnlyInWarehouseId(WarehouseId.ofRepoId(p_M_Warehouse_ID)); } // Only for given SQL where clause if (!Check.isEmpty(p_huWhereClause, true)) { huQueryBuilder.addFilter(TypedSqlQueryFilter.of(p_huWhereClause)); } // Fetch the HUs iterator return huQueryBuilder .createQuery() .setOption(IQuery.OPTION_GuaranteedIteratorRequired, true) // because we might change the hu's locator .setOption(IQuery.OPTION_IteratorBufferSize, 1000) .iterate(I_M_HU.class); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\process\WEBUI_M_HU_MoveToDirectWarehouse_Mass.java
2
请完成以下Java代码
private OrderCostTypeMap retrieveMap() { final ImmutableList<OrderCostType> list = queryBL.createQueryBuilder(I_C_Cost_Type.class) .addOnlyActiveRecordsFilter() .create() .stream() .map(OrderCostTypeRepository::fromRecord) .collect(ImmutableList.toImmutableList()); return new OrderCostTypeMap(list); } private static OrderCostType fromRecord(@NonNull final I_C_Cost_Type record) { return OrderCostType.builder() .id(OrderCostTypeId.ofRepoId(record.getC_Cost_Type_ID())) .code(record.getValue()) .name(record.getName()) .distributionMethod(CostDistributionMethod.ofCode(record.getCostDistributionMethod())) .calculationMethod(CostCalculationMethod.ofCode(record.getCostCalculationMethod())) .costElementId(CostElementId.ofRepoId(record.getM_CostElement_ID())) .invoiceableProductId(record.isAllowInvoicing() ? ProductId.ofRepoId(record.getM_Product_ID()) : null) .build(); } // //
// private static class OrderCostTypeMap { private final ImmutableMap<OrderCostTypeId, OrderCostType> byId; public OrderCostTypeMap(final ImmutableList<OrderCostType> list) { this.byId = Maps.uniqueIndex(list, OrderCostType::getId); } public OrderCostType getById(@NonNull final OrderCostTypeId id) { return Check.assumeNotNull(byId.get(id), "No cost type found for {}", id); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\order\costs\OrderCostTypeRepository.java
1
请完成以下Java代码
public class PlanItemDependencyUtil { /** * Returns all {@link PlanItem}s that are referenced by the onParts of the entry criteria of this {@link PlanItem}. */ public static List<PlanItem> getEntryDependencies(PlanItem planItem) { return getSourcePlanItems(planItem.getEntryCriteria()); } /** * Returns all {@link PlanItem}s that are referenced by the onParts of the exit criteria of this {@link PlanItem}. */ public static List<PlanItem> getExitDependencies(PlanItem planItem) { return getSourcePlanItems(planItem.getExitCriteria()); } protected static List<PlanItem> getSourcePlanItems(List<Criterion> criteria) { List<PlanItem> planItems = new ArrayList<>(); if (!criteria.isEmpty()) { for (Criterion entryCriterion : criteria) { Sentry sentry = entryCriterion.getSentry(); if (sentry.getOnParts() != null && !sentry.getOnParts().isEmpty()) { for (SentryOnPart sentryOnPart : sentry.getOnParts()) { planItems.add(sentryOnPart.getSource()); } } } } return planItems; } public static boolean isEntryDependency(PlanItem planItem, PlanItem dependency) { for (PlanItem entryDependency : planItem.getEntryDependencies()) { if (entryDependency.getId().equals(dependency.getId())) {
return true; } } return false; } public static boolean isExitDependency(PlanItem planItem, PlanItem dependency) { for (PlanItem exitDependency : planItem.getExitDependencies()) { if (exitDependency.getId().equals(dependency.getId())) { return true; } } return false; } }
repos\flowable-engine-main\modules\flowable-cmmn-converter\src\main\java\org\flowable\cmmn\converter\util\PlanItemDependencyUtil.java
1
请完成以下Java代码
public String getClassesLocation() { return ""; } @Override public String getRepackagedClassesLocation() { return "BOOT-INF/classes/"; } @Override public String getClasspathIndexFileLocation() { return "BOOT-INF/classpath.idx"; } @Override public String getLayersIndexFileLocation() { return "BOOT-INF/layers.idx"; } @Override public boolean isExecutable() { return true; } } /** * Executable expanded archive layout. */ public static class Expanded extends Jar { @Override public String getLauncherClassName() { return "org.springframework.boot.loader.launch.PropertiesLauncher"; } } /** * No layout. */ public static class None extends Jar { @Override public @Nullable String getLauncherClassName() { return null; } @Override public boolean isExecutable() { return false; } } /** * Executable WAR layout. */ public static class War implements Layout { private static final Map<LibraryScope, String> SCOPE_LOCATION;
static { Map<LibraryScope, String> locations = new HashMap<>(); locations.put(LibraryScope.COMPILE, "WEB-INF/lib/"); locations.put(LibraryScope.CUSTOM, "WEB-INF/lib/"); locations.put(LibraryScope.RUNTIME, "WEB-INF/lib/"); locations.put(LibraryScope.PROVIDED, "WEB-INF/lib-provided/"); SCOPE_LOCATION = Collections.unmodifiableMap(locations); } @Override public String getLauncherClassName() { return "org.springframework.boot.loader.launch.WarLauncher"; } @Override public @Nullable String getLibraryLocation(String libraryName, @Nullable LibraryScope scope) { return SCOPE_LOCATION.get(scope); } @Override public String getClassesLocation() { return "WEB-INF/classes/"; } @Override public String getClasspathIndexFileLocation() { return "WEB-INF/classpath.idx"; } @Override public String getLayersIndexFileLocation() { return "WEB-INF/layers.idx"; } @Override public boolean isExecutable() { return true; } } }
repos\spring-boot-4.0.1\loader\spring-boot-loader-tools\src\main\java\org\springframework\boot\loader\tools\Layouts.java
1
请在Spring Boot框架中完成以下Java代码
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