instruction
string
input
string
output
string
source_file
string
priority
int64
请完成以下Java代码
private static final boolean equalsIgnoreCase(final String s, final String s2) { if (s == s2) { return true; } if (s == null || s2 == null) { return false; } return s.trim().equalsIgnoreCase(s2.trim()); } private static final boolean equalsIgnoreCase(final Set<String> a1, final Set<String> a2) { if (a1 == a2) { return true; } if (a1 == null || a2 == null) { return false; } if (a1.size() != a2.size()) {
return false; } return Objects.equals(toUpperCase(a1), toUpperCase(a2)); } private static Set<String> toUpperCase(final Set<String> set) { return set.stream().map(String::toUpperCase).collect(ImmutableSet.toImmutableSet()); } private static class DBIndex { public String name; public boolean isUnique = true; public Set<String> columnNames; public String filterCondition = null; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\org\adempiere\process\AD_Index_Create.java
1
请完成以下Java代码
public boolean equals(Object obj) { return delegateContext.equals(obj); } @Override public Locale getLocale() { return delegateContext.getLocale(); } @Override public boolean isPropertyResolved() { return delegateContext.isPropertyResolved(); } @Override
@SuppressWarnings("rawtypes") public void putContext(Class key, Object contextObject) { delegateContext.putContext(key, contextObject); } @Override public void setLocale(Locale locale) { delegateContext.setLocale(locale); } @Override public void setPropertyResolved(boolean resolved) { delegateContext.setPropertyResolved(resolved); } }
repos\camunda-bpm-platform-master\engine-cdi\core\src\main\java\org\camunda\bpm\engine\cdi\impl\el\ElContextDelegate.java
1
请完成以下Java代码
public void setMKTG_ContactPerson_ID (int MKTG_ContactPerson_ID) { if (MKTG_ContactPerson_ID < 1) set_ValueNoCheck (COLUMNNAME_MKTG_ContactPerson_ID, null); else set_ValueNoCheck (COLUMNNAME_MKTG_ContactPerson_ID, Integer.valueOf(MKTG_ContactPerson_ID)); } /** Get MKTG_ContactPerson. @return MKTG_ContactPerson */ @Override public int getMKTG_ContactPerson_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_MKTG_ContactPerson_ID); if (ii == null) return 0; return ii.intValue(); } @Override public de.metas.marketing.base.model.I_MKTG_Platform getMKTG_Platform() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_MKTG_Platform_ID, de.metas.marketing.base.model.I_MKTG_Platform.class); } @Override public void setMKTG_Platform(de.metas.marketing.base.model.I_MKTG_Platform MKTG_Platform) { set_ValueFromPO(COLUMNNAME_MKTG_Platform_ID, de.metas.marketing.base.model.I_MKTG_Platform.class, MKTG_Platform); } /** Set MKTG_Platform. @param MKTG_Platform_ID MKTG_Platform */ @Override public void setMKTG_Platform_ID (int MKTG_Platform_ID) { throw new IllegalArgumentException ("MKTG_Platform_ID is virtual column"); } /** Get MKTG_Platform. @return MKTG_Platform */ @Override public int getMKTG_Platform_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_MKTG_Platform_ID); if (ii == null)
return 0; return ii.intValue(); } /** Set Name. @param Name Alphanumeric identifier of the entity */ @Override public void setName (java.lang.String Name) { throw new IllegalArgumentException ("Name is virtual column"); } /** Get Name. @return Alphanumeric identifier of the entity */ @Override public java.lang.String getName () { return (java.lang.String)get_Value(COLUMNNAME_Name); } /** Set Externe Datensatz-ID. @param RemoteRecordId Externe Datensatz-ID */ @Override public void setRemoteRecordId (java.lang.String RemoteRecordId) { throw new IllegalArgumentException ("RemoteRecordId is virtual column"); } /** Get Externe Datensatz-ID. @return Externe Datensatz-ID */ @Override public java.lang.String getRemoteRecordId () { return (java.lang.String)get_Value(COLUMNNAME_RemoteRecordId); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.marketing\base\src\main\java-gen\de\metas\marketing\base\model\X_MKTG_Campaign_ContactPerson.java
1
请完成以下Java代码
private void registerInstanceValidator(final I_C_ReferenceNo_Type type) { final Properties ctx = InterfaceWrapperHelper.getCtx(type); final IReferenceNoGeneratorInstance instance = Services.get(IReferenceNoBL.class).getReferenceNoGeneratorInstance(ctx, type); if (instance == null) { return; } final ReferenceNoGeneratorInstanceValidator validator = new ReferenceNoGeneratorInstanceValidator(instance); engine.addModelValidator(validator); docValidators.add(validator); } private void unregisterInstanceValidator(final I_C_ReferenceNo_Type type) { final Iterator<ReferenceNoGeneratorInstanceValidator> it = docValidators.iterator();
while (it.hasNext()) { final ReferenceNoGeneratorInstanceValidator validator = it.next(); if (validator.getInstance().getType().getC_ReferenceNo_Type_ID() == type.getC_ReferenceNo_Type_ID()) { validator.unregister(); it.remove(); } } } public void updateInstanceValidator(final I_C_ReferenceNo_Type type) { unregisterInstanceValidator(type); registerInstanceValidator(type); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.document.refid\src\main\java\de\metas\document\refid\modelvalidator\Main.java
1
请完成以下Java代码
public class ClusterStateSingleVO { private String address; private Integer mode; private String target; public String getAddress() { return address; } public ClusterStateSingleVO setAddress(String address) { this.address = address; return this; } public Integer getMode() { return mode; } public ClusterStateSingleVO setMode(Integer mode) { this.mode = mode;
return this; } public String getTarget() { return target; } public ClusterStateSingleVO setTarget(String target) { this.target = target; return this; } @Override public String toString() { return "ClusterStateSingleVO{" + "address='" + address + '\'' + ", mode=" + mode + ", target='" + target + '\'' + '}'; } }
repos\spring-boot-student-master\spring-boot-student-sentinel-dashboard\src\main\java\com\alibaba\csp\sentinel\dashboard\domain\cluster\ClusterStateSingleVO.java
1
请完成以下Java代码
public void setC_Order_MFGWarehouse_Report_ID (int C_Order_MFGWarehouse_Report_ID) { if (C_Order_MFGWarehouse_Report_ID < 1) set_ValueNoCheck (COLUMNNAME_C_Order_MFGWarehouse_Report_ID, null); else set_ValueNoCheck (COLUMNNAME_C_Order_MFGWarehouse_Report_ID, Integer.valueOf(C_Order_MFGWarehouse_Report_ID)); } /** Get Order / MFG Warehouse report. @return Order / MFG Warehouse report */ @Override public int getC_Order_MFGWarehouse_Report_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_Order_MFGWarehouse_Report_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Order / MFG Warehouse report line. @param C_Order_MFGWarehouse_ReportLine_ID Order / MFG Warehouse report line */ @Override public void setC_Order_MFGWarehouse_ReportLine_ID (int C_Order_MFGWarehouse_ReportLine_ID) { if (C_Order_MFGWarehouse_ReportLine_ID < 1) set_ValueNoCheck (COLUMNNAME_C_Order_MFGWarehouse_ReportLine_ID, null); else set_ValueNoCheck (COLUMNNAME_C_Order_MFGWarehouse_ReportLine_ID, Integer.valueOf(C_Order_MFGWarehouse_ReportLine_ID)); } /** Get Order / MFG Warehouse report line. @return Order / MFG Warehouse report line */ @Override public int getC_Order_MFGWarehouse_ReportLine_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_Order_MFGWarehouse_ReportLine_ID); if (ii == null) return 0; return ii.intValue(); } @Override public org.compiere.model.I_M_Product getM_Product() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_M_Product_ID, org.compiere.model.I_M_Product.class); } @Override public void setM_Product(org.compiere.model.I_M_Product M_Product)
{ set_ValueFromPO(COLUMNNAME_M_Product_ID, org.compiere.model.I_M_Product.class, M_Product); } /** Set Produkt. @param M_Product_ID Produkt, Leistung, Artikel */ @Override public void setM_Product_ID (int M_Product_ID) { if (M_Product_ID < 1) set_Value (COLUMNNAME_M_Product_ID, null); else set_Value (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID)); } /** Get Produkt. @return Produkt, Leistung, Artikel */ @Override public int getM_Product_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.fresh\de.metas.fresh.base\src\main\java-gen\de\metas\fresh\model\X_C_Order_MFGWarehouse_ReportLine.java
1
请在Spring Boot框架中完成以下Java代码
public class SecondaryConfig { @Autowired @Qualifier("secondaryDataSource") private DataSource secondaryDataSource; @Autowired @Qualifier("vendorProperties") private Map<String, Object> vendorProperties; @Bean(name = "entityManagerFactorySecondary") public LocalContainerEntityManagerFactoryBean entityManagerFactorySecondary (EntityManagerFactoryBuilder builder) { return builder .dataSource(secondaryDataSource) .properties(vendorProperties) .packages("com.neo.model")
.persistenceUnit("secondaryPersistenceUnit") .build(); } @Bean(name = "entityManagerSecondary") public EntityManager entityManager(EntityManagerFactoryBuilder builder) { return entityManagerFactorySecondary(builder).getObject().createEntityManager(); } @Bean(name = "transactionManagerSecondary") PlatformTransactionManager transactionManagerSecondary(EntityManagerFactoryBuilder builder) { return new JpaTransactionManager(entityManagerFactorySecondary(builder).getObject()); } }
repos\spring-boot-leaning-master\2.x_42_courses\第 3-6 课: Spring Data JPA 多数据源的使用\spring-boot-multi-Jpa\src\main\java\com\neo\config\SecondaryConfig.java
2
请完成以下Java代码
public class C_ElementValue_Update extends JavaProcess implements IProcessPrecondition { private final ElementValueService evService = SpringContextHolder.instance.getBean(ElementValueService.class); @Param(parameterName = I_AD_TreeNode.COLUMNNAME_Parent_ID, mandatory = true) private int p_parentId; @Override public ProcessPreconditionsResolution checkPreconditionsApplicable(@NonNull final IProcessPreconditionsContext context) { if (context.isSingleSelection()) { return ProcessPreconditionsResolution.accept(); }
return ProcessPreconditionsResolution.reject(); } @Override protected String doIt() { evService.changeParentAndReorderByAccountNo( ElementValueParentChangeRequest.builder() .elementValueId(ElementValueId.ofRepoId(getRecord_ID())) .newParentId(ElementValueId.ofRepoId(p_parentId)) .build()); return MSG_OK; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\process\C_ElementValue_Update.java
1
请完成以下Java代码
public void registerCallout() { Services.get(IProgramaticCalloutProvider.class).registerAnnotatedCallout(this); } @CalloutMethod(columnNames = { I_PP_Product_Planning.COLUMNNAME_IsMatured }) public void onIsMatured(final I_PP_Product_Planning productPlanningRecord) { if (productPlanningRecord.isMatured()) { final List<MaturingConfigLine> configLines = maturingConfigRepo.getByMaturedProductId(ProductId.ofRepoIdOrNull(productPlanningRecord.getM_Product_ID())); if (configLines.isEmpty() || configLines.size() > 1) { return; } final MaturingConfigLine line = configLines.get(0); productPlanningRecord.setM_Maturing_Configuration_ID(MaturingConfigId.toRepoId(line.getMaturingConfigId())); productPlanningRecord.setM_Maturing_Configuration_Line_ID(MaturingConfigLineId.toRepoId(line.getId())); } } @ModelChange(timings = { ModelValidator.TYPE_BEFORE_CHANGE, ModelValidator.TYPE_BEFORE_NEW }, ifColumnsChanged = { I_PP_Product_Planning.COLUMNNAME_IsMatured }) public void validateMandatoryBOMVersionsAndWarehouseId(final I_PP_Product_Planning productPlanningRecord) { final ProductPlanning productPlanning = ProductPlanningDAO.fromRecord(productPlanningRecord); if (!productPlanning.isMatured()) { return; } if (productPlanning.getBomVersionsId() == null) { throw new FillMandatoryException(I_PP_Product_Planning.COLUMNNAME_PP_Product_BOMVersions_ID); }
if (productPlanning.getWarehouseId() == null) { throw new FillMandatoryException(I_PP_Product_Planning.COLUMNNAME_M_Warehouse_ID); } } @CalloutMethod(columnNames = I_PP_Product_Planning.COLUMNNAME_PP_Product_BOMVersions_ID) public void onBOMVersionsChanged(@NonNull final I_PP_Product_Planning productPlanningRecord) { final ProductBOMVersionsId bomVersionsId = ProductBOMVersionsId.ofRepoIdOrNull(productPlanningRecord.getPP_Product_BOMVersions_ID()); if (bomVersionsId == null) { return; } final I_PP_Product_BOMVersions bomVersions = bomVersionsDAO.getBOMVersions(bomVersionsId); final ProductId productId = ProductId.ofRepoId(bomVersions.getM_Product_ID()); productPlanningRecord.setM_Product_ID(productId.getRepoId()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\callout\PP_Product_Planning.java
1
请在Spring Boot框架中完成以下Java代码
public C createContainer(Pattern topicPattern) { return createContainer(new KafkaListenerEndpointAdapter() { @Override public Pattern getTopicPattern() { return topicPattern; } }); } protected C createContainer(KafkaListenerEndpoint endpoint) { final C container = createContainerInstance(endpoint); initializeContainer(container, endpoint); customizeContainer(container, endpoint);
return container; } @SuppressWarnings("unchecked") protected void customizeContainer(C instance, KafkaListenerEndpoint endpoint) { if (this.containerCustomizer != null) { this.containerCustomizer.configure(instance); } final ContainerPostProcessor<K, V, C> containerPostProcessor = (ContainerPostProcessor<K, V, C>) endpoint.getContainerPostProcessor(); if (containerPostProcessor != null) { containerPostProcessor.postProcess(instance); } } }
repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\config\AbstractKafkaListenerContainerFactory.java
2
请完成以下Java代码
public class ElValueProvider implements ParameterValueProvider, Comparable<ElValueProvider> { protected Expression expression; public ElValueProvider(Expression expression) { this.expression = expression; } public Object getValue(VariableScope variableScope) { EnsureUtil.ensureNotNull("variableScope", variableScope); return expression.getValue(variableScope); } public Expression getExpression() { return expression; }
public void setExpression(Expression expression) { this.expression = expression; } @Override public int compareTo(ElValueProvider o) { return expression.getExpressionText().compareTo(o.getExpression().getExpressionText()); } @Override public boolean isDynamic() { return !getExpression().isLiteralText(); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\el\ElValueProvider.java
1
请在Spring Boot框架中完成以下Java代码
public BatchBuilder status(String status) { this.status = status; return this; } @Override public BatchBuilder batchDocumentJson(String batchDocumentJson) { this.batchDocumentJson = batchDocumentJson; return this; } @Override public BatchBuilder tenantId(String tenantId) { this.tenantId = tenantId; return this; } @Override public Batch create() { if (commandExecutor != null) { BatchBuilder selfBatchBuilder = this; return commandExecutor.execute(new Command<>() { @Override public Batch execute(CommandContext commandContext) { return batchServiceConfiguration.getBatchEntityManager().createBatch(selfBatchBuilder); } }); } else { return ((BatchServiceImpl) batchServiceConfiguration.getBatchService()).createBatch(this); } }
@Override public String getBatchType() { return batchType; } @Override public String getSearchKey() { return searchKey; } @Override public String getSearchKey2() { return searchKey2; } @Override public String getStatus() { return status; } @Override public String getBatchDocumentJson() { return batchDocumentJson; } @Override public String getTenantId() { return tenantId; } }
repos\flowable-engine-main\modules\flowable-batch-service\src\main\java\org\flowable\batch\service\impl\BatchBuilderImpl.java
2
请完成以下Java代码
public Predicate<ServerWebExchange> apply(Config config) { if (log.isDebugEnabled()) { log.debug("Applying XForwardedRemoteAddr route predicate with maxTrustedIndex of " + config.getMaxTrustedIndex() + " for " + config.getSources().size() + " source(s)"); } // Reuse the standard RemoteAddrRoutePredicateFactory but instead of using the // default RemoteAddressResolver to determine the client IP address, use an // XForwardedRemoteAddressResolver. RemoteAddrRoutePredicateFactory.Config wrappedConfig = new RemoteAddrRoutePredicateFactory.Config(); wrappedConfig.setSources(config.getSources()); wrappedConfig .setRemoteAddressResolver(XForwardedRemoteAddressResolver.maxTrustedIndex(config.getMaxTrustedIndex())); RemoteAddrRoutePredicateFactory remoteAddrRoutePredicateFactory = new RemoteAddrRoutePredicateFactory(); Predicate<ServerWebExchange> wrappedPredicate = remoteAddrRoutePredicateFactory.apply(wrappedConfig); return exchange -> { Boolean isAllowed = wrappedPredicate.test(exchange); if (log.isDebugEnabled()) { ServerHttpRequest request = exchange.getRequest(); String clientAddress = request.getRemoteAddress() != null ? request.getRemoteAddress().getAddress().getHostAddress() : "unknown"; log.debug("Request for \"" + request.getURI() + "\" from client \"" + clientAddress + "\" with \"" + XForwardedRemoteAddressResolver.X_FORWARDED_FOR + "\" header value of \"" + request.getHeaders().get(XForwardedRemoteAddressResolver.X_FORWARDED_FOR) + "\" is " + (isAllowed ? "ALLOWED" : "NOT ALLOWED")); } return isAllowed; }; } public static class Config { // Trust the last (right-most) value in the "X-Forwarded-For" header by default,
// which represents the last reverse proxy that was used when calling the gateway. private int maxTrustedIndex = 1; private List<String> sources = new ArrayList<>(); public int getMaxTrustedIndex() { return this.maxTrustedIndex; } public Config setMaxTrustedIndex(int maxTrustedIndex) { this.maxTrustedIndex = maxTrustedIndex; return this; } public List<String> getSources() { return this.sources; } public Config setSources(List<String> sources) { this.sources = sources; return this; } public Config setSources(String... sources) { this.sources = Arrays.asList(sources); return this; } } }
repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webflux\src\main\java\org\springframework\cloud\gateway\handler\predicate\XForwardedRemoteAddrRoutePredicateFactory.java
1
请完成以下Java代码
public void unlinkFromMaterialTracking(final I_PP_Cost_Collector ppCostCollector) { final IMaterialTrackingBL materialTrackingBL = Services.get(IMaterialTrackingBL.class); final IPPCostCollectorBL ppCostCollectorBL = Services.get(IPPCostCollectorBL.class); final IMaterialTrackingDAO materialTrackingDAO = Services.get(IMaterialTrackingDAO.class); final IPPCostCollectorDAO ppCostCollectorDAO = Services.get(IPPCostCollectorDAO.class); // Applies only on issue collectors if (!ppCostCollectorBL.isAnyComponentIssue(ppCostCollector)) { return; } // Applies only on those Quality Inspection orders which are linked to a material tracking final List<I_M_Material_Tracking> materialTrackings = materialTrackingDAO.retrieveMaterialTrackingsForModel(ppCostCollector); if (materialTrackings.isEmpty()) { return; } // unlink materialTrackingBL.unlinkModelFromMaterialTrackings(ppCostCollector); // also unlink the ppOrder, if this was the last costCollector final PPOrderId ppOrderId = PPOrderId.ofRepoId(ppCostCollector.getPP_Order_ID());
boolean anyCCLeft = false; final List<I_PP_Cost_Collector> costCollectors = Services.get(IPPCostCollectorDAO.class).getCompletedOrClosedByOrderId(ppOrderId); for (final I_PP_Cost_Collector cc : costCollectors) { if (cc.getPP_Cost_Collector_ID() == ppCostCollector.getPP_Cost_Collector_ID()) { continue; } if (ppCostCollectorBL.isAnyComponentIssue(cc)) { anyCCLeft = true; break; } } if (!anyCCLeft) { final I_PP_Order ppOrder = Services.get(IPPOrderDAO.class).getById(ppOrderId); materialTrackingBL.unlinkModelFromMaterialTrackings(ppOrder); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java\de\metas\materialtracking\model\validator\PP_Cost_Collector.java
1
请完成以下Java代码
public void addOnlyInLocatorId(@NonNull final LocatorId locatorId) { onlyInLocatorIds.add(locatorId.getRepoId()); } public void addOnlyInLocatorRepoIds(final Collection<Integer> locatorIds) { if (locatorIds != null && !locatorIds.isEmpty()) { locatorIds.forEach(this::addOnlyInLocatorRepoId); } } public void addOnlyInLocatorIds(final Collection<LocatorId> locatorIds) { if (locatorIds != null && !locatorIds.isEmpty())
{ locatorIds.forEach(this::addOnlyInLocatorId); } } public void setExcludeAfterPickingLocator(final boolean excludeAfterPickingLocator) { this.excludeAfterPickingLocator = excludeAfterPickingLocator; } public void setIncludeAfterPickingLocator(final boolean includeAfterPickingLocator) { this.includeAfterPickingLocator = includeAfterPickingLocator; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\impl\HUQueryBuilder_Locator.java
1
请完成以下Java代码
public String getName() { return this.name; } /** * Return the return type. * @return the return type */ public String getReturnType() { return this.returnType; } /** * Return the value. * @return the value */ public Object getValue() { return this.value; } /** * Whether the field declaration is initialized. * @return whether the field declaration is initialized */ public boolean isInitialized() { return this.initialized; } /** * Builder for {@link GroovyFieldDeclaration}. */ public static final class Builder { private final String name; private String returnType; private int modifiers; private Object value; private boolean initialized; private Builder(String name) {
this.name = name; } /** * Sets the modifiers. * @param modifiers the modifiers * @return this for method chaining */ public Builder modifiers(int modifiers) { this.modifiers = modifiers; return this; } /** * Sets the value. * @param value the value * @return this for method chaining */ public Builder value(Object value) { this.value = value; this.initialized = true; return this; } /** * Sets the return type. * @param returnType the return type * @return the field */ public GroovyFieldDeclaration returning(String returnType) { this.returnType = returnType; return new GroovyFieldDeclaration(this); } } }
repos\initializr-main\initializr-generator\src\main\java\io\spring\initializr\generator\language\groovy\GroovyFieldDeclaration.java
1
请完成以下Java代码
public int getM_Product_ID() { return productId; } @Override public IMaterialTrackingQuery setM_Product_ID(final int productId) { this.productId = productId; return this; } @Override public Boolean getProcessed() { return processed; } @Override public IMaterialTrackingQuery setProcessed(final Boolean processed) { this.processed = processed; return this; } @Override public IMaterialTrackingQuery setWithLinkedDocuments(final List<?> linkedModels) { if (linkedModels == null || linkedModels.isEmpty()) { withLinkedDocuments = Collections.emptyList(); } else { withLinkedDocuments = new ArrayList<>(linkedModels); } return this; } @Override public List<?> getWithLinkedDocuments() { return withLinkedDocuments; } @Override public IMaterialTrackingQuery setOnMoreThanOneFound(final OnMoreThanOneFound onMoreThanOneFound) { Check.assumeNotNull(onMoreThanOneFound, "onMoreThanOneFound not null"); this.onMoreThanOneFound = onMoreThanOneFound; return this; }
@Override public OnMoreThanOneFound getOnMoreThanOneFound() { return onMoreThanOneFound; } @Override public IMaterialTrackingQuery setCompleteFlatrateTerm(final Boolean completeFlatrateTerm) { this.completeFlatrateTerm = completeFlatrateTerm; return this; } @Override public Boolean getCompleteFlatrateTerm() { return completeFlatrateTerm; } @Override public IMaterialTrackingQuery setLot(final String lot) { this.lot = lot; return this; } @Override public String getLot() { return lot; } @Override public IMaterialTrackingQuery setReturnReadOnlyRecords(boolean returnReadOnlyRecords) { this.returnReadOnlyRecords = returnReadOnlyRecords; return this; } @Override public boolean isReturnReadOnlyRecords() { return returnReadOnlyRecords; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java\de\metas\materialtracking\impl\MaterialTrackingQuery.java
1
请完成以下Java代码
public String getAuthorizationCheckRevokes() { return wrappedConfiguration.getAuthorizationCheckRevokes(); } @Override protected InputStream getMyBatisXmlConfigurationSteam() { String str = buildMappings(mappingFiles); return new ByteArrayInputStream(str.getBytes()); } protected String buildMappings(List<String> mappingFiles) { List<String> mappings = new ArrayList<String>(mappingFiles); mappings.addAll(Arrays.asList(DEFAULT_MAPPING_FILES)); StringBuilder builder = new StringBuilder(); for (String mappingFile: mappings) { builder.append(String.format("<mapper resource=\"%s\" />\n", mappingFile)); } String mappingsFileTemplate = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "\n" + "<!DOCTYPE configuration PUBLIC \"-//mybatis.org//DTD Config 3.0//EN\" \"http://mybatis.org/dtd/mybatis-3-config.dtd\">\n" + "\n" + "<configuration>\n" + " <settings>\n" + " <setting name=\"lazyLoadingEnabled\" value=\"false\" />\n" +
" </settings>\n" + " <mappers>\n" + "%s\n" + " </mappers>\n" + "</configuration>"; return String.format(mappingsFileTemplate, builder.toString()); } public ProcessEngineConfigurationImpl getWrappedConfiguration() { return wrappedConfiguration; } }
repos\camunda-bpm-platform-master\webapps\assembly\src\main\java\org\camunda\bpm\webapp\impl\db\QuerySessionFactory.java
1
请在Spring Boot框架中完成以下Java代码
public InjectedValue<MscRuntimeContainerJobExecutor> getMscRuntimeContainerJobExecutorInjector() { return mscRuntimeContainerJobExecutorInjector; } public static void initializeServiceBuilder(ManagedProcessEngineMetadata processEngineConfiguration, MscManagedProcessEngineController service, ServiceBuilder<ProcessEngine> serviceBuilder, String jobExecutorName) { ContextNames.BindInfo datasourceBindInfo = ContextNames.bindInfoFor(processEngineConfiguration.getDatasourceJndiName()); serviceBuilder.addDependency(ServiceName.JBOSS.append("txn").append("TransactionManager"), TransactionManager.class, service.getTransactionManagerInjector()) .addDependency(datasourceBindInfo.getBinderServiceName(), DataSourceReferenceFactoryService.class, service.getDatasourceBinderServiceInjector()) .addDependency(ServiceNames.forMscRuntimeContainerDelegate(), MscRuntimeContainerDelegate.class, service.getRuntimeContainerDelegateInjector()) .addDependency(ServiceNames.forMscRuntimeContainerJobExecutorService(jobExecutorName), MscRuntimeContainerJobExecutor.class, service.getMscRuntimeContainerJobExecutorInjector()) .addDependency(ServiceNames.forMscExecutorService()) .setInitialMode(Mode.ACTIVE); if(processEngineConfiguration.isDefault()) { serviceBuilder.addAliases(ServiceNames.forDefaultProcessEngine()); }
JBossCompatibilityExtension.addServerExecutorDependency(serviceBuilder, service.getExecutorInjector(), false); } public ProcessEngine getProcessEngine() { return processEngine; } public InjectedValue<ExecutorService> getExecutorInjector() { return executorInjector; } public ManagedProcessEngineMetadata getProcessEngineMetadata() { return processEngineMetadata; } }
repos\camunda-bpm-platform-master\distro\wildfly26\subsystem\src\main\java\org\camunda\bpm\container\impl\jboss\service\MscManagedProcessEngineController.java
2
请完成以下Java代码
public TimerExpression getTimerExpression() { return timerExpressionChild.getChild(this); } public void setTimerExpression(TimerExpression timerExpression) { timerExpressionChild.setChild(this, timerExpression); } public StartTrigger getTimerStart() { return timerStartChild.getChild(this); } public void setTimerStart(StartTrigger timerStart) { timerStartChild.setChild(this, timerStart); } public static void registerType(ModelBuilder modelBuilder) { ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(TimerEvent.class, CMMN_ELEMENT_TIMER_EVENT) .namespaceUri(CMMN10_NS) .extendsType(Event.class) .instanceProvider(new ModelTypeInstanceProvider<TimerEvent>() {
public TimerEvent newInstance(ModelTypeInstanceContext instanceContext) { return new TimerEventImpl(instanceContext); } }); SequenceBuilder sequenceBuilder = typeBuilder.sequence(); timerExpressionChild = sequenceBuilder.element(TimerExpression.class) .build(); timerStartChild = sequenceBuilder.element(StartTrigger.class) .build(); typeBuilder.build(); } }
repos\camunda-bpm-platform-master\model-api\cmmn-model\src\main\java\org\camunda\bpm\model\cmmn\impl\instance\TimerEventImpl.java
1
请完成以下Java代码
private boolean isDecorationRequired(@Nullable PdxInstance pdxInstance, @Nullable String json) { return isMissingObjectTypeMetadata(pdxInstance) && isValidJson(json); } private boolean isMissingObjectTypeMetadata(@Nullable JsonNode node) { return isObjectNode(node) && !node.has(AT_TYPE_METADATA_PROPERTY_NAME); } private boolean isMissingObjectTypeMetadata(@Nullable PdxInstance pdxInstance) { return pdxInstance != null && !pdxInstance.hasField(AT_TYPE_METADATA_PROPERTY_NAME); } /** * Null-safe method to determine if the given {@link JsonNode} represents a valid {@link String JSON} object. * * @param node {@link JsonNode} to evaluate. * @return a boolean valued indicating whether the given {@link JsonNode} is a valid {@link ObjectNode}. * @see com.fasterxml.jackson.databind.node.ObjectNode * @see com.fasterxml.jackson.databind.JsonNode
*/ boolean isObjectNode(@Nullable JsonNode node) { return node != null && (node.isObject() || node instanceof ObjectNode); } /** * Null-safe method to determine whether the given {@link String JSON} is valid. * * @param json {@link String} containing JSON to evaluate. * @return a boolean value indicating whether the given {@link String JSON} is valid. */ boolean isValidJson(@Nullable String json) { return StringUtils.hasText(json); } }
repos\spring-boot-data-geode-main\spring-geode-project\spring-geode\src\main\java\org\springframework\geode\data\json\converter\support\JSONFormatterPdxToJsonConverter.java
1
请完成以下Java代码
public static Result evaluate(String goldFile, String predFile) throws IOException { return evaluate(goldFile, predFile, null); } /** * 标准化评测分词器 * * @param segment 分词器 * @param outputPath 分词预测输出文件 * @param goldFile 测试集segmented file * @param dictPath 训练集单词列表 * @return 一个储存准确率的结构 * @throws IOException */ public static Result evaluate(Segment segment, String outputPath, String goldFile, String dictPath) throws IOException { IOUtil.LineIterator lineIterator = new IOUtil.LineIterator(goldFile); BufferedWriter bw = IOUtil.newBufferedWriter(outputPath); for (String line : lineIterator) { List<Term> termList = segment.seg(line.replaceAll("\\s+", "")); // 一些testFile与goldFile根本不匹配,比如MSR的testFile有些行缺少单词,所以用goldFile去掉空格代替 int i = 0; for (Term term : termList) { bw.write(term.word); if (++i != termList.size()) bw.write(" "); } bw.newLine(); } bw.close(); Result result = CWSEvaluator.evaluate(goldFile, outputPath, dictPath); return result; } /** * 标准化评测分词器 * * @param segment 分词器 * @param testFile 测试集raw text * @param outputPath 分词预测输出文件 * @param goldFile 测试集segmented file * @param dictPath 训练集单词列表 * @return 一个储存准确率的结构 * @throws IOException */ public static Result evaluate(Segment segment, String testFile, String outputPath, String goldFile, String dictPath) throws IOException { return evaluate(segment, outputPath, goldFile, dictPath);
} /** * 在标准答案与分词结果上执行评测 * * @param goldFile * @param predFile * @return */ public static Result evaluate(String goldFile, String predFile, String dictPath) throws IOException { IOUtil.LineIterator goldIter = new IOUtil.LineIterator(goldFile); IOUtil.LineIterator predIter = new IOUtil.LineIterator(predFile); CWSEvaluator evaluator = new CWSEvaluator(dictPath); while (goldIter.hasNext() && predIter.hasNext()) { evaluator.compare(goldIter.next(), predIter.next()); } return evaluator.getResult(); } public static class Result { public float P, R, F1, OOV_R, IV_R; public Result(float p, float r, float f1, float OOV_R, float IV_R) { P = p; R = r; F1 = f1; this.OOV_R = OOV_R; this.IV_R = IV_R; } @Override public String toString() { return String.format("P:%.2f R:%.2f F1:%.2f OOV-R:%.2f IV-R:%.2f", P, R, F1, OOV_R, IV_R); } } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\seg\common\CWSEvaluator.java
1
请完成以下Java代码
public class Student { private int id; private String firstName; private String lastName; private String grade; public Student() { } public Student(int id, String firstName, String lastName, String grade) { this.id = id; this.firstName = firstName; this.lastName = lastName; this.grade = grade; } public int getId() { return id; } public void setId(int 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 String getGrade() { return grade; } public void setGrade(String grade) { this.grade = grade; } }
repos\tutorials-master\spring-boot-modules\spring-boot-data\src\main\java\com\baeldung\boot\noconverterfound\model\Student.java
1
请完成以下Java代码
public String getLockOwner() { return lockOwner; } public void setLockOwner(String lockOwner) { this.lockOwner = lockOwner; } public Date getLockExpirationTime() { return lockExpirationTime; } public void setLockExpirationTime(Date lockExpirationTime) { this.lockExpirationTime = lockExpirationTime; } public String getRootProcessInstanceId() { return rootProcessInstanceId; } public void setRootProcessInstanceId(String rootProcessInstanceId) { this.rootProcessInstanceId = rootProcessInstanceId; } public String getProcessInstanceId() { return processInstanceId; } public void setProcessInstanceId(String processInstanceId) { this.processInstanceId = processInstanceId; } public boolean isExclusive() { return isExclusive; } public void setExclusive(boolean isExclusive) { this.isExclusive = isExclusive; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true;
if (obj == null) return false; if (getClass() != obj.getClass()) return false; AcquirableJobEntity other = (AcquirableJobEntity) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } @Override public String toString() { return this.getClass().getSimpleName() + "[id=" + id + ", revision=" + revision + ", lockOwner=" + lockOwner + ", lockExpirationTime=" + lockExpirationTime + ", duedate=" + duedate + ", rootProcessInstanceId=" + rootProcessInstanceId + ", processInstanceId=" + processInstanceId + ", isExclusive=" + isExclusive + "]"; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\AcquirableJobEntity.java
1
请完成以下Java代码
private static Method getMethod(String className, String methodName, String[] parameterTypeNames) { try { Class<?> c = Class.forName(className); int len = parameterTypeNames.length; Class<?>[] parameterTypes = new Class[len]; for (int i = 0; i < len; i++) { parameterTypes[i] = Class.forName(parameterTypeNames[i]); } return c.getDeclaredMethod(methodName, parameterTypes); } catch (ClassNotFoundException ex) { logger.error("Required class" + className + " not found"); throw new RuntimeException("Required class" + className + " not found", ex); } catch (NoSuchMethodException ex) { logger.error("Required method " + methodName + " with parameter types (" + Arrays.asList(parameterTypeNames) + ") not found on class " + className); throw new RuntimeException("Required class" + className + " not found", ex); } } private static Method getRunAsSubjectMethod() { if (getRunAsSubject == null) { getRunAsSubject = getMethod("com.ibm.websphere.security.auth.WSSubject", "getRunAsSubject", new String[] {}); } return getRunAsSubject; } private static Method getGroupsForUserMethod() { if (getGroupsForUser == null) { getGroupsForUser = getMethod("com.ibm.websphere.security.UserRegistry", "getGroupsForUser", new String[] { "java.lang.String" }); } return getGroupsForUser; } private static Method getSecurityNameMethod() { if (getSecurityName == null) { getSecurityName = getMethod("com.ibm.websphere.security.cred.WSCredential", "getSecurityName", new String[] {}); } return getSecurityName; } private static Method getNarrowMethod() { if (narrow == null) { narrow = getMethod(PORTABLE_REMOTE_OBJECT_CLASSNAME, "narrow",
new String[] { Object.class.getName(), Class.class.getName() }); } return narrow; } // SEC-803 private static Class<?> getWSCredentialClass() { if (wsCredentialClass == null) { wsCredentialClass = getClass("com.ibm.websphere.security.cred.WSCredential"); } return wsCredentialClass; } private static Class<?> getClass(String className) { try { return Class.forName(className); } catch (ClassNotFoundException ex) { logger.error("Required class " + className + " not found"); throw new RuntimeException("Required class " + className + " not found", ex); } } }
repos\spring-security-main\web\src\main\java\org\springframework\security\web\authentication\preauth\websphere\DefaultWASUsernameAndGroupsExtractor.java
1
请完成以下Java代码
public boolean isOnTuesday() { return get_ValueAsBoolean(COLUMNNAME_OnTuesday); } @Override public void setOnWednesday (final boolean OnWednesday) { set_Value (COLUMNNAME_OnWednesday, OnWednesday); } @Override public boolean isOnWednesday() { return get_ValueAsBoolean(COLUMNNAME_OnWednesday); } @Override public void setPreparationTime_1 (final @Nullable java.sql.Timestamp PreparationTime_1) { set_Value (COLUMNNAME_PreparationTime_1, PreparationTime_1); } @Override public java.sql.Timestamp getPreparationTime_1() { return get_ValueAsTimestamp(COLUMNNAME_PreparationTime_1); } @Override public void setPreparationTime_2 (final @Nullable java.sql.Timestamp PreparationTime_2) { set_Value (COLUMNNAME_PreparationTime_2, PreparationTime_2); } @Override public java.sql.Timestamp getPreparationTime_2() { return get_ValueAsTimestamp(COLUMNNAME_PreparationTime_2); } @Override public void setPreparationTime_3 (final @Nullable java.sql.Timestamp PreparationTime_3) { set_Value (COLUMNNAME_PreparationTime_3, PreparationTime_3); } @Override public java.sql.Timestamp getPreparationTime_3() { return get_ValueAsTimestamp(COLUMNNAME_PreparationTime_3); } @Override public void setPreparationTime_4 (final @Nullable java.sql.Timestamp PreparationTime_4) { set_Value (COLUMNNAME_PreparationTime_4, PreparationTime_4); } @Override public java.sql.Timestamp getPreparationTime_4() { return get_ValueAsTimestamp(COLUMNNAME_PreparationTime_4); } @Override public void setPreparationTime_5 (final @Nullable java.sql.Timestamp PreparationTime_5) { set_Value (COLUMNNAME_PreparationTime_5, PreparationTime_5); } @Override public java.sql.Timestamp getPreparationTime_5() { return get_ValueAsTimestamp(COLUMNNAME_PreparationTime_5); } @Override public void setPreparationTime_6 (final @Nullable java.sql.Timestamp PreparationTime_6) { set_Value (COLUMNNAME_PreparationTime_6, PreparationTime_6);
} @Override public java.sql.Timestamp getPreparationTime_6() { return get_ValueAsTimestamp(COLUMNNAME_PreparationTime_6); } @Override public void setPreparationTime_7 (final @Nullable java.sql.Timestamp PreparationTime_7) { set_Value (COLUMNNAME_PreparationTime_7, PreparationTime_7); } @Override public java.sql.Timestamp getPreparationTime_7() { return get_ValueAsTimestamp(COLUMNNAME_PreparationTime_7); } @Override public void setReminderTimeInMin (final int ReminderTimeInMin) { set_Value (COLUMNNAME_ReminderTimeInMin, ReminderTimeInMin); } @Override public int getReminderTimeInMin() { return get_ValueAsInt(COLUMNNAME_ReminderTimeInMin); } @Override public void setValidFrom (final java.sql.Timestamp ValidFrom) { set_Value (COLUMNNAME_ValidFrom, ValidFrom); } @Override public java.sql.Timestamp getValidFrom() { return get_ValueAsTimestamp(COLUMNNAME_ValidFrom); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.purchasecandidate.base\src\main\java-gen\de\metas\purchasecandidate\model\X_C_BP_PurchaseSchedule.java
1
请完成以下Java代码
public class MBPBankAccount extends X_C_BP_BankAccount { public MBPBankAccount(Properties ctx, int C_BP_BankAccount_ID, String trxName) { super(ctx, C_BP_BankAccount_ID, trxName); if (is_new()) { // setC_BPartner_ID (0); setIsACH(false); setBPBankAcctUse(BPBANKACCTUSE_Both); } } public MBPBankAccount(Properties ctx, ResultSet rs, String trxName) { super(ctx, rs, trxName); } @Override protected boolean beforeSave(boolean newRecord) {
// maintain routing on bank level if (isACH() && getC_Bank_ID() > 0) { setRoutingNo(null); } return true; } @Override public String toString() { return new StringBuilder("MBP_BankAccount[") .append(get_ID()) .append(", Name=").append(getA_Name()) .append("]") .toString(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MBPBankAccount.java
1
请完成以下Java代码
public class Car { /** * The car's engine. */ private Engine engine; /** * The car's brand. */ private Brand brand; /** * Instantiates a new Car. * * @param engine * the {@link #engine} * @param brand * the {@link #brand} */ @Inject public Car(Engine engine, Brand brand) { this.engine = engine; this.brand = brand; } /** * Gets the {@link #engine}. * * @return the {@link #engine} */ public Engine getEngine() { return engine; } /** * Sets the {@link #engine}. * * @param engine * the new {@link #engine} */ public void setEngine(Engine engine) { this.engine = engine;
} /** * Gets the {@link #brand}. * * @return the {@link #brand} */ public Brand getBrand() { return brand; } /** * Sets the {@link #brand}. * * @param brand * the new {@link #brand} */ public void setBrand(Brand brand) { this.brand = brand; } }
repos\tutorials-master\di-modules\dagger\src\main\java\com\baeldung\dagger\intro\Car.java
1
请完成以下Java代码
public void afterPropertiesSet() { start(); } @Override public void setApplicationContext(@NonNull ApplicationContext applicationContext) throws BeansException { this.context = (ConfigurableApplicationContext) applicationContext; } @Override public void start() { if (isRunning()) { return; } try { InMemoryDirectoryServerConfig config = new InMemoryDirectoryServerConfig(this.defaultPartitionSuffix); config.addAdditionalBindCredentials("uid=admin,ou=system", "secret"); config.setListenerConfigs(InMemoryListenerConfig.createLDAPConfig("LDAP", this.port)); config.setEnforceSingleStructuralObjectClass(false); config.setEnforceAttributeSyntaxCompliance(true); DN dn = new DN(this.defaultPartitionSuffix); Entry entry = new Entry(dn); entry.addAttribute("objectClass", "top", "domain", "extensibleObject"); entry.addAttribute("dc", dn.getRDN().getAttributeValues()[0]); InMemoryDirectoryServer directoryServer = new InMemoryDirectoryServer(config); directoryServer.add(entry); importLdif(directoryServer); directoryServer.startListening(); this.port = directoryServer.getListenPort(); this.directoryServer = directoryServer; this.running = true; } catch (LDAPException ex) { throw new RuntimeException("Server startup failed", ex); } } private void importLdif(InMemoryDirectoryServer directoryServer) { if (StringUtils.hasText(this.ldif)) { try { Resource[] resources = this.context.getResources(this.ldif); if (resources.length > 0) { if (!resources[0].exists()) { throw new IllegalArgumentException("Unable to find LDIF resource " + this.ldif); } try (InputStream inputStream = resources[0].getInputStream()) { directoryServer.importFromLDIF(false, new LDIFReader(inputStream)); }
} } catch (Exception ex) { throw new IllegalStateException("Unable to load LDIF " + this.ldif, ex); } } } @Override public void stop() { if (this.isEphemeral && this.context != null && !this.context.isClosed()) { return; } this.directoryServer.shutDown(true); this.running = false; } @Override public boolean isRunning() { return this.running; } }
repos\spring-security-main\ldap\src\main\java\org\springframework\security\ldap\server\UnboundIdContainer.java
1
请完成以下Java代码
public String getRedirectUri() { return this.redirectUri; } /** * Returns the state. * @return the state */ @Nullable public String getState() { return this.state; } /** * Returns the requested (or authorized) scope(s). * @return the requested (or authorized) scope(s), or an empty {@code Set} if not
* available */ public Set<String> getScopes() { return this.scopes; } /** * Returns the additional parameters. * @return the additional parameters, or an empty {@code Map} if not available */ public Map<String, Object> getAdditionalParameters() { return this.additionalParameters; } }
repos\spring-security-main\oauth2\oauth2-authorization-server\src\main\java\org\springframework\security\oauth2\server\authorization\authentication\AbstractOAuth2AuthorizationCodeRequestAuthenticationToken.java
1
请在Spring Boot框架中完成以下Java代码
public ImmutableList<I_M_PriceList> filterAndList(@NonNull final CountryId countryId, @Nullable final SOTrx soTrx, @Nullable final CurrencyId currencyId) { return getPriceLists() .stream() .filter(PriceListFilter.builder() .countryIds(ImmutableSet.of(countryId)) .acceptNoCountry(true) .soTrx(soTrx) .currencyId(currencyId) .build()) .collect(ImmutableList.toImmutableList()); } public ImmutableSet<PriceListId> filterAndListIds(@NonNull final Set<CountryId> countryIds) { return filterAndStreamIds(countryIds) .collect(ImmutableSet.toImmutableSet()); } public Stream<PriceListId> filterAndStreamIds(@NonNull final Set<CountryId> countryIds) { Check.assumeNotEmpty(countryIds, "countryIds is not empty"); return getPriceLists() .stream() .filter(PriceListFilter.builder() .countryIds(ImmutableSet.copyOf(countryIds)) .build()) .map(PriceListsCollection::extractPriceListId) .distinct(); } @NonNull public ImmutableList<I_M_PriceList> getPriceList() { return getPriceLists(); } private static PriceListId extractPriceListId(final I_M_PriceList priceList) { return PriceListId.ofRepoId(priceList.getM_PriceList_ID()); } @Value @Builder static class PriceListFilter implements Predicate<I_M_PriceList> { ImmutableSet<CountryId> countryIds; boolean acceptNoCountry; SOTrx soTrx; CurrencyId currencyId; @Override public boolean test(final I_M_PriceList priceList) { return isCountryMatching(priceList) && isSOTrxMatching(priceList) && isCurrencyMatching(priceList) ; } private boolean isCurrencyMatching(final I_M_PriceList priceList) { if (currencyId == null) { return true; } else
{ return currencyId.equals(CurrencyId.ofRepoId(priceList.getC_Currency_ID())); } } private boolean isCountryMatching(final I_M_PriceList priceList) { if (countryIds == null) { return true; } final CountryId priceListCountryId = CountryId.ofRepoIdOrNull(priceList.getC_Country_ID()); if (priceListCountryId == null && acceptNoCountry) { return true; } if (countryIds.isEmpty()) { return priceListCountryId == null; } else { return countryIds.contains(priceListCountryId); } } private boolean isSOTrxMatching(final I_M_PriceList priceList) { return soTrx == null || soTrx.isSales() == priceList.isSOPriceList(); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\pricing\service\PriceListsCollection.java
2
请在Spring Boot框架中完成以下Java代码
private Long getSchemaVersionFromDb() { return jdbcTemplate.queryForList("SELECT schema_version FROM tb_schema_settings", Long.class).stream().findFirst().orElse(null); } private String getProductFromDb() { return jdbcTemplate.queryForList("SELECT product FROM tb_schema_settings", String.class).stream().findFirst().orElse(null); } private long getPackageSchemaVersionForDb() { String[] versionParts = getPackageSchemaVersion().split("\\."); long major = Integer.parseInt(versionParts[0]); long minor = Integer.parseInt(versionParts[1]); long maintenance = Integer.parseInt(versionParts[2]); long patch = Integer.parseInt(versionParts[3]); return major * 1_000_000_000L + minor * 1_000_000L + maintenance * 1000L + patch; }
private void onSchemaSettingsError(String message) { Runtime.getRuntime().addShutdownHook(new Thread(() -> log.error(message))); throw new RuntimeException(message); } private String normalizeVersion(String version) { String[] parts = version.split("\\."); int major = Integer.parseInt(parts[0]); int minor = parts.length > 1 ? Integer.parseInt(parts[1]) : 0; int maintenance = parts.length > 2 ? Integer.parseInt(parts[2]) : 0; int patch = parts.length > 3 ? Integer.parseInt(parts[3]) : 0; return major + "." + minor + "." + maintenance + "." + patch; } }
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\install\DefaultDatabaseSchemaSettingsService.java
2
请在Spring Boot框架中完成以下Java代码
public PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); } @Override protected void configure(HttpSecurity http) throws Exception { http.csrf() .disable() .cors() .and() .exceptionHandling() .authenticationEntryPoint(new HttpStatusEntryPoint(HttpStatus.UNAUTHORIZED)) .and() .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .authorizeRequests() .antMatchers(HttpMethod.OPTIONS) .permitAll() .antMatchers("/graphiql") .permitAll() .antMatchers("/graphql") .permitAll() .antMatchers(HttpMethod.GET, "/articles/feed") .authenticated() .antMatchers(HttpMethod.POST, "/users", "/users/login") .permitAll() .antMatchers(HttpMethod.GET, "/articles/**", "/profiles/**", "/tags") .permitAll() .anyRequest() .authenticated(); http.addFilterBefore(jwtTokenFilter(), UsernamePasswordAuthenticationFilter.class); } @Bean
public CorsConfigurationSource corsConfigurationSource() { final CorsConfiguration configuration = new CorsConfiguration(); configuration.setAllowedOrigins(asList("*")); configuration.setAllowedMethods(asList("HEAD", "GET", "POST", "PUT", "DELETE", "PATCH")); // setAllowCredentials(true) is important, otherwise: // The value of the 'Access-Control-Allow-Origin' header in the response must not be the // wildcard '*' when the request's credentials mode is 'include'. configuration.setAllowCredentials(false); // setAllowedHeaders is important! Without it, OPTIONS preflight request // will fail with 403 Invalid CORS request configuration.setAllowedHeaders(asList("Authorization", "Cache-Control", "Content-Type")); final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.registerCorsConfiguration("/**", configuration); return source; } }
repos\spring-boot-realworld-example-app-master\src\main\java\io\spring\api\security\WebSecurityConfig.java
2
请完成以下Java代码
public static boolean isHigherLevel(String currentName, String targetName) { return compareLevel(targetName, currentName) > 0; } /** * 获取所有职员层级名称 * @return 职员层级名称列表 */ public static List<String> getStaffLevelNames() { return Arrays.asList(MINISTER.getName(), VICE_MINISTER.getName(), STAFF.getName()); } /** * 获取所有领导层级名称 * @return 领导层级名称列表 */ public static List<String> getLeaderLevelNames() { return Arrays.asList(CHAIRMAN.getName(), GENERAL_MANAGER.getName(), VICE_GENERAL_MANAGER.getName()); } /** * 获取所有职级名称(按等级排序)
* @return 所有职级名称列表 */ public static List<String> getAllPositionNames() { return Arrays.asList( CHAIRMAN.getName(), GENERAL_MANAGER.getName(), VICE_GENERAL_MANAGER.getName(), MINISTER.getName(), VICE_MINISTER.getName(), STAFF.getName() ); } /** * 获取指定等级范围的职级 * @param minLevel 最小等级 * @param maxLevel 最大等级 * @return 职级名称列表 */ public static List<String> getPositionsByLevelRange(int minLevel, int maxLevel) { return Arrays.stream(values()) .filter(p -> p.getLevel() >= minLevel && p.getLevel() <= maxLevel) .map(PositionLevelEnum::getName) .collect(java.util.stream.Collectors.toList()); } }
repos\JeecgBoot-main\jeecg-boot\jeecg-boot-base-core\src\main\java\org\jeecg\common\constant\enums\PositionLevelEnum.java
1
请完成以下Java代码
public Set<String> getFlushRelevantEntityReferences() { return flushRelevantEntityReferences; } public String toString() { return operationType + " " + ClassNameUtil.getClassNameWithoutPackage(entity)+"["+entity.getId()+"]"; } public void setDependency(DbOperation owner) { dependentOperation = owner; } public DbOperation getDependentOperation() { return dependentOperation; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((entity == null) ? 0 : entity.hashCode()); result = prime * result + ((operationType == null) ? 0 : operationType.hashCode()); return result; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; DbEntityOperation other = (DbEntityOperation) obj; if (entity == null) { if (other.entity != null) return false; } else if (!entity.equals(other.entity)) return false; if (operationType != other.operationType) return false; return true; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\db\entitymanager\operation\DbEntityOperation.java
1
请完成以下Java代码
static final class KerberosClientCallbackHandler implements CallbackHandler { private String username; private String password; private KerberosClientCallbackHandler(String username, String password) { this.username = username; this.password = password; } @Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (Callback callback : callbacks) { if (callback instanceof NameCallback) { NameCallback ncb = (NameCallback) callback; ncb.setName(this.username);
} else if (callback instanceof PasswordCallback) { PasswordCallback pwcb = (PasswordCallback) callback; pwcb.setPassword(this.password.toCharArray()); } else { throw new UnsupportedCallbackException(callback, "We got a " + callback.getClass().getCanonicalName() + ", but only NameCallback and PasswordCallback is supported"); } } } } }
repos\spring-security-main\kerberos\kerberos-core\src\main\java\org\springframework\security\kerberos\authentication\sun\SunJaasKerberosClient.java
1
请完成以下Java代码
public class UsernameNotFoundException extends AuthenticationException { @Serial private static final long serialVersionUID = 1410688585992297006L; private static final String DEFAULT_USER_NOT_FOUND_MESSAGE = "user not found"; private final @Nullable String name; /** * Constructs a <code>UsernameNotFoundException</code> with the specified message. * @param msg the detail message. */ public UsernameNotFoundException(String msg) { super(msg); this.name = null; } /** * Constructs a {@code UsernameNotFoundException} with the specified message and root * cause. * @param msg the detail message. * @param cause root cause */ public UsernameNotFoundException(String msg, Throwable cause) { super(msg, cause); this.name = null; } private UsernameNotFoundException(String msg, String name) { super(msg); this.name = name; } private UsernameNotFoundException(String msg, String name, Throwable cause) {
super(msg, cause); this.name = name; } /** * Construct an exception based on a specific username * @param username the invalid username * @return the {@link UsernameNotFoundException} * @since 7.0 */ public static UsernameNotFoundException fromUsername(String username) { return new UsernameNotFoundException(DEFAULT_USER_NOT_FOUND_MESSAGE, username); } /** * Construct an exception based on a specific username * @param username the invalid username * @param cause any underlying cause * @return the {@link UsernameNotFoundException} * @since 7.0 */ public static UsernameNotFoundException fromUsername(String username, Throwable cause) { return new UsernameNotFoundException(DEFAULT_USER_NOT_FOUND_MESSAGE, username, cause); } /** * Get the username that couldn't be found * @return the username * @since 7.0 */ public @Nullable String getName() { return this.name; } }
repos\spring-security-main\core\src\main\java\org\springframework\security\core\userdetails\UsernameNotFoundException.java
1
请在Spring Boot框架中完成以下Java代码
public class Developer { // private long id; private String firstName; private String lastName; private String emailId; private Date createAt; @Id @GeneratedValue(strategy = GenerationType.AUTO) public long getId(){ return id; } public void setId(long id) { this.id = id; } @Column(name = "first_name", nullable = false) public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } @Column(name = "last_name", nullable = false) public String getLastName() { return lastName; } public void setLastName(String lastName) {
this.lastName = lastName; } @Column(name = "email_address", nullable = false) public String getEmailId() { return emailId; } public void setEmailId(String emailId) { this.emailId = emailId; } @Column(name = "create_at", nullable = false) @CreatedDate public Date getCreateAt() { return createAt; } public void setCreateAt(Date createAt) { this.createAt = createAt; } }
repos\SpringBoot-Projects-FullStack-master\Part-4 Spring Boot REST API\SpringMySQL\src\main\java\spring\restapi\model\Developer.java
2
请完成以下Java代码
public static boolean verify(String token, String username, String secret) { try { Algorithm algorithm = Algorithm.HMAC256(secret); JWTVerifier verifier = JWT.require(algorithm) .withClaim("username", username) .build(); verifier.verify(token); log.info("token is valid"); return true; } catch (Exception e) { log.info("token is invalid{}", e.getMessage()); return false; } } /** * 从 token中获取用户名 * * @return token中包含的用户名 */ public static String getUsername(String token) { try { DecodedJWT jwt = JWT.decode(token); return jwt.getClaim("username").asString(); } catch (JWTDecodeException e) { log.error("error:{}", e.getMessage()); return null; } } /** * 生成 token *
* @param username 用户名 * @param secret 用户的密码 * @return token */ public static String sign(String username, String secret) { try { username = StringUtils.lowerCase(username); Date date = new Date(System.currentTimeMillis() + EXPIRE_TIME); Algorithm algorithm = Algorithm.HMAC256(secret); return JWT.create() .withClaim("username", username) .withExpiresAt(date) .sign(algorithm); } catch (Exception e) { log.error("error:{}", e); return null; } } }
repos\SpringAll-master\62.Spring-Boot-Shiro-JWT\src\main\java\com\example\demo\authentication\JWTUtil.java
1
请完成以下Java代码
public class ShiroRedisCache<K, V> implements Cache<K, V> { private String cacheKey; // 缓存的超时时间,单位为s private long expireTime = 3600; public ShiroRedisCache(String cacheKey, long expireTime) { this.cacheKey = cacheKey; this.expireTime = expireTime; } @Override public V get(K key) throws CacheException { BoundHashOperations<String, K, V> hash = redisTemplate.boundHashOps(cacheKey); Object k = hashKey(key); return hash.get(k); } @Override public V put(K key, V value) throws CacheException { BoundHashOperations<String, K, V> hash = redisTemplate.boundHashOps(cacheKey); //超时时间 Object k = hashKey(key); hash.put((K) k, value); hash.expire(expireTime, TimeUnit.SECONDS); return value; } @Override public V remove(K key) throws CacheException { BoundHashOperations<String, K, V> hash = redisTemplate.boundHashOps(cacheKey); V value = null; try { Object k = hashKey(key); value = hash.get(k); hash.delete(k); } catch (Exception e) { e.printStackTrace(); } return value; } @Override public void clear() throws CacheException {
redisTemplate.delete(cacheKey); } @Override public int size() { BoundHashOperations<String, K, V> hash = redisTemplate.boundHashOps(cacheKey); return hash.size().intValue(); } @Override public Set<K> keys() { BoundHashOperations<String, K, V> hash = redisTemplate.boundHashOps(cacheKey); return hash.keys(); } @Override public Collection<V> values() { BoundHashOperations<String, K, V> hash = redisTemplate.boundHashOps(cacheKey); return hash.values(); } protected Object hashKey(K key) { //此处很重要,如果key是登录凭证,那么这是访问用户的授权缓存;将登录凭证转为user对象,返回user的id属性做为hash key,否则会以user对象做为hash key,这样就不好清除指定用户的缓存了 if (key instanceof PrincipalCollection) { PrincipalCollection pc = (PrincipalCollection) key; ShiroUser user = (ShiroUser) pc.getPrimaryPrincipal(); return user.getUserId(); } return key; } } }
repos\springBoot-master\springboot-shiro2\src\main\java\cn\abel\rest\shiro\ShiroRedisCacheManager.java
1
请完成以下Java代码
public void setGenre(String genre) { this.genre = genre; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } @Override public String toString() { return "Author{" + "id=" + id + ", name=" + name + ", genre=" + genre + ", age=" + age + '}'; } @Override public boolean equals(Object obj) {
if (obj == null) { return false; } if (this == obj) { return true; } if (getClass() != obj.getClass()) { return false; } return id != null && id.equals(((Author) obj).id); } @Override public int hashCode() { return 2021; } }
repos\Hibernate-SpringBoot-master\HibernateSpringBootUnproxyAProxy\src\main\java\com\bookstore\entity\Author.java
1
请完成以下Java代码
public <T> List<T> getDeployedArtifacts(Class<T> clazz) { for (Class<?> deployedArtifactsClass : deployedArtifacts.keySet()) { if (clazz.isAssignableFrom(deployedArtifactsClass)) { return (List<T>) deployedArtifacts.get(deployedArtifactsClass); } } return null; } @Override public void addAppDefinitionCacheEntry(String appDefinitionId, AppDefinitionCacheEntry appDefinitionCacheEntry) { appDefinitionCache.put(appDefinitionId, appDefinitionCacheEntry); } @Override public AppDefinitionCacheEntry getAppDefinitionCacheEntry(String appDefinitionId) { return appDefinitionCache.get(appDefinitionId); } // getters and setters //////////////////////////////////////////////////////// @Override public String getName() { return name; } @Override public void setName(String name) { this.name = name; } @Override public String getCategory() { return category; } @Override public void setCategory(String category) { this.category = category; } @Override public String getKey() { return key; } @Override public void setKey(String key) { this.key = key; } @Override public String getTenantId() { return tenantId; } @Override public void setTenantId(String tenantId) { this.tenantId = tenantId; } @Override public void setResources(Map<String, EngineResource> resources) { this.resources = resources; } @Override public Date getDeploymentTime() { return deploymentTime; } @Override public void setDeploymentTime(Date deploymentTime) { this.deploymentTime = deploymentTime; }
@Override public boolean isNew() { return isNew; } @Override public void setNew(boolean isNew) { this.isNew = isNew; } @Override public String getDerivedFrom() { return null; } @Override public String getDerivedFromRoot() { return null; } @Override public String getEngineVersion() { return null; } // common methods ////////////////////////////////////////////////////////// @Override public String toString() { return "AppDeploymentEntity[id=" + id + ", name=" + name + "]"; } }
repos\flowable-engine-main\modules\flowable-app-engine\src\main\java\org\flowable\app\engine\impl\persistence\entity\AppDeploymentEntityImpl.java
1
请完成以下Java代码
public void invalidateCandidatesFor(final Object model) { Check.errorIf(true, "Shall not be called, because we have getOnInvalidateForModelAction()=RECREATE_ASYNC; model: {}", model); } @Override public boolean isUserInChargeUserEditable() { return true; } /** * @param limit how many quality orders to retrieve * @return all PP_Orders which are suitable for invoices and there are no invoice candidates created yet. */ @Override public Iterator<I_PP_Order> retrieveAllModelsWithMissingCandidates(@NonNull final QueryLimit limit) { return dao.retrievePPOrdersWithMissingICs(limit); } /** * Does nothing. */ @Override public void setOrderedData(final I_C_Invoice_Candidate ic) { // nothing to do; the value won't change } /** * <ul> * <li>QtyDelivered := QtyOrdered * <li>DeliveryDate := DateOrdered * <li>M_InOut_ID: untouched * </ul> * * @see IInvoiceCandidateHandler#setDeliveredData(I_C_Invoice_Candidate) */ @Override public void setDeliveredData(final I_C_Invoice_Candidate ic) { ic.setQtyDelivered(ic.getQtyOrdered()); // when changing this, make sure to threat ProductType.Service specially ic.setQtyDeliveredInUOM(ic.getQtyEntered()); ic.setDeliveryDate(ic.getDateOrdered());
} @Override public void setBPartnerData(final I_C_Invoice_Candidate ic) { // nothing to do; the value won't change } /** * @return {@link OnInvalidateForModelAction#RECREATE_ASYNC}. */ @Override public final OnInvalidateForModelAction getOnInvalidateForModelAction() { return OnInvalidateForModelAction.RECREATE_ASYNC; } /* package */boolean isInvoiceable(final Object model) { final I_PP_Order ppOrder = InterfaceWrapperHelper.create(model, I_PP_Order.class); return dao.isInvoiceable(ppOrder); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java\de\metas\materialtracking\qualityBasedInvoicing\ic\spi\impl\PP_Order_MaterialTracking_Handler.java
1
请完成以下Java代码
private static final class ConstantExpression extends ConstantExpressionTemplate<BigDecimal, BigDecimalStringExpression>implements BigDecimalStringExpression { public ConstantExpression(final Compiler<BigDecimal, BigDecimalStringExpression> compiler, final String expressionStr, final BigDecimal constantValue) { super(ExpressionContext.EMPTY, compiler, expressionStr, constantValue); } } private static final class SingleParameterExpression extends SingleParameterExpressionTemplate<BigDecimal, BigDecimalStringExpression>implements BigDecimalStringExpression { public SingleParameterExpression(final ExpressionContext context, final Compiler<BigDecimal, BigDecimalStringExpression> compiler, final String expressionStr, final CtxName parameter) { super(context, compiler, expressionStr, parameter); } @Override protected Object extractParameterValue(final Evaluatee ctx)
{ return parameter.getValueAsBigDecimal(ctx); } } private static final class GeneralExpression extends GeneralExpressionTemplate<BigDecimal, BigDecimalStringExpression>implements BigDecimalStringExpression { public GeneralExpression(final ExpressionContext context, final Compiler<BigDecimal, BigDecimalStringExpression> compiler, final String expressionStr, final List<Object> expressionChunks) { super(context, compiler, expressionStr, expressionChunks); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\expression\api\impl\BigDecimalStringExpressionSupport.java
1
请完成以下Java代码
public int getUseLifeYears () { Integer ii = (Integer)get_Value(COLUMNNAME_UseLifeYears); if (ii == null) return 0; return ii.intValue(); } /** Set Use units. @param UseUnits Currently used units of the assets */ public void setUseUnits (int UseUnits) { set_Value (COLUMNNAME_UseUnits, Integer.valueOf(UseUnits)); } /** Get Use units. @return Currently used units of the assets */ public int getUseUnits () { Integer ii = (Integer)get_Value(COLUMNNAME_UseUnits); if (ii == null) return 0; return ii.intValue(); } /** Set Version No. @param VersionNo
Version Number */ public void setVersionNo (String VersionNo) { set_ValueNoCheck (COLUMNNAME_VersionNo, VersionNo); } /** Get Version No. @return Version Number */ public String getVersionNo () { return (String)get_Value(COLUMNNAME_VersionNo); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_A_Asset_Change.java
1
请在Spring Boot框架中完成以下Java代码
void setTemplateDefaults(AnnotationTemplateExpressionDefaults templateDefaults) { this.templateDefaults = templateDefaults; } @Override public void afterSingletonsInstantiated() { SimpleUrlHandlerMapping mapping = getBeanOrNull(SIMPLE_URL_HANDLER_MAPPING_BEAN_NAME, SimpleUrlHandlerMapping.class); if (mapping == null) { return; } configureCsrf(mapping); } private <T> T getBeanOrNull(String name, Class<T> type) { Map<String, T> beans = this.context.getBeansOfType(type); return beans.get(name); } private void configureCsrf(SimpleUrlHandlerMapping mapping) { Map<String, Object> mappings = mapping.getHandlerMap(); for (Object object : mappings.values()) { if (object instanceof SockJsHttpRequestHandler) { setHandshakeInterceptors((SockJsHttpRequestHandler) object); } else if (object instanceof WebSocketHttpRequestHandler) { setHandshakeInterceptors((WebSocketHttpRequestHandler) object); } else { throw new IllegalStateException( "Bean " + SIMPLE_URL_HANDLER_MAPPING_BEAN_NAME + " is expected to contain mappings to either a " + "SockJsHttpRequestHandler or a WebSocketHttpRequestHandler but got " + object); } } }
private void setHandshakeInterceptors(SockJsHttpRequestHandler handler) { SockJsService sockJsService = handler.getSockJsService(); Assert.state(sockJsService instanceof TransportHandlingSockJsService, () -> "sockJsService must be instance of TransportHandlingSockJsService got " + sockJsService); TransportHandlingSockJsService transportHandlingSockJsService = (TransportHandlingSockJsService) sockJsService; List<HandshakeInterceptor> handshakeInterceptors = transportHandlingSockJsService.getHandshakeInterceptors(); List<HandshakeInterceptor> interceptorsToSet = new ArrayList<>(handshakeInterceptors.size() + 1); interceptorsToSet.add(new CsrfTokenHandshakeInterceptor()); interceptorsToSet.addAll(handshakeInterceptors); transportHandlingSockJsService.setHandshakeInterceptors(interceptorsToSet); } private void setHandshakeInterceptors(WebSocketHttpRequestHandler handler) { List<HandshakeInterceptor> handshakeInterceptors = handler.getHandshakeInterceptors(); List<HandshakeInterceptor> interceptorsToSet = new ArrayList<>(handshakeInterceptors.size() + 1); interceptorsToSet.add(new CsrfTokenHandshakeInterceptor()); interceptorsToSet.addAll(handshakeInterceptors); handler.setHandshakeInterceptors(interceptorsToSet); } }
repos\spring-security-main\config\src\main\java\org\springframework\security\config\annotation\web\socket\WebSocketMessageBrokerSecurityConfiguration.java
2
请完成以下Java代码
public void setName (String Name) { set_Value (COLUMNNAME_Name, Name); } /** Get Name. @return Alphanumeric identifier of the entity */ @Override 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()); } // /** PaymentRule AD_Reference_ID=214 */ // public static final int PAYMENTRULE_AD_Reference_ID=214; // /** Credit Card = C */ // public static final String PAYMENTRULE_CreditCard = "C"; // /** Check = K */ // public static final String PAYMENTRULE_Check = "K"; // /** Direct Deposit = A */ // public static final String PAYMENTRULE_DirectDeposit = "A"; // /** Direct Debit = D */ // public static final String PAYMENTRULE_DirectDebit = "D"; // /** Account = T */ // public static final String PAYMENTRULE_Account = "T"; // /** Cash = X */ // public static final String PAYMENTRULE_Cash = "X"; /** Set Payment Rule. @param PaymentRule How you pay the invoice */ @Override public void setPaymentRule (String PaymentRule) { set_Value (COLUMNNAME_PaymentRule, PaymentRule); } /** Get Payment Rule. @return How you pay the invoice */ @Override public String getPaymentRule () { return (String)get_Value(COLUMNNAME_PaymentRule); } /** Set Processed. @param Processed The document has been processed */ @Override public void setProcessed (boolean Processed) { set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed)); } /** Get Processed. @return The document has been processed */ @Override public boolean isProcessed () { Object oo = get_Value(COLUMNNAME_Processed); if (oo != null) { if (oo instanceof Boolean) { return ((Boolean)oo).booleanValue(); } return "Y".equals(oo); } return false; } /** Set Process Now. @param Processing Process Now */ @Override public void setProcessing (boolean Processing)
{ set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing)); } /** Get Process Now. @return Process Now */ @Override public boolean isProcessing () { Object oo = get_Value(COLUMNNAME_Processing); if (oo != null) { if (oo instanceof Boolean) { return ((Boolean)oo).booleanValue(); } return "Y".equals(oo); } return false; } /** Set Search Key. @param Value Search key for the record in the format required - must be unique */ @Override public void setValue (String Value) { set_Value (COLUMNNAME_Value, Value); } /** Get Search Key. @return Search key for the record in the format required - must be unique */ @Override public String getValue () { return (String)get_Value(COLUMNNAME_Value); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_HR_Payroll.java
1
请完成以下Java代码
public void setLevel_Max (final @Nullable BigDecimal Level_Max) { set_Value (COLUMNNAME_Level_Max, Level_Max); } @Override public BigDecimal getLevel_Max() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Level_Max); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setLevel_Min (final BigDecimal Level_Min) { set_Value (COLUMNNAME_Level_Min, Level_Min); } @Override public BigDecimal getLevel_Min() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Level_Min); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setM_Locator_ID (final int M_Locator_ID) { if (M_Locator_ID < 1) set_Value (COLUMNNAME_M_Locator_ID, null); else set_Value (COLUMNNAME_M_Locator_ID, M_Locator_ID); } @Override public int getM_Locator_ID() { return get_ValueAsInt(COLUMNNAME_M_Locator_ID); } @Override public void setM_Product_ID (final int M_Product_ID) { if (M_Product_ID < 1) set_ValueNoCheck (COLUMNNAME_M_Product_ID, null); else set_ValueNoCheck (COLUMNNAME_M_Product_ID, M_Product_ID); } @Override public int getM_Product_ID() { return get_ValueAsInt(COLUMNNAME_M_Product_ID); } @Override public void setM_Replenish_ID (final int M_Replenish_ID) { if (M_Replenish_ID < 1) set_ValueNoCheck (COLUMNNAME_M_Replenish_ID, null); else set_ValueNoCheck (COLUMNNAME_M_Replenish_ID, M_Replenish_ID); } @Override public int getM_Replenish_ID() { return get_ValueAsInt(COLUMNNAME_M_Replenish_ID); } @Override public void setM_Warehouse_ID (final int M_Warehouse_ID) { if (M_Warehouse_ID < 1) set_ValueNoCheck (COLUMNNAME_M_Warehouse_ID, null); else set_ValueNoCheck (COLUMNNAME_M_Warehouse_ID, M_Warehouse_ID); } @Override public int getM_Warehouse_ID() { return get_ValueAsInt(COLUMNNAME_M_Warehouse_ID);
} /** * ReplenishType AD_Reference_ID=164 * Reference name: M_Replenish Type */ public static final int REPLENISHTYPE_AD_Reference_ID=164; /** Maximalbestand beibehalten = 2 */ public static final String REPLENISHTYPE_MaximalbestandBeibehalten = "2"; /** Manuell = 0 */ public static final String REPLENISHTYPE_Manuell = "0"; /** Bei Unterschreitung Minimalbestand = 1 */ public static final String REPLENISHTYPE_BeiUnterschreitungMinimalbestand = "1"; /** Custom = 9 */ public static final String REPLENISHTYPE_Custom = "9"; /** Zuk?nftigen Bestand sichern = 7 */ public static final String REPLENISHTYPE_ZukNftigenBestandSichern = "7"; @Override public void setReplenishType (final java.lang.String ReplenishType) { set_Value (COLUMNNAME_ReplenishType, ReplenishType); } @Override public java.lang.String getReplenishType() { return get_ValueAsString(COLUMNNAME_ReplenishType); } @Override public void setTimeToMarket (final int TimeToMarket) { set_Value (COLUMNNAME_TimeToMarket, TimeToMarket); } @Override public int getTimeToMarket() { return get_ValueAsInt(COLUMNNAME_TimeToMarket); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Replenish.java
1
请完成以下Java代码
public static String getFileNameFromUrl(String fileUrl) { try { // 处理HTTP URL:从路径部分提取文件名 if (fileUrl.startsWith(CommonConstant.STR_HTTP)) { URL url = new URL(fileUrl); String path = url.getPath(); return path.substring(path.lastIndexOf('/') + 1); } // 处理本地文件路径:从文件路径提取文件名 return fileUrl.substring(fileUrl.lastIndexOf(File.separator) + 1); } catch (Exception e) { // 如果解析失败,使用时间戳作为文件名 return "file_" + System.currentTimeMillis(); } } /** * 生成ZIP中的文件名 * 功能:避免文件名冲突,为多个文件添加序号 * @param fileUrl 文件URL(用于提取原始文件名) * @param index 文件序号(从0开始) * @param total 文件总数 * @return 处理后的文件名(带序号)
*/ public static String generateFileName(String fileUrl, int index, int total) { // 从URL中提取原始文件名 String originalFileName = getFileNameFromUrl(fileUrl); // 如果只有一个文件,直接使用原始文件名 if (total == 1) { return originalFileName; } // 多个文件时,使用序号+原始文件名 String extension = getFileExtension(originalFileName); String nameWithoutExtension = originalFileName.replace("." + extension, ""); return String.format("%s_%d.%s", nameWithoutExtension, index + 1, extension); } }
repos\JeecgBoot-main\jeecg-boot\jeecg-boot-base-core\src\main\java\org\jeecg\common\util\FileDownloadUtils.java
1
请在Spring Boot框架中完成以下Java代码
public LocalContainerEntityManagerFactoryBean entityManagerFactory(@Qualifier("secondDataSource") DataSource secondDataSource, @Qualifier("secondJpaProperties") JpaProperties jpaProperties, EntityManagerFactoryBuilder builder) { return builder // 设置数据源 .dataSource(secondDataSource) // 设置jpa配置 .properties(jpaProperties.getProperties()) // 设置实体包名 .packages(ENTITY_PACKAGE) // 设置持久化单元名,用于@PersistenceContext注解获取EntityManager时指定数据源 .persistenceUnit("secondPersistenceUnit").build(); } /** * 获取实体管理对象 * * @param factory 注入名为secondEntityManagerFactory的bean * @return 实体管理对象 */ @Bean(name = "secondEntityManager")
public EntityManager entityManager(@Qualifier("secondEntityManagerFactory") EntityManagerFactory factory) { return factory.createEntityManager(); } /** * 获取主库事务管理对象 * * @param factory 注入名为secondEntityManagerFactory的bean * @return 事务管理对象 */ @Bean(name = "secondTransactionManager") public PlatformTransactionManager transactionManager(@Qualifier("secondEntityManagerFactory") EntityManagerFactory factory) { return new JpaTransactionManager(factory); } }
repos\spring-boot-demo-master\demo-multi-datasource-jpa\src\main\java\com\xkcoding\multi\datasource\jpa\config\SecondJpaConfig.java
2
请完成以下Java代码
public ExportStatus getExportStatus() { return exportStatus; } protected void setExportStatus(ExportStatus newStatus) { exportStatus = newStatus; } @Override public Throwable getError() { return error; } @Override public final void export(@NonNull final OutputStream out) { final IExportDataSource dataSource = getDataSource(); Check.assumeNotNull(dataSource, "dataSource not null"); Check.assume(ExportStatus.NotStarted.equals(getExportStatus()), "ExportStatus shall be " + ExportStatus.NotStarted + " and not {}", getExportStatus()); IExportDataDestination dataDestination = null; try { // Init dataDestination // NOTE: make sure we are doing this as first thing, because if anything fails, we need to close this "destination" dataDestination = createDataDestination(out); // Init status error = null; setExportStatus(ExportStatus.Running); monitor.exportStarted(this); while (dataSource.hasNext()) { final List<Object> values = dataSource.next(); // for (int i = 1; i <= 3000; i++) // debugging // { appendRow(dataDestination, values); incrementExportedRowCount(); // } } } catch (Exception e) { final AdempiereException ex = new AdempiereException("Error while exporting line " + getExportedRowCount() + ": " + e.getLocalizedMessage(), e); error = ex; throw ex; } finally { close(dataSource); close(dataDestination); dataDestination = null;
setExportStatus(ExportStatus.Finished); // Notify the monitor but discard all exceptions because we don't want to throw an "false" exception in finally block try { monitor.exportFinished(this); } catch (Exception e) { logger.error("Error while invoking monitor(finish): " + e.getLocalizedMessage(), e); } } logger.info("Exported " + getExportedRowCount() + " rows"); } protected abstract void appendRow(IExportDataDestination dataDestination, List<Object> values) throws IOException; protected abstract IExportDataDestination createDataDestination(OutputStream out) throws IOException; /** * Close {@link Closeable} object. * * NOTE: if <code>closeableObj</code> is not implementing {@link Closeable} or is null, nothing will happen * * @param closeableObj */ private static final void close(Object closeableObj) { if (closeableObj instanceof Closeable) { final Closeable closeable = (Closeable)closeableObj; try { closeable.close(); } catch (IOException e) { e.printStackTrace(); // NOPMD by tsa on 3/17/13 1:30 PM } } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\data\export\api\impl\AbstractExporter.java
1
请完成以下Java代码
public void setPrivateNote (String PrivateNote) { set_Value (COLUMNNAME_PrivateNote, PrivateNote); } /** Get Private Note. @return Private Note - not visible to the other parties */ public String getPrivateNote () { return (String)get_Value(COLUMNNAME_PrivateNote); } /** Set Text Message. @param TextMsg
Text Message */ public void setTextMsg (String TextMsg) { set_Value (COLUMNNAME_TextMsg, TextMsg); } /** Get Text Message. @return Text Message */ public String getTextMsg () { return (String)get_Value(COLUMNNAME_TextMsg); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_B_Bid.java
1
请完成以下Spring Boot application配置
# Enabling H2 Console spring.h2.console.enabled=true #Turn Statistics on spring.jpa.properties.hibernate.generate_statistics=true logging.level.org.hibernate.stat=debug # Show all queries spring.jpa.show-sql=true spring.jpa.properties.hibernate.format_sql=true logging.level.
org.hibernate.type=trace spring.datasource.url=jdbc:h2:mem:testdb spring.data.jpa.repositories.bootstrap-mode=default
repos\Spring-Boot-Advanced-Projects-main\spring-boot jpa-with-hibernate-and-h2\src\main\resources\application.properties
2
请完成以下Java代码
public void correctBounds(ComponentWrapper comp) { // no corrections } public void setEnforceSameSizeOnAllLabels(boolean enforceSameSizeOnAllLabels) { this.enforceSameSizeOnAllLabels = enforceSameSizeOnAllLabels; } public void setLabelMinWidth(final int labelMinWidth) { this.labelMinWidth = labelMinWidth; } public void setLabelMaxWidth(final int labelMaxWidth) { this.labelMaxWidth = labelMaxWidth; } public void setFieldMinWidth(final int fieldMinWidth) { this.fieldMinWidth = fieldMinWidth; } public void setFieldMaxWidth(final int fieldMaxWidth) { this.fieldMaxWidth = fieldMaxWidth; } public void updateMinWidthFrom(final CLabel label) { final int labelWidth = label.getPreferredSize().width; labelMinWidth = labelWidth > labelMinWidth ? labelWidth : labelMinWidth;
logger.trace("LabelMinWidth={} ({})", new Object[] { labelMinWidth, label }); } public void updateMinWidthFrom(final VEditor editor) { final JComponent editorComp = swingEditorFactory.getEditorComponent(editor); final int editorCompWidth = editorComp.getPreferredSize().width; if (editorCompWidth > fieldMinWidth) { fieldMinWidth = editorCompWidth; } logger.trace("FieldMinWidth={} ({})", new Object[] { fieldMinWidth, editorComp }); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\org\compiere\grid\VPanelLayoutCallback.java
1
请完成以下Java代码
public boolean equals(final Object obj) { if (this == obj) { return true; } final MethodNameCalloutInstance other = EqualsBuilder.getOther(this, obj); if (other == null) { return false; } return id.equals(other.id); } @Override public void execute(final ICalloutExecutor executor, final ICalloutField field) { try { legacyCallout.start(methodName, field); } catch (final CalloutException e) { throw e.setCalloutExecutor(executor) .setCalloutInstance(this) .setField(field); } catch (final Exception e) { throw CalloutExecutionException.wrapIfNeeded(e) .setCalloutExecutor(executor)
.setCalloutInstance(this) .setField(field); } } @VisibleForTesting public org.compiere.model.Callout getLegacyCallout() { return legacyCallout; } public String getMethodName() { return methodName; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\callout\api\impl\MethodNameCalloutInstance.java
1
请在Spring Boot框架中完成以下Java代码
public UserLoginRespVO login(@RequestBody UserLoginReqVO reqVO) { UserLoginRespVO respVO = new UserLoginRespVO(); respVO.setUserId(1024); respVO.setUsername(reqVO.getUsername()); respVO.setName("芋道源码"); return respVO; } /** * showdoc * @title 用户登录 * @description 用户登录的接口 * @url http://127.0.0.1:8080/user/login2 * @method POST * @json_param {"username": "yudaoyuanma", "password": "yunai"} * @param username 必选 string 用户名 * @param password 必选 string 密码
* @return { "userId": 1024, "name": "芋道源码", "username": "yudaoyuanma" } * @return_param userId 必选 number 用户编号 * @return_param name 必选 string 用户昵称 * @return_param username 必选 string 用户账号 * @remark 我就是快乐的备注 */ @PostMapping("/login2") public UserLoginRespVO login2(@RequestBody UserLoginReqVO reqVO) { UserLoginRespVO respVO = new UserLoginRespVO(); respVO.setUserId(1024); respVO.setUsername(reqVO.getUsername()); respVO.setName("芋道源码"); return respVO; } }
repos\SpringBoot-Labs-master\lab-24\lab-24-apidoc-showdoc\src\main\java\cn\iocoder\springboot\lab24\apidoc\controller\UserController.java
2
请完成以下Java代码
public static byte[] floatToBytes(float f) { return intToBytes(Float.floatToIntBits(f)); } /** * 将一个整数转换位字节数组(4个字节),b[0]存储高位字符,大端 * * @param i 整数 * @return 代表整数的字节数组 */ public static byte[] intToBytes(int i) { byte[] b = new byte[4]; b[0] = (byte) (i >>> 24); b[1] = (byte) (i >>> 16); b[2] = (byte) (i >>> 8); b[3] = (byte) i; return b; } /** * 将一个长整数转换位字节数组(8个字节),b[0]存储高位字符,大端 * * @param l 长整数 * @return 代表长整数的字节数组 */ public static byte[] longToBytes(long l) { byte[] b = new byte[8]; b[0] = (byte) (l >>> 56); b[1] = (byte) (l >>> 48); b[2] = (byte) (l >>> 40); b[3] = (byte) (l >>> 32); b[4] = (byte) (l >>> 24); b[5] = (byte) (l >>> 16); b[6] = (byte) (l >>> 8); b[7] = (byte) (l); return b; } /** * 字节数组和整型的转换 * * @param bytes 字节数组 * @return 整型 */ public static int bytesToInt(byte[] bytes, int start) { int num = bytes[start] & 0xFF; num |= ((bytes[start + 1] << 8) & 0xFF00); num |= ((bytes[start + 2] << 16) & 0xFF0000); num |= ((bytes[start + 3] << 24) & 0xFF000000); return num; } /** * 字节数组和整型的转换,高位在前,适用于读取writeInt的数据 * * @param bytes 字节数组 * @return 整型 */ public static int bytesHighFirstToInt(byte[] bytes, int start) { int num = bytes[start + 3] & 0xFF; num |= ((bytes[start + 2] << 8) & 0xFF00); num |= ((bytes[start + 1] << 16) & 0xFF0000); num |= ((bytes[start] << 24) & 0xFF000000);
return num; } /** * 字节数组转char,高位在前,适用于读取writeChar的数据 * * @param bytes * @param start * @return */ public static char bytesHighFirstToChar(byte[] bytes, int start) { char c = (char) (((bytes[start] & 0xFF) << 8) | (bytes[start + 1] & 0xFF)); return c; } /** * 读取float,高位在前 * * @param bytes * @param start * @return */ public static float bytesHighFirstToFloat(byte[] bytes, int start) { int l = bytesHighFirstToInt(bytes, start); return Float.intBitsToFloat(l); } /** * 无符号整型输出 * @param out * @param uint * @throws IOException */ public static void writeUnsignedInt(DataOutputStream out, int uint) throws IOException { out.writeByte((byte) ((uint >>> 8) & 0xFF)); out.writeByte((byte) ((uint >>> 0) & 0xFF)); } public static int convertTwoCharToInt(char high, char low) { int result = high << 16; result |= low; return result; } public static char[] convertIntToTwoChar(int n) { char[] result = new char[2]; result[0] = (char) (n >>> 16); result[1] = (char) (0x0000FFFF & n); return result; } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\utility\ByteUtil.java
1
请在Spring Boot框架中完成以下Java代码
public class HelloResource { /** * Say hello to currently logged in user. * * Authorized only for principals with Roles.HELLO_ROLE role. * * @return a Message to say hello */ @GET("/message") @RolesAllowed(Roles.HELLO_ROLE) public Message sayHello() { return new Message().setMessage(String.format( "hello %s, it's %s", RestxSession.current().getPrincipal().get().getName(), DateTime.now(DateTimeZone.UTC).toString("HH:mm:ss"))); } /** * Say hello to anybody. * * Does not require authentication. *
* @return a Message to say hello */ @GET("/hello") @PermitAll public Message helloPublic(String who) { return new Message().setMessage(String.format( "hello %s, it's %s", who, DateTime.now(DateTimeZone.UTC).toString("HH:mm:ss"))); } public static class MyPOJO { @NotNull String value; public String getValue(){ return value; } public void setValue(String value){ this.value = value; } } @POST("/mypojo") @PermitAll public MyPOJO helloPojo(MyPOJO pojo){ pojo.setValue("hello "+pojo.getValue()); return pojo; } }
repos\tutorials-master\web-modules\restx\src\main\java\restx\demo\rest\HelloResource.java
2
请完成以下Java代码
public void setTo_Country_ID (final int To_Country_ID) { if (To_Country_ID < 1) set_Value (COLUMNNAME_To_Country_ID, null); else set_Value (COLUMNNAME_To_Country_ID, To_Country_ID); } @Override public int getTo_Country_ID() { return get_ValueAsInt(COLUMNNAME_To_Country_ID); } @Override public void setValidFrom (final java.sql.Timestamp ValidFrom) { set_Value (COLUMNNAME_ValidFrom, ValidFrom); } @Override public java.sql.Timestamp getValidFrom() { return get_ValueAsTimestamp(COLUMNNAME_ValidFrom); } @Override public void setValidTo (final @Nullable java.sql.Timestamp ValidTo) { set_Value (COLUMNNAME_ValidTo, ValidTo); } @Override public java.sql.Timestamp getValidTo()
{ return get_ValueAsTimestamp(COLUMNNAME_ValidTo); } @Override public void setVATaxID (final java.lang.String VATaxID) { set_Value (COLUMNNAME_VATaxID, VATaxID); } @Override public java.lang.String getVATaxID() { return get_ValueAsString(COLUMNNAME_VATaxID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Fiscal_Representation.java
1
请在Spring Boot框架中完成以下Java代码
public boolean supportsUnionAll() { return true; } public boolean hasAlterTable() { return false; // As specify in NHibernate dialect } public boolean dropConstraints() { return false; } public String getAddColumnString() { return "add column"; } public String getForUpdateString() { return ""; } public boolean supportsOuterJoinForUpdate() { return false; } public String getDropForeignKeyString() { throw new UnsupportedOperationException("No drop foreign key syntax supported by SQLiteDialect"); } public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey, boolean referencesPrimaryKey) { throw new UnsupportedOperationException("No add foreign key syntax supported by SQLiteDialect"); }
public String getAddPrimaryKeyConstraintString(String constraintName) { throw new UnsupportedOperationException("No add primary key syntax supported by SQLiteDialect"); } public boolean supportsIfExistsBeforeTableName() { return true; } public boolean supportsCascadeDelete() { return false; } }
repos\SpringBoot-vue-master\src\main\java\com\boylegu\springboot_vue\config\SQLiteDialect.java
2
请完成以下Java代码
public int getC_OrderPO_ID() { return get_ValueAsInt(COLUMNNAME_C_OrderPO_ID); } @Override public void setC_PurchaseCandidate_Alloc_ID (final int C_PurchaseCandidate_Alloc_ID) { if (C_PurchaseCandidate_Alloc_ID < 1) set_ValueNoCheck (COLUMNNAME_C_PurchaseCandidate_Alloc_ID, null); else set_ValueNoCheck (COLUMNNAME_C_PurchaseCandidate_Alloc_ID, C_PurchaseCandidate_Alloc_ID); } @Override public int getC_PurchaseCandidate_Alloc_ID() { return get_ValueAsInt(COLUMNNAME_C_PurchaseCandidate_Alloc_ID); } @Override public de.metas.purchasecandidate.model.I_C_PurchaseCandidate getC_PurchaseCandidate() { return get_ValueAsPO(COLUMNNAME_C_PurchaseCandidate_ID, de.metas.purchasecandidate.model.I_C_PurchaseCandidate.class); } @Override public void setC_PurchaseCandidate(final de.metas.purchasecandidate.model.I_C_PurchaseCandidate C_PurchaseCandidate) { set_ValueFromPO(COLUMNNAME_C_PurchaseCandidate_ID, de.metas.purchasecandidate.model.I_C_PurchaseCandidate.class, C_PurchaseCandidate); } @Override public void setC_PurchaseCandidate_ID (final int C_PurchaseCandidate_ID) { if (C_PurchaseCandidate_ID < 1) set_ValueNoCheck (COLUMNNAME_C_PurchaseCandidate_ID, null); else set_ValueNoCheck (COLUMNNAME_C_PurchaseCandidate_ID, C_PurchaseCandidate_ID); } @Override public int getC_PurchaseCandidate_ID() { return get_ValueAsInt(COLUMNNAME_C_PurchaseCandidate_ID); } @Override public void setDateOrdered (final @Nullable java.sql.Timestamp DateOrdered) { set_Value (COLUMNNAME_DateOrdered, DateOrdered); } @Override
public java.sql.Timestamp getDateOrdered() { return get_ValueAsTimestamp(COLUMNNAME_DateOrdered); } @Override public void setDatePromised (final @Nullable java.sql.Timestamp DatePromised) { set_Value (COLUMNNAME_DatePromised, DatePromised); } @Override public java.sql.Timestamp getDatePromised() { return get_ValueAsTimestamp(COLUMNNAME_DatePromised); } @Override public void setRecord_ID (final int Record_ID) { if (Record_ID < 0) set_Value (COLUMNNAME_Record_ID, null); else set_Value (COLUMNNAME_Record_ID, Record_ID); } @Override public int getRecord_ID() { return get_ValueAsInt(COLUMNNAME_Record_ID); } @Override public void setRemotePurchaseOrderId (final @Nullable java.lang.String RemotePurchaseOrderId) { set_Value (COLUMNNAME_RemotePurchaseOrderId, RemotePurchaseOrderId); } @Override public java.lang.String getRemotePurchaseOrderId() { return get_ValueAsString(COLUMNNAME_RemotePurchaseOrderId); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.purchasecandidate.base\src\main\java-gen\de\metas\purchasecandidate\model\X_C_PurchaseCandidate_Alloc.java
1
请完成以下Java代码
public void setState(State state) { switch (state) { case UNCHECKED: super.setArmed(false); setPressed(false); setSelected(false); break; case CHECKED: super.setArmed(false); setPressed(false); setSelected(true); break; case GREY_UNCHECKED: super.setArmed(true); setPressed(true); setSelected(false); break; case GREY_CHECKED: super.setArmed(true); setPressed(true); setSelected(true); break; } } /** * The current state is embedded in the selection / armed state of the * model. We return the CHECKED state when the checkbox is selected but * not armed, GREY_CHECKED state when the checkbox is selected and armed * (grey) and UNCHECKED when the checkbox is deselected. */ public State getState() { if (isSelected() && !isArmed()) { // CHECKED return State.CHECKED; } else if (isSelected() && isArmed()) { // GREY_CHECKED
return State.GREY_CHECKED; } else if (!isSelected() && isArmed()) { // GREY_UNCHECKED return State.GREY_UNCHECKED; } else { // (!isSelected() && !isArmed()){ // UNCHECKED return State.UNCHECKED; } } /** * We rotate between UNCHECKED, CHECKED, GREY_UNCHECKED, GREY_CHECKED. */ public void nextState() { switch (getState()) { case UNCHECKED: setState(State.CHECKED); break; case CHECKED: setState(State.GREY_UNCHECKED); break; case GREY_UNCHECKED: setState(State.GREY_CHECKED); break; case GREY_CHECKED: setState(State.UNCHECKED); break; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\it\cnr\imaa\essi\lablib\gui\checkboxtree\QuadristateButtonModel.java
1
请完成以下Java代码
protected void initDefaultCredentials() { if (StringUtils.isNotBlank(defaultUsername)) { login.setUsername(defaultUsername); } if (StringUtils.isNotBlank(defaultPassword)) { login.setPassword(defaultPassword); } } @Subscribe("login") public void onLogin(final LoginEvent event) { try { loginViewSupport.authenticate( AuthDetails.of(event.getUsername(), event.getPassword()) .withLocale(login.getSelectedLocale()) .withRememberMe(login.isRememberMe()) ); } catch (final BadCredentialsException | DisabledException | LockedException | AccessDeniedException e) { log.warn("Login failed for user '{}': {}", event.getUsername(), e.toString()); event.getSource().setError(true); } } @Override public void localeChange(final LocaleChangeEvent event) { UI.getCurrent().getPage().setTitle(messageBundle.getMessage("LoginView.title")); final JmixLoginI18n loginI18n = JmixLoginI18n.createDefault(); final JmixLoginI18n.JmixForm form = new JmixLoginI18n.JmixForm(); form.setTitle(messageBundle.getMessage("loginForm.headerTitle")); form.setUsername(messageBundle.getMessage("loginForm.username")); form.setPassword(messageBundle.getMessage("loginForm.password"));
form.setSubmit(messageBundle.getMessage("loginForm.submit")); form.setForgotPassword(messageBundle.getMessage("loginForm.forgotPassword")); form.setRememberMe(messageBundle.getMessage("loginForm.rememberMe")); loginI18n.setForm(form); final LoginI18n.ErrorMessage errorMessage = new LoginI18n.ErrorMessage(); errorMessage.setTitle(messageBundle.getMessage("loginForm.errorTitle")); errorMessage.setMessage(messageBundle.getMessage("loginForm.badCredentials")); errorMessage.setUsername(messageBundle.getMessage("loginForm.errorUsername")); errorMessage.setPassword(messageBundle.getMessage("loginForm.errorPassword")); loginI18n.setErrorMessage(errorMessage); login.setI18n(loginI18n); } }
repos\tutorials-master\spring-boot-modules\jmix\src\main\java\com\baeldung\jmix\expensetracker\view\login\LoginView.java
1
请完成以下Java代码
public void setProcessing (final boolean Processing) { set_Value (COLUMNNAME_Processing, Processing); } @Override public boolean isProcessing() { return get_ValueAsBoolean(COLUMNNAME_Processing); } @Override public void setTermDuration (final int TermDuration) { set_Value (COLUMNNAME_TermDuration, TermDuration); } @Override public int getTermDuration() { return get_ValueAsInt(COLUMNNAME_TermDuration); } /** * TermDurationUnit AD_Reference_ID=540281 * Reference name: TermDurationUnit */ public static final int TERMDURATIONUNIT_AD_Reference_ID=540281; /** Monat(e) = month */ public static final String TERMDURATIONUNIT_MonatE = "month"; /** Woche(n) = week */ public static final String TERMDURATIONUNIT_WocheN = "week"; /** Tag(e) = day */ public static final String TERMDURATIONUNIT_TagE = "day"; /** Jahr(e) = year */ public static final String TERMDURATIONUNIT_JahrE = "year"; @Override public void setTermDurationUnit (final java.lang.String TermDurationUnit) { set_Value (COLUMNNAME_TermDurationUnit, TermDurationUnit); } @Override public java.lang.String getTermDurationUnit() { return get_ValueAsString(COLUMNNAME_TermDurationUnit); } @Override public void setTermOfNotice (final int TermOfNotice) { set_Value (COLUMNNAME_TermOfNotice, TermOfNotice); } @Override public int getTermOfNotice() { return get_ValueAsInt(COLUMNNAME_TermOfNotice); }
/** * TermOfNoticeUnit AD_Reference_ID=540281 * Reference name: TermDurationUnit */ public static final int TERMOFNOTICEUNIT_AD_Reference_ID=540281; /** Monat(e) = month */ public static final String TERMOFNOTICEUNIT_MonatE = "month"; /** Woche(n) = week */ public static final String TERMOFNOTICEUNIT_WocheN = "week"; /** Tag(e) = day */ public static final String TERMOFNOTICEUNIT_TagE = "day"; /** Jahr(e) = year */ public static final String TERMOFNOTICEUNIT_JahrE = "year"; @Override public void setTermOfNoticeUnit (final java.lang.String TermOfNoticeUnit) { set_Value (COLUMNNAME_TermOfNoticeUnit, TermOfNoticeUnit); } @Override public java.lang.String getTermOfNoticeUnit() { return get_ValueAsString(COLUMNNAME_TermOfNoticeUnit); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java-gen\de\metas\contracts\model\X_C_Flatrate_Transition.java
1
请在Spring Boot框架中完成以下Java代码
public class SecurityConfig extends WebSecurityConfigurerAdapter { private static final String REALM = "MSV3_SERVER"; public static final String ROLE_CLIENT = "ROLE_CLIENT"; public static final String ROLE_SERVER_ADMIN = "ROLE_SERVER_ADMIN"; @Autowired public void configureGlobalSecurity( final AuthenticationManagerBuilder auth, final MSV3ServerAuthenticationService msv3authService) throws Exception { auth.userDetailsService(msv3authService); } @Override protected void configure(final HttpSecurity http) throws Exception { http .csrf().disable() .authorizeRequests() .antMatchers(MSV3ServerConstants.WEBSERVICE_ENDPOINT_PATH + "/**").hasAuthority(ROLE_CLIENT) .antMatchers(MSV3ServerConstants.REST_ENDPOINT_PATH + "/**").hasAuthority(ROLE_SERVER_ADMIN) .and().httpBasic().realmName(REALM).authenticationEntryPoint(getBasicAuthEntryPoint()) .and().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); }
@Bean public BasicAuthenticationEntryPoint getBasicAuthEntryPoint() { final BasicAuthenticationEntryPoint authenticationEntryPoint = new BasicAuthenticationEntryPoint(); authenticationEntryPoint.setRealmName(REALM); return authenticationEntryPoint; } /* To allow Pre-flight [OPTIONS] request from browser */ @Override public void configure(final WebSecurity web) throws Exception { web.ignoring().antMatchers(HttpMethod.OPTIONS, "/**"); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.msv3.server\src\main\java\de\metas\vertical\pharma\msv3\server\security\SecurityConfig.java
2
请完成以下Java代码
public class CellValue { public static CellValue ofDate(final Object dateObj) { if (dateObj != null && !TimeUtil.isDateOrTimeObject(dateObj)) { throw new AdempiereException("Invalid date value: " + dateObj + " (" + dateObj.getClass() + ")"); } return new CellValue(CellValueType.Date, dateObj); } public static CellValue ofNumber(final Number number) { return new CellValue(CellValueType.Number, number); } public static CellValue ofBoolean(final boolean bool) { return new CellValue(CellValueType.Boolean, bool); } public static CellValue ofString(final String string) { return new CellValue(CellValueType.String, string); } @NonNull CellValueType type; @NonNull @Getter(AccessLevel.NONE) Object valueObj; public boolean isDate() { return type == CellValueType.Date; } public java.util.Date dateValue() {
return TimeUtil.asDate(valueObj); } public boolean isNumber() { return type == CellValueType.Number; } public double doubleValue() { return ((Number)valueObj).doubleValue(); } public boolean isBoolean() { return type == CellValueType.Boolean; } public boolean booleanValue() { return (boolean)valueObj; } public String stringValue() { return valueObj.toString(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\impexp\spreadsheet\excel\CellValue.java
1
请完成以下Java代码
protected void completeBatch(Batch batch, String status, CmmnEngineConfiguration engineConfiguration) { engineConfiguration.getBatchServiceConfiguration() .getBatchService() .completeBatch(batch.getId(), status); } protected void completeBatchFail(Batch batch, List<BatchPart> failedParts, CmmnEngineConfiguration engineConfiguration) { completeBatch(batch, DeleteCaseInstanceBatchConstants.STATUS_FAILED, engineConfiguration); long totalFailedInstances = 0; ObjectMapper objectMapper = engineConfiguration.getObjectMapper(); for (BatchPart failedPart : failedParts) { JsonNode node = readJson(failedPart.getResultDocumentJson(ScopeTypes.CMMN), objectMapper); if (node != null) { totalFailedInstances += node.path("caseInstanceIdsFailedToDelete").size(); }
} ObjectNode batchDocument = (ObjectNode) readJson(batch.getBatchDocumentJson(ScopeTypes.CMMN), objectMapper); batchDocument.put("numberOfFailedInstances", totalFailedInstances); ((BatchEntity) batch).setBatchDocumentJson(batchDocument.toString(), ScopeTypes.CMMN); } protected JsonNode readJson(String json, ObjectMapper objectMapper) { if (json == null) { return null; } return objectMapper.readTree(json); } }
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\delete\DeleteHistoricCaseInstanceIdsStatusJobHandler.java
1
请完成以下Java代码
public String getStatusDescription() { final String statusCode = migration.getStatusCode(); if (action == Action.Apply) { if (X_AD_Migration.STATUSCODE_Applied.equals(statusCode)) { return "Migration successful"; } else if (X_AD_Migration.STATUSCODE_PartiallyApplied.equals(statusCode)) { return "Migration partially applied. Please review migration steps for errors."; } else if (X_AD_Migration.STATUSCODE_Failed.equals(statusCode)) { return "Migration failed. Please review migration steps for errors."; } } else if (action == Action.Rollback) { if (X_AD_Migration.STATUSCODE_Unapplied.equals(statusCode)) { return "Rollback successful."; } else if (X_AD_Migration.STATUSCODE_PartiallyApplied.equals(statusCode)) { return "Migration partially rollback. Please review migration steps for errors."; } else { return "Rollback failed. Please review migration steps for errors."; } } // // Default return "@Action@=" + action + ", @StatusCode@=" + statusCode; } @Override public List<Exception> getExecutionErrors() { if (executionErrors == null) { return Collections.emptyList(); } else { return new ArrayList<>(executionErrors); } } private final void log(String msg, String resolution, boolean isError) {
if (isError && !logger.isErrorEnabled()) { return; } if (!isError && !logger.isInfoEnabled()) { return; } final StringBuffer sb = new StringBuffer(); sb.append(Services.get(IMigrationBL.class).getSummary(migration)); if (!Check.isEmpty(msg, true)) { sb.append(": ").append(msg.trim()); } if (resolution != null) { sb.append(" [").append(resolution).append("]"); } if (isError) { logger.error(sb.toString()); } else { logger.info(sb.toString()); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\migration\executor\impl\MigrationExecutor.java
1
请完成以下Java代码
public class CsrfRequestDataValueProcessor implements RequestDataValueProcessor { /** * The default request attribute to look for a {@link CsrfToken}. */ public static final String DEFAULT_CSRF_ATTR_NAME = "_csrf"; private static final Pattern DISABLE_CSRF_TOKEN_PATTERN = Pattern.compile("(?i)^(GET|HEAD|TRACE|OPTIONS)$"); private static final String DISABLE_CSRF_TOKEN_ATTR = "DISABLE_CSRF_TOKEN_ATTR"; @Override public String processAction(ServerWebExchange exchange, String action, String httpMethod) { if (httpMethod != null && DISABLE_CSRF_TOKEN_PATTERN.matcher(httpMethod).matches()) { exchange.getAttributes().put(DISABLE_CSRF_TOKEN_ATTR, Boolean.TRUE); } else { exchange.getAttributes().remove(DISABLE_CSRF_TOKEN_ATTR); } return action; } @Override
public String processFormFieldValue(ServerWebExchange exchange, String name, String value, String type) { return value; } @NonNull @Override public Map<String, String> getExtraHiddenFields(ServerWebExchange exchange) { if (Boolean.TRUE.equals(exchange.getAttribute(DISABLE_CSRF_TOKEN_ATTR))) { exchange.getAttributes().remove(DISABLE_CSRF_TOKEN_ATTR); return Collections.emptyMap(); } CsrfToken token = exchange.getAttribute(DEFAULT_CSRF_ATTR_NAME); if (token == null) { return Collections.emptyMap(); } return Collections.singletonMap(token.getParameterName(), token.getToken()); } @Override public String processUrl(ServerWebExchange exchange, String url) { return url; } }
repos\spring-security-main\web\src\main\java\org\springframework\security\web\reactive\result\view\CsrfRequestDataValueProcessor.java
1
请在Spring Boot框架中完成以下Java代码
public boolean isEnabled() { return this.enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public Duration getConnectTimeout() { return this.connectTimeout; } public void setConnectTimeout(Duration connectTimeout) { this.connectTimeout = connectTimeout; }
public Duration getReadTimeout() { return this.readTimeout; } public void setReadTimeout(Duration readTimeout) { this.readTimeout = readTimeout; } public Integer getBatchSize() { return this.batchSize; } public void setBatchSize(Integer batchSize) { this.batchSize = batchSize; } }
repos\spring-boot-4.0.1\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\export\properties\PushRegistryProperties.java
2
请完成以下Java代码
public class LabeledAction { public Action action; public int label; public LabeledAction(Action action, int label) { this.action = action; this.label = label; } public LabeledAction(final int actionCode, final int labelSize) { if (actionCode == Action.Shift.ordinal()) { action = Action.Shift; } else if (actionCode == Action.Reduce.ordinal())
{ action = Action.Reduce; } else if (actionCode >= Action.RightArc.ordinal() + labelSize) { label = actionCode - (Action.RightArc.ordinal() + labelSize); action = Action.LeftArc; } else if (actionCode >= Action.RightArc.ordinal()) { label = actionCode - Action.RightArc.ordinal(); action = Action.RightArc; } else if (actionCode == Action.Unshift.ordinal()) { action = Action.Unshift; } } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\dependency\perceptron\transition\parser\LabeledAction.java
1
请完成以下Java代码
public static void write10000RowsToSXSSFWorkbook(Blackhole blackhole) throws IOException { writeRowsToWorkbook(getSXSSFWorkbook(), 10000, blackhole); } @Benchmark public static void write20000RowsToSXSSFWorkbook(Blackhole blackhole) throws IOException { writeRowsToWorkbook(getSXSSFWorkbook(), 20000, blackhole); } @Benchmark public static void write40000RowsToSXSSFWorkbook(Blackhole blackhole) throws IOException { writeRowsToWorkbook(getSXSSFWorkbook(), 40000, blackhole); } private static SXSSFWorkbook getSXSSFWorkbook() { SXSSFWorkbook workbook = new SXSSFWorkbook(); workbook.setCompressTempFiles(true); return workbook; } public static void writeRowsToWorkbook(Workbook workbook, int iterations, Blackhole blackhole) throws IOException { Sheet sheet = workbook.createSheet(); for (int n=0;n<iterations;n++) {
Row row = sheet.createRow(sheet.getLastRowNum()+1); for (int c=0;c<256;c++) { Cell cell = row.createCell(c); cell.setCellValue("abcdefghijklmnopqrstuvwxyz"); } } workbook.close(); blackhole.consume(workbook); } public static void main(String[] args) throws Exception { Options options = new OptionsBuilder() .include(WorkbookBenchmark.class.getSimpleName()).threads(1) .shouldFailOnError(true) .shouldDoGC(true) .addProfiler(MemPoolProfiler.class) .jvmArgs("-server").build(); new Runner(options).run(); } }
repos\tutorials-master\apache-poi-3\src\main\java\com\baeldung\poi\benchmark\WorkbookBenchmark.java
1
请完成以下Java代码
public boolean isBaseLanguage(final ValueNamePair language) { return isBaseLanguage(language.getValue()); } public boolean isBaseLanguage(final String adLanguage) { if (baseADLanguage == null) { return false; } return baseADLanguage.equals(adLanguage); } // // // // // public static class Builder { private final Map<String, ValueNamePair> languagesByADLanguage = new LinkedHashMap<>(); private String baseADLanguage = null; private Builder() {
} public ADLanguageList build() { return new ADLanguageList(this); } public Builder addLanguage(@NonNull final String adLanguage, @NonNull final String caption, final boolean isBaseLanguage) { final ValueNamePair languageVNP = ValueNamePair.of(adLanguage, caption); languagesByADLanguage.put(adLanguage, languageVNP); if (isBaseLanguage) { baseADLanguage = adLanguage; } return this; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\i18n\ADLanguageList.java
1
请完成以下Java代码
public void registerVetoer(final ModelWithoutInvoiceCandidateVetoer vetoer, final String tableName) { final Collection<ModelWithoutInvoiceCandidateVetoer> listeners = tableName2Listeners.computeIfAbsent(tableName, k -> new ArrayList<>()); listeners.add(vetoer); } @Override public boolean isAllowedToCreateInvoiceCandidateFor(final Object model) { final String tableName = InterfaceWrapperHelper.getModelTableName(model); final Collection<ModelWithoutInvoiceCandidateVetoer> listeners = tableName2Listeners.get(tableName); if (listeners == null) { return true; } for (final ModelWithoutInvoiceCandidateVetoer listener : listeners) { if (I_VETO.equals(listener.foundModelWithoutInvoiceCandidate(model))) { return false; } }
return true; } @NonNull private BigDecimal getActualDeliveredQty(@NonNull final org.compiere.model.I_M_InOutLine inOutLine) { final org.compiere.model.I_M_InOut inOut = inoutBL.getById(InOutId.ofRepoId(inOutLine.getM_InOut_ID())); final DocStatus docStatus = DocStatus.ofCode(inOut.getDocStatus()); Loggables.withLogger(logger, Level.DEBUG) .addLog("DocStatus for M_InOutLine_ID={} is {}", inOutLine.getM_InOutLine_ID(), docStatus.getCode()); if (docStatus.equals(DocStatus.Completed) || docStatus.equals(DocStatus.Closed)) { return inOutLine.getMovementQty(); } return ZERO; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\api\impl\InvoiceCandBL.java
1
请完成以下Java代码
public String getProcessInstanceId() { return processInstanceId; } public String getExecutionId() { return executionId; } public String getProcessDefinitionId() { return processDefinitionId; } public String getActivityId() { return activityId; } public String getActivityName() { return activityName; } public String getActivityType() { return activityType; } public String getAssignee() { return assignee; } public String getCompletedBy() { return completedBy; }
public boolean isFinished() { return finished; } public boolean isUnfinished() { return unfinished; } public String getActivityInstanceId() { return activityInstanceId; } public String getDeleteReason() { return deleteReason; } public String getDeleteReasonLike() { return deleteReasonLike; } public List<List<String>> getSafeProcessInstanceIds() { return safeProcessInstanceIds; } public void setSafeProcessInstanceIds(List<List<String>> safeProcessInstanceIds) { this.safeProcessInstanceIds = safeProcessInstanceIds; } public Collection<String> getProcessInstanceIds() { return processInstanceIds; } }
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\ActivityInstanceQueryImpl.java
1
请完成以下Java代码
public void setM_Shipper_ID (int M_Shipper_ID) { if (M_Shipper_ID < 1) set_Value (COLUMNNAME_M_Shipper_ID, null); else set_Value (COLUMNNAME_M_Shipper_ID, Integer.valueOf(M_Shipper_ID)); } /** Get Lieferweg. @return Methode oder Art der Warenlieferung */ @Override public int getM_Shipper_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_Shipper_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Transport Auftrag.
@param M_ShipperTransportation_ID Transport Auftrag */ @Override public void setM_ShipperTransportation_ID (int M_ShipperTransportation_ID) { if (M_ShipperTransportation_ID < 1) set_Value (COLUMNNAME_M_ShipperTransportation_ID, null); else set_Value (COLUMNNAME_M_ShipperTransportation_ID, Integer.valueOf(M_ShipperTransportation_ID)); } /** Get Transport Auftrag. @return Transport Auftrag */ @Override public int getM_ShipperTransportation_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_ShipperTransportation_ID); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.derkurier\src\main\java-gen\de\metas\shipper\gateway\derkurier\model\X_DerKurier_DeliveryOrder.java
1
请完成以下Java代码
protected void preCommence(HttpServletRequest request, HttpServletResponse response) { } /** * The enterprise-wide CAS login URL. Usually something like * <code>https://www.mycompany.com/cas/login</code>. * @return the enterprise-wide CAS login URL */ public final @Nullable String getLoginUrl() { return this.loginUrl; } public final ServiceProperties getServiceProperties() { return this.serviceProperties; } public final void setLoginUrl(String loginUrl) { this.loginUrl = loginUrl; } public final void setServiceProperties(ServiceProperties serviceProperties) { this.serviceProperties = serviceProperties; } /** * Sets whether to encode the service url with the session id or not. * @param encodeServiceUrlWithSessionId whether to encode the service url with the * session id or not. */ public final void setEncodeServiceUrlWithSessionId(boolean encodeServiceUrlWithSessionId) {
this.encodeServiceUrlWithSessionId = encodeServiceUrlWithSessionId; } /** * Sets whether to encode the service url with the session id or not. * @return whether to encode the service url with the session id or not. * */ protected boolean getEncodeServiceUrlWithSessionId() { return this.encodeServiceUrlWithSessionId; } /** * Sets the {@link RedirectStrategy} to use * @param redirectStrategy the {@link RedirectStrategy} to use * @since 6.3 */ public void setRedirectStrategy(RedirectStrategy redirectStrategy) { Assert.notNull(redirectStrategy, "redirectStrategy cannot be null"); this.redirectStrategy = redirectStrategy; } }
repos\spring-security-main\cas\src\main\java\org\springframework\security\cas\web\CasAuthenticationEntryPoint.java
1
请完成以下Java代码
public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable { Object result; currentTime.set(System.currentTimeMillis()); result = joinPoint.proceed(); SysLog sysLog = new SysLog("INFO",System.currentTimeMillis() - currentTime.get()); currentTime.remove(); HttpServletRequest request = RequestHolder.getHttpServletRequest(); sysLogService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request),joinPoint, sysLog); return result; } /** * 配置异常通知 * * @param joinPoint join point for advice * @param e exception */ @AfterThrowing(pointcut = "logPointcut()", throwing = "e") public void logAfterThrowing(JoinPoint joinPoint, Throwable e) { SysLog sysLog = new SysLog("ERROR",System.currentTimeMillis() - currentTime.get()); currentTime.remove(); sysLog.setExceptionDetail(ThrowableUtil.getStackTrace(e).getBytes()); HttpServletRequest request = RequestHolder.getHttpServletRequest();
sysLogService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), (ProceedingJoinPoint)joinPoint, sysLog); } /** * 获取用户名 * @return / */ public String getUsername() { try { return SecurityUtils.getCurrentUsername(); }catch (Exception e){ return ""; } } }
repos\eladmin-master\eladmin-logging\src\main\java\me\zhengjie\aspect\LogAspect.java
1
请完成以下Java代码
public void setEXP_Processor_ID (int EXP_Processor_ID) { if (EXP_Processor_ID < 1) set_ValueNoCheck (COLUMNNAME_EXP_Processor_ID, null); else set_ValueNoCheck (COLUMNNAME_EXP_Processor_ID, Integer.valueOf(EXP_Processor_ID)); } /** Get Export Processor. @return Export Processor */ public int getEXP_Processor_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_EXP_Processor_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Processor Parameter. @param EXP_ProcessorParameter_ID Processor Parameter */ public void setEXP_ProcessorParameter_ID (int EXP_ProcessorParameter_ID) { if (EXP_ProcessorParameter_ID < 1) set_ValueNoCheck (COLUMNNAME_EXP_ProcessorParameter_ID, null); else set_ValueNoCheck (COLUMNNAME_EXP_ProcessorParameter_ID, Integer.valueOf(EXP_ProcessorParameter_ID)); } /** Get Processor Parameter. @return Processor Parameter */ public int getEXP_ProcessorParameter_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_EXP_ProcessorParameter_ID); if (ii == null) return 0; return ii.intValue(); } /** 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); } /** Set Parameter Value. @param ParameterValue Parameter Value */ public void setParameterValue (String ParameterValue) { set_Value (COLUMNNAME_ParameterValue, ParameterValue); } /** Get Parameter Value. @return Parameter Value */ public String getParameterValue () { return (String)get_Value(COLUMNNAME_ParameterValue); } /** Set Search Key. @param Value Search key for the record in the format required - must be unique */ public void setValue (String Value) { set_Value (COLUMNNAME_Value, Value); } /** Get Search Key. @return Search key for the record in the format required - must be unique */ public String getValue () { return (String)get_Value(COLUMNNAME_Value); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_EXP_ProcessorParameter.java
1
请完成以下Java代码
public String getExtensionId() { return EXTENSION_ID; } @Override public ExtensionOutput getOutput() { return this.output; } /** * The output for {@link CredentialPropertiesOutput} * * @author Rob Winch * @since 6.4 * @see #getOutput() */ public static final class ExtensionOutput implements Serializable { @Serial private static final long serialVersionUID = 4557406414847424019L; private final boolean rk; private ExtensionOutput(boolean rk) {
this.rk = rk; } /** * This OPTIONAL property, known abstractly as the resident key credential * property (i.e., client-side discoverable credential property), is a Boolean * value indicating whether the PublicKeyCredential returned as a result of a * registration ceremony is a client-side discoverable credential. * @return is resident key credential property */ public boolean isRk() { return this.rk; } } }
repos\spring-security-main\webauthn\src\main\java\org\springframework\security\web\webauthn\api\CredentialPropertiesOutput.java
1
请在Spring Boot框架中完成以下Java代码
public void start() { log.warn(ThreadPoolEnum.SQL_SERVER_LISTENER_POOL + "线程池开始执行 debeziumEngine 实时监听任务!"); executor.execute(debeziumEngine); } @SneakyThrows @Override public void stop() { log.warn("debeziumEngine 监听实例关闭!"); debeziumEngine.close(); Thread.sleep(2000); log.warn(ThreadPoolEnum.SQL_SERVER_LISTENER_POOL + "线程池关闭!"); executor.shutdown(); } @Override public boolean isRunning() { return false; } @Override public void afterPropertiesSet() { Assert.notNull(debeziumEngine, "DebeZiumEngine 不能为空!"); } public enum ThreadPoolEnum { /** * 实例 */ INSTANCE; public static final String SQL_SERVER_LISTENER_POOL = "sql-server-listener-pool"; /** * 线程池单例 */ private final ExecutorService es; /** * 枚举 (构造器默认为私有) */
ThreadPoolEnum() { final ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat(SQL_SERVER_LISTENER_POOL + "-%d").build(); es = new ThreadPoolExecutor(8, 16, 60, TimeUnit.SECONDS, new ArrayBlockingQueue<>(256), threadFactory, new ThreadPoolExecutor.DiscardPolicy()); } /** * 公有方法 * * @return ExecutorService */ public ExecutorService getInstance() { return es; } } } }
repos\springboot-demo-master\debezium\src\main\java\com\et\debezium\config\ChangeEventConfig.java
2
请完成以下Java代码
public String getDeploymentMode() { return deploymentMode; } @Override public void setDeploymentMode(String deploymentMode) { this.deploymentMode = deploymentMode; } /** * Gets the {@link AutoDeploymentStrategy} for the provided mode. This method may be overridden to implement custom deployment strategies if required, but implementors should take care not to * return <code>null</code>. * * @param mode * the mode to get the strategy for * @return the deployment strategy to use for the mode. Never <code>null</code> */ protected AutoDeploymentStrategy<AppEngine> getAutoDeploymentStrategy(final String mode) { AutoDeploymentStrategy<AppEngine> result = new DefaultAutoDeploymentStrategy(); for (final AutoDeploymentStrategy<AppEngine> strategy : deploymentStrategies) { if (strategy.handlesMode(mode)) { result = strategy; break; } } return result; } @Override public void start() { synchronized (lifeCycleMonitor) { if (!isRunning()) { enginesBuild.forEach(name -> autoDeployResources(AppEngines.getAppEngine(name))); running = true; } } } public Collection<AutoDeploymentStrategy<AppEngine>> getDeploymentStrategies() { return deploymentStrategies; }
public void setDeploymentStrategies(Collection<AutoDeploymentStrategy<AppEngine>> deploymentStrategies) { this.deploymentStrategies = deploymentStrategies; } @Override public void stop() { synchronized (lifeCycleMonitor) { running = false; } } @Override public boolean isRunning() { return running; } @Override public String getDeploymentName() { return null; } @Override public void setDeploymentName(String deploymentName) { // not supported throw new FlowableException("Setting a deployment name is not supported for apps"); } }
repos\flowable-engine-main\modules\flowable-app-engine-spring\src\main\java\org\flowable\app\spring\SpringAppEngineConfiguration.java
1
请完成以下Java代码
public boolean equals(Object obj) { if (obj == null || obj.getClass() != getClass()) { return false; } return features.equals(((Builder) obj).features); } @Override public int hashCode() { return getClass().hashCode(); } /** * Dump out abstract syntax tree for a given expression * * @param args array with one element, containing the expression string */ public static void main(String[] args) { if (args.length != 1) { System.err.println("usage: java " + Builder.class.getName() + " <expression string>"); System.exit(1); } PrintWriter out = new PrintWriter(System.out); Tree tree = null; try { tree = new Builder(Feature.METHOD_INVOCATIONS).build(args[0]); } catch (TreeBuilderException e) { System.out.println(e.getMessage()); System.exit(0); } NodePrinter.dump(out, tree.getRoot()); if (!tree.getFunctionNodes().iterator().hasNext() && !tree.getIdentifierNodes().iterator().hasNext()) { ELContext context = new ELContext() { @Override public VariableMapper getVariableMapper() {
return null; } @Override public FunctionMapper getFunctionMapper() { return null; } @Override public ELResolver getELResolver() { return null; } }; out.print(">> "); try { out.println(tree.getRoot().getValue(new Bindings(null, null), context, null)); } catch (ELException e) { out.println(e.getMessage()); } } out.flush(); } }
repos\Activiti-develop\activiti-core-common\activiti-juel-jakarta\src\main\java\org\activiti\core\el\juel\tree\impl\Builder.java
1
请在Spring Boot框架中完成以下Java代码
public String getPicsUrlPrefix() { return picsUrlPrefix; } public void setPicsUrlPrefix(String picsUrlPrefix) { this.picsUrlPrefix = picsUrlPrefix; } public Boolean getKaptchaOpen() { return kaptchaOpen; } public void setKaptchaOpen(Boolean kaptchaOpen) { this.kaptchaOpen = kaptchaOpen; } public Boolean getSwaggerOpen() { return swaggerOpen; } public void setSwaggerOpen(Boolean swaggerOpen) { this.swaggerOpen = swaggerOpen; } public Integer getSessionInvalidateTime() { return sessionInvalidateTime; } public void setSessionInvalidateTime(Integer sessionInvalidateTime) { this.sessionInvalidateTime = sessionInvalidateTime; } public Integer getSessionValidationInterval() { return sessionValidationInterval; } public void setSessionValidationInterval(Integer sessionValidationInterval) { this.sessionValidationInterval = sessionValidationInterval; } public String getFilesUrlPrefix() { return filesUrlPrefix; } public void setFilesUrlPrefix(String filesUrlPrefix) { this.filesUrlPrefix = filesUrlPrefix; } public String getFilesPath() {
return filesPath; } public void setFilesPath(String filesPath) { this.filesPath = filesPath; } public Integer getHeartbeatTimeout() { return heartbeatTimeout; } public void setHeartbeatTimeout(Integer heartbeatTimeout) { this.heartbeatTimeout = heartbeatTimeout; } public String getPicsPath() { return picsPath; } public void setPicsPath(String picsPath) { this.picsPath = picsPath; } public String getPosapiUrlPrefix() { return posapiUrlPrefix; } public void setPosapiUrlPrefix(String posapiUrlPrefix) { this.posapiUrlPrefix = posapiUrlPrefix; } }
repos\SpringBootBucket-master\springboot-shiro\src\main\java\com\xncoding\pos\config\properties\MyProperties.java
2
请完成以下Java代码
public EntityType getEntityType() { return EntityType.ALARM; } //TODO: refactor to use efficient caching. private AlarmApiCallResult withPropagated(AlarmApiCallResult result) { if (result.isSuccessful() && result.getAlarm() != null) { List<EntityId> propagationEntities; if (result.isPropagationChanged()) { try { propagationEntities = createEntityAlarmRecords(result.getAlarm()); } catch (ExecutionException | InterruptedException e) { throw new RuntimeException(e); } } else { propagationEntities = getPropagationEntityIdsList(result.getAlarm()); } return new AlarmApiCallResult(result, propagationEntities); } else { return result; } }
private void validateAlarmRequest(AlarmModificationRequest request) { ConstraintValidator.validateFields(request); if (request.getEndTs() > 0 && request.getStartTs() > request.getEndTs()) { throw new DataValidationException("Alarm start ts can't be greater then alarm end ts!"); } if (!tenantService.tenantExists(request.getTenantId())) { throw new DataValidationException("Alarm is referencing to non-existent tenant!"); } if (request.getStartTs() == 0L) { request.setStartTs(System.currentTimeMillis()); } if (request.getEndTs() == 0L) { request.setEndTs(request.getStartTs()); } } }
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\alarm\BaseAlarmService.java
1
请在Spring Boot框架中完成以下Java代码
public void setSaveMode(SaveMode saveMode) { Assert.notNull(saveMode, "saveMode cannot be null"); this.saveMode = saveMode; } public Duration getMaxInactiveInterval() { return this.maxInactiveInterval; } public String getRedisNamespace() { return this.redisNamespace; } public SaveMode getSaveMode() { return this.saveMode; } public SessionIdGenerator getSessionIdGenerator() { return this.sessionIdGenerator; } public RedisSerializer<Object> getDefaultRedisSerializer() { return this.defaultRedisSerializer; } @Autowired public void setRedisConnectionFactory( @SpringSessionRedisConnectionFactory ObjectProvider<ReactiveRedisConnectionFactory> springSessionRedisConnectionFactory, ObjectProvider<ReactiveRedisConnectionFactory> redisConnectionFactory) { ReactiveRedisConnectionFactory redisConnectionFactoryToUse = springSessionRedisConnectionFactory .getIfAvailable(); if (redisConnectionFactoryToUse == null) { redisConnectionFactoryToUse = redisConnectionFactory.getObject(); } this.redisConnectionFactory = redisConnectionFactoryToUse; } @Autowired(required = false) @Qualifier("springSessionDefaultRedisSerializer") public void setDefaultRedisSerializer(RedisSerializer<Object> defaultRedisSerializer) { this.defaultRedisSerializer = defaultRedisSerializer; } @Autowired(required = false)
public void setSessionRepositoryCustomizer( ObjectProvider<ReactiveSessionRepositoryCustomizer<T>> sessionRepositoryCustomizers) { this.sessionRepositoryCustomizers = sessionRepositoryCustomizers.orderedStream().collect(Collectors.toList()); } protected List<ReactiveSessionRepositoryCustomizer<T>> getSessionRepositoryCustomizers() { return this.sessionRepositoryCustomizers; } protected ReactiveRedisTemplate<String, Object> createReactiveRedisTemplate() { RedisSerializer<String> keySerializer = RedisSerializer.string(); RedisSerializer<Object> defaultSerializer = (this.defaultRedisSerializer != null) ? this.defaultRedisSerializer : new JdkSerializationRedisSerializer(); RedisSerializationContext<String, Object> serializationContext = RedisSerializationContext .<String, Object>newSerializationContext(defaultSerializer) .key(keySerializer) .hashKey(keySerializer) .build(); return new ReactiveRedisTemplate<>(this.redisConnectionFactory, serializationContext); } public ReactiveRedisConnectionFactory getRedisConnectionFactory() { return this.redisConnectionFactory; } @Autowired(required = false) public void setSessionIdGenerator(SessionIdGenerator sessionIdGenerator) { this.sessionIdGenerator = sessionIdGenerator; } }
repos\spring-session-main\spring-session-data-redis\src\main\java\org\springframework\session\data\redis\config\annotation\web\server\AbstractRedisWebSessionConfiguration.java
2
请完成以下Java代码
private boolean isMatching(final ITranslatableString trl) { if (isAny()) { return true; } if (isMatching(trl.getDefaultValue())) { return true; } for (final String adLanguage : trl.getAD_Languages()) { if (isMatching(trl.translate(adLanguage))) { return true; } } return false; } @VisibleForTesting
boolean isMatching(final String name) { if (isAny()) { return true; } final String nameNorm = normalizeString(name); if (nameNorm == null) { return false; } return pattern.equalsIgnoreCase(nameNorm); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\dataentry\data\impexp\NamePattern.java
1
请完成以下Java代码
public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getRoleId() { return roleId; } public void setRoleId(Long roleId) { this.roleId = roleId; } public Long getMenuId() { return menuId; } public void setMenuId(Long menuId) { this.menuId = menuId; }
@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(", roleId=").append(roleId); sb.append(", menuId=").append(menuId); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); } }
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\UmsRoleMenuRelation.java
1
请在Spring Boot框架中完成以下Java代码
public String getSupplierIDissuedByCustomer() { return supplierIDissuedByCustomer; } /** * Sets the value of the supplierIDissuedByCustomer property. * * @param value * allowed object is * {@link String } * */ public void setSupplierIDissuedByCustomer(String value) { this.supplierIDissuedByCustomer = value; } /** * Gets the value of the supplierExtension property. * * @return * possible object is * {@link SupplierExtensionType } *
*/ public SupplierExtensionType getSupplierExtension() { return supplierExtension; } /** * Sets the value of the supplierExtension property. * * @param value * allowed object is * {@link SupplierExtensionType } * */ public void setSupplierExtension(SupplierExtensionType value) { this.supplierExtension = value; } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\SupplierType.java
2
请完成以下Java代码
public String getUpdateBy() { return updateBy; } public void setUpdateBy(String updateBy) { this.updateBy = updateBy; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public Integer getDisabled() {
return disabled; } public void setDisabled(Integer disabled) { this.disabled = disabled; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } }
repos\springBoot-master\springboot-swagger-ui\src\main\java\com\abel\example\bean\User.java
1
请在Spring Boot框架中完成以下Java代码
private JSONObject getItemHintProvider(ItemHint.ValueProvider provider) throws Exception { JSONObject result = new JSONObject(); result.put("name", provider.getName()); if (provider.getParameters() != null && !provider.getParameters().isEmpty()) { JSONObject parameters = new JSONObject(); for (Map.Entry<String, Object> entry : provider.getParameters().entrySet()) { parameters.put(entry.getKey(), extractItemValue(entry.getValue())); } result.put("parameters", parameters); } return result; } private void putHintValue(JSONObject jsonObject, Object value) throws Exception { Object hintValue = extractItemValue(value); jsonObject.put("value", hintValue); } private void putDefaultValue(JSONObject jsonObject, Object value) throws Exception { Object defaultValue = extractItemValue(value); jsonObject.put("defaultValue", defaultValue); } private Object extractItemValue(Object value) { Object defaultValue = value; if (value.getClass().isArray()) { JSONArray array = new JSONArray(); int length = Array.getLength(value); for (int i = 0; i < length; i++) { array.put(Array.get(value, i)); } defaultValue = array; } return defaultValue; }
private static final class ItemMetadataComparator implements Comparator<ItemMetadata> { private static final Comparator<ItemMetadata> GROUP = Comparator.comparing(ItemMetadata::getName) .thenComparing(ItemMetadata::getSourceType, Comparator.nullsFirst(Comparator.naturalOrder())); private static final Comparator<ItemMetadata> ITEM = Comparator.comparing(ItemMetadataComparator::isDeprecated) .thenComparing(ItemMetadata::getName) .thenComparing(ItemMetadata::getSourceType, Comparator.nullsFirst(Comparator.naturalOrder())); @Override public int compare(ItemMetadata o1, ItemMetadata o2) { if (o1.isOfItemType(ItemType.GROUP)) { return GROUP.compare(o1, o2); } return ITEM.compare(o1, o2); } private static boolean isDeprecated(ItemMetadata item) { return item.getDeprecation() != null; } } }
repos\spring-boot-4.0.1\configuration-metadata\spring-boot-configuration-processor\src\main\java\org\springframework\boot\configurationprocessor\metadata\JsonConverter.java
2
请完成以下Java代码
public int getPoolSize () { Integer ii = (Integer)get_Value(COLUMNNAME_PoolSize); if (ii == null) return 0; return ii.intValue(); } /** * Priority AD_Reference_ID=154 * Reference name: _PriorityRule */ public static final int PRIORITY_AD_Reference_ID=154; /** High = 3 */ public static final String PRIORITY_High = "3"; /** Medium = 5 */ public static final String PRIORITY_Medium = "5"; /** Low = 7 */ public static final String PRIORITY_Low = "7"; /** Urgent = 1 */ public static final String PRIORITY_Urgent = "1"; /** Minor = 9 */ public static final String PRIORITY_Minor = "9";
/** Set Priority. @param Priority Indicates if this request is of a high, medium or low priority. */ @Override public void setPriority (java.lang.String Priority) { set_Value (COLUMNNAME_Priority, Priority); } /** Get Priority. @return Indicates if this request is of a high, medium or low priority. */ @Override public java.lang.String getPriority () { return (java.lang.String)get_Value(COLUMNNAME_Priority); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java-gen\de\metas\async\model\X_C_Queue_Processor.java
1
请完成以下Java代码
public KeyNamePair getKeyNamePair() { return new KeyNamePair(get_ID(), String.valueOf(getMovementDate())); } public I_M_ProductDownload getM_ProductDownload() throws RuntimeException { return (I_M_ProductDownload)MTable.get(getCtx(), I_M_ProductDownload.Table_Name) .getPO(getM_ProductDownload_ID(), get_TrxName()); } /** Set Product Download. @param M_ProductDownload_ID Product downloads */ public void setM_ProductDownload_ID (int M_ProductDownload_ID) { if (M_ProductDownload_ID < 1) set_Value (COLUMNNAME_M_ProductDownload_ID, null); else set_Value (COLUMNNAME_M_ProductDownload_ID, Integer.valueOf(M_ProductDownload_ID)); } /** Get Product Download. @return Product downloads */ public int getM_ProductDownload_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_ProductDownload_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Referrer. @param Referrer Referring web address */ public void setReferrer (String Referrer) { set_ValueNoCheck (COLUMNNAME_Referrer, Referrer); } /** Get Referrer. @return Referring web address */ public String getReferrer () { return (String)get_Value(COLUMNNAME_Referrer); } /** Set Remote Addr. @param Remote_Addr Remote Address */ public void setRemote_Addr (String Remote_Addr) { set_ValueNoCheck (COLUMNNAME_Remote_Addr, Remote_Addr); } /** Get Remote Addr. @return Remote Address */ public String getRemote_Addr () { return (String)get_Value(COLUMNNAME_Remote_Addr); } /** Set Remote Host. @param Remote_Host Remote host Info */ public void setRemote_Host (String Remote_Host) { set_ValueNoCheck (COLUMNNAME_Remote_Host, Remote_Host); } /** Get Remote Host. @return Remote host Info */ public String getRemote_Host () { return (String)get_Value(COLUMNNAME_Remote_Host);
} /** Set Serial No. @param SerNo Product Serial Number */ public void setSerNo (String SerNo) { set_ValueNoCheck (COLUMNNAME_SerNo, SerNo); } /** Get Serial No. @return Product Serial Number */ public String getSerNo () { return (String)get_Value(COLUMNNAME_SerNo); } /** Set URL. @param URL Full URL address - e.g. http://www.adempiere.org */ public void setURL (String URL) { set_ValueNoCheck (COLUMNNAME_URL, URL); } /** Get URL. @return Full URL address - e.g. http://www.adempiere.org */ public String getURL () { return (String)get_Value(COLUMNNAME_URL); } /** Set Version No. @param VersionNo Version Number */ public void setVersionNo (String VersionNo) { set_ValueNoCheck (COLUMNNAME_VersionNo, VersionNo); } /** Get Version No. @return Version Number */ public String getVersionNo () { return (String)get_Value(COLUMNNAME_VersionNo); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_A_Asset_Delivery.java
1
请完成以下Java代码
public class ApiPageListResultVo { /** * 返回码 */ private int code; /** * 返回描述 */ private String msg = ""; /** * 返回分页数据,默认为0页0条 */ private PageListVO data = new PageListVO(0,0,0,new ArrayList<rpObject>()); public void setCode(int code) { this.code = code; } public void setMsg(String msg) { this.msg = msg; } public void setData(PageListVO data) { this.data = data; } public int getCode() { return code; } public String getMsg() { return msg; }
public PageListVO getData() { return data; } public static void main(String [] args ){ ApiPageListResultVo apiPageListResultVo = new ApiPageListResultVo(); apiPageListResultVo.setCode(-1); apiPageListResultVo.setMsg("测试数据"); PageListVO pageListVO = new PageListVO(0,2,33,new ArrayList<Object>()); apiPageListResultVo.setData(pageListVO); System.out.println(JSONObject.toJSONString(apiPageListResultVo)); } }
repos\roncoo-pay-master\roncoo-pay-common-core\src\main\java\com\roncoo\pay\common\core\entity\ApiPageListResultVo.java
1
请完成以下Java代码
public void setRef_Order_ID (final int Ref_Order_ID) { if (Ref_Order_ID < 1) set_Value (COLUMNNAME_Ref_Order_ID, null); else set_Value (COLUMNNAME_Ref_Order_ID, Ref_Order_ID); } @Override public int getRef_Order_ID() { return get_ValueAsInt(COLUMNNAME_Ref_Order_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 setSendEMail (final boolean SendEMail) { set_Value (COLUMNNAME_SendEMail, SendEMail); } @Override public boolean isSendEMail() { return get_ValueAsBoolean(COLUMNNAME_SendEMail); } @Override public void setSeqNo (final int SeqNo) { set_Value (COLUMNNAME_SeqNo, SeqNo); } @Override public int getSeqNo() { return get_ValueAsInt(COLUMNNAME_SeqNo); } @Override public org.compiere.model.I_C_ElementValue getUser1() { return get_ValueAsPO(COLUMNNAME_User1_ID, org.compiere.model.I_C_ElementValue.class); } @Override public void setUser1(final org.compiere.model.I_C_ElementValue User1) { set_ValueFromPO(COLUMNNAME_User1_ID, org.compiere.model.I_C_ElementValue.class, User1); } @Override public void setUser1_ID (final int User1_ID) { if (User1_ID < 1) set_Value (COLUMNNAME_User1_ID, null); else set_Value (COLUMNNAME_User1_ID, User1_ID); } @Override public int getUser1_ID() {
return get_ValueAsInt(COLUMNNAME_User1_ID); } @Override public org.compiere.model.I_C_ElementValue getUser2() { return get_ValueAsPO(COLUMNNAME_User2_ID, org.compiere.model.I_C_ElementValue.class); } @Override public void setUser2(final org.compiere.model.I_C_ElementValue User2) { set_ValueFromPO(COLUMNNAME_User2_ID, org.compiere.model.I_C_ElementValue.class, User2); } @Override public void setUser2_ID (final int User2_ID) { if (User2_ID < 1) set_Value (COLUMNNAME_User2_ID, null); else set_Value (COLUMNNAME_User2_ID, User2_ID); } @Override public int getUser2_ID() { return get_ValueAsInt(COLUMNNAME_User2_ID); } @Override public void setVolume (final @Nullable BigDecimal Volume) { set_Value (COLUMNNAME_Volume, Volume); } @Override public BigDecimal getVolume() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Volume); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setWeight (final @Nullable BigDecimal Weight) { set_Value (COLUMNNAME_Weight, Weight); } @Override public BigDecimal getWeight() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Weight); return bd != null ? bd : BigDecimal.ZERO; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_DD_Order.java
1
请在Spring Boot框架中完成以下Java代码
public String getExecutionId() { return executionId; } public void setExecutionId(String executionId) { this.executionId = executionId; } public String getExecutionUrl() { return executionUrl; } public void setExecutionUrl(String executionUrl) { this.executionUrl = executionUrl; } public String getScopeId() { return scopeId; } public void setScopeId(String scopeId) { this.scopeId = scopeId; } public String getScopeType() { return scopeType; } public void setScopeType(String scopeType) { this.scopeType = scopeType; } public String getSubScopeId() { return subScopeId; } public void setSubScopeId(String subScopeId) { this.subScopeId = subScopeId; } public String getScopeDefinitionId() { return scopeDefinitionId; } public void setScopeDefinitionId(String scopeDefinitionId) { this.scopeDefinitionId = scopeDefinitionId; }
public Date getCreated() { return created; } public void setCreated(Date created) { this.created = created; } public String getConfiguration() { return configuration; } public void setConfiguration(String configuration) { this.configuration = configuration; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } public String getTenantId() { return tenantId; } }
repos\flowable-engine-main\modules\flowable-rest\src\main\java\org\flowable\rest\service\api\runtime\process\EventSubscriptionResponse.java
2
请完成以下Java代码
public String getName () { return (String)get_Value(COLUMNNAME_Name); } /** Get Record ID/ColumnName @return ID/ColumnName pair */ public KeyNamePair getKeyNamePair() { return new KeyNamePair(get_ID(), getName()); } /** Set Reporting Hierarchy. @param PA_Hierarchy_ID Optional Reporting Hierarchy - If not selected the default hierarchy trees are used. */ public void setPA_Hierarchy_ID (int PA_Hierarchy_ID) {
if (PA_Hierarchy_ID < 1) set_ValueNoCheck (COLUMNNAME_PA_Hierarchy_ID, null); else set_ValueNoCheck (COLUMNNAME_PA_Hierarchy_ID, Integer.valueOf(PA_Hierarchy_ID)); } /** Get Reporting Hierarchy. @return Optional Reporting Hierarchy - If not selected the default hierarchy trees are used. */ public int getPA_Hierarchy_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_PA_Hierarchy_ID); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_PA_Hierarchy.java
1
请完成以下Java代码
public class AuthProvider { public static String AUTH_KEY = TokenConstant.HEADER; private static final List<String> DEFAULT_SKIP_URL = new ArrayList<>(); static { DEFAULT_SKIP_URL.add("/example"); DEFAULT_SKIP_URL.add("/token/**"); DEFAULT_SKIP_URL.add("/captcha/**"); DEFAULT_SKIP_URL.add("/actuator/health/**"); DEFAULT_SKIP_URL.add("/v3/api-docs/**"); DEFAULT_SKIP_URL.add("/auth/**"); DEFAULT_SKIP_URL.add("/oauth/**"); DEFAULT_SKIP_URL.add("/log/**"); DEFAULT_SKIP_URL.add("/menu/routes"); DEFAULT_SKIP_URL.add("/menu/auth-routes");
DEFAULT_SKIP_URL.add("/tenant/info"); DEFAULT_SKIP_URL.add("/order/create/**"); DEFAULT_SKIP_URL.add("/storage/deduct/**"); DEFAULT_SKIP_URL.add("/error/**"); DEFAULT_SKIP_URL.add("/assets/**"); } /** * 默认无需鉴权的API */ public static List<String> getDefaultSkipUrl() { return DEFAULT_SKIP_URL; } }
repos\SpringBlade-master\blade-gateway\src\main\java\org\springblade\gateway\provider\AuthProvider.java
1
请在Spring Boot框架中完成以下Java代码
public String getSaml2Response() { return this.saml2Response; } @Override public Object getCredentials() { return getSaml2Response(); } abstract static class Builder<B extends Builder<B>> extends AbstractAuthenticationBuilder<B> { private Object principal; String saml2Response; Builder(Saml2Authentication token) { super(token); this.principal = token.principal; this.saml2Response = token.saml2Response;
} @Override public B principal(@Nullable Object principal) { Assert.notNull(principal, "principal cannot be null"); this.principal = principal; return (B) this; } void saml2Response(String saml2Response) { this.saml2Response = saml2Response; } } }
repos\spring-security-main\saml2\saml2-service-provider\src\main\java\org\springframework\security\saml2\provider\service\authentication\Saml2Authentication.java
2
请在Spring Boot框架中完成以下Java代码
public class PushBOMProductsRouteBuilder extends RouteBuilder { public static final String PUSH_BOM_PRODUCTS_ROUTE_ID = "GRSSignum-pushBOMs"; public static final String ATTACH_FILE_TO_BOM_PRODUCT_ROUTE_ID = "GRSSignum-bomProductsAttachFile"; public static final String PUSH_BOM_PRODUCTS_ROUTE_PROCESSOR_ID = "GRSSignum-pushBOMsProcessorID"; public static final String PUSH_PRODUCT_ROUTE_PROCESSOR_ID = "GRSSignum-pushProductProcessorID"; public static final String ATTACH_FILE_TO_BOM_PRODUCTS_PROCESSOR_ID = "GRSSignum-bomProductsAttachFileProcessorID"; @Override public void configure() throws Exception { //@formatter:off errorHandler(defaultErrorHandler()); onException(Exception.class) .to(direct(MF_ERROR_ROUTE_ID)); from(direct(PUSH_BOM_PRODUCTS_ROUTE_ID)) .routeId(PUSH_BOM_PRODUCTS_ROUTE_ID) .log("Route invoked!") .unmarshal(setupJacksonDataFormatFor(getContext(), JsonBOM.class)) .process(new PushProductProcessor()).id(PUSH_PRODUCT_ROUTE_PROCESSOR_ID) .to(direct(MF_UPSERT_PRODUCT_V2_CAMEL_URI)) .process(new PushBOMProductsProcessor()).id(PUSH_BOM_PRODUCTS_ROUTE_PROCESSOR_ID) .to(direct(MF_UPSERT_BOM_V2_CAMEL_URI)) .to(direct(ATTACH_FILE_TO_BOM_PRODUCT_ROUTE_ID)); from(direct(ATTACH_FILE_TO_BOM_PRODUCT_ROUTE_ID)) .routeId(ATTACH_FILE_TO_BOM_PRODUCT_ROUTE_ID) .process(RetrieveExternalSystemRequestBuilder::buildAndAttachRetrieveExternalSystemRequest) .to("{{" + ExternalSystemCamelConstants.MF_GET_EXTERNAL_SYSTEM_INFO + "}}") .unmarshal(CamelRouteUtil.setupJacksonDataFormatFor(getContext(), JsonExternalSystemInfo.class))
.process(this::processExternalSystemInfo) .process(new ProductsAttachFileProcessor()).id(ATTACH_FILE_TO_BOM_PRODUCTS_PROCESSOR_ID) .choice() .when(body().isNull()) .log("No attachments found!") .otherwise() .to(direct(ExternalSystemCamelConstants.MF_ATTACHMENT_ROUTE_ID)) .end(); //@formatter:on } private void processExternalSystemInfo(@NonNull final Exchange exchange) { final PushBOMsRouteContext context = ProcessorHelper.getPropertyOrThrowError(exchange, GRSSignumConstants.ROUTE_PROPERTY_PUSH_BOMs_CONTEXT, PushBOMsRouteContext.class); final JsonExternalSystemInfo externalSystemInfo = exchange.getIn().getBody(JsonExternalSystemInfo.class); if (externalSystemInfo == null) { throw new RuntimeException("Missing JsonExternalSystemInfo!"); } context.setExportDirectoriesBasePath(externalSystemInfo.getParameters().get(PARAM_BasePathForExportDirectories)); } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-grssignum\src\main\java\de\metas\camel\externalsystems\grssignum\from_grs\bom\PushBOMProductsRouteBuilder.java
2