instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请在Spring Boot框架中完成以下Java代码
|
public class MyProperties {
private final boolean enabled;
private final InetAddress remoteAddress;
private final Security security;
// tag::code[]
public MyProperties(boolean enabled, InetAddress remoteAddress, @DefaultValue Security security) {
this.enabled = enabled;
this.remoteAddress = remoteAddress;
this.security = security;
}
// end::code[]
public boolean isEnabled() {
return this.enabled;
}
public InetAddress getRemoteAddress() {
return this.remoteAddress;
}
public Security getSecurity() {
return this.security;
}
public static class Security {
private final String username;
|
private final String password;
private final List<String> roles;
public Security(String username, String password, @DefaultValue("USER") List<String> roles) {
this.username = username;
this.password = password;
this.roles = roles;
}
public String getUsername() {
return this.username;
}
public String getPassword() {
return this.password;
}
public List<String> getRoles() {
return this.roles;
}
}
}
|
repos\spring-boot-4.0.1\documentation\spring-boot-docs\src\main\java\org\springframework\boot\docs\features\externalconfig\typesafeconfigurationproperties\constructorbinding\nonnull\MyProperties.java
| 2
|
请完成以下Java代码
|
public Void execute(CommandContext commandContext) {
EnsureUtil.ensureNotNull(NotValidException.class, "incident id", incidentId);
IncidentEntity incident = (IncidentEntity) commandContext.getIncidentManager().findIncidentById(incidentId);
EnsureUtil.ensureNotNull(BadUserRequestException.class, "incident", incident);
ExecutionEntity execution = null;
if (incident.getExecutionId() != null) {
execution = commandContext.getExecutionManager().findExecutionById(incident.getExecutionId());
if (execution != null) {
// check rights for updating an execution-related incident
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkUpdateProcessInstance(execution);
}
}
}
incident.setAnnotation(annotation);
triggerHistoryEvent(commandContext, incident);
String tenantId = execution != null ? execution.getTenantId() : null;
if (annotation == null) {
commandContext.getOperationLogManager()
.logClearIncidentAnnotationOperation(incidentId, tenantId);
} else {
commandContext.getOperationLogManager()
.logSetIncidentAnnotationOperation(incidentId, tenantId);
}
return null;
|
}
protected void triggerHistoryEvent(CommandContext commandContext, IncidentEntity incident) {
HistoryLevel historyLevel = commandContext.getProcessEngineConfiguration().getHistoryLevel();
if (historyLevel.isHistoryEventProduced(HistoryEventTypes.INCIDENT_UPDATE, incident)) {
HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
@Override
public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
HistoricIncidentEventEntity incidentUpdateEvt = (HistoricIncidentEventEntity)
producer.createHistoricIncidentUpdateEvt(incident);
incidentUpdateEvt.setAnnotation(annotation);
return incidentUpdateEvt;
}
});
}
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmd\SetAnnotationForIncidentCmd.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class AllergenId implements RepoIdAware
{
int repoId;
@JsonCreator
public static AllergenId ofRepoId(final int repoId)
{
return new AllergenId(repoId);
}
@Nullable
public static AllergenId ofRepoIdOrNull(@Nullable final Integer repoId)
{
return repoId != null && repoId > 0 ? new AllergenId(repoId) : null;
}
@Nullable
public static AllergenId ofRepoIdOrNull(final int repoId)
{
return repoId > 0 ? new AllergenId(repoId) : null;
}
public static int toRepoId(@Nullable final AllergenId AllergenId)
{
return AllergenId != null ? AllergenId.getRepoId() : -1;
}
public static boolean equals(@Nullable final AllergenId o1, @Nullable final AllergenId o2)
|
{
return Objects.equals(o1, o2);
}
private AllergenId(final int repoId)
{
this.repoId = Check.assumeGreaterThanZero(repoId, "M_Allergen_ID");
}
@Override
@JsonValue
public int getRepoId()
{
return repoId;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\product\allergen\AllergenId.java
| 2
|
请完成以下Java代码
|
public void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
public void setBeanClassLoader(ClassLoader classLoader) {
this.beanClassLoader = classLoader;
}
public int getOrder() {
return this.order;
}
public void afterPropertiesSet() {
Assert.notNull(this.beanClassLoader, "beanClassLoader must not be null");
Assert.notNull(this.beanFactory, "beanFactory must not be null");
}
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
return bean;
}
public void setRegistry(ActivitiStateHandlerRegistry registry) {
this.registry = registry;
}
public Object postProcessAfterInitialization(final Object bean,
final String beanName) throws BeansException {
// first sift through and get all the methods
// then get all the annotations
// then build the metadata and register the metadata
final Class<?> targetClass = AopUtils.getTargetClass(bean);
final org.camunda.bpm.engine.spring.annotations.ProcessEngineComponent component = targetClass.getAnnotation(org.camunda.bpm.engine.spring.annotations.ProcessEngineComponent.class);
ReflectionUtils.doWithMethods(targetClass,
new ReflectionUtils.MethodCallback() {
@SuppressWarnings("unchecked")
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
State state = AnnotationUtils.getAnnotation(method, State.class);
String processName = component.processKey();
if (StringUtils.hasText(state.process())) {
processName = state.process();
}
String stateName = state.state();
if (!StringUtils.hasText(stateName)) {
stateName = state.value();
}
Assert.notNull(stateName, "You must provide a stateName!");
Map<Integer, String> vars = new HashMap<Integer, String>();
Annotation[][] paramAnnotationsArray = method.getParameterAnnotations();
int ctr = 0;
int pvMapIndex = -1;
int procIdIndex = -1;
|
for (Annotation[] paramAnnotations : paramAnnotationsArray) {
ctr += 1;
for (Annotation pa : paramAnnotations) {
if (pa instanceof ProcessVariable) {
ProcessVariable pv = (ProcessVariable) pa;
String pvName = pv.value();
vars.put(ctr, pvName);
} else if (pa instanceof ProcessVariables) {
pvMapIndex = ctr;
} else if (pa instanceof ProcessId ) {
procIdIndex = ctr;
}
}
}
ActivitiStateHandlerRegistration registration = new ActivitiStateHandlerRegistration(vars,
method, bean, stateName, beanName, pvMapIndex,
procIdIndex, processName);
registry.registerActivitiStateHandler(registration);
}
},
new ReflectionUtils.MethodFilter() {
public boolean matches(Method method) {
return null != AnnotationUtils.getAnnotation(method,
State.class);
}
});
return bean;
}
}
|
repos\camunda-bpm-platform-master\engine-spring\core\src\main\java\org\camunda\bpm\engine\spring\components\aop\ActivitiStateAnnotationBeanPostProcessor.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void setLastSeen(Date lastSeen) {
this.lastSeen = lastSeen;
}
public List<Item> getIncomes() {
return incomes;
}
public void setIncomes(List<Item> incomes) {
this.incomes = incomes;
}
public List<Item> getExpenses() {
return expenses;
}
public void setExpenses(List<Item> expenses) {
this.expenses = expenses;
}
public Saving getSaving() {
|
return saving;
}
public void setSaving(Saving saving) {
this.saving = saving;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
}
|
repos\piggymetrics-master\account-service\src\main\java\com\piggymetrics\account\domain\Account.java
| 2
|
请完成以下Java代码
|
public Map<String, Object> getPlanItemInstanceLocalVariables() {
Map<String, Object> variables = new HashMap<>();
if (queryVariables != null) {
for (VariableInstance variableInstance : queryVariables) {
if (variableInstance.getId() != null && variableInstance.getSubScopeId() != null) {
variables.put(variableInstance.getName(), variableInstance.getValue());
}
}
}
return variables;
}
@Override
public List<VariableInstanceEntity> getQueryVariables() {
if (queryVariables == null && Context.getCommandContext() != null) {
queryVariables = new VariableInitializingList();
}
return queryVariables;
}
public void setQueryVariables(List<VariableInstanceEntity> queryVariables) {
this.queryVariables = queryVariables;
}
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("PlanItemInstance with id: ")
.append(id);
if (getName() != null) {
|
stringBuilder.append(", name: ").append(getName());
}
stringBuilder.append(", definitionId: ")
.append(planItemDefinitionId)
.append(", state: ")
.append(state);
if (elementId != null) {
stringBuilder.append(", elementId: ").append(elementId);
}
stringBuilder
.append(", caseInstanceId: ")
.append(caseInstanceId)
.append(", caseDefinitionId: ")
.append(caseDefinitionId);
if (StringUtils.isNotEmpty(tenantId)) {
stringBuilder.append(", tenantId=").append(tenantId);
}
return stringBuilder.toString();
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\persistence\entity\PlanItemInstanceEntityImpl.java
| 1
|
请完成以下Java代码
|
private boolean isRestarterInitialized() {
try {
Restarter restarter = Restarter.getInstance();
return (restarter != null && restarter.getInitialUrls() != null);
}
catch (Exception ex) {
return false;
}
}
private boolean isRemoteRestartEnabled(Environment environment) {
return environment.containsProperty("spring.devtools.remote.secret");
}
private boolean isWebApplication(Environment environment) {
for (String candidate : WEB_ENVIRONMENT_CLASSES) {
Class<?> environmentClass = resolveClassName(candidate, environment.getClass().getClassLoader());
|
if (environmentClass != null && environmentClass.isInstance(environment)) {
return true;
}
}
return false;
}
private @Nullable Class<?> resolveClassName(String candidate, ClassLoader classLoader) {
try {
return ClassUtils.resolveClassName(candidate, classLoader);
}
catch (IllegalArgumentException ex) {
return null;
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-devtools\src\main\java\org\springframework\boot\devtools\env\DevToolsPropertyDefaultsPostProcessor.java
| 1
|
请完成以下Java代码
|
public Tool getObject() throws Exception {
return new Tool(toolId);
}
@Override
public Class<?> getObjectType() {
return Tool.class;
}
@Override
public boolean isSingleton() {
return false;
}
public int getFactoryId() {
|
return factoryId;
}
public void setFactoryId(int factoryId) {
this.factoryId = factoryId;
}
public int getToolId() {
return toolId;
}
public void setToolId(int toolId) {
this.toolId = toolId;
}
}
|
repos\tutorials-master\spring-core-3\src\main\java\com\baeldung\factorybean\ToolFactory.java
| 1
|
请完成以下Java代码
|
private <T> WebEndpointResponse<T> handle(String jobsOrTriggers, ResponseSupplier<T> jobAction,
ResponseSupplier<T> triggerAction) throws SchedulerException {
if ("jobs".equals(jobsOrTriggers)) {
return handleNull(jobAction.get());
}
if ("triggers".equals(jobsOrTriggers)) {
return handleNull(triggerAction.get());
}
return new WebEndpointResponse<>(WebEndpointResponse.STATUS_BAD_REQUEST);
}
private <T> WebEndpointResponse<T> handleNull(@Nullable T value) {
return (value != null) ? new WebEndpointResponse<>(value)
: new WebEndpointResponse<>(WebEndpointResponse.STATUS_NOT_FOUND);
}
@FunctionalInterface
private interface ResponseSupplier<T> {
@Nullable T get() throws SchedulerException;
|
}
static class QuartzEndpointWebExtensionRuntimeHints implements RuntimeHintsRegistrar {
private final BindingReflectionHintsRegistrar bindingRegistrar = new BindingReflectionHintsRegistrar();
@Override
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
this.bindingRegistrar.registerReflectionHints(hints.reflection(), QuartzGroupsDescriptor.class,
QuartzJobDetailsDescriptor.class, QuartzJobGroupSummaryDescriptor.class,
QuartzTriggerGroupSummaryDescriptor.class);
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-quartz\src\main\java\org\springframework\boot\quartz\actuate\endpoint\QuartzEndpointWebExtension.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class SampleOidEntityController {
private static final UrlBuilder LOCATION_BUILDER = new DefaultUrlBuilder();
private SampleOidEntityService service;
public SampleOidEntityController(SampleOidEntityService sampleService) {
super();
this.service = sampleService;
}
public SampleOidEntity create(Request request, Response response) {
SampleOidEntity entity = request.getBodyAs(SampleOidEntity.class, "Resource details not provided");
SampleOidEntity saved = service.create(entity);
// Construct the response for create...
response.setResponseCreated();
// Include the Location header...
String locationPattern = request.getNamedUrl(HttpMethod.GET, Constants.Routes.SINGLE_OID_SAMPLE);
response.addLocationHeader(LOCATION_BUILDER.build(locationPattern, new DefaultTokenResolver()));
// Return the newly-created resource...
return saved;
}
public SampleOidEntity read(Request request, Response response) {
String id = request.getHeader(Constants.Url.SAMPLE_ID, "No resource ID supplied");
SampleOidEntity entity = service.read(Identifiers.MONGOID.parse(id));
return entity;
|
}
public List<SampleOidEntity> readAll(Request request, Response response) {
QueryFilter filter = QueryFilters.parseFrom(request);
QueryOrder order = QueryOrders.parseFrom(request);
QueryRange range = QueryRanges.parseFrom(request, 20);
List<SampleOidEntity> entities = service.readAll(filter, range, order);
long count = service.count(filter);
response.setCollectionResponse(range, entities.size(), count);
return entities;
}
public void update(Request request, Response response) {
String id = request.getHeader(Constants.Url.SAMPLE_ID, "No resource ID supplied");
SampleOidEntity entity = request.getBodyAs(SampleOidEntity.class, "Resource details not provided");
entity.setId(Identifiers.MONGOID.parse(id));
service.update(entity);
response.setResponseNoContent();
}
public void delete(Request request, Response response) {
String id = request.getHeader(Constants.Url.SAMPLE_ID, "No resource ID supplied");
service.delete(Identifiers.MONGOID.parse(id));
response.setResponseNoContent();
}
}
|
repos\tutorials-master\microservices-modules\rest-express\src\main\java\com\baeldung\restexpress\objectid\SampleOidEntityController.java
| 2
|
请完成以下Java代码
|
public class C_Order
{
private static final String SYSCONFIG_DatePromisedOffsetDays = "de.metas.order.DatePromisedOffsetDays";
@CalloutMethod(columnNames = { I_C_Order.COLUMNNAME_DateOrdered })
public void setDatePromised(final I_C_Order order, final ICalloutField field)
{
if (field.isRecordCopyingMode())
{
return;
}
if (!order.isSOTrx())
{
return;
}
final LocalDate dateOrdered = TimeUtil.asLocalDate(order.getDateOrdered());
if (dateOrdered == null)
{
return;
}
final int datePromisedOffsetDays = Services.get(ISysConfigBL.class).getIntValue(SYSCONFIG_DatePromisedOffsetDays, -1);
if (datePromisedOffsetDays <= 0)
|
{
return;
}
final ZoneId timeZone = Services.get(IOrderBL.class).getTimeZone(order);
final ZonedDateTime datePromised = dateOrdered
.plusDays(datePromisedOffsetDays)
.atStartOfDay(timeZone);
order.setDatePromised(TimeUtil.asTimestamp(datePromised));
}
@CalloutMethod(columnNames = { I_C_Order.COLUMNNAME_C_BPartner_Location_ID, I_C_Order.COLUMNNAME_DatePromised })
public void setPreparationDate(final I_C_Order order, final ICalloutField field)
{
// The user needs to make sure there is a *proper* PreparationDate (task 08931).
// If we are currently copying this record, it's fine to fallback to DatePromised (task 09000).
final boolean fallbackToDatePromised = field.isRecordCopyingMode();
Services.get(IOrderDeliveryDayBL.class).setPreparationDateAndTour(order, fallbackToDatePromised);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\tourplanning\callout\C_Order.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class NewsService {
@Autowired
private NewsDao newsDao;
public List<News> getByMap(Map<String, Object> map) {
DynamicDataSourceContextHolder.resetDatabaseType();
return newsDao.getByMap(map);
}
public News getById(Integer id) {
DynamicDataSourceContextHolder.resetDatabaseType();
return newsDao.getById(id);
}
public News create(News news) {
DynamicDataSourceContextHolder.resetDatabaseType();
|
newsDao.create(news);
return news;
}
public News update(News news) {
DynamicDataSourceContextHolder.resetDatabaseType();
newsDao.update(news);
return news;
}
public int delete(Integer id) {
DynamicDataSourceContextHolder.resetDatabaseType();
return newsDao.delete(id);
}
}
|
repos\springBoot-master\springboot-dynamicDataSource\src\main\java\cn\abel\service\NewsService.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class DeleteDeadLetterJobCmd implements Command<Object>, Serializable {
private static final Logger LOGGER = LoggerFactory.getLogger(DeleteDeadLetterJobCmd.class);
private static final long serialVersionUID = 1L;
protected JobServiceConfiguration jobServiceConfiguration;
protected String deadLetterJobId;
public DeleteDeadLetterJobCmd(String deadLetterJobId, JobServiceConfiguration jobServiceConfiguration) {
this.deadLetterJobId = deadLetterJobId;
this.jobServiceConfiguration = jobServiceConfiguration;
}
@Override
public Object execute(CommandContext commandContext) {
DeadLetterJobEntity jobToDelete = getJobToDelete(commandContext);
sendCancelEvent(jobToDelete);
jobServiceConfiguration.getDeadLetterJobEntityManager().delete(jobToDelete);
return null;
}
protected void sendCancelEvent(DeadLetterJobEntity jobToDelete) {
FlowableEventDispatcher eventDispatcher = jobServiceConfiguration.getEventDispatcher();
if (eventDispatcher != null && eventDispatcher.isEnabled()) {
eventDispatcher.dispatchEvent(FlowableJobEventBuilder.createEntityEvent(FlowableEngineEventType.JOB_CANCELED, jobToDelete),
jobServiceConfiguration.getEngineName());
}
}
|
protected DeadLetterJobEntity getJobToDelete(CommandContext commandContext) {
if (deadLetterJobId == null) {
throw new FlowableIllegalArgumentException("jobId is null");
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Deleting job {}", deadLetterJobId);
}
DeadLetterJobEntity job = jobServiceConfiguration.getDeadLetterJobEntityManager().findById(deadLetterJobId);
if (job == null) {
throw new FlowableObjectNotFoundException("No dead letter job found with id '" + deadLetterJobId + "'", Job.class);
}
return job;
}
}
|
repos\flowable-engine-main\modules\flowable-job-service\src\main\java\org\flowable\job\service\impl\cmd\DeleteDeadLetterJobCmd.java
| 2
|
请完成以下Java代码
|
public boolean isSameTax ()
{
Object oo = get_Value(COLUMNNAME_IsSameTax);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Price includes Tax.
@param IsTaxIncluded
Tax is included in the price
*/
public void setIsTaxIncluded (boolean IsTaxIncluded)
{
set_Value (COLUMNNAME_IsTaxIncluded, Boolean.valueOf(IsTaxIncluded));
}
/** Get Price includes Tax.
@return Tax is included in the price
*/
public boolean isTaxIncluded ()
{
Object oo = get_Value(COLUMNNAME_IsTaxIncluded);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
|
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Charge.java
| 1
|
请完成以下Java代码
|
public boolean isMailServerUseSsl() {
return mailServerUseSsl;
}
public void setMailServerUseSsl(boolean mailServerUseSsl) {
this.mailServerUseSsl = mailServerUseSsl;
}
public boolean isMailServerUseTls() {
return mailServerUseTls;
}
public void setMailServerUseTls(boolean mailServerUseTls) {
this.mailServerUseTls = mailServerUseTls;
}
public List<String> getCustomMybatisMappers() {
return customMybatisMappers;
}
public void setCustomMybatisMappers(List<String> customMyBatisMappers) {
this.customMybatisMappers = customMyBatisMappers;
}
public List<String> getCustomMybatisXMLMappers() {
return customMybatisXMLMappers;
}
public void setCustomMybatisXMLMappers(List<String> customMybatisXMLMappers) {
this.customMybatisXMLMappers = customMybatisXMLMappers;
}
public boolean isUseStrongUuids() {
return useStrongUuids;
}
public void setUseStrongUuids(boolean useStrongUuids) {
this.useStrongUuids = useStrongUuids;
}
public boolean isCopyVariablesToLocalForTasks() {
return copyVariablesToLocalForTasks;
}
public void setCopyVariablesToLocalForTasks(boolean copyVariablesToLocalForTasks) {
this.copyVariablesToLocalForTasks = copyVariablesToLocalForTasks;
}
public String getDeploymentMode() {
return deploymentMode;
}
public void setDeploymentMode(String deploymentMode) {
|
this.deploymentMode = deploymentMode;
}
public boolean isSerializePOJOsInVariablesToJson() {
return serializePOJOsInVariablesToJson;
}
public void setSerializePOJOsInVariablesToJson(boolean serializePOJOsInVariablesToJson) {
this.serializePOJOsInVariablesToJson = serializePOJOsInVariablesToJson;
}
public String getJavaClassFieldForJackson() {
return javaClassFieldForJackson;
}
public void setJavaClassFieldForJackson(String javaClassFieldForJackson) {
this.javaClassFieldForJackson = javaClassFieldForJackson;
}
public Integer getProcessDefinitionCacheLimit() {
return processDefinitionCacheLimit;
}
public void setProcessDefinitionCacheLimit(Integer processDefinitionCacheLimit) {
this.processDefinitionCacheLimit = processDefinitionCacheLimit;
}
public String getProcessDefinitionCacheName() {
return processDefinitionCacheName;
}
public void setProcessDefinitionCacheName(String processDefinitionCacheName) {
this.processDefinitionCacheName = processDefinitionCacheName;
}
public void setDisableExistingStartEventSubscriptions(boolean disableExistingStartEventSubscriptions) {
this.disableExistingStartEventSubscriptions = disableExistingStartEventSubscriptions;
}
public boolean shouldDisableExistingStartEventSubscriptions() {
return disableExistingStartEventSubscriptions;
}
}
|
repos\Activiti-develop\activiti-core\activiti-spring-boot-starter\src\main\java\org\activiti\spring\boot\ActivitiProperties.java
| 1
|
请完成以下Spring Boot application配置
|
spring:
# R2DBC 配置,对应 R2dbcProperties 配置类
r2dbc:
url: mysql://47.112.193.81:3306/lab-27-webflux-r2dbc
username: lab-27-webflux-r2dbc
password: 0ed86@11-r2Dbc123
# jasync:
# r2dbc:
# host: 47.112.193.81
# port: 3306
#
|
database: lab-27-webflux-r2dbc
# username: lab-27-webflux-r2dbc
# password: 0ed86@11-r2Dbc123
|
repos\SpringBoot-Labs-master\lab-27\lab-27-webflux-r2dbc\src\main\resources\application.yaml
| 2
|
请在Spring Boot框架中完成以下Java代码
|
protected static final class GroovyTemplateAvailabilityProperties extends TemplateAvailabilityProperties {
private List<String> resourceLoaderPath = new ArrayList<>(
Arrays.asList(GroovyTemplateProperties.DEFAULT_RESOURCE_LOADER_PATH));
GroovyTemplateAvailabilityProperties() {
super(GroovyTemplateProperties.DEFAULT_PREFIX, GroovyTemplateProperties.DEFAULT_SUFFIX);
}
@Override
protected List<String> getLoaderPath() {
return this.resourceLoaderPath;
}
public List<String> getResourceLoaderPath() {
return this.resourceLoaderPath;
}
|
public void setResourceLoaderPath(List<String> resourceLoaderPath) {
this.resourceLoaderPath = resourceLoaderPath;
}
}
static class GroovyTemplateAvailabilityRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
if (ClassUtils.isPresent(REQUIRED_CLASS_NAME, classLoader)) {
BindableRuntimeHintsRegistrar.forTypes(GroovyTemplateAvailabilityProperties.class)
.registerHints(hints, classLoader);
}
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-groovy-templates\src\main\java\org\springframework\boot\groovy\template\autoconfigure\GroovyTemplateAvailabilityProvider.java
| 2
|
请完成以下Java代码
|
public Consumer<I_C_Invoice_Candidate> getInvoiceScheduleSetterFunction(@NonNull final Consumer<I_C_Invoice_Candidate> defaultImplementation)
{
return defaultImplementation;
}
@Override
public Timestamp calculateDateOrdered(@NonNull final I_C_Invoice_Candidate invoiceCandidateRecord)
{
final I_C_Flatrate_Term term = HandlerTools.retrieveTerm(invoiceCandidateRecord);
final Timestamp dateOrdered;
final boolean termHasAPredecessor = Services.get(IContractsDAO.class).termHasAPredecessor(term);
if (!termHasAPredecessor)
{
dateOrdered = term.getStartDate();
}
// If the term was extended (meaning that there is a predecessor term),
// C_Invoice_Candidate.DateOrdered should rather be the StartDate minus TermOfNoticeDuration/TermOfNoticeUnit
else
{
final Timestamp firstDayOfNewTerm = getGetExtentionDateOfNewTerm(term);
dateOrdered = firstDayOfNewTerm;
}
return dateOrdered;
}
/**
* For the given <code>term</code> and its <code>C_Flatrate_Transition</code> record, this method returns the term's start date minus the period specified by <code>TermOfNoticeDuration</code> and
* <code>TermOfNoticeUnit</code>.
*/
|
private static Timestamp getGetExtentionDateOfNewTerm(@NonNull final I_C_Flatrate_Term term)
{
final Timestamp startDateOfTerm = term.getStartDate();
final I_C_Flatrate_Conditions conditions = term.getC_Flatrate_Conditions();
final I_C_Flatrate_Transition transition = conditions.getC_Flatrate_Transition();
final String termOfNoticeUnit = transition.getTermOfNoticeUnit();
final int termOfNotice = transition.getTermOfNotice();
final Timestamp minimumDateToStart;
if (X_C_Flatrate_Transition.TERMOFNOTICEUNIT_MonatE.equals(termOfNoticeUnit))
{
minimumDateToStart = TimeUtil.addMonths(startDateOfTerm, termOfNotice * -1);
}
else if (X_C_Flatrate_Transition.TERMOFNOTICEUNIT_WocheN.equals(termOfNoticeUnit))
{
minimumDateToStart = TimeUtil.addWeeks(startDateOfTerm, termOfNotice * -1);
}
else if (X_C_Flatrate_Transition.TERMOFNOTICEUNIT_TagE.equals(termOfNoticeUnit))
{
minimumDateToStart = TimeUtil.addDays(startDateOfTerm, termOfNotice * -1);
}
else
{
Check.assume(false, "TermOfNoticeDuration " + transition.getTermOfNoticeUnit() + " doesn't exist");
minimumDateToStart = null; // code won't be reached
}
return minimumDateToStart;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\subscription\invoicecandidatehandler\FlatrateTermSubscription_Handler.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Result<SysAppVersion> app3Version(@RequestParam(name="key", required = false)String appKey) throws Exception {
Object appConfig = redisUtil.get(APP3_VERSION + appKey);
if (oConvertUtils.isNotEmpty(appConfig)) {
try {
SysAppVersion sysAppVersion = (SysAppVersion)appConfig;
return Result.OK(sysAppVersion);
} catch (Exception e) {
log.error(e.toString(),e);
return Result.error("app版本信息获取失败:" + e.getMessage());
}
}
return Result.OK();
}
|
/**
* 保存APP3
*
* @param sysAppVersion
* @return
*/
@RequiresRoles({"admin"})
@Operation(summary="app系统配置-保存")
@PostMapping(value = "/saveVersion")
public Result<?> saveVersion(@RequestBody SysAppVersion sysAppVersion) {
String id = sysAppVersion.getId();
redisUtil.set(APP3_VERSION + id,sysAppVersion);
return Result.OK();
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-module-system\jeecg-system-biz\src\main\java\org\jeecg\modules\system\controller\SysAppVersionController.java
| 2
|
请完成以下Java代码
|
public static void main(String[] args) throws InterruptedException, KeeperException {
String path = ZKConstants.ZK_FIRST_PATH;
final CountDownLatch connectedSignal = new CountDownLatch(1);
try {
conn = new ZooKeeperConnection();
zk = conn.connect(ZKConstants.ZK_HOST);
Stat stat = znode_exists(path);
if (stat != null) {
byte[] b = zk.getData(path, new Watcher() {
public void process(WatchedEvent we) {
if (we.getType() == Event.EventType.None) {
switch (we.getState()) {
case Expired:
connectedSignal.countDown();
break;
}
} else {
String path = ZKConstants.ZK_FIRST_PATH;
try {
|
byte[] bn = zk.getData(path,
false, null);
String data = new String(bn,
"UTF-8");
System.out.println(data);
connectedSignal.countDown();
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
}
}
}, null);
String data = new String(b, "UTF-8");
System.out.println(data);
connectedSignal.await();
} else {
System.out.println("Node does not exists");
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
|
repos\spring-boot-quick-master\quick-zookeeper\src\main\java\com\quick\zookeeper\client\ZKGetData.java
| 1
|
请完成以下Java代码
|
public void setM_Product_ID (int M_Product_ID)
{
if (M_Product_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Product_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID));
}
/** Get Product.
@return Product, Service, Item
*/
public int getM_Product_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
if (ii == null)
return 0;
return ii.intValue();
}
|
/** Set Quantity.
@param Qty
Quantity
*/
public void setQty (BigDecimal Qty)
{
set_Value (COLUMNNAME_Qty, Qty);
}
/** Get Quantity.
@return Quantity
*/
public BigDecimal getQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty);
if (bd == null)
return Env.ZERO;
return bd;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_LandedCostAllocation.java
| 1
|
请完成以下Java代码
|
public class JacksonModuleSchemaGenerator {
public static void main(String[] args) {
JacksonModule module = new JacksonModule(RESPECT_JSONPROPERTY_REQUIRED);
SchemaGeneratorConfigBuilder configBuilder = new SchemaGeneratorConfigBuilder(DRAFT_2020_12, PLAIN_JSON).with(module).with(EXTRA_OPEN_API_FORMAT_VALUES);
SchemaGenerator generator = new SchemaGenerator(configBuilder.build());
JsonNode jsonSchema = generator.generateSchema(Person.class);
System.out.println(jsonSchema.toPrettyString());
}
static class Person {
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
UUID id;
@JsonProperty(access = JsonProperty.Access.READ_WRITE, required = true)
String name;
@JsonProperty(access = JsonProperty.Access.READ_WRITE, required = true)
String surname;
@JsonProperty(access = JsonProperty.Access.READ_WRITE, required = true)
Address address;
@JsonIgnore
String fullName;
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
Date createdAt;
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
List<Person> friends;
|
}
static class Address {
@JsonProperty()
String street;
@JsonProperty(required = true)
String city;
@JsonProperty(required = true)
String country;
}
}
|
repos\tutorials-master\json-modules\json-2\src\main\java\com\baeldung\jsonschemageneration\modules\JacksonModuleSchemaGenerator.java
| 1
|
请完成以下Java代码
|
public void setC_Async_Batch_Type_ID (final int C_Async_Batch_Type_ID)
{
if (C_Async_Batch_Type_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Async_Batch_Type_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Async_Batch_Type_ID, C_Async_Batch_Type_ID);
}
@Override
public int getC_Async_Batch_Type_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Async_Batch_Type_ID);
}
@Override
public void setInternalName (final String InternalName)
{
set_Value (COLUMNNAME_InternalName, InternalName);
}
@Override
public String getInternalName()
{
return get_ValueAsString(COLUMNNAME_InternalName);
}
@Override
public void setKeepAliveTimeHours (final @Nullable String KeepAliveTimeHours)
{
set_Value (COLUMNNAME_KeepAliveTimeHours, KeepAliveTimeHours);
}
@Override
public String getKeepAliveTimeHours()
{
return get_ValueAsString(COLUMNNAME_KeepAliveTimeHours);
}
/**
* NotificationType AD_Reference_ID=540643
* Reference name: _NotificationType
|
*/
public static final int NOTIFICATIONTYPE_AD_Reference_ID=540643;
/** Async Batch Processed = ABP */
public static final String NOTIFICATIONTYPE_AsyncBatchProcessed = "ABP";
/** Workpackage Processed = WPP */
public static final String NOTIFICATIONTYPE_WorkpackageProcessed = "WPP";
@Override
public void setNotificationType (final @Nullable String NotificationType)
{
set_Value (COLUMNNAME_NotificationType, NotificationType);
}
@Override
public String getNotificationType()
{
return get_ValueAsString(COLUMNNAME_NotificationType);
}
@Override
public void setSkipTimeoutMillis (final int SkipTimeoutMillis)
{
set_Value (COLUMNNAME_SkipTimeoutMillis, SkipTimeoutMillis);
}
@Override
public int getSkipTimeoutMillis()
{
return get_ValueAsInt(COLUMNNAME_SkipTimeoutMillis);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java-gen\de\metas\async\model\X_C_Async_Batch_Type.java
| 1
|
请完成以下Java代码
|
public java.lang.String getRuleType ()
{
return (java.lang.String)get_Value(COLUMNNAME_RuleType);
}
/** Set Skript.
@param Script
Dynamic Java Language Script to calculate result
*/
@Override
public void setScript (java.lang.String Script)
{
set_Value (COLUMNNAME_Script, Script);
}
/** Get Skript.
@return Dynamic Java Language Script to calculate result
*/
@Override
public java.lang.String getScript ()
{
return (java.lang.String)get_Value(COLUMNNAME_Script);
}
|
/** Set Suchschlüssel.
@param Value
Search key for the record in the format required - must be unique
*/
@Override
public void setValue (java.lang.String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
/** Get Suchschlüssel.
@return Search key for the record in the format required - must be unique
*/
@Override
public java.lang.String getValue ()
{
return (java.lang.String)get_Value(COLUMNNAME_Value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Rule.java
| 1
|
请完成以下Java代码
|
public void setProcessing (boolean Processing)
{
set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
}
/** Get Process Now.
@return Process Now */
public boolean isProcessing ()
{
Object oo = get_Value(COLUMNNAME_Processing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Quantity Invoiced.
@param ServiceLevelInvoiced
Quantity of product or service invoiced
*/
public void setServiceLevelInvoiced (BigDecimal ServiceLevelInvoiced)
{
set_ValueNoCheck (COLUMNNAME_ServiceLevelInvoiced, ServiceLevelInvoiced);
}
/** Get Quantity Invoiced.
@return Quantity of product or service invoiced
*/
public BigDecimal getServiceLevelInvoiced ()
|
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_ServiceLevelInvoiced);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Quantity Provided.
@param ServiceLevelProvided
Quantity of service or product provided
*/
public void setServiceLevelProvided (BigDecimal ServiceLevelProvided)
{
set_ValueNoCheck (COLUMNNAME_ServiceLevelProvided, ServiceLevelProvided);
}
/** Get Quantity Provided.
@return Quantity of service or product provided
*/
public BigDecimal getServiceLevelProvided ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_ServiceLevelProvided);
if (bd == null)
return Env.ZERO;
return bd;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_ServiceLevel.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getOrgCheckFilePath() {
return orgCheckFilePath;
}
public void setOrgCheckFilePath(String orgCheckFilePath) {
this.orgCheckFilePath = orgCheckFilePath == null ? null : orgCheckFilePath.trim();
}
public String getReleaseCheckFilePath() {
return releaseCheckFilePath;
}
public void setReleaseCheckFilePath(String releaseCheckFilePath) {
this.releaseCheckFilePath = releaseCheckFilePath == null ? null : releaseCheckFilePath.trim();
}
public String getReleaseStatus() {
return releaseStatus;
}
public void setReleaseStatus(String releaseStatus) {
this.releaseStatus = releaseStatus == null ? null : releaseStatus.trim();
}
public BigDecimal getFee() {
return fee;
}
public void setFee(BigDecimal fee) {
|
this.fee = fee;
}
public String getCheckFailMsg() {
return checkFailMsg;
}
public void setCheckFailMsg(String checkFailMsg) {
this.checkFailMsg = checkFailMsg;
}
public String getBankErrMsg() {
return bankErrMsg;
}
public void setBankErrMsg(String bankErrMsg) {
this.bankErrMsg = bankErrMsg;
}
}
|
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\reconciliation\entity\RpAccountCheckBatch.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class AsyncBatchQueueConfiguration implements IEventBusQueueConfiguration
{
public static final Topic EVENTBUS_TOPIC = Topic.distributed("de.metas.async.eventbus.AsyncBatchNotifyRequest");
static final String QUEUE_NAME_SPEL = "#{metasfreshAsyncBatchQueue.name}";
private static final String QUEUE_BEAN_NAME = "metasfreshAsyncBatchQueue";
private static final String EXCHANGE_NAME_PREFIX = "metasfresh-async-batch-events";
@Value(RabbitMQEventBusConfiguration.APPLICATION_NAME_SPEL)
private String appName;
@Bean(QUEUE_BEAN_NAME)
public AnonymousQueue asyncBatchQueue()
{
final NamingStrategy eventQueueNamingStrategy = new Base64UrlNamingStrategy(EVENTBUS_TOPIC.getName() + "." + appName + "-");
return new AnonymousQueue(eventQueueNamingStrategy);
}
@Bean
public DirectExchange asyncBatchExchange()
{
return new DirectExchange(EXCHANGE_NAME_PREFIX);
}
@Bean
public Binding asyncBatchBinding()
{
|
return BindingBuilder.bind(asyncBatchQueue())
.to(asyncBatchExchange()).with(EXCHANGE_NAME_PREFIX);
}
@Override
public String getQueueName()
{
return asyncBatchQueue().getName();
}
@Override
public Optional<String> getTopicName()
{
return Optional.of(EVENTBUS_TOPIC.getName());
}
@Override
public String getExchangeName()
{
return asyncBatchExchange().getName();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\event\remote\rabbitmq\queues\async_batch\AsyncBatchQueueConfiguration.java
| 2
|
请完成以下Java代码
|
public static String getToken(String auth) {
if (isBearer(auth) || isCrypto(auth)) {
return auth.substring(AUTH_LENGTH);
}
return null;
}
/**
* 判断token类型为bearer
*
* @param auth token
* @return String
*/
public static Boolean isBearer(String auth) {
if ((auth != null) && (auth.length() > AUTH_LENGTH)) {
String headStr = auth.substring(0, 6).toLowerCase();
return headStr.compareTo(BEARER) == 0;
}
return false;
}
/**
* 判断token类型为crypto
*
* @param auth token
* @return String
*/
public static Boolean isCrypto(String auth) {
|
if ((auth != null) && (auth.length() > AUTH_LENGTH)) {
String headStr = auth.substring(0, 6).toLowerCase();
return headStr.compareTo(CRYPTO) == 0;
}
return false;
}
/**
* 解析jsonWebToken
*
* @param jsonWebToken token串
* @return Claims
*/
public static Claims parseJWT(String jsonWebToken) {
try {
return Jwts.parser()
.verifyWith(Keys.hmacShaKeyFor(Base64.getDecoder().decode(getBase64Security()))).build()
.parseSignedClaims(jsonWebToken)
.getPayload();
} catch (Exception ex) {
return null;
}
}
}
|
repos\SpringBlade-master\blade-gateway\src\main\java\org\springblade\gateway\utils\JwtUtil.java
| 1
|
请完成以下Java代码
|
public void setMKTG_CleverReach_Config_ID (int MKTG_CleverReach_Config_ID)
{
if (MKTG_CleverReach_Config_ID < 1)
set_ValueNoCheck (COLUMNNAME_MKTG_CleverReach_Config_ID, null);
else
set_ValueNoCheck (COLUMNNAME_MKTG_CleverReach_Config_ID, Integer.valueOf(MKTG_CleverReach_Config_ID));
}
/** Get MKTG_CleverReach_Config.
@return MKTG_CleverReach_Config */
@Override
public int getMKTG_CleverReach_Config_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_MKTG_CleverReach_Config_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set MKTG_Platform.
@param MKTG_Platform_ID MKTG_Platform */
@Override
public void setMKTG_Platform_ID (int MKTG_Platform_ID)
{
if (MKTG_Platform_ID < 1)
set_ValueNoCheck (COLUMNNAME_MKTG_Platform_ID, null);
else
set_ValueNoCheck (COLUMNNAME_MKTG_Platform_ID, Integer.valueOf(MKTG_Platform_ID));
}
/** 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 Kennwort.
@param Password Kennwort */
@Override
public void setPassword (java.lang.String Password)
{
set_Value (COLUMNNAME_Password, Password);
}
/** Get Kennwort.
@return Kennwort */
@Override
public java.lang.String getPassword ()
{
return (java.lang.String)get_Value(COLUMNNAME_Password);
}
/** Set Registered EMail.
@param UserName
Email of the responsible for the System
*/
@Override
public void setUserName (java.lang.String UserName)
{
set_Value (COLUMNNAME_UserName, UserName);
}
/** Get Registered EMail.
@return Email of the responsible for the System
*/
@Override
public java.lang.String getUserName ()
{
return (java.lang.String)get_Value(COLUMNNAME_UserName);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.marketing\cleverreach\src\main\java-gen\de\metas\marketing\cleverreach\model\X_MKTG_CleverReach_Config.java
| 1
|
请完成以下Java代码
|
public void setDefaultContact(final Boolean defaultContact)
{
this.defaultContact = defaultContact;
this.defaultContactSet = true;
}
public void setShipToDefault(final Boolean shipToDefault)
{
this.shipToDefault = shipToDefault;
this.shipToDefaultSet = true;
}
public void setBillToDefault(final Boolean billToDefault)
{
this.billToDefault = billToDefault;
this.billToDefaultSet = true;
}
public void setNewsletter(final Boolean newsletter)
{
this.newsletter = newsletter;
this.newsletterSet = true;
}
public void setDescription(final String description)
{
this.description = description;
this.descriptionSet = true;
}
public void setSales(final Boolean sales)
{
this.sales = sales;
this.salesSet = true;
}
public void setSalesDefault(final Boolean salesDefault)
{
this.salesDefault = salesDefault;
this.salesDefaultSet = true;
}
|
public void setPurchase(final Boolean purchase)
{
this.purchase = purchase;
this.purchaseSet = true;
}
public void setPurchaseDefault(final Boolean purchaseDefault)
{
this.purchaseDefault = purchaseDefault;
this.purchaseDefaultSet = true;
}
public void setSubjectMatter(final Boolean subjectMatter)
{
this.subjectMatter = subjectMatter;
this.subjectMatterSet = true;
}
public void setSyncAdvise(final SyncAdvise syncAdvise)
{
this.syncAdvise = syncAdvise;
this.syncAdviseSet = true;
}
}
|
repos\metasfresh-new_dawn_uat\misc\de-metas-common\de-metas-common-bpartner\src\main\java\de\metas\common\bpartner\v1\request\JsonRequestContact.java
| 1
|
请完成以下Java代码
|
public boolean isTourInstanceMatches(final I_M_Tour_Instance tourInstance, final ITourInstanceQueryParams params)
{
if (tourInstance == null)
{
return false;
}
return createTourInstanceMatcher(params)
.accept(tourInstance);
}
@Override
public boolean hasDeliveryDays(final I_M_Tour_Instance tourInstance)
{
Check.assumeNotNull(tourInstance, "tourInstance not null");
final int tourInstanceId = tourInstance.getM_Tour_Instance_ID();
Check.assume(tourInstanceId > 0, "tourInstance shall not be a new/not saved one");
return Services.get(IQueryBL.class)
.createQueryBuilder(I_M_DeliveryDay.class, tourInstance)
// .addOnlyActiveRecordsFilter() // check all records
// Delivery days for our tour instance
|
.addEqualsFilter(I_M_DeliveryDay.COLUMN_M_Tour_Instance_ID, tourInstanceId)
.create()
.anyMatch();
}
public I_M_Tour_Instance retrieveTourInstanceForShipperTransportation(final I_M_ShipperTransportation shipperTransportation)
{
Check.assumeNotNull(shipperTransportation, "shipperTransportation not null");
return Services.get(IQueryBL.class)
.createQueryBuilder(I_M_Tour_Instance.class, shipperTransportation)
// .addOnlyActiveRecordsFilter()
// Delivery days for our tour instance
.addEqualsFilter(I_M_Tour_Instance.COLUMN_M_ShipperTransportation_ID, shipperTransportation.getM_ShipperTransportation_ID())
.create()
.firstOnly(I_M_Tour_Instance.class);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\tourplanning\api\impl\TourInstanceDAO.java
| 1
|
请完成以下Java代码
|
public ProductInfo getProductInfo(
@NonNull final ExternalIdentifier productExternalIdentifier,
@NonNull final OrgId orgId)
{
return productInfoCache.getOrLoad(
new ProductCacheKey(orgId, productExternalIdentifier),
this::getProductInfo0);
}
private ProductInfo getProductInfo0(@NonNull final ProductCacheKey key)
{
final ExternalIdentifier productIdentifier = key.getProductExternalIdentifier();
final ProductAndHUPIItemProductId productAndHUPIItemProductId = productLookupService
|
.resolveProductExternalIdentifier(productIdentifier, key.getOrgId())
.orElseThrow(() -> MissingResourceException.builder()
.resourceName("productIdentifier")
.resourceIdentifier(productIdentifier.getRawValue())
.build());
final UomId uomId = productsBL.getStockUOMId(productAndHUPIItemProductId.getProductId());
return ProductInfo.builder()
.productId(productAndHUPIItemProductId.getProductId())
.hupiItemProductId(productAndHUPIItemProductId.getHupiItemProductId())
.uomId(uomId)
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\v2\ordercandidates\impl\ProductMasterDataProvider.java
| 1
|
请完成以下Java代码
|
public long getFinishedBatchesCount() {
return finishedBatchesCount;
}
public void setFinishedBatchesCount(long finishedBatchCount) {
this.finishedBatchesCount = finishedBatchCount;
}
public long getCleanableBatchesCount() {
return cleanableBatchesCount;
}
public void setCleanableBatchesCount(long cleanableBatchCount) {
this.cleanableBatchesCount = cleanableBatchCount;
}
|
protected CleanableHistoricBatchReport createNewReportQuery(ProcessEngine engine) {
return engine.getHistoryService().createCleanableHistoricBatchReport();
}
public static List<CleanableHistoricBatchReportResultDto> convert(List<CleanableHistoricBatchReportResult> reportResult) {
List<CleanableHistoricBatchReportResultDto> dtos = new ArrayList<CleanableHistoricBatchReportResultDto>();
for (CleanableHistoricBatchReportResult current : reportResult) {
CleanableHistoricBatchReportResultDto dto = new CleanableHistoricBatchReportResultDto();
dto.setBatchType(current.getBatchType());
dto.setHistoryTimeToLive(current.getHistoryTimeToLive());
dto.setFinishedBatchesCount(current.getFinishedBatchesCount());
dto.setCleanableBatchesCount(current.getCleanableBatchesCount());
dtos.add(dto);
}
return dtos;
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\history\batch\CleanableHistoricBatchReportResultDto.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void deleteHistoricTaskLogEntriesForNonExistingProcessInstances() {
getDataManager().deleteHistoricTaskLogEntriesForNonExistingProcessInstances();
}
@Override
public void deleteHistoricTaskLogEntriesForNonExistingCaseInstances() {
getDataManager().deleteHistoricTaskLogEntriesForNonExistingCaseInstances();
}
@Override
public void createHistoricTaskLogEntry(HistoricTaskLogEntryBuilder historicTaskLogEntryBuilder) {
HistoricTaskLogEntryEntity historicTaskLogEntryEntity = getDataManager().create();
historicTaskLogEntryEntity.setUserId(historicTaskLogEntryBuilder.getUserId());
historicTaskLogEntryEntity.setTimeStamp(historicTaskLogEntryBuilder.getTimeStamp());
historicTaskLogEntryEntity.setTaskId(historicTaskLogEntryBuilder.getTaskId());
|
historicTaskLogEntryEntity.setTenantId(historicTaskLogEntryBuilder.getTenantId());
historicTaskLogEntryEntity.setProcessInstanceId(historicTaskLogEntryBuilder.getProcessInstanceId());
historicTaskLogEntryEntity.setProcessDefinitionId(historicTaskLogEntryBuilder.getProcessDefinitionId());
historicTaskLogEntryEntity.setExecutionId(historicTaskLogEntryBuilder.getExecutionId());
historicTaskLogEntryEntity.setScopeId(historicTaskLogEntryBuilder.getScopeId());
historicTaskLogEntryEntity.setScopeDefinitionId(historicTaskLogEntryBuilder.getScopeDefinitionId());
historicTaskLogEntryEntity.setSubScopeId(historicTaskLogEntryBuilder.getSubScopeId());
historicTaskLogEntryEntity.setScopeType(historicTaskLogEntryBuilder.getScopeType());
historicTaskLogEntryEntity.setType(historicTaskLogEntryBuilder.getType());
historicTaskLogEntryEntity.setData(historicTaskLogEntryBuilder.getData());
getDataManager().insert(historicTaskLogEntryEntity);
}
}
|
repos\flowable-engine-main\modules\flowable-task-service\src\main\java\org\flowable\task\service\impl\persistence\entity\HistoricTaskLogEntryEntityManagerImpl.java
| 2
|
请完成以下Java代码
|
public class LongestCommonSubstring
{
public static int compute(char[] str1, char[] str2)
{
int size1 = str1.length;
int size2 = str2.length;
if (size1 == 0 || size2 == 0) return 0;
// the start position of substring in original string
// int start1 = -1;
// int start2 = -1;
// the longest length of com.hankcs.common substring
int longest = 0;
// record how many comparisons the solution did;
// it can be used to know which algorithm is better
// int comparisons = 0;
for (int i = 0; i < size1; ++i)
{
int m = i;
int n = 0;
int length = 0;
while (m < size1 && n < size2)
{
// ++comparisons;
if (str1[m] != str2[n])
{
length = 0;
}
else
{
++length;
if (longest < length)
{
longest = length;
// start1 = m - longest + 1;
// start2 = n - longest + 1;
}
}
|
++m;
++n;
}
}
// shift string2 to find the longest com.hankcs.common substring
for (int j = 1; j < size2; ++j)
{
int m = 0;
int n = j;
int length = 0;
while (m < size1 && n < size2)
{
// ++comparisons;
if (str1[m] != str2[n])
{
length = 0;
}
else
{
++length;
if (longest < length)
{
longest = length;
// start1 = m - longest + 1;
// start2 = n - longest + 1;
}
}
++m;
++n;
}
}
// System.out.printf("from %d of %s and %d of %s, compared for %d times\n", start1, new String(str1), start2, new String(str2), comparisons);
return longest;
}
public static int compute(String str1, String str2)
{
return compute(str1.toCharArray(), str2.toCharArray());
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\algorithm\LongestCommonSubstring.java
| 1
|
请完成以下Java代码
|
public Set<CourseRating> getRatings() {
return ratings;
}
public void setRatings(Set<CourseRating> ratings) {
this.ratings = ratings;
}
public Set<CourseRegistration> getRegistrations() {
return registrations;
}
public void setRegistrations(Set<CourseRegistration> registrations) {
this.registrations = registrations;
}
@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;
Course other = (Course) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}
|
repos\tutorials-master\persistence-modules\spring-jpa\src\main\java\com\baeldung\manytomany\model\Course.java
| 1
|
请完成以下Java代码
|
public Color getTitleForegroundColor()
{
return titleForegroundColor;
}
/**
* Set title foreground color
*
* @param titleForegroundColor
*/
public void setTitleForegroundColor(final Color titleForegroundColor)
{
this.titleForegroundColor = titleForegroundColor;
}
/**
*
* @return title background color
*/
public Color getTitleBackgroundColor()
{
return titleBackgroundColor;
}
/**
* Set background color of title
*
* @param titleBackgroundColor
*/
public void setTitleBackgroundColor(final Color titleBackgroundColor)
{
this.titleBackgroundColor = titleBackgroundColor;
}
/**
* Set title of the section
*
* @param title
*/
public void setTitle(final String title)
{
if (link != null)
{
link.setText(title);
}
}
/**
*
* @return collapsible pane
*/
public JXCollapsiblePane getCollapsiblePane()
{
return collapsible;
}
public JComponent getContentPane()
{
return (JComponent)getCollapsiblePane().getContentPane();
}
public void setContentPane(JComponent contentPanel)
{
getCollapsiblePane().setContentPane(contentPanel);
}
/**
* The border between the stack components. It separates each component with a fine line border.
*/
class SeparatorBorder implements Border
{
boolean isFirst(final Component c)
{
return c.getParent() == null || c.getParent().getComponent(0) == c;
}
@Override
public Insets getBorderInsets(final Component c)
{
// if the collapsible is collapsed, we do not want its border to be
// painted.
if (c instanceof JXCollapsiblePane)
{
if (((JXCollapsiblePane)c).isCollapsed())
{
|
return new Insets(0, 0, 0, 0);
}
}
return new Insets(4, 0, 1, 0);
}
@Override
public boolean isBorderOpaque()
{
return true;
}
@Override
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, final int height)
{
// if the collapsible is collapsed, we do not want its border to be painted.
if (c instanceof JXCollapsiblePane)
{
if (((JXCollapsiblePane)c).isCollapsed())
{
return;
}
}
g.setColor(getSeparatorColor());
if (isFirst(c))
{
g.drawLine(x, y + 2, x + width, y + 2);
}
g.drawLine(x, y + height - 1, x + width, y + height - 1);
}
}
@Override
public final Component add(final Component comp)
{
return collapsible.add(comp);
}
public final void setCollapsed(final boolean collapsed)
{
collapsible.setCollapsed(collapsed);
}
public final void setCollapsible(final boolean collapsible)
{
this.toggleAction.setEnabled(collapsible);
if (!collapsible)
{
this.collapsible.setCollapsed(false);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\swing\CollapsiblePanel.java
| 1
|
请完成以下Java代码
|
protected boolean beforeSave (boolean newRecord)
{
if (newRecord)
setIsValid(true);
if (isValid())
setErrorMsg(null);
return true;
} // beforeSave
@Override
protected boolean afterSave(boolean newRecord, boolean success) {
if (!success)
return false;
return updateParent();
}
@Override
protected boolean afterDelete(boolean success) {
if (!success)
return false;
return updateParent();
}
/**
* Update parent flags
* @return true if success
*/
private boolean updateParent() {
final String sql_count = "SELECT COUNT(*) FROM "+Table_Name+" r"
+" WHERE r."+COLUMNNAME_AD_Alert_ID+"=a."+MAlert.COLUMNNAME_AD_Alert_ID
+" AND r."+COLUMNNAME_IsValid+"='N'"
+" AND r.IsActive='Y'"
;
final String sql = "UPDATE "+MAlert.Table_Name+" a SET "
+" "+MAlert.COLUMNNAME_IsValid+"=(CASE WHEN ("+sql_count+") > 0 THEN 'N' ELSE 'Y' END)"
|
+" WHERE a."+MAlert.COLUMNNAME_AD_Alert_ID+"=?"
;
int no = DB.executeUpdateAndSaveErrorOnFail(sql, getAD_Alert_ID(), get_TrxName());
return no == 1;
}
/**
* String Representation
* @return info
*/
@Override
public String toString ()
{
StringBuffer sb = new StringBuffer ("MAlertRule[");
sb.append(get_ID())
.append("-").append(getName())
.append(",Valid=").append(isValid())
.append(",").append(getSql(false));
sb.append ("]");
return sb.toString ();
} // toString
} // MAlertRule
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MAlertRule.java
| 1
|
请完成以下Java代码
|
public String getShapeType ()
{
return (String)get_Value(COLUMNNAME_ShapeType);
}
/** Set Record Sort No.
@param SortNo
Determines in what order the records are displayed
*/
public void setSortNo (int SortNo)
{
set_Value (COLUMNNAME_SortNo, Integer.valueOf(SortNo));
}
/** Get Record Sort No.
@return Determines in what order the records are displayed
*/
public int getSortNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SortNo);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set X Position.
@param XPosition
Absolute X (horizontal) position in 1/72 of an inch
*/
public void setXPosition (int XPosition)
{
set_Value (COLUMNNAME_XPosition, Integer.valueOf(XPosition));
}
/** Get X Position.
@return Absolute X (horizontal) position in 1/72 of an inch
*/
public int getXPosition ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_XPosition);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set X Space.
@param XSpace
Relative X (horizontal) space in 1/72 of an inch
*/
public void setXSpace (int XSpace)
{
set_Value (COLUMNNAME_XSpace, Integer.valueOf(XSpace));
}
/** Get X Space.
@return Relative X (horizontal) space in 1/72 of an inch
*/
public int getXSpace ()
{
|
Integer ii = (Integer)get_Value(COLUMNNAME_XSpace);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Y Position.
@param YPosition
Absolute Y (vertical) position in 1/72 of an inch
*/
public void setYPosition (int YPosition)
{
set_Value (COLUMNNAME_YPosition, Integer.valueOf(YPosition));
}
/** Get Y Position.
@return Absolute Y (vertical) position in 1/72 of an inch
*/
public int getYPosition ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_YPosition);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Y Space.
@param YSpace
Relative Y (vertical) space in 1/72 of an inch
*/
public void setYSpace (int YSpace)
{
set_Value (COLUMNNAME_YSpace, Integer.valueOf(YSpace));
}
/** Get Y Space.
@return Relative Y (vertical) space in 1/72 of an inch
*/
public int getYSpace ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_YSpace);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_PrintFormatItem.java
| 1
|
请完成以下Java代码
|
public int getTemperature() {
return temperature;
}
public void setTemperature(int temperature) {
this.temperature = temperature;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
|
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
WeatherData that = (WeatherData) o;
return temperature == that.temperature && Objects.equals(city, that.city) && Objects.equals(description,
that.description);
}
@Override
public int hashCode() {
return Objects.hash(city, temperature, description);
}
}
|
repos\tutorials-master\spring-reactive-modules\spring-reactive-4\src\main\java\com\baeldung\webclient\WeatherData.java
| 1
|
请完成以下Java代码
|
public void onCommandFailed(CommandContext commandContext, Throwable t) {
setFailure(t);
}
@Override
public void onCommandContextClose(CommandContext commandContext) {
// ignore
}
public void setJob(JobEntity job) {
this.job = job;
}
public JobEntity getJob() {
return job;
|
}
public String getJobId() {
return jobId;
}
public String getFailedActivityId() {
return failedActivityId;
}
public void setFailedActivityId(String activityId) {
this.failedActivityId = activityId;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\jobexecutor\JobFailureCollector.java
| 1
|
请完成以下Java代码
|
public void setPickFrom_Locator_ID (final int PickFrom_Locator_ID)
{
if (PickFrom_Locator_ID < 1)
set_Value (COLUMNNAME_PickFrom_Locator_ID, null);
else
set_Value (COLUMNNAME_PickFrom_Locator_ID, PickFrom_Locator_ID);
}
@Override
public int getPickFrom_Locator_ID()
{
return get_ValueAsInt(COLUMNNAME_PickFrom_Locator_ID);
}
/**
* PriorityRule AD_Reference_ID=154
* Reference name: _PriorityRule
*/
public static final int PRIORITYRULE_AD_Reference_ID=154;
/** High = 3 */
public static final String PRIORITYRULE_High = "3";
/** Medium = 5 */
public static final String PRIORITYRULE_Medium = "5";
/** Low = 7 */
public static final String PRIORITYRULE_Low = "7";
/** Urgent = 1 */
public static final String PRIORITYRULE_Urgent = "1";
/** Minor = 9 */
public static final String PRIORITYRULE_Minor = "9";
@Override
public void setPriorityRule (final @Nullable java.lang.String PriorityRule)
{
set_Value (COLUMNNAME_PriorityRule, PriorityRule);
}
|
@Override
public java.lang.String getPriorityRule()
{
return get_ValueAsString(COLUMNNAME_PriorityRule);
}
@Override
public void setSeqNo (final int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, SeqNo);
}
@Override
public int getSeqNo()
{
return get_ValueAsInt(COLUMNNAME_SeqNo);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Workplace.java
| 1
|
请完成以下Java代码
|
public String getProcessDefinitionId() {
return processDefinitionId;
}
public String getProcessDefinitionKey() {
return processDefinitionKey;
}
public String getProcessDefinitionName() {
return processDefinitionName;
}
public int getProcessDefinitionVersion() {
return processDefinitionVersion;
}
public Integer getHistoryTimeToLive() {
return historyTimeToLive;
}
public Long getFinishedProcessInstanceCount() {
return finishedProcessInstanceCount;
}
public Long getCleanableProcessInstanceCount() {
return cleanableProcessInstanceCount;
}
public String getTenantId() {
return tenantId;
}
protected CleanableHistoricProcessInstanceReport createNewReportQuery(ProcessEngine engine) {
return engine.getHistoryService().createCleanableHistoricProcessInstanceReport();
|
}
public static List<CleanableHistoricProcessInstanceReportResultDto> convert(List<CleanableHistoricProcessInstanceReportResult> reportResult) {
List<CleanableHistoricProcessInstanceReportResultDto> dtos = new ArrayList<CleanableHistoricProcessInstanceReportResultDto>();
for (CleanableHistoricProcessInstanceReportResult current : reportResult) {
CleanableHistoricProcessInstanceReportResultDto dto = new CleanableHistoricProcessInstanceReportResultDto();
dto.setProcessDefinitionId(current.getProcessDefinitionId());
dto.setProcessDefinitionKey(current.getProcessDefinitionKey());
dto.setProcessDefinitionName(current.getProcessDefinitionName());
dto.setProcessDefinitionVersion(current.getProcessDefinitionVersion());
dto.setHistoryTimeToLive(current.getHistoryTimeToLive());
dto.setFinishedProcessInstanceCount(current.getFinishedProcessInstanceCount());
dto.setCleanableProcessInstanceCount(current.getCleanableProcessInstanceCount());
dto.setTenantId(current.getTenantId());
dtos.add(dto);
}
return dtos;
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\history\CleanableHistoricProcessInstanceReportResultDto.java
| 1
|
请完成以下Java代码
|
public String getSellPoint() {
return sellPoint;
}
public ESProductDO setSellPoint(String sellPoint) {
this.sellPoint = sellPoint;
return this;
}
public String getDescription() {
return description;
}
public ESProductDO setDescription(String description) {
this.description = description;
return this;
}
public Integer getCid() {
return cid;
}
public ESProductDO setCid(Integer cid) {
this.cid = cid;
return this;
}
public String getCategoryName() {
return categoryName;
}
public ESProductDO setCategoryName(String categoryName) {
this.categoryName = categoryName;
return this;
|
}
@Override
public String toString() {
return "ProductDO{" +
"id=" + id +
", name='" + name + '\'' +
", sellPoint='" + sellPoint + '\'' +
", description='" + description + '\'' +
", cid=" + cid +
", categoryName='" + categoryName + '\'' +
'}';
}
}
|
repos\SpringBoot-Labs-master\lab-15-spring-data-es\lab-15-spring-data-jest\src\main\java\cn\iocoder\springboot\lab15\springdatajest\dataobject\ESProductDO.java
| 1
|
请完成以下Java代码
|
public BooleanWithReason checkAllowGoingAwayFrom(final WFActivity fromActivity)
{
if (isStdUserWorkflow())
{
final IDocument document = fromActivity.getDocumentOrNull();
if (document != null)
{
final String docStatus = document.getDocStatus();
final String docAction = document.getDocAction();
if (!IDocument.ACTION_Complete.equals(docAction)
|| IDocument.STATUS_Completed.equals(docStatus)
|| IDocument.STATUS_WaitingConfirmation.equals(docStatus)
|| IDocument.STATUS_WaitingPayment.equals(docStatus)
|| IDocument.STATUS_Voided.equals(docStatus)
|| IDocument.STATUS_Closed.equals(docStatus)
|| IDocument.STATUS_Reversed.equals(docStatus))
{
return BooleanWithReason.falseBecause("document state is not valid for a standard workflow transition (docStatus=" + docStatus + ", docAction=" + docAction + ")");
}
}
}
// No Conditions
final ImmutableList<WFNodeTransitionCondition> conditions = getConditions();
if (conditions.isEmpty())
|
{
return BooleanWithReason.trueBecause("no conditions");
}
// First condition always AND
boolean ok = conditions.get(0).evaluate(fromActivity);
for (int i = 1; i < conditions.size(); i++)
{
final WFNodeTransitionCondition condition = conditions.get(i);
if (condition.isOr())
{
ok = ok || condition.evaluate(fromActivity);
}
else
{
ok = ok && condition.evaluate(fromActivity);
}
} // for all conditions
return ok
? BooleanWithReason.trueBecause("transition conditions matched")
: BooleanWithReason.falseBecause("transition conditions NOT matched");
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\workflow\WFNodeTransition.java
| 1
|
请完成以下Java代码
|
public class TableCacheStatistics implements ITableCacheStatistics
{
private Date startDate;
private final String tableName;
private final AtomicLong hitCount = new AtomicLong(0);
private final AtomicLong hitInTrxCount = new AtomicLong(0);
private final AtomicLong missCount = new AtomicLong(0);
private final AtomicLong missInTrxCount = new AtomicLong(0);
private final ITableCacheConfig cacheConfig;
public TableCacheStatistics(final String tableName, final ITableCacheConfig cacheConfig)
{
super();
this.tableName = tableName;
// cacheConfig can be null
this.cacheConfig = cacheConfig;
reset();
}
@Override
public void reset()
{
startDate = new Date();
hitCount.set(0);
hitInTrxCount.set(0);
missCount.set(0);
missInTrxCount.set(0);
}
@Override
public String getTableName()
{
return tableName;
}
@Override
public Date getStartDate()
{
return startDate;
}
@Override
public long getHitCount()
{
return hitCount.longValue();
}
@Override
public void incrementHitCount()
{
hitCount.incrementAndGet();
}
@Override
public long getHitInTrxCount()
{
return hitInTrxCount.longValue();
}
|
@Override
public void incrementHitInTrxCount()
{
hitInTrxCount.incrementAndGet();
}
@Override
public long getMissCount()
{
return missCount.longValue();
}
@Override
public void incrementMissCount()
{
missCount.incrementAndGet();
}
@Override
public long getMissInTrxCount()
{
return missInTrxCount.longValue();
}
@Override
public void incrementMissInTrxCount()
{
missInTrxCount.incrementAndGet();
}
@Override
public boolean isCacheEnabled()
{
if (cacheConfig != null)
{
return cacheConfig.isEnabled();
}
// if no caching config is provided, it means we are dealing with an overall statistics
// so we consider caching as Enabled
return true;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\cache\model\impl\TableCacheStatistics.java
| 1
|
请完成以下Java代码
|
public <T> T evaluateSimpleExpression(String expression, VariableContext variableContext) {
CustomContext context = new CustomContext() {
public VariableProvider variableProvider() {
return new ContextVariableWrapper(variableContext);
}
};
Either either = feelEngine.evalExpression(expression, context);
if (either instanceof Right) {
Right right = (Right) either;
return (T) right.value();
} else {
Left left = (Left) either;
Failure failure = (Failure) left.value();
String message = failure.message();
throw LOGGER.evaluationException(message);
}
}
public boolean evaluateSimpleUnaryTests(String expression,
String inputVariable,
VariableContext variableContext) {
Map inputVariableMap = new Map.Map1(INPUT_VARIABLE_NAME, inputVariable);
StaticVariableProvider inputVariableContext = new StaticVariableProvider(inputVariableMap);
ContextVariableWrapper contextVariableWrapper = new ContextVariableWrapper(variableContext);
CustomContext context = new CustomContext() {
public VariableProvider variableProvider() {
return new CompositeVariableProvider(toScalaList(inputVariableContext, contextVariableWrapper));
}
};
Either either = feelEngine.evalUnaryTests(expression, context);
if (either instanceof Right) {
Right right = (Right) either;
Object value = right.value();
return BoxesRunTime.unboxToBoolean(value);
} else {
Left left = (Left) either;
Failure failure = (Failure) left.value();
String message = failure.message();
throw LOGGER.evaluationException(message);
}
}
protected List<CustomValueMapper> getValueMappers() {
SpinValueMapperFactory spinValueMapperFactory = new SpinValueMapperFactory();
|
CustomValueMapper javaValueMapper = new JavaValueMapper();
CustomValueMapper spinValueMapper = spinValueMapperFactory.createInstance();
if (spinValueMapper != null) {
return toScalaList(javaValueMapper, spinValueMapper);
} else {
return toScalaList(javaValueMapper);
}
}
@SafeVarargs
protected final <T> List<T> toScalaList(T... elements) {
java.util.List<T> listAsJava = Arrays.asList(elements);
return toList(listAsJava);
}
protected <T> List<T> toList(java.util.List list) {
return ListHasAsScala(list).asScala().toList();
}
protected org.camunda.feel.FeelEngine buildFeelEngine(CustomFunctionTransformer transformer,
CompositeValueMapper valueMapper) {
return new Builder()
.functionProvider(transformer)
.valueMapper(valueMapper)
.enableExternalFunctions(false)
.build();
}
}
|
repos\camunda-bpm-platform-master\engine-dmn\feel-scala\src\main\java\org\camunda\bpm\dmn\feel\impl\scala\ScalaFeelEngine.java
| 1
|
请完成以下Java代码
|
private static String defaultId(Defaultable<? extends DefaultMetadataElement> element) {
DefaultMetadataElement defaultValue = element.getDefault();
return (defaultValue != null) ? defaultValue.getId() : null;
}
private static class ArtifactIdCapability extends TextCapability {
private final TextCapability nameCapability;
ArtifactIdCapability(TextCapability nameCapability) {
super("artifactId", "Artifact", "project coordinates (infer archive name)");
this.nameCapability = nameCapability;
}
@Override
public String getContent() {
String value = super.getContent();
return (value != null) ? value : this.nameCapability.getContent();
}
}
private static class PackageCapability extends TextCapability {
private final TextCapability groupId;
private final TextCapability artifactId;
PackageCapability(TextCapability groupId, TextCapability artifactId) {
|
super("packageName", "Package Name", "root package");
this.groupId = groupId;
this.artifactId = artifactId;
}
@Override
public String getContent() {
String value = super.getContent();
if (value != null) {
return value;
}
else if (this.groupId.getContent() != null && this.artifactId.getContent() != null) {
return InitializrConfiguration
.cleanPackageName(this.groupId.getContent() + "." + this.artifactId.getContent());
}
return null;
}
}
}
|
repos\initializr-main\initializr-metadata\src\main\java\io\spring\initializr\metadata\InitializrMetadata.java
| 1
|
请完成以下Java代码
|
public void setCard(PaymentCard4 value) {
this.card = value;
}
/**
* Gets the value of the poi property.
*
* @return
* possible object is
* {@link PointOfInteraction1 }
*
*/
public PointOfInteraction1 getPOI() {
return poi;
}
/**
* Sets the value of the poi property.
*
* @param value
* allowed object is
* {@link PointOfInteraction1 }
*
*/
public void setPOI(PointOfInteraction1 value) {
this.poi = value;
}
/**
* Gets the value of the tx property.
*
* @return
* possible object is
|
* {@link CardTransaction1Choice }
*
*/
public CardTransaction1Choice getTx() {
return tx;
}
/**
* Sets the value of the tx property.
*
* @param value
* allowed object is
* {@link CardTransaction1Choice }
*
*/
public void setTx(CardTransaction1Choice value) {
this.tx = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_04\CardTransaction1.java
| 1
|
请完成以下Java代码
|
public List<ContactWithJavaUtilDate> getContactsWithJavaUtilDate() {
List<ContactWithJavaUtilDate> contacts = new ArrayList<>();
ContactWithJavaUtilDate contact1 = new ContactWithJavaUtilDate("John Doe", "123 Sesame Street", "123-456-789", new Date(), new Date());
ContactWithJavaUtilDate contact2 = new ContactWithJavaUtilDate("John Doe 2", "124 Sesame Street", "123-456-789", new Date(), new Date());
ContactWithJavaUtilDate contact3 = new ContactWithJavaUtilDate("John Doe 3", "125 Sesame Street", "123-456-789", new Date(), new Date());
contacts.add(contact1);
contacts.add(contact2);
contacts.add(contact3);
return contacts;
}
@GetMapping("/plain")
public List<PlainContact> getPlainContacts() {
List<PlainContact> contacts = new ArrayList<>();
PlainContact contact1 = new PlainContact("John Doe", "123 Sesame Street", "123-456-789", LocalDate.now(), LocalDateTime.now());
PlainContact contact2 = new PlainContact("John Doe 2", "124 Sesame Street", "123-456-789", LocalDate.now(), LocalDateTime.now());
PlainContact contact3 = new PlainContact("John Doe 3", "125 Sesame Street", "123-456-789", LocalDate.now(), LocalDateTime.now());
contacts.add(contact1);
contacts.add(contact2);
|
contacts.add(contact3);
return contacts;
}
@GetMapping("/plainWithJavaUtilDate")
public List<PlainContactWithJavaUtilDate> getPlainContactsWithJavaUtilDate() {
List<PlainContactWithJavaUtilDate> contacts = new ArrayList<>();
PlainContactWithJavaUtilDate contact1 = new PlainContactWithJavaUtilDate("John Doe", "123 Sesame Street", "123-456-789", new Date(), new Date());
PlainContactWithJavaUtilDate contact2 = new PlainContactWithJavaUtilDate("John Doe 2", "124 Sesame Street", "123-456-789", new Date(), new Date());
PlainContactWithJavaUtilDate contact3 = new PlainContactWithJavaUtilDate("John Doe 3", "125 Sesame Street", "123-456-789", new Date(), new Date());
contacts.add(contact1);
contacts.add(contact2);
contacts.add(contact3);
return contacts;
}
}
|
repos\tutorials-master\spring-boot-modules\spring-boot-data\src\main\java\com\baeldung\jsondateformat\ContactController.java
| 1
|
请完成以下Java代码
|
public class DelegateExpressionOutboundChannelModelProcessor implements ChannelModelProcessor {
protected HasExpressionManagerEngineConfiguration engineConfiguration;
protected ObjectMapper objectMapper;
public DelegateExpressionOutboundChannelModelProcessor(HasExpressionManagerEngineConfiguration engineConfiguration, ObjectMapper objectMapper) {
this.engineConfiguration = engineConfiguration;
this.objectMapper = objectMapper;
}
@Override
public boolean canProcess(ChannelModel channelModel) {
return channelModel instanceof DelegateExpressionOutboundChannelModel;
}
@Override
public boolean canProcessIfChannelModelAlreadyRegistered(ChannelModel channelModel) {
return channelModel instanceof DelegateExpressionOutboundChannelModel;
}
@Override
public void registerChannelModel(ChannelModel channelModel, String tenantId, EventRegistry eventRegistry, EventRepositoryService eventRepositoryService,
boolean fallbackToDefaultTenant) {
if (channelModel instanceof DelegateExpressionOutboundChannelModel) {
registerChannelModel((DelegateExpressionOutboundChannelModel) channelModel, tenantId);
}
}
protected void registerChannelModel(DelegateExpressionOutboundChannelModel channelModel, String tenantId) {
String delegateExpression = channelModel.getAdapterDelegateExpression();
if (StringUtils.isNotEmpty(delegateExpression)) {
VariableContainerWrapper variableContainer = new VariableContainerWrapper(Collections.emptyMap());
variableContainer.setVariable("tenantId", tenantId);
|
variableContainer.setTenantId(tenantId);
Object channelAdapter = engineConfiguration.getExpressionManager()
.createExpression(delegateExpression)
.getValue(variableContainer);
if (!(channelAdapter instanceof OutboundEventChannelAdapter)) {
throw new FlowableException(
"DelegateExpression outbound channel model with key " + channelModel.getKey() + " resolved channel adapter delegate expression to "
+ channelAdapter + " which is not of type " + OutboundEventChannelAdapter.class);
}
channelModel.setOutboundEventChannelAdapter(channelAdapter);
}
}
@Override
public void unregisterChannelModel(ChannelModel channelModel, String tenantId, EventRepositoryService eventRepositoryService) {
// Nothing to do
}
public HasExpressionManagerEngineConfiguration getEngineConfiguration() {
return engineConfiguration;
}
public void setEngineConfiguration(HasExpressionManagerEngineConfiguration engineConfiguration) {
this.engineConfiguration = engineConfiguration;
}
}
|
repos\flowable-engine-main\modules\flowable-event-registry\src\main\java\org\flowable\eventregistry\impl\pipeline\DelegateExpressionOutboundChannelModelProcessor.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public synchronized boolean deleteAccount(DeleteAccountAsyncEvent deleteAccountAsyncEvent) {
LOGGER.info("Deleting account {}", deleteAccountAsyncEvent.getAccountId());
Account account = accounts.remove(deleteAccountAsyncEvent.getAccountId());
if (account != null) {
LOGGER.error("Account {} not found !", deleteAccountAsyncEvent.getAccountId());
return true;
} else {
return false;
}
}
@Override
public synchronized boolean transferFunds(TransferFundsAsyncEvent transferFundsAsyncEvent) {
Account source = accounts.get(transferFundsAsyncEvent.getSourceAccountId());
Account destination = accounts.get(transferFundsAsyncEvent.getDestinationAccountId());
if (source != null && destination != null && source.getCredit() >= transferFundsAsyncEvent.getCredit()) {
LOGGER.info("transferring funds {} -> {} {}", source.getName(), destination.getName(), transferFundsAsyncEvent.getCredit());
Account sourceAfterTransaction = new Account(source.getAccountId(), source.getName(), (source.getCredit() - transferFundsAsyncEvent.getCredit()));
Account destinationAfterTransaction = new Account(destination.getAccountId(), destination.getName(), (destination.getCredit() + transferFundsAsyncEvent.getCredit()));
accounts.put(sourceAfterTransaction.getAccountId(), sourceAfterTransaction);
accounts.put(destinationAfterTransaction.getAccountId(), destinationAfterTransaction);
return true;
} else {
LOGGER.error("Transfer funds transaction {} has failed !", transferFundsAsyncEvent.getSourceAccountId());
return false;
}
}
@Override
public boolean depositFunds(DepositAccountAsyncEvent depositAccountAsyncEvent) {
Account account = accounts.get(depositAccountAsyncEvent.getAccountId());
|
if (account != null && (account.getCredit() + depositAccountAsyncEvent.getCredit()) > 0) {
Account accountAfterTransaction = new Account(account.getAccountId(), account.getName(), (account.getCredit() + depositAccountAsyncEvent.getCredit()));
accounts.put(accountAfterTransaction.getAccountId(), accountAfterTransaction);
return true;
} else {
LOGGER.error("Deposit has failed {} !", depositAccountAsyncEvent.getAccountId());
return false;
}
}
@Override
public synchronized Collection<Account> getAccounts() {
return Collections.unmodifiableCollection(accounts.values());
}
@Override
public synchronized Optional<Account> getAccount(AccountId id) {
return Optional.of(accounts.get(id.getId()));
}
}
|
repos\spring-examples-java-17\spring-kafka\kafka-consumer\src\main\java\itx\examples\spring\kafka\consumer\service\AccountServiceImpl.java
| 2
|
请完成以下Java代码
|
public boolean isSupportZoomInto()
{
// Allow zooming into key column. It shall open precisely this record in a new window
// (see https://github.com/metasfresh/metasfresh/issues/1687 to understand the use-case)
// In future we shall think to narrow it down only to included tabs and only for those tables which also have a window where they are the header document.
if (isKey())
{
return true;
}
final DocumentFieldWidgetType widgetType = getWidgetType();
if (!widgetType.isSupportZoomInto())
{
return false;
}
final Class<?> valueClass = getValueClass();
if (StringLookupValue.class.isAssignableFrom(valueClass))
{
return false;
}
final String lookupTableName = getLookupTableName().orElse(null);
return !WindowConstants.TABLENAME_AD_Ref_List.equals(lookupTableName);
}
public Builder setDefaultFilterInfo(@Nullable DocumentFieldDefaultFilterDescriptor defaultFilterInfo)
{
this.defaultFilterInfo = defaultFilterInfo;
return this;
}
/**
* Setting this to a non-{@code null} value means that this field is a tooltip field,
* i.e. it represents a tooltip that is attached to some other field.
*/
public Builder setTooltipIconName(@Nullable final String tooltipIconName)
{
this.tooltipIconName = tooltipIconName;
return this;
}
/**
* @return true if this field has ORDER BY instructions
*/
public boolean isDefaultOrderBy()
{
final DocumentFieldDataBindingDescriptor dataBinding = getDataBinding().orElse(null);
return dataBinding != null && dataBinding.isDefaultOrderBy();
}
public int getDefaultOrderByPriority()
{
// we assume isDefaultOrderBy() was checked before calling this method
//noinspection OptionalGetWithoutIsPresent
|
return getDataBinding().get().getDefaultOrderByPriority();
}
public boolean isDefaultOrderByAscending()
{
// we assume isDefaultOrderBy() was checked before calling this method
//noinspection OptionalGetWithoutIsPresent
return getDataBinding().get().isDefaultOrderByAscending();
}
public Builder deviceDescriptorsProvider(@NonNull final DeviceDescriptorsProvider deviceDescriptorsProvider)
{
this.deviceDescriptorsProvider = deviceDescriptorsProvider;
return this;
}
private DeviceDescriptorsProvider getDeviceDescriptorsProvider()
{
return deviceDescriptorsProvider;
}
public Builder mainAdFieldId(@Nullable final AdFieldId mainAdFieldId)
{
this.mainAdFieldId = mainAdFieldId;
return this;
}
@Nullable
public AdFieldId getMainAdFieldId() {return mainAdFieldId;}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\descriptor\DocumentFieldDescriptor.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Boolean getIncludeProcessVariables() {
return includeProcessVariables;
}
public void setIncludeProcessVariables(Boolean includeProcessVariables) {
this.includeProcessVariables = includeProcessVariables;
}
@JsonTypeInfo(use = Id.CLASS, defaultImpl = QueryVariable.class)
public List<QueryVariable> getTaskVariables() {
return taskVariables;
}
public void setTaskVariables(List<QueryVariable> taskVariables) {
this.taskVariables = taskVariables;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public String getTenantIdLike() {
return tenantIdLike;
}
public void setTenantIdLike(String tenantIdLike) {
this.tenantIdLike = tenantIdLike;
}
public Boolean getWithoutTenantId() {
return withoutTenantId;
}
public void setWithoutTenantId(Boolean withoutTenantId) {
this.withoutTenantId = withoutTenantId;
}
public Boolean getWithoutProcessInstanceId() {
return withoutProcessInstanceId;
}
public void setWithoutProcessInstanceId(Boolean withoutProcessInstanceId) {
this.withoutProcessInstanceId = withoutProcessInstanceId;
}
public String getTaskCandidateGroup() {
return taskCandidateGroup;
}
public void setTaskCandidateGroup(String taskCandidateGroup) {
this.taskCandidateGroup = taskCandidateGroup;
}
public boolean isIgnoreTaskAssignee() {
return ignoreTaskAssignee;
}
public void setIgnoreTaskAssignee(boolean ignoreTaskAssignee) {
this.ignoreTaskAssignee = ignoreTaskAssignee;
}
|
public String getPlanItemInstanceId() {
return planItemInstanceId;
}
public void setPlanItemInstanceId(String planItemInstanceId) {
this.planItemInstanceId = planItemInstanceId;
}
public String getRootScopeId() {
return rootScopeId;
}
public void setRootScopeId(String rootScopeId) {
this.rootScopeId = rootScopeId;
}
public String getParentScopeId() {
return parentScopeId;
}
public void setParentScopeId(String parentScopeId) {
this.parentScopeId = parentScopeId;
}
public Set<String> getScopeIds() {
return scopeIds;
}
public void setScopeIds(Set<String> scopeIds) {
this.scopeIds = scopeIds;
}
public String getScopeId() {
return scopeId;
}
public void setScopeId(String scopeId) {
this.scopeId = scopeId;
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\history\task\HistoricTaskInstanceQueryRequest.java
| 2
|
请完成以下Spring Boot application配置
|
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.sql.
|
init.data-locations=classpath:db/data.sql
spring.sql.init.schema-locations=classpath:db/schema.sql
|
repos\tutorials-master\persistence-modules\spring-boot-persistence-5\src\main\resources\application.properties
| 2
|
请在Spring Boot框架中完成以下Java代码
|
private EntityDataQuery buildEntityDataQuery() {
EntityDataPageLink edpl = new EntityDataPageLink(maxEntitiesPerAlarmSubscription, 0, null,
new EntityDataSortOrder(new EntityKey(EntityKeyType.ENTITY_FIELD, ModelConstants.CREATED_TIME_PROPERTY)));
return new EntityDataQuery(query.getEntityFilter(), edpl, null, null, query.getKeyFilters());
}
private void resetInvocationCounter() {
alarmCountInvocationAttempts = 0;
}
public void createAlarmSubscriptions() {
for (EntityId entityId : entitiesIds) {
createAlarmSubscriptionForEntity(entityId);
}
}
private void createAlarmSubscriptionForEntity(EntityId entityId) {
int subIdx = sessionRef.getSessionSubIdSeq().incrementAndGet();
subToEntityIdMap.put(subIdx, entityId);
log.trace("[{}][{}][{}] Creating alarms subscription for [{}] ", serviceId, cmdId, subIdx, entityId);
TbAlarmsSubscription subscription = TbAlarmsSubscription.builder()
.serviceId(serviceId)
|
.sessionId(sessionRef.getSessionId())
.subscriptionId(subIdx)
.tenantId(sessionRef.getSecurityCtx().getTenantId())
.entityId(entityId)
.updateProcessor((sub, update) -> fetchAlarmCount())
.build();
localSubscriptionService.addSubscription(subscription, sessionRef);
}
public void clearAlarmSubscriptions() {
if (subToEntityIdMap != null) {
for (Integer subId : subToEntityIdMap.keySet()) {
localSubscriptionService.cancelSubscription(getTenantId(), getSessionId(), subId);
}
subToEntityIdMap.clear();
}
}
}
|
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\subscription\TbAlarmCountSubCtx.java
| 2
|
请完成以下Java代码
|
public Collection<KnowledgeRequirement> getKnowledgeRequirement() {
return knowledgeRequirementCollection.get(this);
}
public Collection<AuthorityRequirement> getAuthorityRequirement() {
return authorityRequirementCollection.get(this);
}
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(BusinessKnowledgeModel.class, DMN_ELEMENT_BUSINESS_KNOWLEDGE_MODEL)
.namespaceUri(LATEST_DMN_NS)
.extendsType(DrgElement.class)
.instanceProvider(new ModelTypeInstanceProvider<BusinessKnowledgeModel>() {
public BusinessKnowledgeModel newInstance(ModelTypeInstanceContext instanceContext) {
return new BusinessKnowledgeModelImpl(instanceContext);
}
});
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
encapsulatedLogicChild = sequenceBuilder.element(EncapsulatedLogic.class)
|
.build();
variableChild = sequenceBuilder.element(Variable.class)
.build();
knowledgeRequirementCollection = sequenceBuilder.elementCollection(KnowledgeRequirement.class)
.build();
authorityRequirementCollection = sequenceBuilder.elementCollection(AuthorityRequirement.class)
.build();
typeBuilder.build();
}
}
|
repos\camunda-bpm-platform-master\model-api\dmn-model\src\main\java\org\camunda\bpm\model\dmn\impl\instance\BusinessKnowledgeModelImpl.java
| 1
|
请完成以下Java代码
|
public GroupHeader42 getGrpHdr() {
return grpHdr;
}
/**
* Sets the value of the grpHdr property.
*
* @param value
* allowed object is
* {@link GroupHeader42 }
*
*/
public void setGrpHdr(GroupHeader42 value) {
this.grpHdr = value;
}
/**
* Gets the value of the stmt property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the stmt property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getStmt().add(newItem);
|
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link AccountStatement2 }
*
*
*/
public List<AccountStatement2> getStmt() {
if (stmt == null) {
stmt = new ArrayList<AccountStatement2>();
}
return this.stmt;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_02\BankToCustomerStatementV02.java
| 1
|
请完成以下Java代码
|
public Object getValueByColumn(@NonNull final OLCandAggregationColumn column)
{
final String olCandColumnName = column.getColumnName();
switch (olCandColumnName)
{
case I_C_OLCand.COLUMNNAME_Bill_BPartner_ID:
return getBillBPartnerInfo().getBpartnerId();
case I_C_OLCand.COLUMNNAME_Bill_Location_ID:
return getBillBPartnerInfo().getBpartnerLocationId();
case I_C_OLCand.COLUMNNAME_Bill_Location_Value_ID:
return getBillBPartnerInfo().getLocationId();
case I_C_OLCand.COLUMNNAME_Bill_User_ID:
return getBillBPartnerInfo().getContactId();
case I_C_OLCand.COLUMNNAME_DropShip_BPartner_ID:
return dropShipBPartnerInfo.orElse(bpartnerInfo).getBpartnerId();
case I_C_OLCand.COLUMNNAME_DropShip_Location_ID:
return dropShipBPartnerInfo.orElse(bpartnerInfo).getBpartnerLocationId();
case I_C_OLCand.COLUMNNAME_DropShip_Location_Value_ID:
return dropShipBPartnerInfo.orElse(bpartnerInfo).getLocationId();
case I_C_OLCand.COLUMNNAME_M_PricingSystem_ID:
return getPricingSystemId();
case I_C_OLCand.COLUMNNAME_DateOrdered:
return getDateOrdered();
case I_C_OLCand.COLUMNNAME_DatePromised_Effective:
return getDatePromised();
case I_C_OLCand.COLUMNNAME_BPartnerName:
return getBpartnerName();
case I_C_OLCand.COLUMNNAME_EMail:
return getEmail();
case I_C_OLCand.COLUMNNAME_Phone:
return getPhone();
case I_C_OLCand.COLUMNNAME_IsAutoInvoice:
return isAutoInvoice();
case I_C_OLCand.COLUMNNAME_C_Incoterms_ID:
return getIncotermsId();
case I_C_OLCand.COLUMNNAME_IncotermLocation:
return getIncotermLocation();
default:
return InterfaceWrapperHelper.getValueByColumnId(olCandRecord, column.getAdColumnId());
}
}
@Override
public int getM_ProductPrice_ID()
{
|
return olCandRecord.getM_ProductPrice_ID();
}
@Override
public boolean isExplicitProductPriceAttribute()
{
return olCandRecord.isExplicitProductPriceAttribute();
}
public int getFlatrateConditionsId()
{
return olCandRecord.getC_Flatrate_Conditions_ID();
}
public int getHUPIProductItemId()
{
final HUPIItemProductId packingInstructions = olCandEffectiveValuesBL.getEffectivePackingInstructions(olCandRecord);
return HUPIItemProductId.toRepoId(packingInstructions);
}
public InvoicableQtyBasedOn getInvoicableQtyBasedOn()
{
return InvoicableQtyBasedOn.ofNullableCodeOrNominal(olCandRecord.getInvoicableQtyBasedOn());
}
public BPartnerInfo getBPartnerInfo()
{
return bpartnerInfo;
}
public boolean isAssignToBatch(@NonNull final AsyncBatchId asyncBatchIdCandidate)
{
if (this.asyncBatchId == null)
{
return false;
}
return asyncBatchId.getRepoId() == asyncBatchIdCandidate.getRepoId();
}
public void setHeaderAggregationKey(@NonNull final String headerAggregationKey)
{
olCandRecord.setHeaderAggregationKey(headerAggregationKey);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.salescandidate.base\src\main\java\de\metas\ordercandidate\api\OLCand.java
| 1
|
请完成以下Java代码
|
public class NamedColumnBean extends CsvBean {
@CsvBindByName(column = "name")
private String name;
//Automatically infer column name as Age
@CsvBindByName
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
|
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
@Override
public String toString() {
return name + ',' + age;
}
}
|
repos\tutorials-master\libraries-data-io\src\main\java\com\baeldung\libraries\opencsv\beans\NamedColumnBean.java
| 1
|
请完成以下Java代码
|
public class CS_Creditpass_TransactionFrom_C_BPartner extends JavaProcess implements IProcessPrecondition
{
final private CreditPassTransactionService creditPassTransactionService = Adempiere.getBean(CreditPassTransactionService.class);
@Param(parameterName = CreditPassConstants.PROCESS_PAYMENT_RULE_PARAM)
private String paymentRule;
@Override protected String doIt() throws Exception
{
final BPartnerId bPartnerId = BPartnerId.ofRepoId(getProcessInfo().getRecord_ID());
final List<TransactionResult> transactionResults = creditPassTransactionService
.getAndSaveCreditScore(Optional.ofNullable(paymentRule).orElse(StringUtils.EMPTY), bPartnerId);
List<Integer> tableRecordReferences = transactionResults.stream()
.map(tr -> tr.getTransactionResultId().getRepoId())
.collect(Collectors.toList());
getResult().setRecordsToOpen(I_CS_Transaction_Result.Table_Name, tableRecordReferences, null);
return MSG_OK;
}
@Override
public ProcessPreconditionsResolution checkPreconditionsApplicable(final IProcessPreconditionsContext context)
{
if (context.isNoSelection())
{
return ProcessPreconditionsResolution.rejectBecauseNoSelection();
}
if (!context.isSingleSelection())
{
|
return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection();
}
final I_C_BPartner partner = context.getSelectedModel(I_C_BPartner.class);
if (!partner.isCustomer())
{
return ProcessPreconditionsResolution.rejectWithInternalReason("Business partner is not a customer");
}
if (!creditPassTransactionService.hasConfigForPartnerId(BPartnerId.ofRepoId(partner.getC_BPartner_ID())))
{
return ProcessPreconditionsResolution.rejectWithInternalReason("Business partner has no associated creditPass config");
}
return ProcessPreconditionsResolution.accept();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.creditscore\creditpass\src\main\java\de\metas\vertical\creditscore\creditpass\process\CS_Creditpass_TransactionFrom_C_BPartner.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
class QueueProcessorExecutorService implements IQueueProcessorExecutorService
{
private final IQueueProcessorsExecutor executor;
private final IQueueDAO queueDAO = Services.get(IQueueDAO.class);
/**
* Used to delayed invoke {@link #initNow()}.
*/
private final DelayedRunnableExecutor delayedInit = new DelayedRunnableExecutor(new Runnable()
{
@Override
public void run()
{
initNow();
}
@Override
public String toString()
{
// nice toString representation to be displayed part of the thread name
return QueueProcessorExecutorService.class.getName() + "-delayedInit";
}
});
public QueueProcessorExecutorService()
{
if (Ini.isSwingClient())
{
// NOTE: later, here we can implement and add a ProxyQueueProcessorExecutorService which will contact the server
executor = NullQueueProcessorsExecutor.instance;
}
else
{
// default
executor = new QueueProcessorsExecutor();
}
}
@Override
public void init(final long delayMillis)
{
// If it's NULL then there is no point to schedule a timer
if (executor instanceof NullQueueProcessorsExecutor)
{
return;
}
// Do nothing if already initialized
if (delayedInit.isDone())
{
return;
}
delayedInit.run(delayMillis);
}
/**
* Initialize executors now.
*
* NOTE: never ever call this method directly. It's supposed to be called from {@link #delayedInit}.
*/
private void initNow()
{
// NOTE: don't check if it's already initialized because at the time when this method is called the "initialized" flag was already set,
// to prevent future executions.
// If it's NULL then there is no point to load all processors
if (executor instanceof NullQueueProcessorsExecutor)
|
{
return;
}
// Remove all queue processors. It shall be none, but just to make sure
executor.shutdown();
for (final I_C_Queue_Processor processorDef : queueDAO.retrieveAllProcessors())
{
executor.addQueueProcessor(processorDef);
}
}
@Override
public void removeAllQueueProcessors()
{
delayedInit.cancelAndReset();
executor.shutdown();
}
@Override
public IQueueProcessorsExecutor getExecutor()
{
// Make sure executor was initialized.
// Else it makes no sense to return it because could lead to data corruption.
if (!isInitialized())
{
throw new IllegalStateException("Service not initialized");
}
return executor;
}
@Override
public boolean isInitialized()
{
return delayedInit.isDone();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java\de\metas\async\processor\impl\QueueProcessorExecutorService.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public boolean isEnabled() {
return this.enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public InetAddress getRemoteAddress() {
return this.remoteAddress;
}
public void setRemoteAddress(InetAddress remoteAddress) {
this.remoteAddress = remoteAddress;
}
public Security getSecurity() {
return this.security;
}
// @fold:off
public static class Security {
private String username;
private String password;
private List<String> roles = new ArrayList<>(Collections.singleton("USER"));
// @fold:on // getters / setters...
public String getUsername() {
|
return this.username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
public List<String> getRoles() {
return this.roles;
}
public void setRoles(List<String> roles) {
this.roles = roles;
}
// @fold:off
}
}
|
repos\spring-boot-4.0.1\documentation\spring-boot-docs\src\main\java\org\springframework\boot\docs\features\externalconfig\typesafeconfigurationproperties\javabeanbinding\MyProperties.java
| 2
|
请完成以下Java代码
|
protected void onLoadTxtFinished()
{
super.onLoadTxtFinished();
initTagSet();
}
@Override
public void tag(Table table)
{
int size = table.size();
if (size == 1)
{
table.setLast(0, "S");
return;
}
double[][] net = new double[size][4];
for (int i = 0; i < size; ++i)
{
LinkedList<double[]> scoreList = computeScoreList(table, i);
for (int tag = 0; tag < 4; ++tag)
{
net[i][tag] = computeScore(scoreList, tag);
}
}
net[0][idM] = -1000.0; // 第一个字不可能是M或E
net[0][idE] = -1000.0;
int[][] from = new int[size][4];
double[][] maxScoreAt = new double[2][4]; // 滚动数组
System.arraycopy(net[0], 0, maxScoreAt[0], 0, 4); // 初始preI=0, maxScoreAt[preI][pre] = net[0][pre]
int curI = 0;
for (int i = 1; i < size; ++i)
{
|
curI = i & 1;
int preI = 1 - curI;
for (int now = 0; now < 4; ++now)
{
double maxScore = -1e10;
for (int pre = 0; pre < 4; ++pre)
{
double score = maxScoreAt[preI][pre] + matrix[pre][now] + net[i][now];
if (score > maxScore)
{
maxScore = score;
from[i][now] = pre;
maxScoreAt[curI][now] = maxScore;
}
}
net[i][now] = maxScore;
}
}
// 反向回溯最佳路径
int maxTag = maxScoreAt[curI][idS] > maxScoreAt[curI][idE] ? idS : idE;
table.setLast(size - 1, id2tag[maxTag]);
maxTag = from[size - 1][maxTag];
for (int i = size - 2; i > 0; --i)
{
table.setLast(i, id2tag[maxTag]);
maxTag = from[i][maxTag];
}
table.setLast(0, id2tag[maxTag]);
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\model\CRFSegmentModel.java
| 1
|
请完成以下Java代码
|
protected String getEventName() {
return ExecutionListener.EVENTNAME_END;
}
@Override
protected void eventNotificationsCompleted(PvmExecutionImpl execution) {
if (execution.isProcessInstanceStarting()) {
// only call this method if we are currently in the starting phase;
// if not, this may make an unnecessary request to fetch the process
// instance from the database
execution.setProcessInstanceStarting(false);
}
execution.dispatchDelayedEventsAndPerformOperation(new Callback<PvmExecutionImpl, Void>() {
@Override
public Void callback(PvmExecutionImpl execution) {
execution.leaveActivityInstance();
|
execution.performOperation(TRANSITION_DESTROY_SCOPE);
return null;
}
});
}
public String getCanonicalName() {
return "transition-notify-listener-end";
}
@Override
public boolean shouldHandleFailureAsBpmnError() {
return true;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\pvm\runtime\operation\PvmAtomicOperationTransitionNotifyListenerEnd.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class User {
@Id
@GeneratedValue
private Integer id;
private String name;
private Integer status;
public User() {
}
public User(String name, Integer status) {
this.name = name;
this.status = status;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
|
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}
|
repos\tutorials-master\persistence-modules\spring-boot-persistence-2\src\main\java\com\baeldung\boot\domain\User.java
| 2
|
请完成以下Java代码
|
public class ProcessSetRemovalTimeResultHandler implements TransactionListener {
protected SetRemovalTimeBatchConfiguration batchJobConfiguration;
protected Integer chunkSize;
protected CommandExecutor commandExecutor;
protected ProcessSetRemovalTimeJobHandler jobHandler;
protected String jobId;
protected Map<Class<? extends DbEntity>, DbOperation> operations;
public ProcessSetRemovalTimeResultHandler(SetRemovalTimeBatchConfiguration batchJobConfiguration,
Integer chunkSize,
CommandExecutor commandExecutor,
ProcessSetRemovalTimeJobHandler jobHandler,
String jobId,
Map<Class<? extends DbEntity>, DbOperation> operations) {
this.batchJobConfiguration = batchJobConfiguration;
this.chunkSize = chunkSize;
this.commandExecutor = commandExecutor;
this.jobHandler = jobHandler;
this.jobId = jobId;
this.operations = operations;
}
@Override
public void execute(CommandContext commandContext) {
// use the new command executor since the command context might already have been closed/finished
commandExecutor.execute(context -> {
JobEntity job = context.getJobManager().findJobById(jobId);
Set<String> entitiesToUpdate = getEntitiesToUpdate(operations, chunkSize);
if (entitiesToUpdate.isEmpty() && !operations.containsKey(HistoricProcessInstanceEventEntity.class)) {
// update the process instance last to avoid orphans
entitiesToUpdate = new HashSet<>();
entitiesToUpdate.add(HistoricProcessInstanceEventEntity.class.getName());
}
if (entitiesToUpdate.isEmpty()) {
job.delete(true);
} else {
// save batch job configuration
batchJobConfiguration.setEntities(entitiesToUpdate);
ByteArrayEntity newConfiguration = saveConfiguration(batchJobConfiguration, context);
BatchJobContext newBatchContext = new BatchJobContext(null, newConfiguration);
ProcessSetRemovalTimeJobHandler.JOB_DECLARATION.reconfigure(newBatchContext, (MessageEntity) job);
// reschedule job
|
context.getJobManager().reschedule(job, ClockUtil.getCurrentTime());
}
return null;
});
}
protected ByteArrayEntity saveConfiguration(SetRemovalTimeBatchConfiguration configuration, CommandContext context) {
ByteArrayEntity configurationEntity = new ByteArrayEntity();
configurationEntity.setBytes(jobHandler.writeConfiguration(configuration));
context.getByteArrayManager().insert(configurationEntity);
return configurationEntity;
}
protected static Set<String> getEntitiesToUpdate(Map<Class<? extends DbEntity>, DbOperation> operations, int chunkSize) {
return operations.entrySet().stream()
.filter(op -> op.getValue().getRowsAffected() == chunkSize)
.map(op -> op.getKey().getName())
.collect(Collectors.toSet());
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\batch\removaltime\ProcessSetRemovalTimeResultHandler.java
| 1
|
请完成以下Spring Boot application配置
|
datasource.password=ENC(/AL9nJENCYCh9Pfzdf2xLPsqOZ6HwNgQ3AnMybFAMeOM5GphZlOK6PxzozwtCm+Q)
jasypt.encryptor.password=didispace
# mvn jasypt:encrypt -Djasypt.encryptor.password=didispace
# mvn jasypt:decrypt -Djasypt.encrypt
|
or.password=didispace
#jasypt.encryptor.property.prefix=ENC(
#jasypt.encryptor.property.suffix=)
|
repos\SpringBoot-Learning-master\2.x\chapter1-5\src\main\resources\application.properties
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public static class LoadBalancerHandlerConfiguration {
@Bean
public Function<RouteProperties, HandlerFunctionDefinition> lbHandlerFunctionDefinition() {
return routeProperties -> {
Objects.requireNonNull(routeProperties.getUri(), "routeProperties.uri must not be null");
return new HandlerFunctionDefinition.Default("lb", HandlerFunctions.http(), Collections.emptyList(),
Collections.singletonList(LoadBalancerFilterFunctions.lb(routeProperties.getUri().getHost())));
};
}
}
@Configuration(proxyBeanMethods = false)
static class RetryFilterConfiguration {
private final GatewayMvcProperties properties;
RetryFilterConfiguration(GatewayMvcProperties properties) {
this.properties = properties;
}
|
@Bean
public RetryFilterFunctions.FilterSupplier retryFilterFunctionsSupplier() {
RetryFilterFunctions.setUseFrameworkRetry(properties.isUseFrameworkRetryFilter());
return new RetryFilterFunctions.FilterSupplier();
}
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(OAuth2AuthorizedClient.class)
static class TokenRelayFilterConfiguration {
@Bean
public TokenRelayFilterFunctions.FilterSupplier tokenRelayFilterFunctionsSupplier() {
return new TokenRelayFilterFunctions.FilterSupplier();
}
}
}
|
repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webmvc\src\main\java\org\springframework\cloud\gateway\server\mvc\filter\FilterAutoConfiguration.java
| 2
|
请完成以下Java代码
|
public void setDhl_ShipmentOrder_Log_ID (final int Dhl_ShipmentOrder_Log_ID)
{
if (Dhl_ShipmentOrder_Log_ID < 1)
set_ValueNoCheck (COLUMNNAME_Dhl_ShipmentOrder_Log_ID, null);
else
set_ValueNoCheck (COLUMNNAME_Dhl_ShipmentOrder_Log_ID, Dhl_ShipmentOrder_Log_ID);
}
@Override
public int getDhl_ShipmentOrder_Log_ID()
{
return get_ValueAsInt(COLUMNNAME_Dhl_ShipmentOrder_Log_ID);
}
@Override
public de.metas.shipper.gateway.dhl.model.I_DHL_ShipmentOrderRequest getDHL_ShipmentOrderRequest()
{
return get_ValueAsPO(COLUMNNAME_DHL_ShipmentOrderRequest_ID, de.metas.shipper.gateway.dhl.model.I_DHL_ShipmentOrderRequest.class);
}
@Override
public void setDHL_ShipmentOrderRequest(final de.metas.shipper.gateway.dhl.model.I_DHL_ShipmentOrderRequest DHL_ShipmentOrderRequest)
{
set_ValueFromPO(COLUMNNAME_DHL_ShipmentOrderRequest_ID, de.metas.shipper.gateway.dhl.model.I_DHL_ShipmentOrderRequest.class, DHL_ShipmentOrderRequest);
}
@Override
public void setDHL_ShipmentOrderRequest_ID (final int DHL_ShipmentOrderRequest_ID)
{
if (DHL_ShipmentOrderRequest_ID < 1)
set_Value (COLUMNNAME_DHL_ShipmentOrderRequest_ID, null);
else
set_Value (COLUMNNAME_DHL_ShipmentOrderRequest_ID, DHL_ShipmentOrderRequest_ID);
}
@Override
public int getDHL_ShipmentOrderRequest_ID()
{
return get_ValueAsInt(COLUMNNAME_DHL_ShipmentOrderRequest_ID);
}
@Override
public void setDurationMillis (final int DurationMillis)
{
set_Value (COLUMNNAME_DurationMillis, DurationMillis);
|
}
@Override
public int getDurationMillis()
{
return get_ValueAsInt(COLUMNNAME_DurationMillis);
}
@Override
public void setIsError (final boolean IsError)
{
set_Value (COLUMNNAME_IsError, IsError);
}
@Override
public boolean isError()
{
return get_ValueAsBoolean(COLUMNNAME_IsError);
}
@Override
public void setRequestMessage (final @Nullable java.lang.String RequestMessage)
{
set_Value (COLUMNNAME_RequestMessage, RequestMessage);
}
@Override
public java.lang.String getRequestMessage()
{
return get_ValueAsString(COLUMNNAME_RequestMessage);
}
@Override
public void setResponseMessage (final @Nullable java.lang.String ResponseMessage)
{
set_Value (COLUMNNAME_ResponseMessage, ResponseMessage);
}
@Override
public java.lang.String getResponseMessage()
{
return get_ValueAsString(COLUMNNAME_ResponseMessage);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.dhl\src\main\java-gen\de\metas\shipper\gateway\dhl\model\X_Dhl_ShipmentOrder_Log.java
| 1
|
请完成以下Java代码
|
public boolean isShowPreference()
{
return !isNone();
}
public boolean isNone()
{
return this == NONE;
}
public boolean isClient()
{
return this == CLIENT;
}
public boolean isOrganization()
{
|
return this == ORGANIZATION;
}
public boolean isUser()
{
return this == USER;
}
/**
*
* @return true if this level allows user to view table record change log (i.e. this level is {@link #CLIENT})
*/
public boolean canViewRecordChangeLog()
{
return isClient();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\security\permissions\UserPreferenceLevelConstraint.java
| 1
|
请完成以下Java代码
|
public void invalidateView(final ViewId pickingSlotViewId)
{
final PickingSlotView pickingSlotView = getOrCreatePickingSlotView(pickingSlotViewId, false/* create */);
if (pickingSlotView == null)
{
return;
}
final PackageableView packageableView = getPackageableViewByPickingSlotViewId(pickingSlotViewId);
if (packageableView != null)
{
//we have to invalidate all the related pickingSlotViews in order to make sure the
//changes available in UI when selecting different `packageableRows`
packageableView.invalidatePickingSlotViews();
}
|
pickingSlotView.invalidateAll();
ViewChangesCollector.getCurrentOrAutoflush()
.collectFullyChanged(pickingSlotView);
}
@Override
public Stream<IView> streamAllViews()
{
// Do we really have to implement this?
return Stream.empty();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\picking\pickingslot\PickingSlotViewsIndexStorage.java
| 1
|
请完成以下Java代码
|
public <T> ImmutableList<T> toImmutableList(@NonNull final Function<DocumentId, T> mapper)
{
assertNotAll();
if (documentIds.isEmpty())
{
return ImmutableList.of();
}
return documentIds.stream().map(mapper).collect(ImmutableList.toImmutableList());
}
public Set<Integer> toIntSet()
{
return toSet(DocumentId::toInt);
}
public <ID extends RepoIdAware> ImmutableSet<ID> toIds(@NonNull final Function<Integer, ID> idMapper)
{
return toSet(idMapper.compose(DocumentId::toInt));
}
public <ID extends RepoIdAware> ImmutableSet<ID> toIdsFromInt(@NonNull final IntFunction<ID> idMapper)
{
return toSet(documentId -> idMapper.apply(documentId.toInt()));
}
/**
* Similar to {@link #toIds(Function)} but this returns a list, so it preserves the order
*/
public <ID extends RepoIdAware> ImmutableList<ID> toIdsList(@NonNull final Function<Integer, ID> idMapper)
{
return toImmutableList(idMapper.compose(DocumentId::toInt));
}
public Set<String> toJsonSet()
{
if (all)
{
return ALL_StringSet;
}
return toSet(DocumentId::toJson);
}
public SelectionSize toSelectionSize()
|
{
if (isAll())
{
return SelectionSize.ofAll();
}
return SelectionSize.ofSize(size());
}
public DocumentIdsSelection addAll(@NonNull final DocumentIdsSelection documentIdsSelection)
{
if (this.isEmpty())
{
return documentIdsSelection;
}
else if (documentIdsSelection.isEmpty())
{
return this;
}
if (this.all)
{
return this;
}
else if (documentIdsSelection.all)
{
return documentIdsSelection;
}
final ImmutableSet<DocumentId> combinedIds = Stream.concat(this.stream(), documentIdsSelection.stream()).collect(ImmutableSet.toImmutableSet());
final DocumentIdsSelection result = DocumentIdsSelection.of(combinedIds);
if (this.equals(result))
{
return this;
}
else if (documentIdsSelection.equals(result))
{
return documentIdsSelection;
}
else
{
return result;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\datatypes\DocumentIdsSelection.java
| 1
|
请完成以下Java代码
|
public String getExceptionStacktrace() {
ByteArrayEntity byteArray = getExceptionByteArray();
return ExceptionUtil.getExceptionStacktrace(byteArray);
}
protected ByteArrayEntity getExceptionByteArray() {
if (exceptionByteArrayId != null) {
return Context
.getCommandContext()
.getDbEntityManager()
.selectById(ByteArrayEntity.class, exceptionByteArrayId);
}
return null;
}
public String getJobDefinitionId() {
return jobDefinitionId;
}
public void setJobDefinitionId(String jobDefinitionId) {
this.jobDefinitionId = jobDefinitionId;
}
public String getJobDefinitionType() {
return jobDefinitionType;
}
public void setJobDefinitionType(String jobDefinitionType) {
this.jobDefinitionType = jobDefinitionType;
}
public String getJobDefinitionConfiguration() {
return jobDefinitionConfiguration;
}
public void setJobDefinitionConfiguration(String jobDefinitionConfiguration) {
this.jobDefinitionConfiguration = jobDefinitionConfiguration;
}
public String getActivityId() {
return activityId;
}
public void setActivityId(String activityId) {
this.activityId = activityId;
}
public String getDeploymentId() {
return deploymentId;
}
public void setDeploymentId(String deploymentId) {
this.deploymentId = deploymentId;
}
public int getState() {
return state;
}
public void setState(int state) {
this.state = state;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public String getHostname() {
return hostname;
}
public void setHostname(String hostname) {
|
this.hostname = hostname;
}
public boolean isCreationLog() {
return state == JobState.CREATED.getStateCode();
}
public boolean isFailureLog() {
return state == JobState.FAILED.getStateCode();
}
public boolean isSuccessLog() {
return state == JobState.SUCCESSFUL.getStateCode();
}
public boolean isDeletionLog() {
return state == JobState.DELETED.getStateCode();
}
public String getRootProcessInstanceId() {
return rootProcessInstanceId;
}
public void setRootProcessInstanceId(String rootProcessInstanceId) {
this.rootProcessInstanceId = rootProcessInstanceId;
}
public String getFailedActivityId() {
return failedActivityId;
}
public void setFailedActivityId(String failedActivityId) {
this.failedActivityId = failedActivityId;
}
public String getBatchId() {
return batchId;
}
public void setBatchId(String batchId) {
this.batchId = batchId;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\history\event\HistoricJobLogEvent.java
| 1
|
请完成以下Java代码
|
public int getXmlColumnNumber() {
return xmlColumnNumber;
}
public void setXmlColumnNumber(int xmlColumnNumber) {
this.xmlColumnNumber = xmlColumnNumber;
}
public String getActivityId() {
return activityId;
}
public void setActivityId(String activityId) {
this.activityId = activityId;
}
public String getActivityName() {
return activityName;
}
public void setActivityName(String activityName) {
this.activityName = activityName;
}
public boolean isWarning() {
return isWarning;
}
public void setWarning(boolean isWarning) {
this.isWarning = isWarning;
}
@Override
public String toString() {
StringBuilder strb = new StringBuilder();
strb.append("[Validation set: '").append(validatorSetName).append("' | Problem: '").append(problem).append("'] : ");
strb.append(defaultDescription);
strb.append(" - [Extra info : ");
boolean extraInfoAlreadyPresent = false;
if (processDefinitionId != null) {
strb.append("processDefinitionId = ").append(processDefinitionId);
|
extraInfoAlreadyPresent = true;
}
if (processDefinitionName != null) {
if (extraInfoAlreadyPresent) {
strb.append(" | ");
}
strb.append("processDefinitionName = ").append(processDefinitionName).append(" | ");
extraInfoAlreadyPresent = true;
}
if (activityId != null) {
if (extraInfoAlreadyPresent) {
strb.append(" | ");
}
strb.append("id = ").append(activityId).append(" | ");
extraInfoAlreadyPresent = true;
}
if (activityName != null) {
if (extraInfoAlreadyPresent) {
strb.append(" | ");
}
strb.append("activityName = ").append(activityName).append(" | ");
extraInfoAlreadyPresent = true;
}
strb.append("]");
if (xmlLineNumber > 0 && xmlColumnNumber > 0) {
strb.append(" ( line: ").append(xmlLineNumber).append(", column: ").append(xmlColumnNumber).append(")");
}
return strb.toString();
}
}
|
repos\flowable-engine-main\modules\flowable-process-validation\src\main\java\org\flowable\validation\ValidationError.java
| 1
|
请完成以下Java代码
|
public void run() {
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(this.source, StandardCharsets.UTF_8))) {
String line = reader.readLine();
while (line != null) {
this.output.append(line);
this.output.append("\n");
if (this.outputConsumer != null) {
this.outputConsumer.accept(line);
}
line = reader.readLine();
}
this.latch.countDown();
}
catch (IOException ex) {
throw new UncheckedIOException("Failed to read process stream", ex);
}
}
|
@Override
public String toString() {
try {
this.latch.await();
return this.output.toString();
}
catch (InterruptedException ex) {
return "";
}
}
}
}
|
repos\spring-boot-4.0.1\core\spring-boot-docker-compose\src\main\java\org\springframework\boot\docker\compose\core\ProcessRunner.java
| 1
|
请完成以下Java代码
|
public class Book implements Serializable {
private String isbn;
private String name;
private String author;
private int pages;
public Book() {
}
public Book(String isbn, String name, String author, int pages) {
this.isbn = isbn;
this.name = name;
this.author = author;
this.pages = pages;
}
public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
|
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public int getPages() {
return pages;
}
public void setPages(int pages) {
this.pages = pages;
}
@Override
public String toString() {
return "Book{" +
"isbn='" + isbn + '\'' +
", name='" + name + '\'' +
", author='" + author + '\'' +
", pages=" + pages +
'}';
}
}
|
repos\tutorials-master\persistence-modules\jnosql\jnosql-diana\src\main\java\com\baeldung\jnosql\diana\key\Book.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class NextPageQuery
{
public static NextPageQuery anyEntityOrNull(@Nullable final String nextPageId)
{
if (isEmpty(nextPageId, true))
{
return null;
}
return new NextPageQuery(SinceEntity.ALL, nextPageId);
}
public static NextPageQuery onlyContactsOrNull(@Nullable final String nextPageId)
{
if (isEmpty(nextPageId, true))
{
return null;
}
|
return new NextPageQuery(SinceEntity.CONTACT_ONLY, nextPageId);
}
SinceEntity sinceEntity;
String nextPageId;
private NextPageQuery(
@NonNull final SinceEntity sinceEntity,
@NonNull final String nextPageId)
{
this.sinceEntity = sinceEntity;
this.nextPageId = assumeNotEmpty(nextPageId, "nextPageId");
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\bpartner\composite\repository\NextPageQuery.java
| 2
|
请完成以下Java代码
|
public class EventRegistryFactoryBean implements FactoryBean<EventRegistryEngine>, DisposableBean, ApplicationContextAware {
protected EventRegistryEngineConfiguration eventEngineConfiguration;
protected ApplicationContext applicationContext;
protected EventRegistryEngine eventRegistryEngine;
@Override
public void destroy() throws Exception {
if (eventRegistryEngine != null) {
eventRegistryEngine.close();
}
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
@Override
public EventRegistryEngine getObject() throws Exception {
configureExternallyManagedTransactions();
if (eventEngineConfiguration.getBeans() == null) {
eventEngineConfiguration.setBeans(new SpringBeanFactoryProxyMap(applicationContext));
}
this.eventRegistryEngine = eventEngineConfiguration.buildEventRegistryEngine();
return this.eventRegistryEngine;
}
protected void configureExternallyManagedTransactions() {
if (eventEngineConfiguration instanceof SpringEventRegistryEngineConfiguration) { // remark: any config can be injected, so we cannot have SpringConfiguration as member
SpringEventRegistryEngineConfiguration engineConfiguration = (SpringEventRegistryEngineConfiguration) eventEngineConfiguration;
if (engineConfiguration.getTransactionManager() != null) {
eventEngineConfiguration.setTransactionsExternallyManaged(true);
|
}
}
}
@Override
public Class<EventRegistryEngine> getObjectType() {
return EventRegistryEngine.class;
}
@Override
public boolean isSingleton() {
return true;
}
public EventRegistryEngineConfiguration getEventEngineConfiguration() {
return eventEngineConfiguration;
}
public void setEventEngineConfiguration(EventRegistryEngineConfiguration eventEngineConfiguration) {
this.eventEngineConfiguration = eventEngineConfiguration;
}
}
|
repos\flowable-engine-main\modules\flowable-event-registry-spring\src\main\java\org\flowable\eventregistry\spring\EventRegistryFactoryBean.java
| 1
|
请完成以下Java代码
|
public void doStart() {
List<ApplicationDeployedEvent> applicationDeployedEvents = getApplicationDeployedEvents();
if (!applicationDeployedEvents.isEmpty()) {
ApplicationDeployedEvent applicationDeployedEvent = applicationDeployedEvents.get(0);
for (ProcessRuntimeEventListener<ApplicationDeployedEvent> listener : listeners) {
listener.onEvent(applicationDeployedEvent);
}
eventPublisher.publishEvent(new ApplicationDeployedEvents(List.of(applicationDeployedEvent)));
}
}
private List<ApplicationDeployedEvent> getApplicationDeployedEvents() {
ApplicationEvents eventType = getEventType();
return deploymentConverter
.from(
repositoryService
.createDeploymentQuery()
.deploymentName(APPLICATION_DEPLOYMENT_NAME)
.latestVersion()
.list()
)
.stream()
.map(this::withProjectVersion1Based)
.map(deployment -> new ApplicationDeployedEventImpl(deployment, eventType))
.collect(Collectors.toList());
}
private Deployment withProjectVersion1Based(Deployment deployment) {
String projectReleaseVersion = deployment.getProjectReleaseVersion();
if (StringUtils.isNumeric(projectReleaseVersion)) {
//The project version in the database is 0 based while in the devops section is 1 based
|
DeploymentImpl result = new DeploymentImpl();
result.setVersion(deployment.getVersion());
result.setId(deployment.getId());
result.setName(deployment.getName());
int projectReleaseVersionInt = Integer.valueOf(projectReleaseVersion) + 1;
result.setProjectReleaseVersion(String.valueOf(projectReleaseVersionInt));
return result;
} else {
return deployment;
}
}
private ApplicationEvents getEventType() {
ApplicationEvents eventType;
if (afterRollback) {
LOGGER.info("This pod has been marked as created after a rollback.");
eventType = ApplicationEvents.APPLICATION_ROLLBACK;
} else {
eventType = ApplicationEvents.APPLICATION_DEPLOYED;
}
return eventType;
}
public void setAfterRollback(boolean afterRollback) {
this.afterRollback = afterRollback;
}
@Override
public void doStop() {
//nothing
}
}
|
repos\Activiti-develop\activiti-core\activiti-spring-boot-starter\src\main\java\org\activiti\spring\ApplicationDeployedEventProducer.java
| 1
|
请完成以下Java代码
|
public void enableUserOperationLog() {
userOperationLogEnabled = true;
}
public void disableUserOperationLog() {
userOperationLogEnabled = false;
}
public boolean isUserOperationLogEnabled() {
return userOperationLogEnabled;
}
public void setLogUserOperationEnabled(boolean userOperationLogEnabled) {
this.userOperationLogEnabled = userOperationLogEnabled;
}
public void enableTenantCheck() {
tenantCheckEnabled = true;
}
public void disableTenantCheck() {
tenantCheckEnabled = false;
}
public void setTenantCheckEnabled(boolean tenantCheckEnabled) {
this.tenantCheckEnabled = tenantCheckEnabled;
}
public boolean isTenantCheckEnabled() {
return tenantCheckEnabled;
}
public JobEntity getCurrentJob() {
return currentJob;
}
public void setCurrentJob(JobEntity currentJob) {
this.currentJob = currentJob;
}
public boolean isRestrictUserOperationLogToAuthenticatedUsers() {
return restrictUserOperationLogToAuthenticatedUsers;
}
public void setRestrictUserOperationLogToAuthenticatedUsers(boolean restrictUserOperationLogToAuthenticatedUsers) {
this.restrictUserOperationLogToAuthenticatedUsers = restrictUserOperationLogToAuthenticatedUsers;
|
}
public String getOperationId() {
if (!getOperationLogManager().isUserOperationLogEnabled()) {
return null;
}
if (operationId == null) {
operationId = Context.getProcessEngineConfiguration().getIdGenerator().getNextId();
}
return operationId;
}
public void setOperationId(String operationId) {
this.operationId = operationId;
}
public OptimizeManager getOptimizeManager() {
return getSession(OptimizeManager.class);
}
public <T> void executeWithOperationLogPrevented(Command<T> command) {
boolean initialLegacyRestrictions =
isRestrictUserOperationLogToAuthenticatedUsers();
disableUserOperationLog();
setRestrictUserOperationLogToAuthenticatedUsers(true);
try {
command.execute(this);
} finally {
enableUserOperationLog();
setRestrictUserOperationLogToAuthenticatedUsers(initialLegacyRestrictions);
}
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\interceptor\CommandContext.java
| 1
|
请完成以下Java代码
|
public class QueueRoutingInfo {
private final TenantId tenantId;
private final QueueId queueId;
private final String queueName;
private final String queueTopic;
private final int partitions;
private final boolean duplicateMsgToAllPartitions;
public QueueRoutingInfo(Queue queue) {
this.tenantId = queue.getTenantId();
this.queueId = queue.getId();
this.queueName = queue.getName();
this.queueTopic = queue.getTopic();
this.partitions = queue.getPartitions();
this.duplicateMsgToAllPartitions = queue.isDuplicateMsgToAllPartitions();
}
public QueueRoutingInfo(GetQueueRoutingInfoResponseMsg routingInfo) {
this.tenantId = TenantId.fromUUID(new UUID(routingInfo.getTenantIdMSB(), routingInfo.getTenantIdLSB()));
this.queueId = new QueueId(new UUID(routingInfo.getQueueIdMSB(), routingInfo.getQueueIdLSB()));
|
this.queueName = routingInfo.getQueueName();
this.queueTopic = routingInfo.getQueueTopic();
this.partitions = routingInfo.getPartitions();
this.duplicateMsgToAllPartitions = routingInfo.hasDuplicateMsgToAllPartitions() && routingInfo.getDuplicateMsgToAllPartitions();
}
public QueueRoutingInfo(QueueUpdateMsg queueUpdateMsg) {
this.tenantId = TenantId.fromUUID(new UUID(queueUpdateMsg.getTenantIdMSB(), queueUpdateMsg.getTenantIdLSB()));
this.queueId = new QueueId(new UUID(queueUpdateMsg.getQueueIdMSB(), queueUpdateMsg.getQueueIdLSB()));
this.queueName = queueUpdateMsg.getQueueName();
this.queueTopic = queueUpdateMsg.getQueueTopic();
this.partitions = queueUpdateMsg.getPartitions();
this.duplicateMsgToAllPartitions = queueUpdateMsg.hasDuplicateMsgToAllPartitions() && queueUpdateMsg.getDuplicateMsgToAllPartitions();
}
}
|
repos\thingsboard-master\common\queue\src\main\java\org\thingsboard\server\queue\discovery\QueueRoutingInfo.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Object visitPrimitiveAsInt(PrimitiveType type, String value) {
return parseNumber(value, Integer::parseInt, type);
}
@Override
public Object visitPrimitiveAsLong(PrimitiveType type, String value) {
return parseNumber(value, Long::parseLong, type);
}
@Override
public Object visitPrimitiveAsChar(PrimitiveType type, String value) {
if (value.length() > 1) {
throw new IllegalArgumentException(String.format("Invalid character representation '%s'", value));
}
return value;
|
}
@Override
public Object visitPrimitiveAsFloat(PrimitiveType type, String value) {
return parseNumber(value, Float::parseFloat, type);
}
@Override
public Object visitPrimitiveAsDouble(PrimitiveType type, String value) {
return parseNumber(value, Double::parseDouble, type);
}
}
}
|
repos\spring-boot-4.0.1\configuration-metadata\spring-boot-configuration-processor\src\main\java\org\springframework\boot\configurationprocessor\ParameterPropertyDescriptor.java
| 2
|
请完成以下Java代码
|
public void setProjectLineLevel (final java.lang.String ProjectLineLevel)
{
set_Value (COLUMNNAME_ProjectLineLevel, ProjectLineLevel);
}
@Override
public java.lang.String getProjectLineLevel()
{
return get_ValueAsString(COLUMNNAME_ProjectLineLevel);
}
/**
* ProjInvoiceRule AD_Reference_ID=383
* Reference name: C_Project InvoiceRule
*/
public static final int PROJINVOICERULE_AD_Reference_ID=383;
/** None = - */
public static final String PROJINVOICERULE_None = "-";
/** Committed Amount = C */
public static final String PROJINVOICERULE_CommittedAmount = "C";
/** Time&Material max Comitted = c */
public static final String PROJINVOICERULE_TimeMaterialMaxComitted = "c";
/** Time&Material = T */
public static final String PROJINVOICERULE_TimeMaterial = "T";
/** Product Quantity = P */
public static final String PROJINVOICERULE_ProductQuantity = "P";
@Override
public void setProjInvoiceRule (final java.lang.String ProjInvoiceRule)
{
set_Value (COLUMNNAME_ProjInvoiceRule, ProjInvoiceRule);
}
@Override
public java.lang.String getProjInvoiceRule()
{
return get_ValueAsString(COLUMNNAME_ProjInvoiceRule);
}
@Override
public org.compiere.model.I_R_Status getR_Project_Status()
{
return get_ValueAsPO(COLUMNNAME_R_Project_Status_ID, org.compiere.model.I_R_Status.class);
}
@Override
public void setR_Project_Status(final org.compiere.model.I_R_Status R_Project_Status)
{
set_ValueFromPO(COLUMNNAME_R_Project_Status_ID, org.compiere.model.I_R_Status.class, R_Project_Status);
}
@Override
public void setR_Project_Status_ID (final int R_Project_Status_ID)
{
if (R_Project_Status_ID < 1)
set_Value (COLUMNNAME_R_Project_Status_ID, null);
else
set_Value (COLUMNNAME_R_Project_Status_ID, R_Project_Status_ID);
}
@Override
public int getR_Project_Status_ID()
{
return get_ValueAsInt(COLUMNNAME_R_Project_Status_ID);
|
}
@Override
public void setSalesRep_ID (final int SalesRep_ID)
{
if (SalesRep_ID < 1)
set_Value (COLUMNNAME_SalesRep_ID, null);
else
set_Value (COLUMNNAME_SalesRep_ID, SalesRep_ID);
}
@Override
public int getSalesRep_ID()
{
return get_ValueAsInt(COLUMNNAME_SalesRep_ID);
}
@Override
public void setstartdatetime (final @Nullable java.sql.Timestamp startdatetime)
{
set_Value (COLUMNNAME_startdatetime, startdatetime);
}
@Override
public java.sql.Timestamp getstartdatetime()
{
return get_ValueAsTimestamp(COLUMNNAME_startdatetime);
}
@Override
public void setValue (final java.lang.String Value)
{
set_ValueNoCheck (COLUMNNAME_Value, Value);
}
@Override
public java.lang.String getValue()
{
return get_ValueAsString(COLUMNNAME_Value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Project.java
| 1
|
请完成以下Java代码
|
public class VincentyDistance {
// Constants for WGS84 ellipsoid model of Earth
private static final double SEMI_MAJOR_AXIS_MT = 6378137;
private static final double SEMI_MINOR_AXIS_MT = 6356752.314245;
private static final double FLATTENING = 1 / 298.257223563;
private static final double ERROR_TOLERANCE = 1e-12;
public static double calculateDistance(double latitude1, double longitude1, double latitude2, double longitude2) {
double U1 = Math.atan((1 - FLATTENING) * Math.tan(Math.toRadians(latitude1)));
double U2 = Math.atan((1 - FLATTENING) * Math.tan(Math.toRadians(latitude2)));
double sinU1 = Math.sin(U1);
double cosU1 = Math.cos(U1);
double sinU2 = Math.sin(U2);
double cosU2 = Math.cos(U2);
double longitudeDifference = Math.toRadians(longitude2 - longitude1);
double previousLongitudeDifference;
double sinSigma, cosSigma, sigma, sinAlpha, cosSqAlpha, cos2SigmaM;
do {
sinSigma = Math.sqrt(Math.pow(cosU2 * Math.sin(longitudeDifference), 2) +
Math.pow(cosU1 * sinU2 - sinU1 * cosU2 * Math.cos(longitudeDifference), 2));
|
cosSigma = sinU1 * sinU2 + cosU1 * cosU2 * Math.cos(longitudeDifference);
sigma = Math.atan2(sinSigma, cosSigma);
sinAlpha = cosU1 * cosU2 * Math.sin(longitudeDifference) / sinSigma;
cosSqAlpha = 1 - Math.pow(sinAlpha, 2);
cos2SigmaM = cosSigma - 2 * sinU1 * sinU2 / cosSqAlpha;
if (Double.isNaN(cos2SigmaM)) {
cos2SigmaM = 0;
}
previousLongitudeDifference = longitudeDifference;
double C = FLATTENING / 16 * cosSqAlpha * (4 + FLATTENING * (4 - 3 * cosSqAlpha));
longitudeDifference = Math.toRadians(longitude2 - longitude1) + (1 - C) * FLATTENING * sinAlpha *
(sigma + C * sinSigma * (cos2SigmaM + C * cosSigma * (-1 + 2 * Math.pow(cos2SigmaM, 2))));
} while (Math.abs(longitudeDifference - previousLongitudeDifference) > ERROR_TOLERANCE);
double uSq = cosSqAlpha * (Math.pow(SEMI_MAJOR_AXIS_MT, 2) - Math.pow(SEMI_MINOR_AXIS_MT, 2)) / Math.pow(SEMI_MINOR_AXIS_MT, 2);
double A = 1 + uSq / 16384 * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq)));
double B = uSq / 1024 * (256 + uSq * (-128 + uSq * (74 - 47 * uSq)));
double deltaSigma = B * sinSigma * (cos2SigmaM + B / 4 * (cosSigma * (-1 + 2 * Math.pow(cos2SigmaM, 2)) -
B / 6 * cos2SigmaM * (-3 + 4 * Math.pow(sinSigma, 2)) * (-3 + 4 * Math.pow(cos2SigmaM, 2))));
double distanceMt = SEMI_MINOR_AXIS_MT * A * (sigma - deltaSigma);
return distanceMt / 1000;
}
}
|
repos\tutorials-master\algorithms-modules\algorithms-miscellaneous-1\src\main\java\com\baeldung\algorithms\latlondistance\VincentyDistance.java
| 1
|
请完成以下Java代码
|
public void setM_Product_ID (int M_Product_ID)
{
if (M_Product_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Product_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID));
}
/** Get Product.
@return Product, Service, Item
*/
public int getM_Product_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set On Hand Quantity.
@param QtyOnHand
On Hand Quantity
*/
public void setQtyOnHand (BigDecimal QtyOnHand)
{
set_ValueNoCheck (COLUMNNAME_QtyOnHand, QtyOnHand);
}
/** Get On Hand Quantity.
@return On Hand Quantity
*/
public BigDecimal getQtyOnHand ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyOnHand);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Ordered Quantity.
@param QtyOrdered
Ordered Quantity
|
*/
public void setQtyOrdered (BigDecimal QtyOrdered)
{
set_ValueNoCheck (COLUMNNAME_QtyOrdered, QtyOrdered);
}
/** Get Ordered Quantity.
@return Ordered Quantity
*/
public BigDecimal getQtyOrdered ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyOrdered);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Reserved Quantity.
@param QtyReserved
Reserved Quantity
*/
public void setQtyReserved (BigDecimal QtyReserved)
{
set_ValueNoCheck (COLUMNNAME_QtyReserved, QtyReserved);
}
/** Get Reserved Quantity.
@return Reserved Quantity
*/
public BigDecimal getQtyReserved ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyReserved);
if (bd == null)
return Env.ZERO;
return bd;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Storage.java
| 1
|
请完成以下Java代码
|
public final class CompositeHUAssignmentListener implements IHUAssignmentListener
{
private final CopyOnWriteArrayList<IHUAssignmentListener> listeners = new CopyOnWriteArrayList<IHUAssignmentListener>();
public final void addHUAssignmentListener(final IHUAssignmentListener listener)
{
Check.assumeNotNull(listener, "listener not null");
listeners.addIfAbsent(listener);
}
/**
* Invokes {@link #assertAssignable(I_M_HU, Object, String)} on all included listeners.
*/
@Override
public void assertAssignable(final I_M_HU hu, final Object model, final String trxName) throws HUNotAssignableException
{
for (final IHUAssignmentListener listener : listeners)
{
listener.assertAssignable(hu, model, trxName);
}
}
@Override
public final void onHUAssigned(final I_M_HU hu, final Object model, final String trxName)
{
|
for (final IHUAssignmentListener listener : listeners)
{
listener.onHUAssigned(hu, model, trxName);
}
}
@Override
public final void onHUUnassigned(final IReference<I_M_HU> huRef, final IReference<Object> modelRef, final String trxName)
{
for (final IHUAssignmentListener listener : listeners)
{
listener.onHUUnassigned(huRef, modelRef, trxName);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\impl\CompositeHUAssignmentListener.java
| 1
|
请完成以下Java代码
|
public static DistributionFacetId ofSalesOrderId(@NonNull OrderId salesOrderId)
{
return ofRepoId(DistributionFacetGroupType.SALES_ORDER, salesOrderId);
}
public static DistributionFacetId ofManufacturingOrderId(@NonNull PPOrderId manufacturingOrderId)
{
return ofRepoId(DistributionFacetGroupType.MANUFACTURING_ORDER_NO, manufacturingOrderId);
}
public static DistributionFacetId ofDatePromised(@NonNull LocalDate datePromised)
{
return ofLocalDate(DistributionFacetGroupType.DATE_PROMISED, datePromised);
}
public static DistributionFacetId ofProductId(@NonNull ProductId productId)
{
return ofRepoId(DistributionFacetGroupType.PRODUCT, productId);
}
private static DistributionFacetId ofRepoId(@NonNull DistributionFacetGroupType groupType, @NonNull RepoIdAware id)
{
final WorkflowLaunchersFacetId workflowLaunchersFacetId = WorkflowLaunchersFacetId.ofId(groupType.toWorkflowLaunchersFacetGroupId(), id);
return ofWorkflowLaunchersFacetId(workflowLaunchersFacetId);
}
@SuppressWarnings("SameParameterValue")
private static DistributionFacetId ofLocalDate(@NonNull DistributionFacetGroupType groupType, @NonNull LocalDate localDate)
{
final WorkflowLaunchersFacetId workflowLaunchersFacetId = WorkflowLaunchersFacetId.ofLocalDate(groupType.toWorkflowLaunchersFacetGroupId(), localDate);
return ofWorkflowLaunchersFacetId(workflowLaunchersFacetId);
}
|
public static DistributionFacetId ofQuantity(@NonNull Quantity qty)
{
return ofWorkflowLaunchersFacetId(
WorkflowLaunchersFacetId.ofQuantity(
DistributionFacetGroupType.QUANTITY.toWorkflowLaunchersFacetGroupId(),
qty.toBigDecimal(),
qty.getUomId()
)
);
}
public static DistributionFacetId ofPlantId(@NonNull final ResourceId plantId)
{
return ofRepoId(DistributionFacetGroupType.PLANT_RESOURCE_ID, plantId);
}
private static Quantity getAsQuantity(final @NonNull WorkflowLaunchersFacetId workflowLaunchersFacetId)
{
final ImmutablePair<BigDecimal, Integer> parts = workflowLaunchersFacetId.getAsQuantity();
return Quantitys.of(parts.getLeft(), UomId.ofRepoId(parts.getRight()));
}
public WorkflowLaunchersFacetId toWorkflowLaunchersFacetId() {return workflowLaunchersFacetId;}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.distribution.rest-api\src\main\java\de\metas\distribution\mobileui\launchers\facets\DistributionFacetId.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class UserService {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Resource
private UserMapper userMapper;
/**
* cacheNames 设置缓存的值
* key:指定缓存的key,这是指参数id值。key可以使用spEl表达式
*
* @param id
* @return
*/
@Cacheable(value = "userCache", key = "#id", unless="#result == null")
public User getById(int id) {
logger.info("获取用户start...");
return userMapper.selectById(id);
}
@Cacheable(value = "allUsersCache", unless = "#result.size() == 0")
public List<User> getAllUsers() {
logger.info("获取所有用户列表");
return userMapper.selectList(null);
}
/**
* 创建用户,同时使用新的返回值的替换缓存中的值
* 创建用户后会将allUsersCache缓存全部清空
*/
@Caching(
put = {@CachePut(value = "userCache", key = "#user.id")},
evict = {@CacheEvict(value = "allUsersCache", allEntries = true)}
)
public User createUser(User user) {
logger.info("创建用户start..., user.id=" + user.getId());
userMapper.insert(user);
return user;
}
|
/**
* 更新用户,同时使用新的返回值的替换缓存中的值
* 更新用户后会将allUsersCache缓存全部清空
*/
@Caching(
put = {@CachePut(value = "userCache", key = "#user.id")},
evict = {@CacheEvict(value = "allUsersCache", allEntries = true)}
)
public User updateUser(User user) {
logger.info("更新用户start...");
userMapper.updateById(user);
return user;
}
/**
* 对符合key条件的记录从缓存中移除
* 删除用户后会将allUsersCache缓存全部清空
*/
@Caching(
evict = {
@CacheEvict(value = "userCache", key = "#id"),
@CacheEvict(value = "allUsersCache", allEntries = true)
}
)
public void deleteById(int id) {
logger.info("删除用户start...");
userMapper.deleteById(id);
}
}
|
repos\SpringBootBucket-master\springboot-cache\src\main\java\com\xncoding\trans\service\UserService.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public Duration getReceiveTimeout() {
return this.receiveTimeout;
}
public void setReceiveTimeout(Duration receiveTimeout) {
this.receiveTimeout = receiveTimeout;
}
public @Nullable Duration getFixedDelay() {
return this.fixedDelay;
}
public void setFixedDelay(@Nullable Duration fixedDelay) {
this.fixedDelay = fixedDelay;
}
public @Nullable Duration getFixedRate() {
return this.fixedRate;
}
public void setFixedRate(@Nullable Duration fixedRate) {
this.fixedRate = fixedRate;
}
public @Nullable Duration getInitialDelay() {
return this.initialDelay;
}
public void setInitialDelay(@Nullable Duration initialDelay) {
this.initialDelay = initialDelay;
}
public @Nullable String getCron() {
return this.cron;
}
public void setCron(@Nullable String cron) {
this.cron = cron;
}
}
|
public static class Management {
/**
* Whether Spring Integration components should perform logging in the main
* message flow. When disabled, such logging will be skipped without checking the
* logging level. When enabled, such logging is controlled as normal by the
* logging system's log level configuration.
*/
private boolean defaultLoggingEnabled = true;
/**
* List of simple patterns to match against the names of Spring Integration
* components. When matched, observation instrumentation will be performed for the
* component. Please refer to the javadoc of the smartMatch method of Spring
* Integration's PatternMatchUtils for details of the pattern syntax.
*/
private List<String> observationPatterns = new ArrayList<>();
public boolean isDefaultLoggingEnabled() {
return this.defaultLoggingEnabled;
}
public void setDefaultLoggingEnabled(boolean defaultLoggingEnabled) {
this.defaultLoggingEnabled = defaultLoggingEnabled;
}
public List<String> getObservationPatterns() {
return this.observationPatterns;
}
public void setObservationPatterns(List<String> observationPatterns) {
this.observationPatterns = observationPatterns;
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-integration\src\main\java\org\springframework\boot\integration\autoconfigure\IntegrationProperties.java
| 2
|
请完成以下Java代码
|
public String getElementName() {
return ELEMENT_MULTIINSTANCE;
}
public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception {
if (!(parentElement instanceof Activity)) {
return;
}
MultiInstanceLoopCharacteristics multiInstanceDef = new MultiInstanceLoopCharacteristics();
BpmnXMLUtil.addXMLLocation(multiInstanceDef, xtr);
parseMultiInstanceProperties(xtr, multiInstanceDef);
((Activity) parentElement).setLoopCharacteristics(multiInstanceDef);
}
private void parseMultiInstanceProperties(XMLStreamReader xtr, MultiInstanceLoopCharacteristics multiInstanceDef) {
boolean readyWithMultiInstance = false;
try {
do {
ElementParser<MultiInstanceLoopCharacteristics> matchingParser = multiInstanceElementParsers
.stream()
.filter(elementParser -> elementParser.canParseCurrentElement(xtr))
.findFirst()
|
.orElse(null);
if (matchingParser != null) {
matchingParser.setInformation(xtr, multiInstanceDef);
}
if (xtr.isEndElement() && getElementName().equalsIgnoreCase(xtr.getLocalName())) {
readyWithMultiInstance = true;
}
if (xtr.hasNext()) {
xtr.next();
}
} while (!readyWithMultiInstance && xtr.hasNext());
} catch (Exception e) {
LOGGER.warn("Error parsing multi instance definition", e);
}
}
}
|
repos\Activiti-develop\activiti-core\activiti-bpmn-converter\src\main\java\org\activiti\bpmn\converter\child\multi\instance\MultiInstanceParser.java
| 1
|
请完成以下Java代码
|
public void setObligation(Boolean value) {
this.obligation = value;
}
/**
* Gets the value of the sectionCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSectionCode() {
return sectionCode;
}
/**
* Sets the value of the sectionCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSectionCode(String value) {
this.sectionCode = value;
}
/**
* Gets the value of the remark property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRemark() {
return remark;
}
/**
* Sets the value of the remark property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRemark(String value) {
this.remark = value;
}
/**
* Gets the value of the serviceAttributes property.
*
|
* @return
* possible object is
* {@link Long }
*
*/
public long getServiceAttributes() {
if (serviceAttributes == null) {
return 0L;
} else {
return serviceAttributes;
}
}
/**
* Sets the value of the serviceAttributes property.
*
* @param value
* allowed object is
* {@link Long }
*
*/
public void setServiceAttributes(Long value) {
this.serviceAttributes = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_request\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\request\RecordServiceType.java
| 1
|
请完成以下Java代码
|
public static BufferedImage generateUPCABarcodeImage(String barcodeText) throws Exception {
UPCAWriter barcodeWriter = new UPCAWriter();
BitMatrix bitMatrix = barcodeWriter.encode(barcodeText, BarcodeFormat.UPC_A, 300, 150);
return MatrixToImageWriter.toBufferedImage(bitMatrix);
}
public static BufferedImage generateEAN13BarcodeImage(String barcodeText) throws Exception {
EAN13Writer barcodeWriter = new EAN13Writer();
BitMatrix bitMatrix = barcodeWriter.encode(barcodeText, BarcodeFormat.EAN_13, 300, 150);
return MatrixToImageWriter.toBufferedImage(bitMatrix);
}
public static BufferedImage generateCode128BarcodeImage(String barcodeText) throws Exception {
Code128Writer barcodeWriter = new Code128Writer();
BitMatrix bitMatrix = barcodeWriter.encode(barcodeText, BarcodeFormat.CODE_128, 300, 150);
return MatrixToImageWriter.toBufferedImage(bitMatrix);
|
}
public static BufferedImage generatePDF417BarcodeImage(String barcodeText) throws Exception {
PDF417Writer barcodeWriter = new PDF417Writer();
BitMatrix bitMatrix = barcodeWriter.encode(barcodeText, BarcodeFormat.PDF_417, 700, 700);
return MatrixToImageWriter.toBufferedImage(bitMatrix);
}
public static BufferedImage generateQRCodeImage(String barcodeText) throws Exception {
QRCodeWriter barcodeWriter = new QRCodeWriter();
BitMatrix bitMatrix = barcodeWriter.encode(barcodeText, BarcodeFormat.QR_CODE, 200, 200);
return MatrixToImageWriter.toBufferedImage(bitMatrix);
}
}
|
repos\tutorials-master\spring-boot-modules\spring-boot-libraries\src\main\java\com\baeldung\barcodes\generators\ZxingBarcodeGenerator.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public boolean isEnabled() {
return (this.enabled != null) ? this.enabled : this.bundle != null;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public @Nullable String getBundle() {
return this.bundle;
}
public void setBundle(@Nullable String bundle) {
this.bundle = bundle;
}
}
/**
* Jedis client properties.
*/
public static class Jedis {
/**
* Jedis pool configuration.
*/
private final Pool pool = new Pool();
public Pool getPool() {
return this.pool;
}
}
/**
* Lettuce client properties.
*/
public static class Lettuce {
/**
* Shutdown timeout.
*/
private Duration shutdownTimeout = Duration.ofMillis(100);
/**
* Defines from which Redis nodes data is read.
*/
private @Nullable String readFrom;
/**
* Lettuce pool configuration.
*/
private final Pool pool = new Pool();
private final Cluster cluster = new Cluster();
public Duration getShutdownTimeout() {
return this.shutdownTimeout;
}
public void setShutdownTimeout(Duration shutdownTimeout) {
this.shutdownTimeout = shutdownTimeout;
}
public @Nullable String getReadFrom() {
return this.readFrom;
}
public void setReadFrom(@Nullable String readFrom) {
this.readFrom = readFrom;
}
public Pool getPool() {
return this.pool;
}
public Cluster getCluster() {
return this.cluster;
}
|
public static class Cluster {
private final Refresh refresh = new Refresh();
public Refresh getRefresh() {
return this.refresh;
}
public static class Refresh {
/**
* Whether to discover and query all cluster nodes for obtaining the
* cluster topology. When set to false, only the initial seed nodes are
* used as sources for topology discovery.
*/
private boolean dynamicRefreshSources = true;
/**
* Cluster topology refresh period.
*/
private @Nullable Duration period;
/**
* Whether adaptive topology refreshing using all available refresh
* triggers should be used.
*/
private boolean adaptive;
public boolean isDynamicRefreshSources() {
return this.dynamicRefreshSources;
}
public void setDynamicRefreshSources(boolean dynamicRefreshSources) {
this.dynamicRefreshSources = dynamicRefreshSources;
}
public @Nullable Duration getPeriod() {
return this.period;
}
public void setPeriod(@Nullable Duration period) {
this.period = period;
}
public boolean isAdaptive() {
return this.adaptive;
}
public void setAdaptive(boolean adaptive) {
this.adaptive = adaptive;
}
}
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-data-redis\src\main\java\org\springframework\boot\data\redis\autoconfigure\DataRedisProperties.java
| 2
|
请完成以下Java代码
|
public class MyCustomRule implements EnforcerRule {
public void execute(EnforcerRuleHelper enforcerRuleHelper) throws EnforcerRuleException {
try {
String groupId = (String) enforcerRuleHelper.evaluate("${project.groupId}");
if (groupId == null || !groupId.startsWith("com.baeldung")) {
throw new EnforcerRuleException("Project group id does not start with com.baeldung");
}
}
catch (ExpressionEvaluationException ex ) {
throw new EnforcerRuleException( "Unable to lookup an expression " + ex.getLocalizedMessage(), ex );
|
}
}
public boolean isCacheable() {
return false;
}
public boolean isResultValid(EnforcerRule enforcerRule) {
return false;
}
public String getCacheId() {
return null;
}
}
|
repos\tutorials-master\maven-modules\maven-plugins\custom-rule\src\main\java\com\baeldung\enforcer\MyCustomRule.java
| 1
|
请完成以下Java代码
|
public class CompleteAdhocSubProcessCmd implements Command<Void>, Serializable {
private static final long serialVersionUID = 1L;
protected String executionId;
public CompleteAdhocSubProcessCmd(String executionId) {
this.executionId = executionId;
}
public Void execute(CommandContext commandContext) {
ExecutionEntityManager executionEntityManager = commandContext.getExecutionEntityManager();
ExecutionEntity execution = executionEntityManager.findById(executionId);
if (execution == null) {
throw new ActivitiObjectNotFoundException(
"No execution found for id '" + executionId + "'",
ExecutionEntity.class
);
}
if (!(execution.getCurrentFlowElement() instanceof AdhocSubProcess)) {
|
throw new ActivitiException(
"The current flow element of the requested execution is not an ad-hoc sub process"
);
}
List<? extends ExecutionEntity> childExecutions = execution.getExecutions();
if (childExecutions.size() > 0) {
throw new ActivitiException(
"Ad-hoc sub process has running child executions that need to be completed first"
);
}
ExecutionEntity outgoingFlowExecution = executionEntityManager.createChildExecution(execution.getParent());
outgoingFlowExecution.setCurrentFlowElement(execution.getCurrentFlowElement());
executionEntityManager.deleteExecutionAndRelatedData(execution, null);
Context.getAgenda().planTakeOutgoingSequenceFlowsOperation(outgoingFlowExecution, true);
return null;
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\cmd\CompleteAdhocSubProcessCmd.java
| 1
|
请完成以下Java代码
|
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.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;
User other = (User) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
}
|
repos\tutorials-master\web-modules\jakarta-servlets-2\src\main\java\com\baeldung\user\check\User.java
| 1
|
请完成以下Java代码
|
public class DeleteHistoricProcessInstanceCmd implements Command<Object>, Serializable {
private static final long serialVersionUID = 1L;
protected String processInstanceId;
public DeleteHistoricProcessInstanceCmd(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
@Override
public Object execute(CommandContext commandContext) {
if (processInstanceId == null) {
throw new FlowableIllegalArgumentException("processInstanceId is null");
}
// Check if process instance is still running
HistoricProcessInstanceEntity instance = CommandContextUtil.getHistoricProcessInstanceEntityManager(commandContext).findById(processInstanceId);
if (instance == null) {
throw new FlowableObjectNotFoundException("No historic process instance found with id: " + processInstanceId, HistoricProcessInstance.class);
}
if (instance.isDeleted()) {
return null;
}
if (instance.getEndTime() == null) {
|
throw new FlowableException("Process instance is still running, cannot delete " + instance);
}
if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, instance.getProcessDefinitionId())) {
Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();
compatibilityHandler.deleteHistoricProcessInstance(processInstanceId);
return null;
}
CommandContextUtil.getHistoryManager(commandContext).recordProcessInstanceDeleted(processInstanceId, instance.getProcessDefinitionId(), instance.getTenantId());
return null;
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\cmd\DeleteHistoricProcessInstanceCmd.java
| 1
|
请完成以下Java代码
|
public static IdmIdentityService getIdmIdentityService() {
IdmIdentityService identityService = null;
IdmEngineConfigurationApi idmEngineConfiguration = getIdmEngineConfiguration();
if (idmEngineConfiguration != null) {
identityService = idmEngineConfiguration.getIdmIdentityService();
}
return identityService;
}
public static IdentityLinkServiceConfiguration getIdentityLinkServiceConfiguration() {
return getIdentityLinkServiceConfiguration(getCommandContext());
}
public static IdentityLinkServiceConfiguration getIdentityLinkServiceConfiguration(CommandContext commandContext) {
return getAppEngineConfiguration(commandContext).getIdentityLinkServiceConfiguration();
}
public static IdentityLinkService getIdentityLinkService() {
return getIdentityLinkService(getCommandContext());
}
public static IdentityLinkService getIdentityLinkService(CommandContext commandContext) {
return getIdentityLinkServiceConfiguration(commandContext).getIdentityLinkService();
}
public static VariableServiceConfiguration getVariableServiceConfiguration() {
return getVariableServiceConfiguration(getCommandContext());
}
public static VariableServiceConfiguration getVariableServiceConfiguration(CommandContext commandContext) {
return getAppEngineConfiguration(commandContext).getVariableServiceConfiguration();
}
public static DbSqlSession getDbSqlSession() {
return getDbSqlSession(getCommandContext());
}
|
public static DbSqlSession getDbSqlSession(CommandContext commandContext) {
return commandContext.getSession(DbSqlSession.class);
}
public static EntityCache getEntityCache() {
return getEntityCache(getCommandContext());
}
public static EntityCache getEntityCache(CommandContext commandContext) {
return commandContext.getSession(EntityCache.class);
}
public static CommandContext getCommandContext() {
return Context.getCommandContext();
}
}
|
repos\flowable-engine-main\modules\flowable-app-engine\src\main\java\org\flowable\app\engine\impl\util\CommandContextUtil.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
RSocketServerCustomizer frameDecoderRSocketServerCustomizer(RSocketMessageHandler rSocketMessageHandler) {
return (server) -> {
if (rSocketMessageHandler.getRSocketStrategies()
.dataBufferFactory() instanceof NettyDataBufferFactory) {
server.payloadDecoder(PayloadDecoder.ZERO_COPY);
}
};
}
}
static class OnRSocketWebServerCondition extends AllNestedConditions {
OnRSocketWebServerCondition() {
super(ConfigurationPhase.PARSE_CONFIGURATION);
}
@ConditionalOnWebApplication(type = Type.REACTIVE)
static class IsReactiveWebApplication {
|
}
@ConditionalOnProperty(name = "spring.rsocket.server.port", matchIfMissing = true)
static class HasNoPortConfigured {
}
@ConditionalOnProperty("spring.rsocket.server.mapping-path")
static class HasMappingPathConfigured {
}
@ConditionalOnProperty(name = "spring.rsocket.server.transport", havingValue = "websocket")
static class HasWebsocketTransportConfigured {
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-rsocket\src\main\java\org\springframework\boot\rsocket\autoconfigure\RSocketServerAutoConfiguration.java
| 2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.