instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请完成以下Java代码
|
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Override
public void run(ApplicationArguments args) throws Exception {
DataSource dataSourceMysql = applicationContext.getBean(DataSource.class);
//模板引擎配置 生成文件配置
EngineConfig engineConfig = EngineConfig.builder()
// 生成文件路径
.fileOutputDir("D://tmp/")
// 打开目录
.openOutputDir(false)
// 文件类型
.fileType(EngineFileType.WORD)
// 生成模板实现
.produceType(EngineTemplateType.freemarker).build();
// 生成文档配置(包含以下自定义版本号、描述等配置连接),文档名称拼接:数据库名_描述_版本.扩展名
Configuration config = Configuration.builder()
.title("数据库文档")
// 版本号
.version("1.0.0")
// 描述
.description("数据库设计文档")
// 数据源
.dataSource(dataSourceMysql)
// 模板引擎配置
.engineConfig(engineConfig)
// 加载配置:想要生成的表、想要忽略的表
.produceConfig(getProcessConfig())
.build();
// 执行生成
new DocumentationExecute(config).execute();
}
|
/**
* 配置想要生成的表+ 配置想要忽略的表
*
* @return 生成表配置
*/
public static ProcessConfig getProcessConfig() {
// 忽略表名
List<String> ignoreTableName = Arrays.asList("");
return ProcessConfig.builder()
//根据名称指定表生成
.designatedTableName(new ArrayList<>())
//根据表前缀生成
.designatedTablePrefix(new ArrayList<>())
//根据表后缀生成
.designatedTableSuffix(new ArrayList<>())
//忽略表名
.ignoreTableName(ignoreTableName)
.build();
}
}
|
repos\springboot-demo-master\Screw\src\main\java\com\et\screw\Application.java
| 1
|
请完成以下Java代码
|
public int getM_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
@Override
public void setM_Product_Ingredients_ID (final int M_Product_Ingredients_ID)
{
if (M_Product_Ingredients_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Product_Ingredients_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Product_Ingredients_ID, M_Product_Ingredients_ID);
}
@Override
public int getM_Product_Ingredients_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_Ingredients_ID);
}
@Override
public void setNRV (final int NRV)
{
set_Value (COLUMNNAME_NRV, NRV);
}
@Override
public int getNRV()
{
return get_ValueAsInt(COLUMNNAME_NRV);
}
@Override
public org.compiere.model.I_M_Ingredients getParentElement()
{
return get_ValueAsPO(COLUMNNAME_ParentElement_ID, org.compiere.model.I_M_Ingredients.class);
}
@Override
public void setParentElement(final org.compiere.model.I_M_Ingredients ParentElement)
{
set_ValueFromPO(COLUMNNAME_ParentElement_ID, org.compiere.model.I_M_Ingredients.class, ParentElement);
}
@Override
public void setParentElement_ID (final int ParentElement_ID)
{
if (ParentElement_ID < 1)
set_Value (COLUMNNAME_ParentElement_ID, null);
|
else
set_Value (COLUMNNAME_ParentElement_ID, ParentElement_ID);
}
@Override
public int getParentElement_ID()
{
return get_ValueAsInt(COLUMNNAME_ParentElement_ID);
}
@Override
public void setPrecision (final int Precision)
{
set_Value (COLUMNNAME_Precision, Precision);
}
@Override
public int getPrecision()
{
return get_ValueAsInt(COLUMNNAME_Precision);
}
@Override
public void setQty (final @Nullable java.lang.String Qty)
{
set_Value (COLUMNNAME_Qty, Qty);
}
@Override
public java.lang.String getQty()
{
return get_ValueAsString(COLUMNNAME_Qty);
}
@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_M_Product_Ingredients.java
| 1
|
请完成以下Java代码
|
public final class IdConstants
{
public static final int UNSPECIFIED_REPO_ID = Integer.MAX_VALUE - 10;
public static final int NULL_REPO_ID = Integer.MAX_VALUE - 20;
private IdConstants()
{
}
public static int toRepoId(final int id)
{
if (id == UNSPECIFIED_REPO_ID)
{
return 0;
}
else if (id == NULL_REPO_ID)
{
return 0;
}
return id;
|
}
public static int toUnspecifiedIfZero(final int repoId)
{
if (repoId <= 0)
{
return UNSPECIFIED_REPO_ID;
}
return repoId;
}
public static void assertValidId(final int id, @NonNull final String name)
{
if (!(id > 0 || id == UNSPECIFIED_REPO_ID || id == NULL_REPO_ID))
{
throw new RuntimeException(name + "=" + id + " needs to be >0 or ==IdConstants.UNSPECIFIED_REPO_ID or ==IdConstants.NULL_REPO_ID");
}
}
}
|
repos\metasfresh-new_dawn_uat\misc\de-metas-common\de-metas-common-util\src\main\java\de\metas\common\util\IdConstants.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public org.compiere.model.I_C_POS getC_POS()
{
return get_ValueAsPO(COLUMNNAME_C_POS_ID, org.compiere.model.I_C_POS.class);
}
@Override
public void setC_POS(final org.compiere.model.I_C_POS C_POS)
{
set_ValueFromPO(COLUMNNAME_C_POS_ID, org.compiere.model.I_C_POS.class, C_POS);
}
@Override
public void setC_POS_ID (final int C_POS_ID)
{
if (C_POS_ID < 1)
set_Value (COLUMNNAME_C_POS_ID, null);
else
set_Value (COLUMNNAME_C_POS_ID, C_POS_ID);
}
@Override
public int getC_POS_ID()
{
return get_ValueAsInt(COLUMNNAME_C_POS_ID);
}
@Override
public void setC_POS_Journal_ID (final int C_POS_Journal_ID)
{
if (C_POS_Journal_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_POS_Journal_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_POS_Journal_ID, C_POS_Journal_ID);
}
@Override
public int getC_POS_Journal_ID()
{
return get_ValueAsInt(COLUMNNAME_C_POS_Journal_ID);
}
@Override
public void setDateTrx (final java.sql.Timestamp DateTrx)
{
set_Value (COLUMNNAME_DateTrx, DateTrx);
}
@Override
public java.sql.Timestamp getDateTrx()
{
return get_ValueAsTimestamp(COLUMNNAME_DateTrx);
}
|
@Override
public void setDocumentNo (final java.lang.String DocumentNo)
{
set_Value (COLUMNNAME_DocumentNo, DocumentNo);
}
@Override
public java.lang.String getDocumentNo()
{
return get_ValueAsString(COLUMNNAME_DocumentNo);
}
@Override
public void setIsClosed (final boolean IsClosed)
{
set_Value (COLUMNNAME_IsClosed, IsClosed);
}
@Override
public boolean isClosed()
{
return get_ValueAsBoolean(COLUMNNAME_IsClosed);
}
@Override
public void setOpeningNote (final @Nullable java.lang.String OpeningNote)
{
set_Value (COLUMNNAME_OpeningNote, OpeningNote);
}
@Override
public java.lang.String getOpeningNote()
{
return get_ValueAsString(COLUMNNAME_OpeningNote);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.pos.base\src\main\java-gen\de\metas\pos\repository\model\X_C_POS_Journal.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public float getMultiplication(@PathVariable("number1") float number1, @PathVariable("number2") float number2) {
return arithmeticService.multiply(number1, number2);
}
@GetMapping("/divide/{number1}/{number2}")
public float getDivision(@PathVariable("number1") float number1, @PathVariable("number2") float number2) {
return arithmeticService.divide(number1, number2);
}
@GetMapping("/memory")
public String getMemoryStatus() {
MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
String memoryStats = "";
String init = String.format(
|
"Initial: %.2f GB \n",
(double)memoryBean.getHeapMemoryUsage().getInit() /1073741824);
String usedHeap = String.format("Used: %.2f GB \n",
(double)memoryBean.getHeapMemoryUsage().getUsed() /1073741824);
String maxHeap = String.format("Max: %.2f GB \n",
(double)memoryBean.getHeapMemoryUsage().getMax() /1073741824);
String committed = String.format("Committed: %.2f GB \n",
(double)memoryBean.getHeapMemoryUsage().getCommitted() /1073741824);
memoryStats += init;
memoryStats += usedHeap;
memoryStats += maxHeap;
memoryStats += committed;
return memoryStats;
}
}
|
repos\tutorials-master\spring-boot-modules\spring-boot-mvc-3\src\main\java\com\baeldung\micronaut\vs\springboot\controller\ArithmeticController.java
| 2
|
请完成以下Java代码
|
public static <T> CommonResult<T> error(CommonResult<?> result) {
return error(result.getCode(), result.getMessage());
}
public static <T> CommonResult<T> error(Integer code, String message) {
Assert.isTrue(!CODE_SUCCESS.equals(code), "code 必须是错误的!");
CommonResult<T> result = new CommonResult<>();
result.code = code;
result.message = message;
return result;
}
public static <T> CommonResult<T> success(T data) {
CommonResult<T> result = new CommonResult<>();
result.code = CODE_SUCCESS;
result.data = data;
result.message = "";
return result;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
|
@JsonIgnore
public boolean isSuccess() {
return CODE_SUCCESS.equals(code);
}
@JsonIgnore
public boolean isError() {
return !isSuccess();
}
@Override
public String toString() {
return "CommonResult{" +
"code=" + code +
", message='" + message + '\'' +
", data=" + data +
'}';
}
}
|
repos\SpringBoot-Labs-master\lab-22\lab-22-validation-01\src\main\java\cn\iocoder\springboot\lab22\validation\core\vo\CommonResult.java
| 1
|
请完成以下Java代码
|
public String toString() {
return "CamundaBpmRunLdapProperty [enabled=" + enabled +
", initialContextFactory=" + initialContextFactory +
", securityAuthentication=" + securityAuthentication +
", contextProperties=" + contextProperties +
", serverUrl=******" + // sensitive for logging
", managerDn=******" + // sensitive for logging
", managerPassword=******" + // sensitive for logging
", baseDn=" + baseDn +
", userDnPattern=" + userDnPattern +
", userSearchBase=" + userSearchBase +
", userSearchFilter=" + userSearchFilter +
", groupSearchBase=" + groupSearchBase +
", groupSearchFilter=" + groupSearchFilter +
", userIdAttribute=" + userIdAttribute +
", userFirstnameAttribute=" + userFirstnameAttribute +
|
", userLastnameAttribute=" + userLastnameAttribute +
", userEmailAttribute=" + userEmailAttribute +
", userPasswordAttribute=" + userPasswordAttribute +
", groupIdAttribute=" + groupIdAttribute +
", groupNameAttribute=" + groupNameAttribute +
", groupTypeAttribute=" + groupTypeAttribute +
", groupMemberAttribute=" + groupMemberAttribute +
", sortControlSupported=" + sortControlSupported +
", useSsl=" + useSsl +
", usePosixGroups=" + usePosixGroups +
", allowAnonymousLogin=" + allowAnonymousLogin +
", authorizationCheckEnabled=" + authorizationCheckEnabled +
", passwordCheckCatchAuthenticationException=" + passwordCheckCatchAuthenticationException + "]";
}
}
|
repos\camunda-bpm-platform-master\distro\run\core\src\main\java\org\camunda\bpm\run\property\CamundaBpmRunLdapProperties.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
protected String getBeanClassName(Element element) {
return InMemoryUserDetailsManager.class.getName();
}
@Override
@SuppressWarnings("unchecked")
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
String userProperties = element.getAttribute(ATT_PROPERTIES);
List<Element> userElts = DomUtils.getChildElementsByTagName(element, ELT_USER);
if (StringUtils.hasText(userProperties)) {
if (!CollectionUtils.isEmpty(userElts)) {
throw new BeanDefinitionStoreException(
"Use of a properties file and user elements are mutually exclusive");
}
BeanDefinition bd = new RootBeanDefinition(PropertiesFactoryBean.class);
bd.getPropertyValues().addPropertyValue("location", userProperties);
builder.addConstructorArgValue(bd);
return;
}
if (CollectionUtils.isEmpty(userElts)) {
throw new BeanDefinitionStoreException("You must supply user definitions, either with <" + ELT_USER
+ "> child elements or a " + "properties file (using the '" + ATT_PROPERTIES + "' attribute)");
}
ManagedList<BeanDefinition> users = new ManagedList<>();
for (Object elt : userElts) {
Element userElt = (Element) elt;
String userName = userElt.getAttribute(ATT_NAME);
String password = userElt.getAttribute(ATT_PASSWORD);
if (!StringUtils.hasLength(password)) {
password = generateRandomPassword();
}
boolean locked = "true".equals(userElt.getAttribute(ATT_LOCKED));
boolean disabled = "true".equals(userElt.getAttribute(ATT_DISABLED));
BeanDefinitionBuilder authorities = BeanDefinitionBuilder.rootBeanDefinition(AuthorityUtils.class);
authorities.addConstructorArgValue(userElt.getAttribute(ATT_AUTHORITIES));
authorities.setFactoryMethod("commaSeparatedStringToAuthorityList");
BeanDefinitionBuilder user = BeanDefinitionBuilder.rootBeanDefinition(User.class);
user.addConstructorArgValue(userName);
user.addConstructorArgValue(password);
|
user.addConstructorArgValue(!disabled);
user.addConstructorArgValue(true);
user.addConstructorArgValue(true);
user.addConstructorArgValue(!locked);
user.addConstructorArgValue(authorities.getBeanDefinition());
users.add(user.getBeanDefinition());
}
builder.addConstructorArgValue(users);
}
private String generateRandomPassword() {
if (this.random == null) {
try {
this.random = SecureRandom.getInstance("SHA1PRNG");
}
catch (NoSuchAlgorithmException ex) {
// Shouldn't happen...
throw new RuntimeException("Failed find SHA1PRNG algorithm!");
}
}
return Long.toString(this.random.nextLong());
}
}
|
repos\spring-security-main\config\src\main\java\org\springframework\security\config\authentication\UserServiceBeanDefinitionParser.java
| 2
|
请完成以下Java代码
|
protected void configure(AuthenticationManagerBuilder auth){
auth.authenticationProvider(authenticationProvider());
}
@Override
protected void configure(HttpSecurity http) throws Exception{
http
.authorizeRequests()
.antMatchers("/index.html").permitAll()
.antMatchers("/profile/**").hasRole("ADMIN")
.antMatchers("/admin/**").hasAnyRole("ADMIN", "MANAGER")
.antMatchers("/api/public/test1").hasAuthority("ACCESS_TEST1")
.antMatchers("/api/public/test2").hasAuthority("ACCESS_TEST1")
.antMatchers("/api/public/users").hasRole("ADMIN")
.and()
.formLogin()
.loginProcessingUrl("/signin")
.loginPage("/login").permitAll()
.usernameParameter("txtUsername")
.passwordParameter("txtPassword")
.and()
.logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout")).logoutSuccessUrl("/login")
.and()
.rememberMe().tokenValiditySeconds(2592000).key("mySecret!").rememberMeParameter("checkRememberMe");
|
/** */
}
@Bean
DaoAuthenticationProvider authenticationProvider(){
DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider();
daoAuthenticationProvider.setPasswordEncoder(passwordEncoder());
daoAuthenticationProvider.setUserDetailsService((UserDetailsService) this.userPrincipalDetailsService);
return daoAuthenticationProvider;
}
@Bean
PasswordEncoder passwordEncoder(){
return new BCryptPasswordEncoder();
}
}
|
repos\SpringBoot-Projects-FullStack-master\Part-6 Spring Boot Security\10.SpringCustomLogin\src\main\java\spring\custom\security\SpringSecurity.java
| 1
|
请完成以下Java代码
|
public void addLabel(String label, Integer frequency)
{
Integer innerFrequency = labelMap.get(label);
if (innerFrequency == null)
{
innerFrequency = frequency;
}
else
{
innerFrequency += frequency;
}
labelMap.put(label, innerFrequency);
}
/**
* 删除一个标签
* @param label 标签
*/
public void removeLabel(String label)
{
labelMap.remove(label);
}
public boolean containsLabel(String label)
{
return labelMap.containsKey(label);
}
public int getFrequency(String label)
{
Integer frequency = labelMap.get(label);
if (frequency == null) return 0;
return frequency;
}
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder();
ArrayList<Map.Entry<String, Integer>> entries = new ArrayList<Map.Entry<String, Integer>>(labelMap.entrySet());
Collections.sort(entries, new Comparator<Map.Entry<String, Integer>>()
{
@Override
public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2)
{
return -o1.getValue().compareTo(o2.getValue());
}
});
for (Map.Entry<String, Integer> entry : entries)
{
sb.append(entry.getKey());
sb.append(' ');
sb.append(entry.getValue());
sb.append(' ');
}
return sb.toString();
}
public static SimpleItem create(String param)
{
if (param == null) return null;
|
String[] array = param.split(" ");
return create(array);
}
public static SimpleItem create(String param[])
{
if (param.length % 2 == 1) return null;
SimpleItem item = new SimpleItem();
int natureCount = (param.length) / 2;
for (int i = 0; i < natureCount; ++i)
{
item.labelMap.put(param[2 * i], Integer.parseInt(param[1 + 2 * i]));
}
return item;
}
/**
* 合并两个条目,两者的标签map会合并
* @param other
*/
public void combine(SimpleItem other)
{
for (Map.Entry<String, Integer> entry : other.labelMap.entrySet())
{
addLabel(entry.getKey(), entry.getValue());
}
}
/**
* 获取全部频次
* @return
*/
public int getTotalFrequency()
{
int frequency = 0;
for (Integer f : labelMap.values())
{
frequency += f;
}
return frequency;
}
public String getMostLikelyLabel()
{
return labelMap.entrySet().iterator().next().getKey();
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\corpus\dictionary\item\SimpleItem.java
| 1
|
请完成以下Java代码
|
public class FullName {
private String firstName;
private String middleName;
private String lastName;
public FullName() {
}
public FullName(String firstName, String middleName, String lastName) {
this.firstName = firstName;
this.middleName = middleName;
this.lastName = lastName;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getMiddleName() {
return middleName;
}
|
public void setMiddleName(String middleName) {
this.middleName = middleName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
@Override
public String toString() {
return "[firstName=" + firstName + ", middleName="
+ middleName + ", lastName=" + lastName + "]";
}
}
|
repos\SpringBootBucket-master\springboot-echarts\src\main\java\com\xncoding\benchmark\json\model\FullName.java
| 1
|
请完成以下Java代码
|
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public String getMetaInfo() {
return metaInfo;
}
public void setMetaInfo(String metaInfo) {
this.metaInfo = metaInfo;
}
public String getDeploymentId() {
return deploymentId;
}
public void setDeploymentId(String deploymentId) {
this.deploymentId = deploymentId;
}
public String getEditorSourceValueId() {
return editorSourceValueId;
}
public void setEditorSourceValueId(String editorSourceValueId) {
this.editorSourceValueId = editorSourceValueId;
}
public String getEditorSourceExtraValueId() {
return editorSourceExtraValueId;
}
public void setEditorSourceExtraValueId(String editorSourceExtraValueId) {
this.editorSourceExtraValueId = editorSourceExtraValueId;
}
|
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public boolean hasEditorSource() {
return this.editorSourceValueId != null;
}
public boolean hasEditorSourceExtra() {
return this.editorSourceExtraValueId != null;
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\persistence\entity\ModelEntityImpl.java
| 1
|
请完成以下Java代码
|
public void handle(MigratingInstanceParseContext parseContext, MigratingActivityInstance owningInstance, List<EventSubscriptionEntity> elements) {
Map<String, EventSubscriptionDeclaration> targetDeclarations = getDeclarationsByTriggeringActivity(owningInstance.getTargetScope());
for (EventSubscriptionEntity eventSubscription : elements) {
if (!getSupportedEventTypes().contains(eventSubscription.getEventType())) {
// ignore unsupported event subscriptions
continue;
}
MigrationInstruction migrationInstruction = parseContext.findSingleMigrationInstruction(eventSubscription.getActivityId());
ActivityImpl targetActivity = parseContext.getTargetActivity(migrationInstruction);
if (targetActivity != null && owningInstance.migratesTo(targetActivity.getEventScope())) {
// the event subscription is migrated
EventSubscriptionDeclaration targetDeclaration = targetDeclarations.remove(targetActivity.getId());
owningInstance.addMigratingDependentInstance(
new MigratingEventSubscriptionInstance(eventSubscription, targetActivity, migrationInstruction.isUpdateEventTrigger(), targetDeclaration));
}
else {
// the event subscription will be removed
owningInstance.addRemovingDependentInstance(new MigratingEventSubscriptionInstance(eventSubscription));
}
parseContext.consume(eventSubscription);
}
if (owningInstance.migrates()) {
addEmergingEventSubscriptions(owningInstance, targetDeclarations);
|
}
}
protected Set<String> getSupportedEventTypes() {
return SUPPORTED_EVENT_TYPES;
}
protected Map<String, EventSubscriptionDeclaration> getDeclarationsByTriggeringActivity(ScopeImpl eventScope) {
Map<String, EventSubscriptionDeclaration> declarations = EventSubscriptionDeclaration.getDeclarationsForScope(eventScope);
return new HashMap<String, EventSubscriptionDeclaration>(declarations);
}
protected void addEmergingEventSubscriptions(MigratingActivityInstance owningInstance, Map<String, EventSubscriptionDeclaration> targetDeclarations) {
for (String key : targetDeclarations.keySet()) {
// the event subscription will be created
EventSubscriptionDeclaration declaration = targetDeclarations.get(key);
if (!declaration.isStartEvent()) {
owningInstance.addEmergingDependentInstance(new MigratingEventSubscriptionInstance(declaration));
}
}
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\migration\instance\parser\EventSubscriptionInstanceHandler.java
| 1
|
请完成以下Java代码
|
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getContinueSignDay() {
return continueSignDay;
}
public void setContinueSignDay(Integer continueSignDay) {
this.continueSignDay = continueSignDay;
}
public Integer getContinueSignPoint() {
return continueSignPoint;
}
public void setContinueSignPoint(Integer continueSignPoint) {
this.continueSignPoint = continueSignPoint;
}
public BigDecimal getConsumePerPoint() {
return consumePerPoint;
}
public void setConsumePerPoint(BigDecimal consumePerPoint) {
this.consumePerPoint = consumePerPoint;
}
public BigDecimal getLowOrderAmount() {
return lowOrderAmount;
}
public void setLowOrderAmount(BigDecimal lowOrderAmount) {
this.lowOrderAmount = lowOrderAmount;
}
public Integer getMaxPointPerOrder() {
return maxPointPerOrder;
}
|
public void setMaxPointPerOrder(Integer maxPointPerOrder) {
this.maxPointPerOrder = maxPointPerOrder;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", continueSignDay=").append(continueSignDay);
sb.append(", continueSignPoint=").append(continueSignPoint);
sb.append(", consumePerPoint=").append(consumePerPoint);
sb.append(", lowOrderAmount=").append(lowOrderAmount);
sb.append(", maxPointPerOrder=").append(maxPointPerOrder);
sb.append(", type=").append(type);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
|
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\UmsMemberRuleSetting.java
| 1
|
请完成以下Java代码
|
public String getIndentToken()
{
return indentToken;
}
public void setIndentToken(String indent)
{
Check.assumeNotNull(indent, "indent not null");
this.indentToken = indent;
this._linePrefix = null; // reset
}
public String getNewlineToken()
{
return newlineToken;
}
public void setNewlineToken(String newline)
{
Check.assumeNotNull(newline, "newline not null");
this.newlineToken = newline;
}
public int getIndent()
{
return indent;
}
public IndentedStringBuilder incrementIndent()
{
return setIndent(indent + 1);
}
public IndentedStringBuilder decrementIndent()
{
return setIndent(indent - 1);
}
private IndentedStringBuilder setIndent(int indent)
{
Check.assume(indent >= 0, "indent >= 0");
this.indent = indent;
this._linePrefix = null; // reset
return this;
}
private final String getLinePrefix()
|
{
if (_linePrefix == null)
{
final int indent = getIndent();
final String token = getIndentToken();
final StringBuilder prefix = new StringBuilder();
for (int i = 1; i <= indent; i++)
{
prefix.append(token);
}
_linePrefix = prefix.toString();
}
return _linePrefix;
}
public StringBuilder getInnerStringBuilder()
{
return sb;
}
@Override
public String toString()
{
return sb.toString();
}
public IndentedStringBuilder appendLine(final Object obj)
{
final String linePrefix = getLinePrefix();
sb.append(linePrefix).append(obj).append(getNewlineToken());
return this;
}
public IndentedStringBuilder append(final Object obj)
{
sb.append(obj);
return this;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\org\adempiere\util\text\IndentedStringBuilder.java
| 1
|
请完成以下Java代码
|
public int refresh()
{
log.debug("start");
m_loader = new Loader();
m_loader.start();
try
{
m_loader.join();
}
catch (InterruptedException ie)
{
}
log.info("#" + m_lookup.size());
return m_lookup.size();
} // refresh
@Override
public String getTableName()
{
return I_M_Locator.Table_Name;
}
/**
|
* Get underlying fully qualified Table.Column Name
*
* @return Table.ColumnName
*/
@Override
public String getColumnName()
{
return "M_Locator.M_Locator_ID";
} // getColumnName
@Override
public String getColumnNameNotFQ()
{
return I_M_Locator.COLUMNNAME_M_Locator_ID;
}
} // MLocatorLookup
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MLocatorLookup.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public final class ElasticMetricsExportAutoConfiguration {
private final ElasticProperties properties;
ElasticMetricsExportAutoConfiguration(ElasticProperties properties) {
this.properties = properties;
}
@Bean
@ConditionalOnMissingBean
ElasticConfig elasticConfig() {
MutuallyExclusiveConfigurationPropertiesException.throwIfMultipleNonNullValuesIn((entries) -> {
entries.put("api-key-credentials", this.properties.getApiKeyCredentials());
entries.put("user-name", this.properties.getUserName());
});
MutuallyExclusiveConfigurationPropertiesException.throwIfMultipleNonNullValuesIn((entries) -> {
entries.put("api-key-credentials", this.properties.getApiKeyCredentials());
|
entries.put("password", this.properties.getPassword());
});
return new ElasticPropertiesConfigAdapter(this.properties);
}
@Bean
@ConditionalOnMissingBean
ElasticMeterRegistry elasticMeterRegistry(ElasticConfig elasticConfig, Clock clock) {
return ElasticMeterRegistry.builder(elasticConfig)
.clock(clock)
.httpClient(
new HttpUrlConnectionSender(this.properties.getConnectTimeout(), this.properties.getReadTimeout()))
.build();
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\export\elastic\ElasticMetricsExportAutoConfiguration.java
| 2
|
请完成以下Java代码
|
private static SessionFactory makeSessionFactory(ServiceRegistry serviceRegistry) {
MetadataSources metadataSources = new MetadataSources(serviceRegistry);
metadataSources.addPackage("com.baeldung.hibernate.pojo");
metadataSources.addAnnotatedClass(Animal.class);
metadataSources.addAnnotatedClass(Bag.class);
metadataSources.addAnnotatedClass(Laptop.class);
metadataSources.addAnnotatedClass(Book.class);
metadataSources.addAnnotatedClass(Car.class);
metadataSources.addAnnotatedClass(MyEmployee.class);
metadataSources.addAnnotatedClass(MyProduct.class);
metadataSources.addAnnotatedClass(Pen.class);
metadataSources.addAnnotatedClass(Pet.class);
metadataSources.addAnnotatedClass(Vehicle.class);
metadataSources.addAnnotatedClass(TemporalValues.class);
Metadata metadata = metadataSources.getMetadataBuilder()
.build();
return metadata.getSessionFactoryBuilder()
.build();
|
}
private static ServiceRegistry configureServiceRegistry() throws IOException {
Properties properties = getProperties();
return new StandardServiceRegistryBuilder().applySettings(properties)
.build();
}
private static Properties getProperties() throws IOException {
Properties properties = new Properties();
URL propertiesURL = Thread.currentThread()
.getContextClassLoader()
.getResource(StringUtils.defaultString(PROPERTY_FILE_NAME, "hibernate.properties"));
try (FileInputStream inputStream = new FileInputStream(propertiesURL.getFile())) {
properties.load(inputStream);
}
return properties;
}
}
|
repos\tutorials-master\persistence-modules\hibernate-mapping\src\main\java\com\baeldung\hibernate\HibernateUtil.java
| 1
|
请完成以下Java代码
|
static public double MQCON(int p_A_ASSET_ID, String p_POSTINGTYPE, int p_A_ASSET_ACCT_ID, int p_Flag, double p_Period)
{
int v_adj=0;
StringBuffer sqlB = new StringBuffer ("SELECT A_ASSET.ASSETSERVICEDATE,"
+ " A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED,"
+ " A_DEPRECIATION_WORKFILE.A_ASSET_LIFE_YEARS, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD,"
+ " A_DEPRECIATION_WORKFILE.DATEACCT"
+ " FROM A_DEPRECIATION_WORKFILE, A_ASSET"
+ " WHERE A_ASSET.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_DEPRECIATION_WORKFILE.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE+"'");
PreparedStatement pstmt = null;
pstmt = DB.prepareStatement (sqlB.toString(),null);
try {
ResultSet rs = pstmt.executeQuery();
while (rs.next()){
Calendar calendar = new GregorianCalendar();
calendar.setTime(rs.getDate("ASSETSERVICEDATE"));
int AssetServiceDateYear = calendar.get(Calendar.YEAR);
int AssetServiceDateMonth = calendar.get(Calendar.MONTH);
calendar.setTime(rs.getDate("DATEACCT"));
int DateAcctYear = calendar.get(Calendar.YEAR);
int DateAcctMonth = calendar.get(Calendar.MONTH);
if(p_Flag <2){
//ADJUST PERIOD FOR MID-QUARTER CONVENTION
if(DateAcctYear == AssetServiceDateYear){
if(AssetServiceDateMonth < 4 )
return .875;
else if (AssetServiceDateMonth < 7 )
return .625;
else if (AssetServiceDateMonth < 10 )
return .375;
else if (AssetServiceDateMonth > 9 )
return .125;
}
else if(DateAcctYear*12 + DateAcctMonth >= ((AssetServiceDateYear+rs.getInt("A_ASSET_LIFE_YEARS"))*12 + AssetServiceDateMonth)){
if(AssetServiceDateMonth < 4 )
return .125;
else if (AssetServiceDateMonth < 7 )
return .375;
else if (AssetServiceDateMonth < 10 )
|
return .625;
else if (AssetServiceDateMonth > 9 )
return .875;
}
else
return 1;
}
if(p_Flag == 2){
if(AssetServiceDateMonth< 4 )
return .875;
else if (AssetServiceDateMonth < 7 )
return .625;
else if (AssetServiceDateMonth < 10 )
return .375;
else if (AssetServiceDateMonth > 9 )
return .125;
}
}
}
catch (Exception e)
{
System.out.println("MQCON"+e);
}
finally
{
try
{
if (pstmt != null)
pstmt.close ();
}
catch (Exception e)
{}
pstmt = null;
}
return v_adj;
}
}// Conventions
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\compiere\FA\Conventions.java
| 1
|
请完成以下Java代码
|
private DocumentToRepost extractDocumentToRepost(@NonNull final IViewRow row)
{
final String tableName = getTableName();
if (I_Fact_Acct.Table_Name.equals(tableName)
|| FactAcctFilterDescriptorsProviderFactory.FACT_ACCT_TRANSACTIONS_VIEW.equals(tableName)
|| TABLENAME_RV_UnPosted.equals(tableName))
{
return extractDocumentToRepostFromTableAndRecordIdRow(row);
}
else
{
return extractDocumentToRepostFromRegularRow(row);
}
}
private DocumentToRepost extractDocumentToRepostFromTableAndRecordIdRow(final IViewRow row)
{
final int adTableId = row.getFieldValueAsInt(I_Fact_Acct.COLUMNNAME_AD_Table_ID, -1);
final int recordId = row.getFieldValueAsInt(I_Fact_Acct.COLUMNNAME_Record_ID, -1);
final ClientId adClientId = ClientId.ofRepoId(row.getFieldValueAsInt(I_Fact_Acct.COLUMNNAME_AD_Client_ID, -1));
return DocumentToRepost.builder()
.adTableId(adTableId)
.recordId(recordId)
.clientId(adClientId)
.build();
}
private DocumentToRepost extractDocumentToRepostFromRegularRow(final IViewRow row)
{
|
final int adTableId = adTablesRepo.retrieveTableId(getTableName());
final int recordId = row.getId().toInt();
final ClientId adClientId = ClientId.ofRepoId(row.getFieldValueAsInt(I_Fact_Acct.COLUMNNAME_AD_Client_ID, -1));
return DocumentToRepost.builder()
.adTableId(adTableId)
.recordId(recordId)
.clientId(adClientId)
.build();
}
@Override
protected void postProcess(final boolean success)
{
getView().invalidateSelection();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\accounting\process\WEBUI_Fact_Acct_Repost_ViewRows.java
| 1
|
请完成以下Java代码
|
boolean hasValidClassName(@Nullable PdxInstance pdxInstance) {
return Optional.ofNullable(pdxInstance)
.map(PdxInstance::getClassName)
.filter(StringUtils::hasText)
.filter(className -> !JSONFormatter.JSON_CLASSNAME.equals(className))
.isPresent();
}
private boolean isDecorationRequired(@Nullable PdxInstance pdxInstance, @Nullable String json) {
return isMissingObjectTypeMetadata(pdxInstance) && isValidJson(json);
}
private boolean isMissingObjectTypeMetadata(@Nullable JsonNode node) {
return isObjectNode(node) && !node.has(AT_TYPE_METADATA_PROPERTY_NAME);
}
private boolean isMissingObjectTypeMetadata(@Nullable PdxInstance pdxInstance) {
return pdxInstance != null && !pdxInstance.hasField(AT_TYPE_METADATA_PROPERTY_NAME);
}
/**
* Null-safe method to determine if the given {@link JsonNode} represents a valid {@link String JSON} object.
|
*
* @param node {@link JsonNode} to evaluate.
* @return a boolean valued indicating whether the given {@link JsonNode} is a valid {@link ObjectNode}.
* @see com.fasterxml.jackson.databind.node.ObjectNode
* @see com.fasterxml.jackson.databind.JsonNode
*/
boolean isObjectNode(@Nullable JsonNode node) {
return node != null && (node.isObject() || node instanceof ObjectNode);
}
/**
* Null-safe method to determine whether the given {@link String JSON} is valid.
*
* @param json {@link String} containing JSON to evaluate.
* @return a boolean value indicating whether the given {@link String JSON} is valid.
*/
boolean isValidJson(@Nullable String json) {
return StringUtils.hasText(json);
}
}
|
repos\spring-boot-data-geode-main\spring-geode-project\spring-geode\src\main\java\org\springframework\geode\data\json\converter\support\JSONFormatterPdxToJsonConverter.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class PPOrderId implements RepoIdAware
{
@JsonCreator
public static PPOrderId ofRepoId(final int repoId)
{
return new PPOrderId(repoId);
}
public static PPOrderId ofRepoIdOrNull(final int repoId)
{
return repoId > 0 ? new PPOrderId(repoId) : null;
}
public static Optional<PPOrderId> optionalOfRepoId(final int repoId)
{
return Optional.ofNullable(ofRepoIdOrNull(repoId));
}
public static int toRepoId(@Nullable final PPOrderId PPOrderId)
{
return PPOrderId != null ? PPOrderId.getRepoId() : -1;
}
int repoId;
|
private PPOrderId(final int repoId)
{
this.repoId = Check.assumeGreaterThanZero(repoId, "PP_Order_ID");
}
@JsonValue
public int toJson()
{
return getRepoId();
}
public static boolean equals(@Nullable final PPOrderId id1, @Nullable final PPOrderId id2) {return Objects.equals(id1, id2);}
public TableRecordReference toRecordRef() {return TableRecordReference.of(I_PP_Order.Table_Name, this);}
public static PPOrderId ofRecordRef(@NonNull final TableRecordReference recordRef) {return recordRef.getIdAssumingTableName(I_PP_Order.Table_Name, PPOrderId::ofRepoId);}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\eevolution\api\PPOrderId.java
| 2
|
请完成以下Java代码
|
static Bucket loadDefaultBucketWithBlankPassword(Cluster cluster) {
return cluster.openBucket();
}
static Bucket loadBaeldungBucket(Cluster cluster) {
return cluster.openBucket("baeldung", "");
}
static JsonDocument insertExample(Bucket bucket) {
JsonObject content = JsonObject.empty().put("name", "John Doe").put("type", "Person").put("email", "john.doe@mydomain.com").put("homeTown", "Chicago");
String id = UUID.randomUUID().toString();
JsonDocument document = JsonDocument.create(id, content);
JsonDocument inserted = bucket.insert(document);
return inserted;
}
static JsonDocument retrieveAndUpsertExample(Bucket bucket, String id) {
JsonDocument document = bucket.get(id);
JsonObject content = document.content();
content.put("homeTown", "Kansas City");
JsonDocument upserted = bucket.upsert(document);
return upserted;
}
static JsonDocument replaceExample(Bucket bucket, String id) {
JsonDocument document = bucket.get(id);
JsonObject content = document.content();
content.put("homeTown", "Milwaukee");
JsonDocument replaced = bucket.replace(document);
return replaced;
|
}
static JsonDocument removeExample(Bucket bucket, String id) {
JsonDocument removed = bucket.remove(id);
return removed;
}
static JsonDocument getFirstFromReplicaExample(Bucket bucket, String id) {
try {
return bucket.get(id);
} catch (CouchbaseException e) {
List<JsonDocument> list = bucket.getFromReplica(id, ReplicaMode.FIRST);
if (!list.isEmpty()) {
return list.get(0);
}
}
return null;
}
static JsonDocument getLatestReplicaVersion(Bucket bucket, String id) {
long maxCasValue = -1;
JsonDocument latest = null;
for (JsonDocument replica : bucket.getFromReplica(id, ReplicaMode.ALL)) {
if (replica.cas() > maxCasValue) {
latest = replica;
maxCasValue = replica.cas();
}
}
return latest;
}
}
|
repos\tutorials-master\persistence-modules\couchbase\src\main\java\com\baeldung\couchbase\intro\CodeSnippets.java
| 1
|
请完成以下Java代码
|
public List<String> getProcessDefinitionById(String id) {
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult();
List<String> item = new ArrayList<>(3);
item.add(pd.getId());
item.add(pd.getName());
item.add(Integer.toString(pd.getVersion()));
item.add(Boolean.toString(pd.isSuspended()));
item.add(pd.getDescription());
return item;
}
@ManagedAttribute(description = "List of deployed Processes")
public List<List<String>> getDeployments() {
List<Deployment> deployments = repositoryService.createDeploymentQuery().list();
List<List<String>> result = new ArrayList<>(deployments.size());
for (Deployment deployment : deployments) {
List<String> item = new ArrayList<>(3);
item.add(deployment.getId());
item.add(deployment.getName());
item.add(deployment.getTenantId());
result.add(item);
}
return result;
}
@ManagedOperation(description = "delete deployment")
public void deleteDeployment(String deploymentId) {
|
repositoryService.deleteDeployment(deploymentId);
}
@ManagedOperation(description = "Suspend given process ID")
public void suspendProcessDefinitionById(String processId) {
repositoryService.suspendProcessDefinitionById(processId);
}
@ManagedOperation(description = "Activate given process ID")
public void activatedProcessDefinitionById(String processId) {
repositoryService.activateProcessDefinitionById(processId);
}
@ManagedOperation(description = "Suspend given process ID")
public void suspendProcessDefinitionByKey(String processDefinitionKey) {
repositoryService.suspendProcessDefinitionByKey(processDefinitionKey);
}
@ManagedOperation(description = "Activate given process ID")
public void activatedProcessDefinitionByKey(String processDefinitionKey) {
repositoryService.activateProcessDefinitionByKey(processDefinitionKey);
}
@ManagedOperation(description = "Deploy Process Definition")
public void deployProcessDefinition(String resourceName, String processDefinitionFile) throws FileNotFoundException {
DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();
Deployment deployment = deploymentBuilder.addInputStream(resourceName, new FileInputStream(processDefinitionFile)).deploy();
}
}
|
repos\flowable-engine-main\modules\flowable-jmx\src\main\java\org\flowable\management\jmx\mbeans\ProcessDefinitionsMBean.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void setIncludeCaseVariablesNames(Collection<String> includeCaseVariablesNames) {
this.includeCaseVariablesNames = includeCaseVariablesNames;
}
@JsonTypeInfo(use = Id.CLASS, defaultImpl = QueryVariable.class)
public List<QueryVariable> getVariables() {
return variables;
}
public void setVariables(List<QueryVariable> variables) {
this.variables = variables;
}
public String getActivePlanItemDefinitionId() {
return activePlanItemDefinitionId;
}
public void setActivePlanItemDefinitionId(String activePlanItemDefinitionId) {
this.activePlanItemDefinitionId = activePlanItemDefinitionId;
}
public Set<String> getActivePlanItemDefinitionIds() {
return activePlanItemDefinitionIds;
}
public void setActivePlanItemDefinitionIds(Set<String> activePlanItemDefinitionIds) {
this.activePlanItemDefinitionIds = activePlanItemDefinitionIds;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public String getTenantId() {
return tenantId;
}
public void setWithoutTenantId(Boolean withoutTenantId) {
this.withoutTenantId = withoutTenantId;
}
public Boolean getWithoutTenantId() {
return withoutTenantId;
}
public String getTenantIdLike() {
return tenantIdLike;
}
|
public void setTenantIdLike(String tenantIdLike) {
this.tenantIdLike = tenantIdLike;
}
public String getTenantIdLikeIgnoreCase() {
return tenantIdLikeIgnoreCase;
}
public void setTenantIdLikeIgnoreCase(String tenantIdLikeIgnoreCase) {
this.tenantIdLikeIgnoreCase = tenantIdLikeIgnoreCase;
}
public Set<String> getCaseInstanceCallbackIds() {
return caseInstanceCallbackIds;
}
public void setCaseInstanceCallbackIds(Set<String> caseInstanceCallbackIds) {
this.caseInstanceCallbackIds = caseInstanceCallbackIds;
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\runtime\caze\CaseInstanceQueryRequest.java
| 2
|
请完成以下Java代码
|
public void setValue (final @Nullable java.lang.String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
@Override
public java.lang.String getValue()
{
return get_ValueAsString(COLUMNNAME_Value);
}
@Override
public void setVendorCategory (final @Nullable java.lang.String VendorCategory)
{
set_Value (COLUMNNAME_VendorCategory, VendorCategory);
}
@Override
public java.lang.String getVendorCategory()
{
return get_ValueAsString(COLUMNNAME_VendorCategory);
}
@Override
public void setVendorProductNo (final @Nullable java.lang.String VendorProductNo)
{
set_Value (COLUMNNAME_VendorProductNo, VendorProductNo);
}
@Override
public java.lang.String getVendorProductNo()
{
return get_ValueAsString(COLUMNNAME_VendorProductNo);
}
@Override
public void setVolume (final @Nullable BigDecimal Volume)
{
set_Value (COLUMNNAME_Volume, Volume);
}
@Override
public BigDecimal getVolume()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Volume);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setWeight (final @Nullable BigDecimal Weight)
{
set_Value (COLUMNNAME_Weight, Weight);
}
@Override
public BigDecimal getWeight()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Weight);
|
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setWeightUOM (final @Nullable java.lang.String WeightUOM)
{
set_Value (COLUMNNAME_WeightUOM, WeightUOM);
}
@Override
public java.lang.String getWeightUOM()
{
return get_ValueAsString(COLUMNNAME_WeightUOM);
}
@Override
public void setWeight_UOM_ID (final int Weight_UOM_ID)
{
if (Weight_UOM_ID < 1)
set_Value (COLUMNNAME_Weight_UOM_ID, null);
else
set_Value (COLUMNNAME_Weight_UOM_ID, Weight_UOM_ID);
}
@Override
public int getWeight_UOM_ID()
{
return get_ValueAsInt(COLUMNNAME_Weight_UOM_ID);
}
@Override
public void setWidthInCm (final int WidthInCm)
{
set_Value (COLUMNNAME_WidthInCm, WidthInCm);
}
@Override
public int getWidthInCm()
{
return get_ValueAsInt(COLUMNNAME_WidthInCm);
}
@Override
public void setX12DE355 (final @Nullable java.lang.String X12DE355)
{
set_Value (COLUMNNAME_X12DE355, X12DE355);
}
@Override
public java.lang.String getX12DE355()
{
return get_ValueAsString(COLUMNNAME_X12DE355);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_I_Product.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class HUConsolidationTarget
{
@NonNull String id;
@NonNull String caption;
//
// New LU
@Nullable HuPackingInstructionsId luPIId;
//
// Existing LU
@Nullable HuId luId;
@Nullable HUQRCode luQRCode;
@Builder
private HUConsolidationTarget(
@NonNull final String caption,
@Nullable final HuPackingInstructionsId luPIId,
@Nullable final HuId luId,
@Nullable final HUQRCode luQRCode)
{
this.caption = caption;
if (luId != null)
{
this.luPIId = null;
this.luId = luId;
this.luQRCode = luQRCode;
this.id = "existing-" + luId.getRepoId();
}
else if (luPIId != null)
{
this.luPIId = luPIId;
this.luId = null;
this.luQRCode = null;
this.id = "new-" + luPIId.getRepoId();
}
else
{
throw new AdempiereException("Invalid HU consolidation target");
}
}
public static HUConsolidationTarget ofNewLU(@NonNull final HuPackingInstructionsIdAndCaption luPIAndCaption)
{
return builder()
.caption(luPIAndCaption.getCaption())
.luPIId(luPIAndCaption.getId())
.build();
}
public static HUConsolidationTarget ofExistingLU(@NonNull final HuId luId, @NonNull final HUQRCode qrCode)
{
return builder().luId(luId).luQRCode(qrCode).caption(qrCode.toDisplayableQRCode()).build();
}
public boolean isExistingLU()
{
return luId != null;
}
public boolean isNewLU()
{
return luId == null && luPIId != null;
}
public HuPackingInstructionsId getLuPIIdNotNull()
{
return Check.assumeNotNull(luPIId, "LU PI shall be set for {}", this);
}
public HuId getLuIdNotNull()
{
|
return Check.assumeNotNull(luId, "LU shall be set for {}", this);
}
public interface CaseConsumer
{
void newLU(final HuPackingInstructionsId luPackingInstructionsId);
void existingLU(final HuId luId, final HUQRCode luQRCode);
}
public void apply(@NonNull final HUConsolidationTarget.CaseConsumer consumer)
{
if (isNewLU())
{
consumer.newLU(getLuPIIdNotNull());
}
else if (isExistingLU())
{
consumer.existingLU(getLuIdNotNull(), getLuQRCode());
}
else
{
throw new AdempiereException("Unsupported target type: " + this);
}
}
public boolean isPrintable() {return isExistingLU();}
public void assertPrintable()
{
if (!isPrintable())
{
throw new AdempiereException("Target is not printable: " + this);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.hu_consolidation.mobile\src\main\java\de\metas\hu_consolidation\mobile\job\HUConsolidationTarget.java
| 2
|
请完成以下Java代码
|
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public String getProcessDefinitionKey() {
return processDefinitionKey;
}
public void setProcessDefinitionKey(String processDefinitionKey) {
this.processDefinitionKey = processDefinitionKey;
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public void setProcessDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
}
public String getProcessDefinitionName() {
return processDefinitionName;
}
public void setProcessDefinitionName(String processDefinitionName) {
this.processDefinitionName = processDefinitionName;
}
public String getTaskName() {
return taskName;
}
public void setTaskName(String taskName) {
this.taskName = taskName;
}
|
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
@Override
public String toString() {
return this.getClass().getSimpleName()
+ "[" +
"count=" + count +
", processDefinitionKey='" + processDefinitionKey + '\'' +
", processDefinitionId='" + processDefinitionId + '\'' +
", processDefinitionName='" + processDefinitionName + '\'' +
", taskName='" + taskName + '\'' +
", tenantId='" + tenantId + '\'' +
']';
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\TaskReportResultEntity.java
| 1
|
请完成以下Java代码
|
public static boolean evaluateLogic (final Evaluatee source, final String logic)
{
final ILogicExpression expression = Services.get(IExpressionFactory.class).compileOrDefault(logic, ConstantLogicExpression.FALSE, ILogicExpression.class);
// don't fail on missing parameter because we want to be compatible with old org.compiere.util.Evaluator.evaluateLogic(Evaluatee, String) method
final boolean ignoreUnparsable = true;
return expression.evaluate(source, ignoreUnparsable);
} // evaluateLogic
/**
* Parse String and add variables with @ to the list.
* @param list list to be added to
* @param parseString string to parse for variables
* @deprecated metas - Please use {@link IExpressionFactory} or {@link #parseDepends(List, IExpression)}
*/
@Deprecated
public static void parseDepends (List<String> list, String parseString)
{
final IStringExpression expression = Services.get(IExpressionFactory.class).compile(parseString, IStringExpression.class);
parseDepends(list, expression);
} // parseDepends
// metas:
private static String getValue(Evaluatee source, String variable)
{
return CtxNames.parse(variable).getValueAsString(source);
}
public static String parseContext(Evaluatee source, String expression)
{
if (expression == null || expression.length() == 0)
return null;
//
int pos = 0;
String finalExpression = expression;
while (pos < expression.length())
{
int first = expression.indexOf('@', pos);
if (first == -1)
return expression;
int second = expression.indexOf('@', first+1);
if (second == -1)
{
|
s_log.error("No second @ in Logic: {}", expression);
return null;
}
String variable = expression.substring(first+1, second);
String eval = getValue(source, variable);
s_log.trace("{}={}", variable, eval);
if (Check.isEmpty(eval, true))
{
eval = Env.getContext(Env.getCtx(), variable);
}
finalExpression = finalExpression.replaceFirst("@"+variable+"@", eval);
//
pos = second + 1;
}
return finalExpression;
}
public static boolean hasVariable(Evaluatee source, String variableName)
{
if (source instanceof Evaluatee2)
{
final Evaluatee2 source2 = (Evaluatee2)source;
return source2.has_Variable(variableName);
}
else
{
return !Check.isEmpty(source.get_ValueAsString(variableName));
}
}
public static void parseDepends (final List<String> list, final IExpression<?> expr)
{
if (expr == null)
{
return;
}
list.addAll(expr.getParameterNames());
}
} // Evaluator
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\util\Evaluator.java
| 1
|
请完成以下Java代码
|
public OAuth2User getPrincipal() {
return this.principal;
}
@Override
public Object getCredentials() {
// Credentials are never exposed (by the Provider) for an OAuth2 User
return "";
}
/**
* Returns the registration identifier of the {@link OAuth2AuthorizedClient Authorized
* Client}.
* @return the registration identifier of the Authorized Client.
*/
public String getAuthorizedClientRegistrationId() {
return this.authorizedClientRegistrationId;
}
@Override
public Builder<?> toBuilder() {
return new Builder<>(this);
}
/**
* A builder of {@link OAuth2AuthenticationToken} instances
*
* @since 7.0
*/
public static class Builder<B extends Builder<B>> extends AbstractAuthenticationBuilder<B> {
private OAuth2User principal;
private String authorizedClientRegistrationId;
protected Builder(OAuth2AuthenticationToken token) {
super(token);
this.principal = token.principal;
this.authorizedClientRegistrationId = token.authorizedClientRegistrationId;
}
|
@Override
public B principal(@Nullable Object principal) {
Assert.isInstanceOf(OAuth2User.class, principal, "principal must be of type OAuth2User");
this.principal = (OAuth2User) principal;
return (B) this;
}
/**
* Use this
* {@link org.springframework.security.oauth2.client.registration.ClientRegistration}
* {@code registrationId}.
* @param authorizedClientRegistrationId the registration id to use
* @return the {@link Builder} for further configurations
* @see OAuth2AuthenticationToken#getAuthorizedClientRegistrationId
*/
public B authorizedClientRegistrationId(String authorizedClientRegistrationId) {
this.authorizedClientRegistrationId = authorizedClientRegistrationId;
return (B) this;
}
@Override
public OAuth2AuthenticationToken build() {
return new OAuth2AuthenticationToken(this);
}
}
}
|
repos\spring-security-main\oauth2\oauth2-client\src\main\java\org\springframework\security\oauth2\client\authentication\OAuth2AuthenticationToken.java
| 1
|
请完成以下Java代码
|
public void setRoomNumber(String no) {
((InetOrgPerson) this.instance).roomNumber = no;
}
public void setTitle(String title) {
((InetOrgPerson) this.instance).title = title;
}
public void setCarLicense(String carLicense) {
((InetOrgPerson) this.instance).carLicense = carLicense;
}
public void setDepartmentNumber(String departmentNumber) {
((InetOrgPerson) this.instance).departmentNumber = departmentNumber;
}
public void setDisplayName(String displayName) {
((InetOrgPerson) this.instance).displayName = displayName;
}
public void setEmployeeNumber(String no) {
((InetOrgPerson) this.instance).employeeNumber = no;
}
public void setDestinationIndicator(String destination) {
((InetOrgPerson) this.instance).destinationIndicator = destination;
}
public void setHomePhone(String homePhone) {
|
((InetOrgPerson) this.instance).homePhone = homePhone;
}
public void setStreet(String street) {
((InetOrgPerson) this.instance).street = street;
}
public void setPostalCode(String postalCode) {
((InetOrgPerson) this.instance).postalCode = postalCode;
}
public void setPostalAddress(String postalAddress) {
((InetOrgPerson) this.instance).postalAddress = postalAddress;
}
public void setMobile(String mobile) {
((InetOrgPerson) this.instance).mobile = mobile;
}
public void setHomePostalAddress(String homePostalAddress) {
((InetOrgPerson) this.instance).homePostalAddress = homePostalAddress;
}
}
}
|
repos\spring-security-main\ldap\src\main\java\org\springframework\security\ldap\userdetails\InetOrgPerson.java
| 1
|
请完成以下Java代码
|
public void setPlanningHorizon (final int PlanningHorizon)
{
set_Value (COLUMNNAME_PlanningHorizon, PlanningHorizon);
}
@Override
public int getPlanningHorizon()
{
return get_ValueAsInt(COLUMNNAME_PlanningHorizon);
}
@Override
public void setQueuingTime (final @Nullable BigDecimal QueuingTime)
{
set_Value (COLUMNNAME_QueuingTime, QueuingTime);
}
@Override
public BigDecimal getQueuingTime()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QueuingTime);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setS_Resource_ID (final int S_Resource_ID)
{
if (S_Resource_ID < 1)
set_ValueNoCheck (COLUMNNAME_S_Resource_ID, null);
else
set_ValueNoCheck (COLUMNNAME_S_Resource_ID, S_Resource_ID);
}
@Override
public int getS_Resource_ID()
{
return get_ValueAsInt(COLUMNNAME_S_Resource_ID);
}
@Override
public org.compiere.model.I_S_ResourceType getS_ResourceType()
{
return get_ValueAsPO(COLUMNNAME_S_ResourceType_ID, org.compiere.model.I_S_ResourceType.class);
}
@Override
public void setS_ResourceType(final org.compiere.model.I_S_ResourceType S_ResourceType)
{
set_ValueFromPO(COLUMNNAME_S_ResourceType_ID, org.compiere.model.I_S_ResourceType.class, S_ResourceType);
}
@Override
public void setS_ResourceType_ID (final int S_ResourceType_ID)
{
if (S_ResourceType_ID < 1)
set_Value (COLUMNNAME_S_ResourceType_ID, null);
else
set_Value (COLUMNNAME_S_ResourceType_ID, S_ResourceType_ID);
}
@Override
public int getS_ResourceType_ID()
{
|
return get_ValueAsInt(COLUMNNAME_S_ResourceType_ID);
}
@Override
public void setValue (final java.lang.String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
@Override
public java.lang.String getValue()
{
return get_ValueAsString(COLUMNNAME_Value);
}
@Override
public void setWaitingTime (final @Nullable BigDecimal WaitingTime)
{
set_Value (COLUMNNAME_WaitingTime, WaitingTime);
}
@Override
public BigDecimal getWaitingTime()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_WaitingTime);
return bd != null ? bd : BigDecimal.ZERO;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_S_Resource.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class NameAnalysisServiceImpl implements NameAnalysisService {
private NameRequest lastNameRequest;
private AgeAnalysisService ageAnalysisService;
private CountryAnalysisService countryAnalysisService;
private GenderAnalysisService genderAnalysisService;
private NameAnalysisEntityFactory nameAnalysisEntityFactory;
@Autowired
public NameAnalysisServiceImpl(AgeAnalysisService ageAnalysisService, CountryAnalysisService countryAnalysisService, GenderAnalysisService genderAnalysisService, NameAnalysisEntityFactory nameAnalysisEntityFactory) {
super();
this.ageAnalysisService = ageAnalysisService;
this.countryAnalysisService = countryAnalysisService;
this.genderAnalysisService = genderAnalysisService;
this.nameAnalysisEntityFactory = nameAnalysisEntityFactory;
lastNameRequest = new NameRequest();
lastNameRequest.setName("Rigoberto");
}
public NameRequest getLastNameRequest() {
return lastNameRequest;
}
|
public CompletableFuture<NameAnalysisEntity> searchForName(NameRequest nameRequest) {
this.lastNameRequest.setName(nameRequest.getName());
return analyzeName();
}
@Async
private CompletableFuture<NameAnalysisEntity> analyzeName() {
try {
String nameToAnalyze = URLEncoder.encode(lastNameRequest.getName(), "UTF-8");
ResponseEntity<NameAgeEntity> ageRequestResponse = ageAnalysisService.getAgeAnalysisForName(nameToAnalyze);
ResponseEntity<NameCountriesEntity> countriesRequestResponse = countryAnalysisService.getCountryAnalysisForName(nameToAnalyze);
ResponseEntity<NameGenderEntity> genderRequestResponse = genderAnalysisService.getGenderAnalysisForName(nameToAnalyze);
NameAnalysisEntity nameAnalysis = nameAnalysisEntityFactory.getInstance(lastNameRequest.getName(), genderRequestResponse.getBody(), ageRequestResponse.getBody(), countriesRequestResponse.getBody());
return CompletableFuture.completedFuture(nameAnalysis);
} catch (Exception e) {
return CompletableFuture.failedFuture(e);
}
}
}
|
repos\tutorials-master\spring-web-modules\spring-thymeleaf-attributes\accessing-session-attributes\src\main\java\com\baeldung\accesing_session_attributes\business\impl\NameAnalysisServiceImpl.java
| 2
|
请完成以下Java代码
|
public Long getOneMinutePass() {
return oneMinutePass;
}
public void setOneMinutePass(Long oneMinutePass) {
this.oneMinutePass = oneMinutePass;
}
public Long getOneMinuteBlock() {
return oneMinuteBlock;
}
public void setOneMinuteBlock(Long oneMinuteBlock) {
this.oneMinuteBlock = oneMinuteBlock;
}
public Long getOneMinuteException() {
return oneMinuteException;
}
public void setOneMinuteException(Long oneMinuteException) {
this.oneMinuteException = oneMinuteException;
}
public Long getOneMinuteTotal() {
return oneMinuteTotal;
}
public void setOneMinuteTotal(Long oneMinuteTotal) {
this.oneMinuteTotal = oneMinuteTotal;
}
public boolean isVisible() {
|
return visible;
}
public void setVisible(boolean visible) {
this.visible = visible;
}
public List<ResourceTreeNode> getChildren() {
return children;
}
public void setChildren(List<ResourceTreeNode> children) {
this.children = children;
}
}
|
repos\spring-boot-student-master\spring-boot-student-sentinel-dashboard\src\main\java\com\alibaba\csp\sentinel\dashboard\domain\ResourceTreeNode.java
| 1
|
请完成以下Java代码
|
protected org.compiere.model.POInfo initPO(final Properties ctx)
{
return org.compiere.model.POInfo.getPOInfo(Table_Name);
}
@Override
public void setC_PaymentTerm_Break_ID (final int C_PaymentTerm_Break_ID)
{
if (C_PaymentTerm_Break_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_PaymentTerm_Break_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_PaymentTerm_Break_ID, C_PaymentTerm_Break_ID);
}
@Override
public int getC_PaymentTerm_Break_ID()
{
return get_ValueAsInt(COLUMNNAME_C_PaymentTerm_Break_ID);
}
@Override
public void setC_PaymentTerm_ID (final int C_PaymentTerm_ID)
{
if (C_PaymentTerm_ID < 1)
set_Value (COLUMNNAME_C_PaymentTerm_ID, null);
else
set_Value (COLUMNNAME_C_PaymentTerm_ID, C_PaymentTerm_ID);
}
@Override
public int getC_PaymentTerm_ID()
{
return get_ValueAsInt(COLUMNNAME_C_PaymentTerm_ID);
}
@Override
public void setDescription (final java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
@Override
public java.lang.String getDescription()
{
return get_ValueAsString(COLUMNNAME_Description);
}
@Override
public void setOffsetDays (final int OffsetDays)
{
set_Value (COLUMNNAME_OffsetDays, OffsetDays);
}
@Override
public int getOffsetDays()
{
return get_ValueAsInt(COLUMNNAME_OffsetDays);
|
}
@Override
public void setPercent (final int Percent)
{
set_Value (COLUMNNAME_Percent, Percent);
}
@Override
public int getPercent()
{
return get_ValueAsInt(COLUMNNAME_Percent);
}
/**
* ReferenceDateType AD_Reference_ID=541989
* Reference name: ReferenceDateType
*/
public static final int REFERENCEDATETYPE_AD_Reference_ID=541989;
/** InvoiceDate = IV */
public static final String REFERENCEDATETYPE_InvoiceDate = "IV";
/** BLDate = BL */
public static final String REFERENCEDATETYPE_BLDate = "BL";
/** OrderDate = OD */
public static final String REFERENCEDATETYPE_OrderDate = "OD";
/** LCDate = LC */
public static final String REFERENCEDATETYPE_LCDate = "LC";
/** ETADate = ET */
public static final String REFERENCEDATETYPE_ETADate = "ET";
@Override
public void setReferenceDateType (final java.lang.String ReferenceDateType)
{
set_Value (COLUMNNAME_ReferenceDateType, ReferenceDateType);
}
@Override
public java.lang.String getReferenceDateType()
{
return get_ValueAsString(COLUMNNAME_ReferenceDateType);
}
@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_PaymentTerm_Break.java
| 1
|
请完成以下Java代码
|
/* package */class EmptiesInOutLinePackingMaterialDocumentLine extends AbstractPackingMaterialDocumentLine
{
private final I_M_InOutLine inoutLine;
EmptiesInOutLinePackingMaterialDocumentLine(final I_M_InOutLine inoutLine)
{
super();
Check.assumeNotNull(inoutLine, "inoutLine not null");
this.inoutLine = inoutLine;
}
public I_M_InOutLine getM_InOutLine()
{
return inoutLine;
}
@Override
public ProductId getProductId()
{
return ProductId.ofRepoId(inoutLine.getM_Product_ID());
}
/**
* @returns MovementQty of the wrapped inout line
*/
@Override
public BigDecimal getQty()
{
return inoutLine.getMovementQty();
}
/**
|
* Sets both MovementQty and QtyEntered of the wrapped order line.
*
* @param qty MovementQty which will also be converted to QtyEntered.
*/
@Override
protected void setQty(final BigDecimal qty)
{
inoutLine.setMovementQty(qty);
final IUOMConversionBL uomConversionBL = Services.get(IUOMConversionBL.class);
final BigDecimal qtyEntered = uomConversionBL.convertFromProductUOM(getProductId(), UomId.ofRepoId(inoutLine.getC_UOM_ID()), qty);
inoutLine.setQtyEntered(qtyEntered);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\empties\EmptiesInOutLinePackingMaterialDocumentLine.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public static void clearMainProductPriceMatchers()
{
if (!Adempiere.isUnitTestMode())
{
throw new AdempiereException("Resetting main product matchers is allowed only when running in JUnit mode");
}
MATCHERS_MainProductPrice.clear();
logger.info("Cleared all main product matchers");
}
@Nullable public static <T extends I_M_ProductPrice> T iterateAllPriceListVersionsAndFindProductPrice(
@Nullable final I_M_PriceList_Version startPriceListVersion,
@NonNull final Function<I_M_PriceList_Version, T> productPriceMapper,
@NonNull final ZonedDateTime priceDate)
{
if (startPriceListVersion == null)
{
return null;
}
final IPriceListDAO priceListsRepo = Services.get(IPriceListDAO.class);
final Set<Integer> checkedPriceListVersionIds = new HashSet<>();
I_M_PriceList_Version currentPriceListVersion = startPriceListVersion;
while (currentPriceListVersion != null)
{
// Stop here if the price list version was already considered
if (!checkedPriceListVersionIds.add(currentPriceListVersion.getM_PriceList_Version_ID()))
{
return null;
}
final T productPrice = productPriceMapper.apply(currentPriceListVersion);
if (productPrice != null)
{
return productPrice;
}
|
currentPriceListVersion = priceListsRepo.getBasePriceListVersionForPricingCalculationOrNull(currentPriceListVersion, priceDate);
}
return null;
}
/**
* @deprecated Please use {@link IPriceListDAO#addProductPrice(AddProductPriceRequest)}. If doesn't fit, extend it ;)
*/
@Deprecated
public static I_M_ProductPrice createProductPriceOrUpdateExistentOne(@NonNull final ProductPriceCreateRequest ppRequest, @NonNull final I_M_PriceList_Version plv)
{
final IProductDAO productDAO = Services.get(IProductDAO.class);
final BigDecimal price = ppRequest.getPrice().setScale(2);
I_M_ProductPrice pp = ProductPrices.retrieveMainProductPriceOrNull(plv, ProductId.ofRepoId(ppRequest.getProductId()));
if (pp == null)
{
pp = newInstance(I_M_ProductPrice.class, plv);
}
// do not update the price with value 0; 0 means that no price was changed
else if (pp != null && price.signum() == 0)
{
return pp;
}
pp.setM_PriceList_Version_ID(plv.getM_PriceList_Version_ID());
pp.setM_Product_ID(ppRequest.getProductId());
pp.setSeqNo(ppRequest.getSeqNo());
pp.setPriceLimit(price);
pp.setPriceList(price);
pp.setPriceStd(price);
final org.compiere.model.I_M_Product product = productDAO.getById(ppRequest.getProductId());
pp.setC_UOM_ID(product.getC_UOM_ID());
pp.setC_TaxCategory_ID(ppRequest.getTaxCategoryId());
save(pp);
return pp;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\pricing\service\ProductPrices.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public Collection<Document> moviesByKeywords(String keywords) {
List<Bson> pipeline = asList(
search(
text(
fieldPath("fullplot"), keywords
),
searchOptions()
.index(config.getQueryIndex())
),
project(fields(
excludeId(),
include("title", "year", "fullplot", "imdb.rating")
))
);
debug(pipeline);
return collection.aggregate(pipeline)
.into(new ArrayList<>());
}
public Document genresThroughTheDecades(String genre) {
List<Bson> pipeline = asList(
searchMeta(
facet(
text(
fieldPath("genres"), genre
),
asList(
stringFacet("genresFacet",
fieldPath("genres")
|
).numBuckets(5),
numberFacet("yearFacet",
fieldPath("year"),
asList(1900, 1930, 1960, 1990, 2020)
)
)
),
searchOptions()
.index(config.getFacetIndex())
)
);
debug(pipeline);
return collection.aggregate(pipeline)
.first();
}
}
|
repos\tutorials-master\persistence-modules\spring-boot-persistence-mongodb-3\src\main\java\com\baeldung\boot\atlassearch\service\MovieAtlasSearchService.java
| 2
|
请完成以下Java代码
|
public void setC_Invoice_Cand_ToClear_ID (int C_Invoice_Cand_ToClear_ID)
{
if (C_Invoice_Cand_ToClear_ID < 1)
set_Value (COLUMNNAME_C_Invoice_Cand_ToClear_ID, null);
else
set_Value (COLUMNNAME_C_Invoice_Cand_ToClear_ID, Integer.valueOf(C_Invoice_Cand_ToClear_ID));
}
/** Get Zu verrechnender Rechn-Kand..
@return Zu verrechnender Rechn-Kand. */
@Override
public int getC_Invoice_Cand_ToClear_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Invoice_Cand_ToClear_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Rechnungskanditad - Verrechnung.
|
@param C_Invoice_Clearing_Alloc_ID Rechnungskanditad - Verrechnung */
@Override
public void setC_Invoice_Clearing_Alloc_ID (int C_Invoice_Clearing_Alloc_ID)
{
if (C_Invoice_Clearing_Alloc_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Invoice_Clearing_Alloc_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Invoice_Clearing_Alloc_ID, Integer.valueOf(C_Invoice_Clearing_Alloc_ID));
}
/** Get Rechnungskanditad - Verrechnung.
@return Rechnungskanditad - Verrechnung */
@Override
public int getC_Invoice_Clearing_Alloc_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Invoice_Clearing_Alloc_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java-gen\de\metas\contracts\model\X_C_Invoice_Clearing_Alloc.java
| 1
|
请完成以下Java代码
|
public void setDescription (java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
@Override
public java.lang.String getDescription()
{
return (java.lang.String)get_Value(COLUMNNAME_Description);
}
@Override
public void setInvoiceProcessingServiceCompany_ID (int InvoiceProcessingServiceCompany_ID)
{
if (InvoiceProcessingServiceCompany_ID < 1)
set_ValueNoCheck (COLUMNNAME_InvoiceProcessingServiceCompany_ID, null);
else
set_ValueNoCheck (COLUMNNAME_InvoiceProcessingServiceCompany_ID, Integer.valueOf(InvoiceProcessingServiceCompany_ID));
}
@Override
public int getInvoiceProcessingServiceCompany_ID()
{
return get_ValueAsInt(COLUMNNAME_InvoiceProcessingServiceCompany_ID);
}
@Override
public void setServiceCompany_BPartner_ID (int ServiceCompany_BPartner_ID)
{
if (ServiceCompany_BPartner_ID < 1)
set_Value (COLUMNNAME_ServiceCompany_BPartner_ID, null);
else
set_Value (COLUMNNAME_ServiceCompany_BPartner_ID, Integer.valueOf(ServiceCompany_BPartner_ID));
}
@Override
public int getServiceCompany_BPartner_ID()
{
return get_ValueAsInt(COLUMNNAME_ServiceCompany_BPartner_ID);
}
|
@Override
public void setServiceFee_Product_ID (int ServiceFee_Product_ID)
{
if (ServiceFee_Product_ID < 1)
set_Value (COLUMNNAME_ServiceFee_Product_ID, null);
else
set_Value (COLUMNNAME_ServiceFee_Product_ID, Integer.valueOf(ServiceFee_Product_ID));
}
@Override
public int getServiceFee_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_ServiceFee_Product_ID);
}
@Override
public void setServiceInvoice_DocType_ID (int ServiceInvoice_DocType_ID)
{
if (ServiceInvoice_DocType_ID < 1)
set_Value (COLUMNNAME_ServiceInvoice_DocType_ID, null);
else
set_Value (COLUMNNAME_ServiceInvoice_DocType_ID, Integer.valueOf(ServiceInvoice_DocType_ID));
}
@Override
public int getServiceInvoice_DocType_ID()
{
return get_ValueAsInt(COLUMNNAME_ServiceInvoice_DocType_ID);
}
@Override
public void setValidFrom (java.sql.Timestamp ValidFrom)
{
set_Value (COLUMNNAME_ValidFrom, ValidFrom);
}
@Override
public java.sql.Timestamp getValidFrom()
{
return get_ValueAsTimestamp(COLUMNNAME_ValidFrom);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_InvoiceProcessingServiceCompany.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class BookstoreService {
private final AuthorRepository authorRepository;
private final BookRepository bookRepository;
public BookstoreService(AuthorRepository authorRepository,
BookRepository bookRepository) {
this.authorRepository = authorRepository;
this.bookRepository = bookRepository;
}
public void addAuthorWithBooks(){
Author author = new Author();
author.setName("Alicia Tom");
author.setAge(38);
author.setGenre("Anthology");
Book book = new Book();
book.setIsbn("001-AT");
book.setTitle("The book of swords");
author.addBook(book); // use addBook() helper
authorRepository.save(author);
}
|
@Transactional
public void removeBookOfAuthor() {
Author author = authorRepository.findByName("Alicia Tom");
Book book = bookRepository.findByTitle("The book of swords");
author.removeBook(book); // use removeBook() helper
}
@Transactional
public void removeAllBooksOfAuthor() {
Author author = authorRepository.findByName("Joana Nimar");
author.removeBooks(); // use removeBooks() helper
}
}
|
repos\Hibernate-SpringBoot-master\HibernateSpringBootFlywayMySQLDatabase\src\main\java\com\bookstore\service\BookstoreService.java
| 2
|
请完成以下Java代码
|
protected PulsarConnectionDetails getDockerComposeConnectionDetails(DockerComposeConnectionSource source) {
return new PulsarDockerComposeConnectionDetails(source.getRunningService());
}
/**
* {@link PulsarConnectionDetails} backed by a {@code pulsar} {@link RunningService}.
*/
static class PulsarDockerComposeConnectionDetails extends DockerComposeConnectionDetails
implements PulsarConnectionDetails {
private final String brokerUrl;
private final String adminUrl;
PulsarDockerComposeConnectionDetails(RunningService service) {
super(service);
ConnectionPorts ports = service.ports();
|
this.brokerUrl = "pulsar://%s:%s".formatted(service.host(), ports.get(BROKER_PORT));
this.adminUrl = "http://%s:%s".formatted(service.host(), ports.get(ADMIN_PORT));
}
@Override
public String getBrokerUrl() {
return this.brokerUrl;
}
@Override
public String getAdminUrl() {
return this.adminUrl;
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-pulsar\src\main\java\org\springframework\boot\pulsar\docker\compose\PulsarDockerComposeConnectionDetailsFactory.java
| 1
|
请完成以下Java代码
|
public String getMDC(@NonNull final String name)
{
return mdcContextMap.get(name);
}
/**
* Marks this exception as user validation error.
* In case an exception is a user validation error, the framework assumes the message is user friendly and can be displayed directly.
* More, the webui auto-saving will not hide/ignore this error put it will propagate it directly to user.
*/
@OverridingMethodsMustInvokeSuper
public AdempiereException markAsUserValidationError()
{
userValidationError = true;
return this;
}
public final boolean isUserValidationError()
{
return userValidationError;
}
public static boolean isUserValidationError(final Throwable ex)
{
|
return (ex instanceof AdempiereException) && ((AdempiereException)ex).isUserValidationError();
}
/**
* Fluent version of {@link #addSuppressed(Throwable)}
*/
public AdempiereException suppressing(@NonNull final Throwable exception)
{
addSuppressed(exception);
return this;
}
/**
* Override with a method returning false if your exception is more of a signal than an error
* and shall not clutter the log when it is caught and rethrown by the transaction manager.
* <p>
* To be invoked by {@link AdempiereException#isThrowableLoggedInTrxManager(Throwable)}.
*/
protected boolean isLoggedInTrxManager()
{
return true;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\adempiere\exceptions\AdempiereException.java
| 1
|
请完成以下Java代码
|
protected void addPasswordCheckerAndThrowErrorIfAlreadyAvailable(PasswordEncryptor encryptor) {
if(passwordChecker.containsKey(encryptor.hashAlgorithmName())){
throw LOG.hashAlgorithmForPasswordEncryptionAlreadyAvailableException(encryptor.hashAlgorithmName());
}
passwordChecker.put(encryptor.hashAlgorithmName(), encryptor);
}
protected void addDefaultEncryptor(PasswordEncryptor defaultPasswordEncryptor) {
this.defaultPasswordEncryptor = defaultPasswordEncryptor;
passwordChecker.put(defaultPasswordEncryptor.hashAlgorithmName(), defaultPasswordEncryptor);
}
public String encrypt(String password){
String prefix = prefixHandler.generatePrefix(defaultPasswordEncryptor.hashAlgorithmName());
return prefix + defaultPasswordEncryptor.encrypt(password);
}
|
public boolean check(String password, String encrypted){
PasswordEncryptor encryptor = getCorrectEncryptorForPassword(encrypted);
String encryptedPasswordWithoutPrefix = prefixHandler.removePrefix(encrypted);
ensureNotNull("encryptedPasswordWithoutPrefix", encryptedPasswordWithoutPrefix);
return encryptor.check(password, encryptedPasswordWithoutPrefix);
}
protected PasswordEncryptor getCorrectEncryptorForPassword(String encryptedPassword) {
String hashAlgorithmName = prefixHandler.retrieveAlgorithmName(encryptedPassword);
if(hashAlgorithmName == null || !passwordChecker.containsKey(hashAlgorithmName)){
throw LOG.cannotResolveAlgorithmPrefixFromGivenPasswordException(hashAlgorithmName, passwordChecker.keySet());
}
return passwordChecker.get(hashAlgorithmName);
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\digest\PasswordManager.java
| 1
|
请完成以下Java代码
|
public void reactivateIfNoReceiptScheduleProcessed(final I_C_Order order)
{
if (!isEligibleForReceiptSchedule(order))
{
return;
}
final boolean isAllowReactivationIfReceiptsCreated = isAllowReactivationIfReceiptsCreated();
if (!isAllowReactivationIfReceiptsCreated && hasProcessedReceiptSchedules(order))
{
throw new DocumentActionException(ERR_NoReactivationIfProcessedReceiptSchedules);
}
}
@DocValidate(timings = { ModelValidator.TIMING_BEFORE_VOID })
public void VoidIfNoReceiptScheduleProcessed(final I_C_Order order)
{
if (!isEligibleForReceiptSchedule(order))
{
return;
}
if (hasProcessedReceiptSchedules(order))
{
throw new DocumentActionException(ERR_NoVoidIfProcessedReceiptSchedules);
}
}
public boolean hasProcessedReceiptSchedules(final I_C_Order order)
{
// services
final IOrderDAO orderDAO = Services.get(IOrderDAO.class);
final IReceiptScheduleDAO receiptScheduleDAO = Services.get(IReceiptScheduleDAO.class);
final List<I_C_OrderLine> orderLines = orderDAO.retrieveOrderLines(order);
for (final I_C_OrderLine orderLine : orderLines)
{
final I_M_ReceiptSchedule receiptSchedule = receiptScheduleDAO.retrieveForRecord(orderLine);
|
// Throw exception if at least one processed receipt schedule is linked to a line of this order
if (receiptSchedule != null && receiptSchedule.isProcessed())
{
return true;
}
}
return false;
}
@DocValidate(timings = ModelValidator.TIMING_BEFORE_CLOSE)
public void closeReceiptSchedules(final I_C_Order order)
{
if (!isEligibleForReceiptSchedule(order))
{
return;
}
// services
final IOrderDAO orderDAO = Services.get(IOrderDAO.class);
final IReceiptScheduleDAO receiptScheduleDAO = Services.get(IReceiptScheduleDAO.class);
final IReceiptScheduleBL receiptScheduleBL = Services.get(IReceiptScheduleBL.class);
final List<I_C_OrderLine> orderLines = orderDAO.retrieveOrderLines(order);
for (final I_C_OrderLine orderLine : orderLines)
{
final I_M_ReceiptSchedule receiptSchedule = receiptScheduleDAO.retrieveForRecord(orderLine);
if (receiptSchedule == null || receiptScheduleBL.isClosed(receiptSchedule))
{
continue;
}
receiptScheduleBL.close(receiptSchedule);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\inoutcandidate\modelvalidator\C_Order_ReceiptSchedule.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private WFResponsible retrieveWFResponsibleById(final @NonNull WFResponsibleId responsibleId)
{
final I_AD_WF_Responsible record = InterfaceWrapperHelper.loadOutOfTrx(responsibleId, I_AD_WF_Responsible.class);
return WFResponsible.builder()
.id(responsibleId)
.type(WFResponsibleType.ofCode(record.getResponsibleType()))
.name(record.getName())
.userId(record.getAD_User_ID() > 0 ? UserId.ofRepoId(record.getAD_User_ID()) : null)
.roleId(record.getAD_Role_ID() > 0 ? RoleId.ofRepoId(record.getAD_Role_ID()) : null)
.orgId(record.getAD_Org_ID() > 0 ? OrgId.ofRepoId(record.getAD_Org_ID()) : null)
.build();
}
@Override
public void onBeforeSave(final I_AD_WF_Node wfNodeRecord, final boolean newRecord)
{
final I_AD_Workflow workflow = InterfaceWrapperHelper.load(wfNodeRecord.getAD_Workflow_ID(), I_AD_Workflow.class);
if (X_AD_Workflow.WORKFLOWTYPE_Manufacturing.equals(workflow.getWorkflowType()))
{
wfNodeRecord.setAction(X_AD_WF_Node.ACTION_WaitSleep);
return;
}
final WFNodeAction action = WFNodeAction.ofCode(wfNodeRecord.getAction());
if (action == WFNodeAction.WaitSleep)
{
;
}
else if (action == WFNodeAction.AppsProcess || action == WFNodeAction.AppsReport)
{
if (wfNodeRecord.getAD_Process_ID() <= 0)
{
throw new FillMandatoryException(I_AD_WF_Node.COLUMNNAME_AD_Process_ID);
}
}
else if (action == WFNodeAction.AppsTask)
{
if (wfNodeRecord.getAD_Task_ID() <= 0)
{
throw new FillMandatoryException("AD_Task_ID");
}
}
else if (action == WFNodeAction.DocumentAction)
{
if (wfNodeRecord.getDocAction() == null || wfNodeRecord.getDocAction().length() == 0)
{
throw new FillMandatoryException("DocAction");
}
}
else if (action == WFNodeAction.EMail)
{
if (wfNodeRecord.getR_MailText_ID() <= 0)
{
throw new FillMandatoryException("R_MailText_ID");
}
}
else if (action == WFNodeAction.SetVariable)
{
if (wfNodeRecord.getAttributeValue() == null)
{
throw new FillMandatoryException("AttributeValue");
}
}
else if (action == WFNodeAction.SubWorkflow)
{
if (wfNodeRecord.getAD_Workflow_ID() <= 0)
{
throw new FillMandatoryException("AD_Workflow_ID");
}
}
|
else if (action == WFNodeAction.UserChoice)
{
if (wfNodeRecord.getAD_Column_ID() <= 0)
{
throw new FillMandatoryException("AD_Column_ID");
}
}
else if (action == WFNodeAction.UserForm)
{
if (wfNodeRecord.getAD_Form_ID() <= 0)
{
throw new FillMandatoryException("AD_Form_ID");
}
}
else if (action == WFNodeAction.UserWindow)
{
if (wfNodeRecord.getAD_Window_ID() <= 0)
{
throw new FillMandatoryException("AD_Window_ID");
}
}
}
@Override
public ITranslatableString getWFNodeName(
@NonNull final WorkflowId workflowId,
@NonNull final WFNodeId nodeId)
{
return getById(workflowId)
.getNodeById(nodeId)
.getName();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\workflow\service\impl\ADWorkflowDAO.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public Integer calByVistor(@RequestParam String expr) {
try {
// Debug log for incoming expression
System.out.println("Received expression: " + expr);
// Handle URL encoded newline characters
expr = expr.replace("%20", " ").replace("%5Cn", "\n");
System.out.println("Processed expression: " + expr);
// Initialize ANTLR components
ANTLRInputStream input = new ANTLRInputStream(expr);
LabeledExprLexer lexer = new LabeledExprLexer(input);
CommonTokenStream tokens = new CommonTokenStream(lexer);
LabeledExprParser parser = new LabeledExprParser(tokens);
ParseTree tree = parser.prog(); // parse
// Debug log for parse tree
System.out.println("Parse tree: " + tree.toStringTree(parser));
// Initialize EvalVisitor
EvalVisitor eval = new EvalVisitor();
int outcome = eval.visit(tree);
return outcome;
} catch (Exception e) {
e.printStackTrace();
return null; // Or handle the error in a more appropriate way
}
}
@GetMapping("/calBylistener")
public String calBylistener(@RequestParam String expr) {
try {
// Handle URL encoded newline characters
expr = expr.replace("%20", " ").replace("%5Cn", "\n");
|
InputStream is = new ByteArrayInputStream(expr.getBytes());
ANTLRInputStream input = new ANTLRInputStream(is);
LabeledExprLexer lexer = new LabeledExprLexer(input);
CommonTokenStream tokens = new CommonTokenStream(lexer);
LabeledExprParser parser = new LabeledExprParser(tokens);
ParseTree tree = parser.prog(); // parse
ParseTreeWalker walker = new ParseTreeWalker();
EvalListener listener = new EvalListener();
walker.walk(listener, tree);
// Assuming the listener has a method to get the result of the last expression
int result = listener.getResult();
return String.valueOf(result);
} catch (Exception e) {
e.printStackTrace();
return "Error: " + e.getMessage();
}
}
}
|
repos\springboot-demo-master\ANTLR\src\main\java\com\et\antlr\controller\HelloWorldController.java
| 2
|
请完成以下Java代码
|
private void createConfirmListener(CountDownLatch latch) {
this.channel.addConfirmListener((tag, multiple) -> {
ConcurrentNavigableMap<Long, PendingMessage> confirmed = pendingDelivery.headMap(tag, true);
log.debug("[{}#{}/{}] messages acked: {}", multiple, tag, pendingDelivery.size(), confirmed.size());
confirmed.clear();
if (latch != null && pendingDelivery.isEmpty()) {
log.info("publishing complete");
latch.countDown();
}
}, (tag, multiple) -> {
ConcurrentNavigableMap<Long, PendingMessage> failed = pendingDelivery.headMap(tag, true);
log.debug("[{}#{}/{}] messages nacked: {}", multiple, tag, pendingDelivery.size(), failed.size());
failed.values()
.removeIf(pending -> {
pending.incrementTries();
boolean giveUp = pending.getTries() >= MAX_TRIES;
log.warn("retry info: {}", pending);
return giveUp;
});
if (pendingDelivery.isEmpty()) {
log.info("publishing completed with nacks");
if (latch != null) {
latch.countDown();
}
} else {
publishPending();
}
});
}
private void publishPending() {
|
log.info("retrying failed deliveries...");
pendingDelivery.entrySet()
.removeIf(entry -> {
long tag = entry.getKey();
PendingMessage message = entry.getValue();
try {
log.debug("{} - retried, {} remaining", message, pendingDelivery.size());
channel.basicPublish("", queue, null, message.getBody()
.getBytes());
return false;
} catch (IOException e) {
log.error("can't publish #" + tag, e);
return true;
}
});
}
}
|
repos\tutorials-master\messaging-modules\rabbitmq\src\main\java\com\baeldung\consumerackspubconfirms\UuidPublisher.java
| 1
|
请完成以下Java代码
|
public class AttributeReferenceCollectionBuilderImpl<T extends ModelElementInstance> implements AttributeReferenceCollectionBuilder<T>, ModelBuildOperation {
private final AttributeImpl<String> referenceSourceAttribute;
protected AttributeReferenceCollection<T> attributeReferenceCollection;
private final Class<T> referenceTargetElement;
@SuppressWarnings({ "unchecked", "rawtypes" })
public AttributeReferenceCollectionBuilderImpl(AttributeImpl<String> attribute, Class<T> referenceTargetElement, Class<? extends AttributeReferenceCollection> attributeReferenceCollection) {
this.referenceSourceAttribute = attribute;
this.referenceTargetElement = referenceTargetElement;
try {
this.attributeReferenceCollection = (AttributeReferenceCollection<T>) attributeReferenceCollection.getConstructor(AttributeImpl.class)
.newInstance(referenceSourceAttribute);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public AttributeReferenceCollection<T> build() {
referenceSourceAttribute.registerOutgoingReference(attributeReferenceCollection);
return attributeReferenceCollection;
}
@SuppressWarnings("unchecked")
public void performModelBuild(Model model) {
// register declaring type as a referencing type of referenced type
ModelElementTypeImpl referenceTargetType = (ModelElementTypeImpl) model.getType(referenceTargetElement);
|
// the actual referenced type
attributeReferenceCollection.setReferenceTargetElementType(referenceTargetType);
// the referenced attribute may be declared on a base type of the referenced type.
AttributeImpl<String> idAttribute = (AttributeImpl<String>) referenceTargetType.getAttribute("id");
if(idAttribute != null) {
idAttribute.registerIncoming(attributeReferenceCollection);
attributeReferenceCollection.setReferenceTargetAttribute(idAttribute);
} else {
throw new ModelException("Element type " + referenceTargetType.getTypeNamespace() + ":" + referenceTargetType.getTypeName() + " has no id attribute");
}
}
}
|
repos\camunda-bpm-platform-master\model-api\xml-model\src\main\java\org\camunda\bpm\model\xml\impl\type\reference\AttributeReferenceCollectionBuilderImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class TaskFactory {
/**
* 模拟5秒的异步任务
*/
@Async
public Future<Boolean> asyncTask1() throws InterruptedException {
doTask("asyncTask1", 5);
return new AsyncResult<>(Boolean.TRUE);
}
/**
* 模拟2秒的异步任务
*/
@Async
public Future<Boolean> asyncTask2() throws InterruptedException {
doTask("asyncTask2", 2);
return new AsyncResult<>(Boolean.TRUE);
}
/**
* 模拟3秒的异步任务
*/
@Async
public Future<Boolean> asyncTask3() throws InterruptedException {
doTask("asyncTask3", 3);
return new AsyncResult<>(Boolean.TRUE);
}
/**
* 模拟5秒的同步任务
*/
public void task1() throws InterruptedException {
doTask("task1", 5);
}
/**
* 模拟2秒的同步任务
*/
|
public void task2() throws InterruptedException {
doTask("task2", 2);
}
/**
* 模拟3秒的同步任务
*/
public void task3() throws InterruptedException {
doTask("task3", 3);
}
private void doTask(String taskName, Integer time) throws InterruptedException {
log.info("{}开始执行,当前线程名称【{}】", taskName, Thread.currentThread().getName());
TimeUnit.SECONDS.sleep(time);
log.info("{}执行成功,当前线程名称【{}】", taskName, Thread.currentThread().getName());
}
}
|
repos\spring-boot-demo-master\demo-async\src\main\java\com\xkcoding\async\task\TaskFactory.java
| 2
|
请完成以下Java代码
|
public void setIsDefault (final boolean IsDefault)
{
set_Value (COLUMNNAME_IsDefault, IsDefault);
}
@Override
public boolean isDefault()
{
return get_ValueAsBoolean(COLUMNNAME_IsDefault);
}
@Override
public void setName (final java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
|
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
@Override
public void setSQL_Select (final java.lang.String SQL_Select)
{
set_Value (COLUMNNAME_SQL_Select, SQL_Select);
}
@Override
public java.lang.String getSQL_Select()
{
return get_ValueAsString(COLUMNNAME_SQL_Select);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Zebra_Config.java
| 1
|
请完成以下Java代码
|
public int getC_BPartner_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_BPartner_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Geschäftspartner Document Line Sorting Preferences.
@param C_BP_DocLine_Sort_ID Geschäftspartner Document Line Sorting Preferences */
@Override
public void setC_BP_DocLine_Sort_ID (int C_BP_DocLine_Sort_ID)
{
if (C_BP_DocLine_Sort_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_BP_DocLine_Sort_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_BP_DocLine_Sort_ID, Integer.valueOf(C_BP_DocLine_Sort_ID));
}
/** Get Geschäftspartner Document Line Sorting Preferences.
@return Geschäftspartner Document Line Sorting Preferences */
@Override
public int getC_BP_DocLine_Sort_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_BP_DocLine_Sort_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public org.compiere.model.I_C_DocLine_Sort getC_DocLine_Sort() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_C_DocLine_Sort_ID, org.compiere.model.I_C_DocLine_Sort.class);
|
}
@Override
public void setC_DocLine_Sort(org.compiere.model.I_C_DocLine_Sort C_DocLine_Sort)
{
set_ValueFromPO(COLUMNNAME_C_DocLine_Sort_ID, org.compiere.model.I_C_DocLine_Sort.class, C_DocLine_Sort);
}
/** Set Document Line Sorting Preferences.
@param C_DocLine_Sort_ID Document Line Sorting Preferences */
@Override
public void setC_DocLine_Sort_ID (int C_DocLine_Sort_ID)
{
if (C_DocLine_Sort_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_DocLine_Sort_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_DocLine_Sort_ID, Integer.valueOf(C_DocLine_Sort_ID));
}
/** Get Document Line Sorting Preferences.
@return Document Line Sorting Preferences */
@Override
public int getC_DocLine_Sort_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_DocLine_Sort_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_BP_DocLine_Sort.java
| 1
|
请完成以下Java代码
|
public void setSkipIfAlreadyAuthenticated(boolean skipIfAlreadyAuthenticated) {
this.skipIfAlreadyAuthenticated = skipIfAlreadyAuthenticated;
}
/**
* The session handling strategy which will be invoked immediately after an
* authentication request is successfully processed by the
* <tt>AuthenticationManager</tt>. Used, for example, to handle changing of the
* session identifier to prevent session fixation attacks.
* @param sessionStrategy the implementation to use. If not set a null implementation
* is used.
*/
public void setSessionAuthenticationStrategy(SessionAuthenticationStrategy sessionStrategy) {
this.sessionStrategy = sessionStrategy;
}
/**
* Sets the authentication details source.
* @param authenticationDetailsSource the authentication details source
*/
public void setAuthenticationDetailsSource(
AuthenticationDetailsSource<HttpServletRequest, ?> authenticationDetailsSource) {
Assert.notNull(authenticationDetailsSource, "AuthenticationDetailsSource required");
this.authenticationDetailsSource = authenticationDetailsSource;
}
/**
* If set to {@code false} (the default) and authentication is successful, the request
* will be processed by the next filter in the chain. If {@code true} and
* authentication is successful, the filter chain will stop here.
* @param shouldStop set to {@code true} to prevent the next filter in the chain from
* processing the request after a successful authentication.
* @since 1.0.2
*/
public void setStopFilterChainOnSuccessfulAuthentication(boolean shouldStop) {
this.stopFilterChainOnSuccessfulAuthentication = shouldStop;
}
/**
* Sets the {@link SecurityContextRepository} to save the {@link SecurityContext} on
* authentication success. The default action is not to save the
* {@link SecurityContext}.
* @param securityContextRepository the {@link SecurityContextRepository} to use.
|
* Cannot be null.
*/
public void setSecurityContextRepository(SecurityContextRepository securityContextRepository) {
Assert.notNull(securityContextRepository, "securityContextRepository cannot be null");
this.securityContextRepository = securityContextRepository;
}
/**
* Sets the {@link SecurityContextHolderStrategy} to use. The default action is to use
* the {@link SecurityContextHolderStrategy} stored in {@link SecurityContextHolder}.
* @param securityContextHolderStrategy the {@link SecurityContextHolderStrategy} to
* use. Cannot be null.
*/
public void setSecurityContextHolderStrategy(SecurityContextHolderStrategy securityContextHolderStrategy) {
Assert.notNull(securityContextHolderStrategy, "securityContextHolderStrategy cannot be null");
this.securityContextHolderStrategy = securityContextHolderStrategy;
}
}
|
repos\spring-security-main\kerberos\kerberos-web\src\main\java\org\springframework\security\kerberos\web\authentication\SpnegoAuthenticationProcessingFilter.java
| 1
|
请完成以下Java代码
|
public class ResponseHeaderSettingKerberosAuthenticationSuccessHandler implements AuthenticationSuccessHandler {
private static final String NEGOTIATE_PREFIX = "Negotiate ";
private static final String WWW_AUTHENTICATE = "WWW-Authenticate";
private String headerName = WWW_AUTHENTICATE;
private String headerPrefix = NEGOTIATE_PREFIX;
/**
* Sets the name of the header to set. By default this is 'WWW-Authenticate'.
* @param headerName the www authenticate header name
*/
public void setHeaderName(String headerName) {
this.headerName = headerName;
}
/**
|
* Sets the value of the prefix for the encoded response token value. By default this
* is 'Negotiate '.
* @param headerPrefix the negotiate prefix
*/
public void setHeaderPrefix(String headerPrefix) {
this.headerPrefix = headerPrefix;
}
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws IOException, ServletException {
KerberosServiceRequestToken auth = (KerberosServiceRequestToken) authentication;
if (auth.hasResponseToken()) {
response.addHeader(this.headerName, this.headerPrefix + auth.getEncodedResponseToken());
}
}
}
|
repos\spring-security-main\kerberos\kerberos-web\src\main\java\org\springframework\security\kerberos\web\authentication\ResponseHeaderSettingKerberosAuthenticationSuccessHandler.java
| 1
|
请完成以下Java代码
|
private static String createTableSql(@NonNull final Config config)
{
final String packageName = config.getPackageName();
final StringBuilder sql = new StringBuilder();
sql.append("SELECT AD_Table_ID FROM AD_Table WHERE IsActive='Y'");
if(packageName.equals("org.compiere.model"))
{
sql.append("\n AND (IsView='N' OR TableName IN ('RV_WarehousePrice','RV_BPartner')");
}
//
// EntityType
final String sqlEntityTypeFiter = toSql("EntityType", config.getEntityTypePatterns());
if (sqlEntityTypeFiter != null && !sqlEntityTypeFiter.isEmpty())
{
sql.append("\n AND (").append(sqlEntityTypeFiter).append(")");
}
//
// Table LIKE
final String sqlTableNameFilter = toSql("TableName", config.getTableNamePatterns());
if (sqlTableNameFilter != null && !sqlTableNameFilter.isEmpty())
{
sql.append("\n AND (").append(sqlTableNameFilter).append(")");
}
//
// ORDER BY
sql.append("\n ORDER BY TableName");
|
//
return sql.toString();
}
@Value
@Builder
private static class Config
{
@NonNull
String directory;
@NonNull
String packageName;
@NonNull
ImmutableSet<StringPattern> entityTypePatterns;
@NonNull
ImmutableSet<StringPattern> tableNamePatterns;
}
@Value(staticConstructor = "of")
private static class StringPattern
{
@NonNull String pattern;
public boolean isWithWildcard() {return pattern.contains("%");}
@Override
public String toString() {return isWithWildcard() ? "LIKE " + pattern : pattern;}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\adempiere\util\GenerateModel.java
| 1
|
请完成以下Java代码
|
public CostsRevaluationResult revaluateCosts(@NonNull CostsRevaluationRequest request)
{
final CostSegmentAndElement costSegmentAndElement = request.getCostSegmentAndElement();
final Instant evaluationStartDate = request.getEvaluationStartDate();
final CostAmount newCostPrice = request.getNewCostPrice();
//
// Fetch cost details for our cost segment, starting from evaluation start date
final ImmutableList<CostDetail> costDetails = costDetailsService.stream(
CostDetailQuery.builderFrom(costSegmentAndElement)
.dateAcctRage(Range.atLeast(evaluationStartDate))
.orderBy(CostDetailQuery.OrderBy.DATE_ACCT_ASC)
.orderBy(CostDetailQuery.OrderBy.ID_ASC)
.build())
.collect(ImmutableList.toImmutableList());
//
// Restore current costs at the time before evaluation date
final CostsRevaluationResult.CostsRevaluationResultBuilder result = CostsRevaluationResult.builder();
final CurrentCost currentCost = currentCostsRepo.getOrCreate(costSegmentAndElement);
if (!costDetails.isEmpty())
{
final CostDetail firstCostDetail = costDetails.get(0);
currentCost.setFrom(firstCostDetail.getPreviousAmounts());
}
//
final CostsRevaluationResult.CurrentCostBeforeEvaluation currentCostBeforeEvaluation = CostsRevaluationResult.CurrentCostBeforeEvaluation.builder()
.qty(currentCost.getCurrentQty())
.costPriceOld(currentCost.getCostPrice().getOwnCostPrice())
.costPriceNew(newCostPrice)
.build();
currentCost.setOwnCostPrice(newCostPrice);
result.currentCostBeforeEvaluation(currentCostBeforeEvaluation);
|
//
// Iterate all cost details, calculate adjustments and update the current costs
final CostingMethod costingMethod = costElementsRepo.getById(costSegmentAndElement.getCostElementId()).getCostingMethod();
for (final CostDetail costDetail : costDetails)
{
// Cost details which were not changing the costs (so are there only for recording)
// are not relevant for cost adjustment.
if (!costDetail.isChangingCosts())
{
continue;
}
final CostingMethodHandler handler = getSingleCostingMethodHandler(costingMethod, costDetail.getDocumentRef());
final CostDetailAdjustment costDetailAdjustment = handler.recalculateCostDetailAmountAndUpdateCurrentCost(costDetail, currentCost);
result.costDetailAdjustment(costDetailAdjustment);
}
//
result.currentCostAfterEvaluation(CostsRevaluationResult.CurrentCostAfterEvaluation.builder()
.qty(currentCost.getCurrentQty())
.costPriceComputed(currentCost.getCostPrice().getOwnCostPrice())
.build());
//
return result.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\costing\impl\CostingService.java
| 1
|
请完成以下Java代码
|
public class CleanableHistoricCaseInstanceReportDto extends AbstractQueryDto<CleanableHistoricCaseInstanceReport> {
protected String[] caseDefinitionIdIn;
protected String[] caseDefinitionKeyIn;
protected String[] tenantIdIn;
protected Boolean withoutTenantId;
protected Boolean compact;
protected static final String SORT_BY_FINISHED_VALUE = "finished";
public static final List<String> VALID_SORT_BY_VALUES;
static {
VALID_SORT_BY_VALUES = new ArrayList<String>();
VALID_SORT_BY_VALUES.add(SORT_BY_FINISHED_VALUE);
}
public CleanableHistoricCaseInstanceReportDto() {
}
public CleanableHistoricCaseInstanceReportDto(ObjectMapper objectMapper, MultivaluedMap<String, String> queryParameters) {
super(objectMapper, queryParameters);
}
@CamundaQueryParam(value = "caseDefinitionIdIn", converter = StringArrayConverter.class)
public void setCaseDefinitionIdIn(String[] caseDefinitionIdIn) {
this.caseDefinitionIdIn = caseDefinitionIdIn;
}
@CamundaQueryParam(value = "caseDefinitionKeyIn", converter = StringArrayConverter.class)
public void setCaseDefinitionKeyIn(String[] caseDefinitionKeyIn) {
this.caseDefinitionKeyIn = caseDefinitionKeyIn;
}
@CamundaQueryParam(value = "tenantIdIn", converter = StringArrayConverter.class)
public void setTenantIdIn(String[] tenantIdIn) {
this.tenantIdIn = tenantIdIn;
}
@CamundaQueryParam(value = "withoutTenantId", converter = BooleanConverter.class)
public void setWithoutTenantId(Boolean withoutTenantId) {
this.withoutTenantId = withoutTenantId;
}
|
@CamundaQueryParam(value = "compact", converter = BooleanConverter.class)
public void setCompact(Boolean compact) {
this.compact = compact;
}
@Override
protected boolean isValidSortByValue(String value) {
return VALID_SORT_BY_VALUES.contains(value);
}
@Override
protected CleanableHistoricCaseInstanceReport createNewQuery(ProcessEngine engine) {
return engine.getHistoryService().createCleanableHistoricCaseInstanceReport();
}
@Override
protected void applyFilters(CleanableHistoricCaseInstanceReport query) {
if (caseDefinitionIdIn != null && caseDefinitionIdIn.length > 0) {
query.caseDefinitionIdIn(caseDefinitionIdIn);
}
if (caseDefinitionKeyIn != null && caseDefinitionKeyIn.length > 0) {
query.caseDefinitionKeyIn(caseDefinitionKeyIn);
}
if (Boolean.TRUE.equals(withoutTenantId)) {
query.withoutTenantId();
}
if (tenantIdIn != null && tenantIdIn.length > 0) {
query.tenantIdIn(tenantIdIn);
}
if (Boolean.TRUE.equals(compact)) {
query.compact();
}
}
@Override
protected void applySortBy(CleanableHistoricCaseInstanceReport query, String sortBy, Map<String, Object> parameters, ProcessEngine engine) {
if (sortBy.equals(SORT_BY_FINISHED_VALUE)) {
query.orderByFinished();
}
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\history\CleanableHistoricCaseInstanceReportDto.java
| 1
|
请完成以下Java代码
|
private static class CTAction extends UIAction
{
/**
* Constructor
*/
public CTAction (String actionName)
{
super (actionName);
} // Action
@Override
public void actionPerformed (ActionEvent e)
{
String key = getName();
if (!key.equals(ACTION_SELECT)
|
|| !(e.getSource() instanceof CTabbedPane))
return;
CTabbedPane pane = (CTabbedPane)e.getSource();
String command = e.getActionCommand();
if (command == null || command.length() != 1)
return;
int index = command.charAt(0)-'1';
if (index > -1 && index < pane.getTabCount())
pane.setSelectedIndex(index);
else
System.out.println("Action: " + e);
} // actionPerformed
} // Action
} // CTabbedPane
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\swing\CTabbedPane.java
| 1
|
请完成以下Java代码
|
public boolean isEmpty()
{
return isPlain() && Check.isEmpty(value);
}
public static boolean isEmpty(@Nullable final HashableString hashableString)
{
return hashableString == null || hashableString.isEmpty();
}
public boolean isPlain()
{
return !isHashed();
}
public HashableString hash()
{
final String salt = UIDStringUtil.createRandomUUID();
return hashWithSalt(salt);
}
public HashableString hashWithSalt(@Nullable final String salt)
{
if (hashed)
{
return this;
}
HashableString hashedObject = _hashedObject;
if (hashedObject == null)
{
final String valueHashed = hashValue(value, salt);
hashedObject = _hashedObject = new HashableString(valueHashed, true, salt);
}
return hashedObject;
}
private static String hashValue(final String valuePlain, @Nullable final String salt)
{
// IMPORTANT: please keep it in sync with "hash_column_value" database function
final String valuePlainNorm = valuePlain != null ? valuePlain : "";
final String valueWithSalt;
if (salt != null && !salt.isEmpty())
{
valueWithSalt = valuePlainNorm + salt;
}
else
{
valueWithSalt = valuePlainNorm;
}
final HashCode valueHashed = Hashing.sha512().hashString(valueWithSalt, StandardCharsets.UTF_8);
final String valueHashedAndEncoded = valueHashed.toString(); // hex encoding
return PREFIX_SHA512 + valueHashedAndEncoded + SEPARATOR + salt;
}
public boolean isMatching(@Nullable final HashableString other)
{
if (this == other)
|
{
return true;
}
if (other == null)
{
return false;
}
if (isPlain())
{
if (other.isPlain())
{
return valueEquals(other.value);
}
else
{
return hashWithSalt(other.salt).valueEquals(other.value);
}
}
else
{
if (other.isPlain())
{
return other.hashWithSalt(salt).valueEquals(value);
}
else
{
return valueEquals(other.value);
}
}
}
private boolean valueEquals(final String otherValue)
{
return Objects.equals(this.value, otherValue);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\de\metas\util\hash\HashableString.java
| 1
|
请完成以下Java代码
|
public class SignalCmd implements Command<Object>, Serializable {
private static final long serialVersionUID = 1L;
protected String executionId;
protected String signalName;
protected Object signalData;
protected final Map<String, Object> processVariables;
public SignalCmd(String executionId, String signalName, Object signalData, Map<String, Object> processVariables) {
this.executionId = executionId;
this.signalName = signalName;
this.signalData = signalData;
this.processVariables = processVariables;
}
public Object execute(CommandContext commandContext) {
ensureNotNull(BadUserRequestException.class, "executionId is null", "executionId", executionId);
ExecutionEntity execution = commandContext
|
.getExecutionManager()
.findExecutionById(executionId);
ensureNotNull(BadUserRequestException.class, "execution "+executionId+" doesn't exist", "execution", execution);
for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkUpdateProcessInstance(execution);
}
if(processVariables != null) {
execution.setVariables(processVariables);
}
execution.signal(signalName, signalData);
return null;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmd\SignalCmd.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 Statement date.
@param StatementDate
Date of the statement
*/
public void setStatementDate (Timestamp StatementDate)
{
set_Value (COLUMNNAME_StatementDate, StatementDate);
}
/** Get Statement date.
@return Date of the statement
*/
public Timestamp getStatementDate ()
{
return (Timestamp)get_Value(COLUMNNAME_StatementDate);
}
/** Set Statement difference.
@param StatementDifference
Difference between statement ending balance and actual ending balance
*/
public void setStatementDifference (BigDecimal StatementDifference)
{
set_Value (COLUMNNAME_StatementDifference, StatementDifference);
}
/** Get Statement difference.
@return Difference between statement ending balance and actual ending balance
*/
public BigDecimal getStatementDifference ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_StatementDifference);
if (bd == null)
return Env.ZERO;
return bd;
}
public I_C_ElementValue getUser1() throws RuntimeException
{
return (I_C_ElementValue)MTable.get(getCtx(), I_C_ElementValue.Table_Name)
.getPO(getUser1_ID(), get_TrxName()); }
/** Set User List 1.
@param User1_ID
User defined list element #1
*/
public void setUser1_ID (int User1_ID)
{
if (User1_ID < 1)
set_Value (COLUMNNAME_User1_ID, null);
else
set_Value (COLUMNNAME_User1_ID, Integer.valueOf(User1_ID));
}
/** Get User List 1.
@return User defined list element #1
|
*/
public int getUser1_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_User1_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_C_ElementValue getUser2() throws RuntimeException
{
return (I_C_ElementValue)MTable.get(getCtx(), I_C_ElementValue.Table_Name)
.getPO(getUser2_ID(), get_TrxName()); }
/** Set User List 2.
@param User2_ID
User defined list element #2
*/
public void setUser2_ID (int User2_ID)
{
if (User2_ID < 1)
set_Value (COLUMNNAME_User2_ID, null);
else
set_Value (COLUMNNAME_User2_ID, Integer.valueOf(User2_ID));
}
/** Get User List 2.
@return User defined list element #2
*/
public int getUser2_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_User2_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Cash.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private ResourceBundle getResourceBundle()
{
if (_resourceBundle != null)
{
return _resourceBundle;
}
if (!Check.isEmpty(_templateResourceName, true))
{
String baseName = null;
try
{
final int dotIndex = _templateResourceName.lastIndexOf('.');
baseName = dotIndex <= 0 ? _templateResourceName : _templateResourceName.substring(0, dotIndex);
return ResourceBundle.getBundle(baseName, getLocale(), getLoader());
}
catch (final MissingResourceException e)
{
logger.debug("No resource found for {}", baseName);
}
}
|
return null;
}
public Map<String, String> getResourceBundleAsMap()
{
final ResourceBundle bundle = getResourceBundle();
if (bundle == null)
{
return ImmutableMap.of();
}
return ResourceBundleMapWrapper.of(bundle);
}
public JXlsExporter setProperty(@NonNull final String name, @NonNull final Object value)
{
Check.assumeNotEmpty(name, "name not empty");
_properties.put(name, value);
return this;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.report\metasfresh-report-service\src\main\java\de\metas\report\xls\engine\JXlsExporter.java
| 2
|
请完成以下Java代码
|
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Parameter-Name.
@param ParamName Parameter-Name */
public void setParamName (String ParamName)
{
set_Value (COLUMNNAME_ParamName, ParamName);
}
/** Get Parameter-Name.
@return Parameter-Name */
public String getParamName ()
{
return (String)get_Value(COLUMNNAME_ParamName);
}
/** Set Parameterwert.
@param ParamValue Parameterwert */
public void setParamValue (String ParamValue)
{
set_Value (COLUMNNAME_ParamValue, ParamValue);
}
/** Get Parameterwert.
@return Parameterwert */
public String getParamValue ()
{
return (String)get_Value(COLUMNNAME_ParamValue);
|
}
/** Set Reihenfolge.
@param SeqNo
Zur Bestimmung der Reihenfolge der Eintraege; die kleinste Zahl kommt zuerst
*/
public void setSeqNo (int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
}
/** Get Reihenfolge.
@return Zur Bestimmung der Reihenfolge der Eintraege; die kleinste Zahl kommt zuerst
*/
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\de\metas\impex\model\X_Impex_ConnectorParam.java
| 1
|
请完成以下Java代码
|
public void setEventType (final java.lang.String EventType)
{
set_ValueNoCheck (COLUMNNAME_EventType, EventType);
}
@Override
public java.lang.String getEventType()
{
return get_ValueAsString(COLUMNNAME_EventType);
}
@Override
public void setM_ShipmentSchedule_ID (final int M_ShipmentSchedule_ID)
{
if (M_ShipmentSchedule_ID < 1)
set_Value (COLUMNNAME_M_ShipmentSchedule_ID, null);
else
set_Value (COLUMNNAME_M_ShipmentSchedule_ID, M_ShipmentSchedule_ID);
}
@Override
public int getM_ShipmentSchedule_ID()
{
return get_ValueAsInt(COLUMNNAME_M_ShipmentSchedule_ID);
}
@Override
public void setProcessed (final boolean Processed)
{
set_Value (COLUMNNAME_Processed, Processed);
}
@Override
public boolean isProcessed()
{
return get_ValueAsBoolean(COLUMNNAME_Processed);
}
@Override
public void setQty (final @Nullable BigDecimal Qty)
{
set_Value (COLUMNNAME_Qty, Qty);
}
@Override
public BigDecimal getQty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setSeqNo (final int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, SeqNo);
}
@Override
public int getSeqNo()
{
return get_ValueAsInt(COLUMNNAME_SeqNo);
}
|
/**
* Status AD_Reference_ID=540002
* Reference name: C_SubscriptionProgress Status
*/
public static final int STATUS_AD_Reference_ID=540002;
/** Planned = P */
public static final String STATUS_Planned = "P";
/** Open = O */
public static final String STATUS_Open = "O";
/** Delivered = D */
public static final String STATUS_Delivered = "D";
/** InPicking = C */
public static final String STATUS_InPicking = "C";
/** Done = E */
public static final String STATUS_Done = "E";
/** Delayed = H */
public static final String STATUS_Delayed = "H";
@Override
public void setStatus (final java.lang.String Status)
{
set_Value (COLUMNNAME_Status, Status);
}
@Override
public java.lang.String getStatus()
{
return get_ValueAsString(COLUMNNAME_Status);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java-gen\de\metas\contracts\model\X_C_SubscriptionProgress.java
| 1
|
请完成以下Java代码
|
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Set Password Info.
@param PasswordInfo Password Info */
public void setPasswordInfo (String PasswordInfo)
{
set_Value (COLUMNNAME_PasswordInfo, PasswordInfo);
}
/** Get Password Info.
@return Password Info */
public String getPasswordInfo ()
{
return (String)get_Value(COLUMNNAME_PasswordInfo);
}
/** Set Port.
@param Port Port */
public void setPort (int Port)
{
set_Value (COLUMNNAME_Port, Integer.valueOf(Port));
}
/** Get Port.
@return Port */
public int getPort ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Port);
if (ii == null)
return 0;
return ii.intValue();
}
|
/** Set Search Key.
@param Value
Search key for the record in the format required - must be unique
*/
public void setValue (String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
/** Get Search Key.
@return Search key for the record in the format required - must be unique
*/
public String getValue ()
{
return (String)get_Value(COLUMNNAME_Value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_EXP_Processor.java
| 1
|
请完成以下Java代码
|
public void validateExclusiveGateway(
Process process,
ExclusiveGateway exclusiveGateway,
List<ValidationError> errors
) {
if (exclusiveGateway.getOutgoingFlows().isEmpty()) {
addError(errors, Problems.EXCLUSIVE_GATEWAY_NO_OUTGOING_SEQ_FLOW, process, exclusiveGateway);
} else if (exclusiveGateway.getOutgoingFlows().size() == 1) {
SequenceFlow sequenceFlow = exclusiveGateway.getOutgoingFlows().get(0);
if (StringUtils.isNotEmpty(sequenceFlow.getConditionExpression())) {
addError(
errors,
Problems.EXCLUSIVE_GATEWAY_CONDITION_NOT_ALLOWED_ON_SINGLE_SEQ_FLOW,
process,
exclusiveGateway
);
}
} else {
String defaultSequenceFlow = exclusiveGateway.getDefaultFlow();
List<SequenceFlow> flowsWithoutCondition = new ArrayList<SequenceFlow>();
for (SequenceFlow flow : exclusiveGateway.getOutgoingFlows()) {
String condition = flow.getConditionExpression();
boolean isDefaultFlow = flow.getId() != null && flow.getId().equals(defaultSequenceFlow);
boolean hasConditon = StringUtils.isNotEmpty(condition);
if (!hasConditon && !isDefaultFlow) {
flowsWithoutCondition.add(flow);
|
}
if (hasConditon && isDefaultFlow) {
addError(
errors,
Problems.EXCLUSIVE_GATEWAY_CONDITION_ON_DEFAULT_SEQ_FLOW,
process,
exclusiveGateway
);
}
}
if (!flowsWithoutCondition.isEmpty()) {
addWarning(errors, Problems.EXCLUSIVE_GATEWAY_SEQ_FLOW_WITHOUT_CONDITIONS, process, exclusiveGateway);
}
}
}
}
|
repos\Activiti-develop\activiti-core\activiti-process-validation\src\main\java\org\activiti\validation\validator\impl\ExclusiveGatewayValidator.java
| 1
|
请完成以下Java代码
|
public Publisher getPublisher() {
return publisher;
}
public Book setPublisher(Publisher publisher) {
this.publisher = publisher;
return this;
}
public double getCost() {
return cost;
}
public Book setCost(double cost) {
this.cost = cost;
return this;
}
public LocalDateTime getPublishDate() {
return publishDate;
}
public Book setPublishDate(LocalDateTime publishDate) {
this.publishDate = publishDate;
return this;
}
public Set<Book> getCompanionBooks() {
return companionBooks;
}
public Book addCompanionBooks(Book book) {
if (companionBooks != null)
this.companionBooks.add(book);
return this;
}
@Override
public String toString() {
return "Book [isbn=" + isbn + ", title=" + title + ", author=" + author + ", publisher=" + publisher + ", cost=" + cost + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
|
result = prime * result + ((author == null) ? 0 : author.hashCode());
long temp;
temp = Double.doubleToLongBits(cost);
result = prime * result + (int) (temp ^ (temp >>> 32));
result = prime * result + ((isbn == null) ? 0 : isbn.hashCode());
result = prime * result + ((publisher == null) ? 0 : publisher.hashCode());
result = prime * result + ((title == null) ? 0 : title.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;
Book other = (Book) obj;
if (author == null) {
if (other.author != null)
return false;
} else if (!author.equals(other.author))
return false;
if (Double.doubleToLongBits(cost) != Double.doubleToLongBits(other.cost))
return false;
if (isbn == null) {
if (other.isbn != null)
return false;
} else if (!isbn.equals(other.isbn))
return false;
if (publisher == null) {
if (other.publisher != null)
return false;
} else if (!publisher.equals(other.publisher))
return false;
if (title == null) {
if (other.title != null)
return false;
} else if (!title.equals(other.title))
return false;
return true;
}
}
|
repos\tutorials-master\persistence-modules\java-mongodb\src\main\java\com\baeldung\bsontojson\Book.java
| 1
|
请完成以下Java代码
|
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}
public static class CaffeineCacheProviderProperties {
private boolean allowNullValues = true;
private boolean useSystemScheduler = true;
private String defaultSpec = "";
public boolean isAllowNullValues() {
return allowNullValues;
}
public String getDefaultSpec() {
return defaultSpec;
}
public void setAllowNullValues(boolean allowNullValues) {
this.allowNullValues = allowNullValues;
}
public void setDefaultSpec(String defaultSpec) {
this.defaultSpec = defaultSpec;
}
|
public boolean isUseSystemScheduler() {
return useSystemScheduler;
}
public void setUseSystemScheduler(boolean useSystemScheduler) {
this.useSystemScheduler = useSystemScheduler;
}
}
public static class SimpleCacheProviderProperties {
private boolean allowNullValues = true;
public boolean isAllowNullValues() {
return allowNullValues;
}
public void setAllowNullValues(boolean allowNullValues) {
this.allowNullValues = allowNullValues;
}
}
}
|
repos\Activiti-develop\activiti-core-common\activiti-spring-cache-manager\src\main\java\org\activiti\spring\cache\ActivitiSpringCacheManagerProperties.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
protected T loginPage(String loginPage) {
setLoginPage(loginPage);
updateAuthenticationDefaults();
this.customLoginPage = true;
return getSelf();
}
/**
* @return true if a custom login page has been specified, else false
*/
public final boolean isCustomLoginPage() {
return this.customLoginPage;
}
/**
* Gets the Authentication Filter
* @return the Authentication Filter
*/
protected final F getAuthenticationFilter() {
return this.authFilter;
}
/**
* Sets the Authentication Filter
* @param authFilter the Authentication Filter
*/
protected final void setAuthenticationFilter(F authFilter) {
this.authFilter = authFilter;
}
/**
* Gets the login page
* @return the login page
*/
protected final String getLoginPage() {
return this.loginPage;
}
/**
* Gets the Authentication Entry Point
* @return the Authentication Entry Point
*/
protected final AuthenticationEntryPoint getAuthenticationEntryPoint() {
return this.authenticationEntryPoint;
}
/**
* Gets the URL to submit an authentication request to (i.e. where username/password
* must be submitted)
* @return the URL to submit an authentication request to
*/
protected final String getLoginProcessingUrl() {
return this.loginProcessingUrl;
}
/**
* Gets the URL to send users to if authentication fails
* @return the URL to send users if authentication fails (e.g. "/login?error").
*/
protected final String getFailureUrl() {
return this.failureUrl;
}
/**
|
* Updates the default values for authentication.
*/
protected final void updateAuthenticationDefaults() {
if (this.loginProcessingUrl == null) {
loginProcessingUrl(this.loginPage);
}
if (this.failureHandler == null) {
failureUrl(this.loginPage + "?error");
}
LogoutConfigurer<B> logoutConfigurer = getBuilder().getConfigurer(LogoutConfigurer.class);
if (logoutConfigurer != null && !logoutConfigurer.isCustomLogoutSuccess()) {
logoutConfigurer.logoutSuccessUrl(this.loginPage + "?logout");
}
}
/**
* Updates the default values for access.
*/
protected final void updateAccessDefaults(B http) {
if (this.permitAll) {
PermitAllSupport.permitAll(http, this.loginPage, this.loginProcessingUrl, this.failureUrl);
}
}
/**
* Sets the loginPage and updates the {@link AuthenticationEntryPoint}.
* @param loginPage
*/
private void setLoginPage(String loginPage) {
this.loginPage = loginPage;
this.authenticationEntryPoint = new LoginUrlAuthenticationEntryPoint(loginPage);
}
private <C> C getBeanOrNull(B http, Class<C> clazz) {
ApplicationContext context = http.getSharedObject(ApplicationContext.class);
if (context == null) {
return null;
}
return context.getBeanProvider(clazz).getIfUnique();
}
@SuppressWarnings("unchecked")
private T getSelf() {
return (T) this;
}
}
|
repos\spring-security-main\config\src\main\java\org\springframework\security\config\annotation\web\configurers\AbstractAuthenticationFilterConfigurer.java
| 2
|
请完成以下Java代码
|
public TimeRange createTimeRange(
@Nullable final java.util.Date dateFrom,
@Nullable final java.util.Date dateTo)
{
final Instant from = dateFrom == null ? null : dateFrom.toInstant();
final Instant to = dateTo == null ? null : dateTo.toInstant();
return createTimeRange(from, to);
}
private Instant calculateTo()
{
Instant to = SystemTime.asInstant();
if (defaultTimeRangeEndOffset != null)
{
to = to.plus(defaultTimeRangeEndOffset);
}
return to;
}
private Instant calculateFrom(@NonNull final Instant to)
{
if (defaultTimeRange == null || defaultTimeRange.isZero())
|
{
return Instant.ofEpochMilli(0);
}
else
{
return to.minus(defaultTimeRange.abs());
}
}
public KPITimeRangeDefaults compose(final KPITimeRangeDefaults fallback)
{
return builder()
.defaultTimeRange(CoalesceUtil.coalesce(getDefaultTimeRange(), fallback.getDefaultTimeRange()))
.defaultTimeRangeEndOffset(CoalesceUtil.coalesce(getDefaultTimeRangeEndOffset(), fallback.getDefaultTimeRangeEndOffset()))
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\kpi\KPITimeRangeDefaults.java
| 1
|
请完成以下Java代码
|
public synchronized void start() {
if (this.currentGroup != null) {
LOGGER.debug(() -> "Starting first group: " + this.currentGroup);
this.currentGroup.start();
}
this.running = true;
}
public void initialize() {
this.groups.clear();
for (String group : this.groupNames) {
this.groups.add(Objects.requireNonNull(this.applicationContext).getBean(group + ".group", ContainerGroup.class));
}
if (!this.groups.isEmpty()) {
this.iterator = this.groups.iterator();
this.currentGroup = this.iterator.next();
this.groups.forEach(grp -> {
Collection<String> ids = grp.getListenerIds();
ids.forEach(id -> {
MessageListenerContainer container = this.registry.getListenerContainer(id);
if (Objects.requireNonNull(container).getContainerProperties().getIdleEventInterval() == null) {
container.getContainerProperties().setIdleEventInterval(this.defaultIdleEventInterval);
container.setAutoStartup(false);
}
});
});
}
LOGGER.debug(() -> "Found: " + this.groups);
}
|
@Override
public synchronized void stop() {
this.running = false;
if (this.currentGroup != null) {
this.currentGroup.stop();
this.currentGroup = null;
}
}
@Override
public synchronized boolean isRunning() {
return this.running;
}
}
|
repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\listener\ContainerGroupSequencer.java
| 1
|
请完成以下Java代码
|
public List<ActivityExecution> initializeScope(ActivityExecution scopeExecution, int nrOfInstances) {
if (nrOfInstances > 1) {
LOG.unsupportedConcurrencyException(scopeExecution.toString(), this.getClass().getSimpleName());
}
List<ActivityExecution> executions = new ArrayList<ActivityExecution>();
prepareScope(scopeExecution, nrOfInstances);
setLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES, nrOfInstances);
if (nrOfInstances > 0) {
setLoopVariable(scopeExecution, LOOP_COUNTER, 0);
executions.add(scopeExecution);
}
return executions;
}
@Override
public ActivityExecution createInnerInstance(ActivityExecution scopeExecution) {
if (hasLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES) && getLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES) > 0) {
|
throw LOG.unsupportedConcurrencyException(scopeExecution.toString(), this.getClass().getSimpleName());
}
else {
int nrOfInstances = getLoopVariable(scopeExecution, NUMBER_OF_INSTANCES);
setLoopVariable(scopeExecution, LOOP_COUNTER, nrOfInstances);
setLoopVariable(scopeExecution, NUMBER_OF_INSTANCES, nrOfInstances + 1);
setLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES, 1);
}
return scopeExecution;
}
@Override
public void destroyInnerInstance(ActivityExecution scopeExecution) {
removeLoopVariable(scopeExecution, LOOP_COUNTER);
int nrOfActiveInstances = getLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES);
setLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES, nrOfActiveInstances - 1);
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\bpmn\behavior\SequentialMultiInstanceActivityBehavior.java
| 1
|
请完成以下Java代码
|
public B filter(GatewayFilter gatewayFilter) {
this.gatewayFilters.add(gatewayFilter);
return getThis();
}
public B filters(Collection<GatewayFilter> gatewayFilters) {
this.gatewayFilters.addAll(gatewayFilters);
return getThis();
}
public B filters(GatewayFilter... gatewayFilters) {
return filters(Arrays.asList(gatewayFilters));
}
public Route build() {
Objects.requireNonNull(this.id, "id can not be null");
Objects.requireNonNull(this.uri, "uri can not be null");
AsyncPredicate<ServerWebExchange> predicate = getPredicate();
Objects.requireNonNull(predicate, "predicate can not be null");
return new Route(this.id, this.uri, this.order, predicate, this.gatewayFilters, this.metadata);
}
}
public static class AsyncBuilder extends AbstractBuilder<AsyncBuilder> {
protected @Nullable AsyncPredicate<ServerWebExchange> predicate;
@Override
protected AsyncBuilder getThis() {
return this;
}
@Override
public AsyncPredicate<ServerWebExchange> getPredicate() {
Objects.requireNonNull(this.predicate, "predicate can not be null");
return this.predicate;
}
public AsyncBuilder predicate(Predicate<ServerWebExchange> predicate) {
return asyncPredicate(toAsyncPredicate(predicate));
}
public AsyncBuilder asyncPredicate(AsyncPredicate<ServerWebExchange> predicate) {
this.predicate = predicate;
return this;
}
public AsyncBuilder and(AsyncPredicate<ServerWebExchange> predicate) {
Objects.requireNonNull(this.predicate, "can not call and() on null predicate");
this.predicate = this.predicate.and(predicate);
return this;
}
public AsyncBuilder or(AsyncPredicate<ServerWebExchange> predicate) {
Objects.requireNonNull(this.predicate, "can not call or() on null predicate");
this.predicate = this.predicate.or(predicate);
return this;
}
public AsyncBuilder negate() {
Objects.requireNonNull(this.predicate, "can not call negate() on null predicate");
this.predicate = this.predicate.negate();
return this;
}
}
|
public static class Builder extends AbstractBuilder<Builder> {
protected @Nullable Predicate<ServerWebExchange> predicate;
@Override
protected Builder getThis() {
return this;
}
@Override
public AsyncPredicate<ServerWebExchange> getPredicate() {
return ServerWebExchangeUtils.toAsyncPredicate(this.predicate);
}
public Builder and(Predicate<ServerWebExchange> predicate) {
Objects.requireNonNull(this.predicate, "can not call and() on null predicate");
this.predicate = this.predicate.and(predicate);
return this;
}
public Builder or(Predicate<ServerWebExchange> predicate) {
Objects.requireNonNull(this.predicate, "can not call or() on null predicate");
this.predicate = this.predicate.or(predicate);
return this;
}
public Builder negate() {
Objects.requireNonNull(this.predicate, "can not call negate() on null predicate");
this.predicate = this.predicate.negate();
return this;
}
}
}
|
repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webflux\src\main\java\org\springframework\cloud\gateway\route\Route.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public IncludeAttribute getIncludeStacktrace() {
return this.includeStacktrace;
}
public void setIncludeStacktrace(IncludeAttribute includeStacktrace) {
this.includeStacktrace = includeStacktrace;
}
public IncludeAttribute getIncludeMessage() {
return this.includeMessage;
}
public void setIncludeMessage(IncludeAttribute includeMessage) {
this.includeMessage = includeMessage;
}
public IncludeAttribute getIncludeBindingErrors() {
return this.includeBindingErrors;
}
public void setIncludeBindingErrors(IncludeAttribute includeBindingErrors) {
this.includeBindingErrors = includeBindingErrors;
}
public IncludeAttribute getIncludePath() {
return this.includePath;
}
public void setIncludePath(IncludeAttribute includePath) {
this.includePath = includePath;
}
public Whitelabel getWhitelabel() {
return this.whitelabel;
}
/**
* Include error attributes options.
*/
public enum IncludeAttribute {
/**
* Never add error attribute.
*/
NEVER,
/**
* Always add error attribute.
*/
ALWAYS,
/**
* Add error attribute when the appropriate request parameter is not "false".
|
*/
ON_PARAM
}
public static class Whitelabel {
/**
* Whether to enable the default error page displayed in browsers in case of a
* server error.
*/
private boolean enabled = true;
public boolean isEnabled() {
return this.enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}
}
|
repos\spring-boot-4.0.1\core\spring-boot-autoconfigure\src\main\java\org\springframework\boot\autoconfigure\web\ErrorProperties.java
| 2
|
请完成以下Java代码
|
public Object getWrappedModel()
{
return candidate;
}
@Override
public Timestamp getDate()
{
return candidate.getDatePromised();
}
@Override
public BigDecimal getQty()
{
// TODO: shall we use QtyToOrder instead... but that could affect our price (if we have some prices defined on breaks)
return candidate.getQtyPromised();
}
@Override
public void setM_PricingSystem_ID(int M_PricingSystem_ID)
{
candidate.setM_PricingSystem_ID(M_PricingSystem_ID);
}
|
@Override
public void setM_PriceList_ID(int M_PriceList_ID)
{
candidate.setM_PriceList_ID(M_PriceList_ID);
}
@Override
public void setCurrencyId(final CurrencyId currencyId)
{
candidate.setC_Currency_ID(CurrencyId.toRepoId(currencyId));
}
@Override
public void setPrice(BigDecimal priceStd)
{
candidate.setPrice(priceStd);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java\de\metas\procurement\base\order\impl\PMMPricingAware_PurchaseCandidate.java
| 1
|
请完成以下Spring Boot application配置
|
# Undertow 日志存放目录
server.undertow.accesslog.dir=
# 是否启动日志
server.undertow.accesslog.enabled=false
# 日志格式
server.undertow.accesslog.pattern=common
# 日志文件名前缀
server.undertow.accesslog.prefix=access_log
# 日志文件名后缀
server.undertow.accesslog.suffix=log
# HTTP POST请求最大的大小
server.undertow.max-http-post-size=0
# 设置IO线程数, 它主要执行非阻塞的任务,它们会负责多个连接, 默认设置每个CPU核心一个线程
server.undertow.io-threads=4
# 阻塞任务线程池, 当执行类似servlet请求阻塞操作, undertow会从这个线程池中取得线程,它的值设置取决于系统的负载
server.undertow.worker-threads=20
# 以下的配置会影响buffer,这些buffer会用于服务器连接的IO操作,有点
|
类似netty的池化内存管理
# 每块buffer的空间大小,越小的空间被利用越充分
server.undertow.buffer-size=1024
# 每个区分配的buffer数量 , 所以pool的大小是buffer-size * buffers-per-region
server.undertow.buffers-per-region=1024
# 是否分配的直接内存
server.undertow.direct-buffers=true
|
repos\spring-boot-quick-master\quick-undertow\src\main\resources\application.properties
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public String getSignUrls() {
return signUrls;
}
public void setSignUrls(String signUrls) {
this.signUrls = signUrls;
}
public String getFileViewDomain() {
return fileViewDomain;
}
public void setFileViewDomain(String fileViewDomain) {
this.fileViewDomain = fileViewDomain;
}
public String getUploadType() {
return uploadType;
}
public void setUploadType(String uploadType) {
this.uploadType = uploadType;
}
|
public WeiXinPay getWeiXinPay() {
return weiXinPay;
}
public void setWeiXinPay(WeiXinPay weiXinPay) {
this.weiXinPay = weiXinPay;
}
public BaiduApi getBaiduApi() {
return baiduApi;
}
public void setBaiduApi(BaiduApi baiduApi) {
this.baiduApi = baiduApi;
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-boot-base-core\src\main\java\org\jeecg\config\JeecgBaseConfig.java
| 2
|
请完成以下Java代码
|
public boolean contains(ActivityImpl activity) {
if (namedActivities.containsKey(activity.getId())) {
return true;
}
for (ActivityImpl nestedActivity : activities) {
if (nestedActivity.contains(activity)) {
return true;
}
}
return false;
}
// event listeners //////////////////////////////////////////////////////////
@SuppressWarnings("unchecked")
public List<ExecutionListener> getExecutionListeners(String eventName) {
List<ExecutionListener> executionListenerList = getExecutionListeners().get(eventName);
if (executionListenerList != null) {
return executionListenerList;
}
return Collections.EMPTY_LIST;
}
public void addExecutionListener(String eventName, ExecutionListener executionListener) {
addExecutionListener(eventName, executionListener, -1);
}
public void addExecutionListener(String eventName, ExecutionListener executionListener, int index) {
List<ExecutionListener> listeners = executionListeners.get(eventName);
if (listeners == null) {
listeners = new ArrayList<>();
executionListeners.put(eventName, listeners);
}
if (index < 0) {
listeners.add(executionListener);
} else {
listeners.add(index, executionListener);
|
}
}
public Map<String, List<ExecutionListener>> getExecutionListeners() {
return executionListeners;
}
// getters and setters //////////////////////////////////////////////////////
@Override
public List<ActivityImpl> getActivities() {
return activities;
}
public IOSpecification getIoSpecification() {
return ioSpecification;
}
public void setIoSpecification(IOSpecification ioSpecification) {
this.ioSpecification = ioSpecification;
}
}
|
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\pvm\process\ScopeImpl.java
| 1
|
请完成以下Java代码
|
Stream<DataEntrySubTabId> streamSubTabIds()
{
return subTabs.stream().map(DataEntrySubTab::getId);
}
Optional<DataEntrySubTab> getSubTabByIdIfPresent(@NonNull final DataEntrySubTabId subTabId)
{
return getFirstSubTabMatching(subTab -> DataEntrySubTabId.equals(subTab.getId(), subTabId));
}
public Optional<DataEntrySubTab> getFirstSubTabMatching(@NonNull final Predicate<DataEntrySubTab> predicate)
{
return subTabs.stream().filter(predicate).findFirst();
}
@Value
|
public static class DocumentLinkColumnName
{
public static DocumentLinkColumnName of(final String columnName)
{
return new DocumentLinkColumnName(columnName);
}
String asString;
private DocumentLinkColumnName(final String columnName)
{
asString = assumeNotEmpty(columnName, "Given columnName may not be empty");
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\dataentry\layout\DataEntryTab.java
| 1
|
请完成以下Java代码
|
public int getC_UOM_ID()
{
return get_ValueAsInt(COLUMNNAME_C_UOM_ID);
}
@Override
public void setDD_Order_Candidate_DDOrder_ID (final int DD_Order_Candidate_DDOrder_ID)
{
if (DD_Order_Candidate_DDOrder_ID < 1)
set_ValueNoCheck (COLUMNNAME_DD_Order_Candidate_DDOrder_ID, null);
else
set_ValueNoCheck (COLUMNNAME_DD_Order_Candidate_DDOrder_ID, DD_Order_Candidate_DDOrder_ID);
}
@Override
public int getDD_Order_Candidate_DDOrder_ID()
{
return get_ValueAsInt(COLUMNNAME_DD_Order_Candidate_DDOrder_ID);
}
@Override
public org.eevolution.model.I_DD_Order_Candidate getDD_Order_Candidate()
{
return get_ValueAsPO(COLUMNNAME_DD_Order_Candidate_ID, org.eevolution.model.I_DD_Order_Candidate.class);
}
@Override
public void setDD_Order_Candidate(final org.eevolution.model.I_DD_Order_Candidate DD_Order_Candidate)
{
set_ValueFromPO(COLUMNNAME_DD_Order_Candidate_ID, org.eevolution.model.I_DD_Order_Candidate.class, DD_Order_Candidate);
}
@Override
public void setDD_Order_Candidate_ID (final int DD_Order_Candidate_ID)
{
if (DD_Order_Candidate_ID < 1)
set_ValueNoCheck (COLUMNNAME_DD_Order_Candidate_ID, null);
else
set_ValueNoCheck (COLUMNNAME_DD_Order_Candidate_ID, DD_Order_Candidate_ID);
}
@Override
public int getDD_Order_Candidate_ID()
{
return get_ValueAsInt(COLUMNNAME_DD_Order_Candidate_ID);
}
@Override
public org.eevolution.model.I_DD_Order getDD_Order()
{
return get_ValueAsPO(COLUMNNAME_DD_Order_ID, org.eevolution.model.I_DD_Order.class);
}
@Override
public void setDD_Order(final org.eevolution.model.I_DD_Order DD_Order)
{
set_ValueFromPO(COLUMNNAME_DD_Order_ID, org.eevolution.model.I_DD_Order.class, DD_Order);
}
@Override
public void setDD_Order_ID (final int DD_Order_ID)
{
if (DD_Order_ID < 1)
set_ValueNoCheck (COLUMNNAME_DD_Order_ID, null);
else
set_ValueNoCheck (COLUMNNAME_DD_Order_ID, DD_Order_ID);
}
@Override
public int getDD_Order_ID()
{
return get_ValueAsInt(COLUMNNAME_DD_Order_ID);
}
@Override
public org.eevolution.model.I_DD_OrderLine getDD_OrderLine()
{
return get_ValueAsPO(COLUMNNAME_DD_OrderLine_ID, org.eevolution.model.I_DD_OrderLine.class);
|
}
@Override
public void setDD_OrderLine(final org.eevolution.model.I_DD_OrderLine DD_OrderLine)
{
set_ValueFromPO(COLUMNNAME_DD_OrderLine_ID, org.eevolution.model.I_DD_OrderLine.class, DD_OrderLine);
}
@Override
public void setDD_OrderLine_ID (final int DD_OrderLine_ID)
{
if (DD_OrderLine_ID < 1)
set_ValueNoCheck (COLUMNNAME_DD_OrderLine_ID, null);
else
set_ValueNoCheck (COLUMNNAME_DD_OrderLine_ID, DD_OrderLine_ID);
}
@Override
public int getDD_OrderLine_ID()
{
return get_ValueAsInt(COLUMNNAME_DD_OrderLine_ID);
}
@Override
public void setQty (final BigDecimal Qty)
{
set_Value (COLUMNNAME_Qty, Qty);
}
@Override
public BigDecimal getQty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty);
return bd != null ? bd : BigDecimal.ZERO;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_DD_Order_Candidate_DDOrder.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
class ConfigurationMetadataItem extends ConfigurationMetadataProperty {
private String sourceType;
private String sourceMethod;
/**
* The class name of the source that contributed this property. For example, if the
* property was from a class annotated with {@code @ConfigurationProperties} this
* attribute would contain the fully qualified name of that class.
* @return the source type
*/
String getSourceType() {
return this.sourceType;
}
void setSourceType(String sourceType) {
this.sourceType = sourceType;
}
|
/**
* The full name of the method (including parenthesis and argument types) that
* contributed this property. For example, the name of a getter in a
* {@code @ConfigurationProperties} annotated class.
* @return the source method
*/
String getSourceMethod() {
return this.sourceMethod;
}
void setSourceMethod(String sourceMethod) {
this.sourceMethod = sourceMethod;
}
}
|
repos\spring-boot-4.0.1\configuration-metadata\spring-boot-configuration-metadata\src\main\java\org\springframework\boot\configurationmetadata\ConfigurationMetadataItem.java
| 2
|
请完成以下Java代码
|
public class MaterialBalanceDetailBL implements IMaterialBalanceDetailBL
{
@Override
public void addInOutToBalance(final I_M_InOut inOut)
{
// services
final IInOutDAO inoutDAO = Services.get(IInOutDAO.class);
final IMaterialBalanceConfigDAO materialBalanceConfigDAO = Services.get(IMaterialBalanceConfigDAO.class);
final IMaterialBalanceDetailDAO materialBalanceDetailDAO = Services.get(IMaterialBalanceDetailDAO.class);
final Iterator<I_M_InOutLine> lines = inoutDAO.retrieveAllLines(inOut).iterator();
if (!lines.hasNext())
{
// do nothing
return;
}
while (lines.hasNext())
{
final I_M_InOutLine line = lines.next();
final MaterialBalanceConfig balanceConfig = materialBalanceConfigDAO.retrieveFitBalanceConfig(line);
if (balanceConfig == null)
{
// in case there was no balance config entry that fits the given line, it means that the line is not important in balancing
continue;
}
// If a suitable balance config was found, add the line to the according Material Balance Detail
|
materialBalanceDetailDAO.addLineToBalance(line, balanceConfig);
}
}
@Override
public void resetMaterialDetailsForConfigAndDate(final MaterialBalanceConfig config, final Timestamp resetDate)
{
// services
final IMaterialBalanceDetailDAO materialBalanceDAO = Services.get(IMaterialBalanceDetailDAO.class);
final List<I_M_Material_Balance_Detail> detailsToReset = materialBalanceDAO.retrieveDetailsForConfigAndDate(config, resetDate);
for (final I_M_Material_Balance_Detail materialBalanceDetail : detailsToReset)
{
materialBalanceDetail.setIsReset(true);
materialBalanceDetail.setResetDate(resetDate);
InterfaceWrapperHelper.save(materialBalanceDetail);
}
}
@Override
public void resetAllMaterialDetailsForDate(final Timestamp resetDate)
{
resetMaterialDetailsForConfigAndDate(null, resetDate);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\inout\api\impl\MaterialBalanceDetailBL.java
| 1
|
请完成以下Java代码
|
public void setC_DunningDoc_Line_ID (int C_DunningDoc_Line_ID)
{
if (C_DunningDoc_Line_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_DunningDoc_Line_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_DunningDoc_Line_ID, Integer.valueOf(C_DunningDoc_Line_ID));
}
/** Get Dunning Document Line.
@return Dunning Document Line */
@Override
public int getC_DunningDoc_Line_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_DunningDoc_Line_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Dunning Document Line Source.
@param C_DunningDoc_Line_Source_ID Dunning Document Line Source */
@Override
public void setC_DunningDoc_Line_Source_ID (int C_DunningDoc_Line_Source_ID)
{
if (C_DunningDoc_Line_Source_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_DunningDoc_Line_Source_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_DunningDoc_Line_Source_ID, Integer.valueOf(C_DunningDoc_Line_Source_ID));
}
/** Get Dunning Document Line Source.
@return Dunning Document Line Source */
@Override
public int getC_DunningDoc_Line_Source_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_DunningDoc_Line_Source_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Massenaustritt.
@param IsWriteOff Massenaustritt */
@Override
public void setIsWriteOff (boolean IsWriteOff)
{
set_Value (COLUMNNAME_IsWriteOff, Boolean.valueOf(IsWriteOff));
}
/** Get Massenaustritt.
@return Massenaustritt */
@Override
public boolean isWriteOff ()
{
Object oo = get_Value(COLUMNNAME_IsWriteOff);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Massenaustritt Applied.
@param IsWriteOffApplied Massenaustritt Applied */
@Override
public void setIsWriteOffApplied (boolean IsWriteOffApplied)
{
set_Value (COLUMNNAME_IsWriteOffApplied, Boolean.valueOf(IsWriteOffApplied));
}
/** Get Massenaustritt Applied.
@return Massenaustritt Applied */
@Override
public boolean isWriteOffApplied ()
|
{
Object oo = get_Value(COLUMNNAME_IsWriteOffApplied);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Verarbeitet.
@param Processed
Checkbox sagt aus, ob der Beleg verarbeitet wurde.
*/
@Override
public void setProcessed (boolean Processed)
{
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
}
/** Get Verarbeitet.
@return Checkbox sagt aus, ob der Beleg verarbeitet wurde.
*/
@Override
public boolean isProcessed ()
{
Object oo = get_Value(COLUMNNAME_Processed);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.dunning\src\main\java-gen\de\metas\dunning\model\X_C_DunningDoc_Line_Source.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
private UserPrincipalDetailsService userPrincipalDetailsService;
public SecurityConfiguration(UserPrincipalDetailsService userPrincipalDetailsService){
this.userPrincipalDetailsService = userPrincipalDetailsService;
}
@Override
protected void configure(AuthenticationManagerBuilder auth) {
auth.authenticationProvider(authenticationProvider());
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/index.html").permitAll()
.antMatchers("/profile/**").hasRole("ADMIN")
.antMatchers("/admin/**").hasAnyRole("ADMIN", "MANAGER")
.antMatchers("/api/public/test1").hasAuthority("ACCESS_TEST1")
.antMatchers("/api/public/test2").hasAuthority("ACCESS_TEST2")
.antMatchers("/api/public/users").hasRole("ADMIN")
.and()
.formLogin()
.loginPage("/login").permitAll();
|
}
@Bean
DaoAuthenticationProvider authenticationProvider(){
DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider();
daoAuthenticationProvider.setPasswordEncoder(passwordEncoder());
daoAuthenticationProvider.setUserDetailsService(this.userPrincipalDetailsService);
return daoAuthenticationProvider;
}
@Bean
PasswordEncoder passwordEncoder(){
return new BCryptPasswordEncoder();
}
}
|
repos\SpringBoot-Projects-FullStack-master\Part-6 Spring Boot Security\9. SpringSecurityForm\src\main\java\spring\security\security\SecurityConfiguration.java
| 2
|
请完成以下Java代码
|
void startRetransmissionTimer(EventLoop eventLoop, Consumer<Object> sendPacket) {
retransmissionHandler.setHandler((fixedHeader, originalMessage) ->
sendPacket.accept(new MqttUnsubscribeMessage(fixedHeader, originalMessage.variableHeader(), originalMessage.payload())));
retransmissionHandler.start(eventLoop);
}
void onUnsubackReceived() {
retransmissionHandler.stop();
}
void onChannelClosed() {
retransmissionHandler.stop();
}
static Builder builder() {
return new Builder();
}
static class Builder {
private Promise<Void> future;
private String topic;
private MqttUnsubscribeMessage unsubscribeMessage;
private String ownerId;
private PendingOperation pendingOperation;
private MqttClientConfig.RetransmissionConfig retransmissionConfig;
Builder future(Promise<Void> future) {
this.future = future;
return this;
}
Builder topic(String topic) {
this.topic = topic;
return this;
|
}
Builder unsubscribeMessage(MqttUnsubscribeMessage unsubscribeMessage) {
this.unsubscribeMessage = unsubscribeMessage;
return this;
}
Builder ownerId(String ownerId) {
this.ownerId = ownerId;
return this;
}
Builder retransmissionConfig(MqttClientConfig.RetransmissionConfig retransmissionConfig) {
this.retransmissionConfig = retransmissionConfig;
return this;
}
Builder pendingOperation(PendingOperation pendingOperation) {
this.pendingOperation = pendingOperation;
return this;
}
MqttPendingUnsubscription build() {
return new MqttPendingUnsubscription(future, topic, unsubscribeMessage, ownerId, retransmissionConfig, pendingOperation);
}
}
}
|
repos\thingsboard-master\netty-mqtt\src\main\java\org\thingsboard\mqtt\MqttPendingUnsubscription.java
| 1
|
请完成以下Java代码
|
public SpanContext context() {
return null;
}
@Override
public Span setTag(String key, String value) {
return null;
}
@Override
public Span setTag(String key, boolean value) {
return null;
}
@Override
public Span setTag(String key, Number value) {
return null;
}
@Override
public <T> Span setTag(Tag<T> tag, T value) {
return null;
}
@Override
public Span log(Map<String, ?> fields) {
return null;
}
@Override
public Span log(long timestampMicroseconds, Map<String, ?> fields) {
return null;
}
@Override
public Span log(String event) {
return null;
}
@Override
public Span log(long timestampMicroseconds, String event) {
return null;
}
|
@Override
public Span setBaggageItem(String key, String value) {
return null;
}
@Override
public String getBaggageItem(String key) {
return null;
}
@Override
public Span setOperationName(String operationName) {
return null;
}
@Override
public void finish() {
transaction.setStatus(Transaction.SUCCESS);
transaction.complete();
}
@Override
public void finish(long finishMicros) {
}
}
|
repos\SpringBoot-Labs-master\lab-61\lab-61-cat-opentracing\src\main\java\cn\iocoder\springboot\lab61\cat\opentracing\CatSpan.java
| 1
|
请完成以下Java代码
|
public ActiveOrHistoricCurrencyAndAmount getAmt() {
return amt;
}
/**
* Sets the value of the amt property.
*
* @param value
* allowed object is
* {@link ActiveOrHistoricCurrencyAndAmount }
*
*/
public void setAmt(ActiveOrHistoricCurrencyAndAmount value) {
this.amt = value;
}
/**
* Gets the value of the cdtDbtInd property.
*
* @return
* possible object is
* {@link CreditDebitCode }
*
*/
public CreditDebitCode getCdtDbtInd() {
return cdtDbtInd;
}
/**
* Sets the value of the cdtDbtInd property.
*
* @param value
* allowed object is
* {@link CreditDebitCode }
*
*/
public void setCdtDbtInd(CreditDebitCode value) {
this.cdtDbtInd = value;
}
/**
* Gets the value of the dt property.
*
* @return
* possible object is
* {@link DateAndDateTimeChoice }
*
*/
public DateAndDateTimeChoice getDt() {
return dt;
}
|
/**
* Sets the value of the dt property.
*
* @param value
* allowed object is
* {@link DateAndDateTimeChoice }
*
*/
public void setDt(DateAndDateTimeChoice value) {
this.dt = value;
}
/**
* Gets the value of the avlbty 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 avlbty property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAvlbty().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CashBalanceAvailability2 }
*
*
*/
public List<CashBalanceAvailability2> getAvlbty() {
if (avlbty == null) {
avlbty = new ArrayList<CashBalanceAvailability2>();
}
return this.avlbty;
}
}
|
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\CashBalance3.java
| 1
|
请完成以下Java代码
|
private final IUserRolePermissions getUserRolePermissions()
{
final Properties ctx = getCtx();
final IUserRolePermissions role = Env.getUserRolePermissions(ctx);
return role;
}
public InfoWindowMenuBuilder setParentWindowNo(final int windowNo)
{
return setParentWindowNo(Suppliers.ofInstance(windowNo));
}
public InfoWindowMenuBuilder setParentWindowNo(final Supplier<Integer> windowNoSupplier)
{
Check.assumeNotNull(windowNoSupplier, "windowNoSupplier not null");
_parentWindowNoSupplier = windowNoSupplier;
return this;
}
private final int getParentWindowNo()
{
final Integer parentWindowNo = _parentWindowNoSupplier.get();
return parentWindowNo == null ? Env.WINDOW_MAIN : parentWindowNo;
}
private final JFrame getParentFrame()
{
final int parentWindowNo = getParentWindowNo();
// No windowNo => use main window
if (parentWindowNo < 0 || parentWindowNo == Env.WINDOW_None)
{
return Env.getWindow(Env.WINDOW_MAIN);
|
}
// Use particular window
final JFrame frame = Env.getWindow(parentWindowNo);
if (frame != null)
{
return frame;
}
// Fallback to main window (shall not happen)
return Env.getWindow(Env.WINDOW_MAIN);
}
/** Sets the menu where we shall add the info windows menu items */
public InfoWindowMenuBuilder setMenu(final JMenu menu)
{
assertNotBuilt();
Check.assumeNotNull(menu, "menu not null");
_menu = menu;
return this;
}
private final JMenu getMenu()
{
Check.assumeNotNull(_menu, "menu not null");
return _menu;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\apps\search\InfoWindowMenuBuilder.java
| 1
|
请完成以下Java代码
|
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 getId() {
return id;
}
@Override
public void setId(String id) {
this.id = id;
}
@Override
public String getFirstName() {
return firstName;
}
@Override
public void setFirstName(String firstName) {
this.firstName = firstName;
}
@Override
public String getLastName() {
return lastName;
}
@Override
public void setLastName(String lastName) {
this.lastName = lastName;
}
@Override
public String getEmail() {
return email;
}
@Override
public void setEmail(String email) {
|
this.email = email;
}
@Override
public String getPassword() {
return password != null ? password : id;
}
@Override
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
return joinOn(this.getClass())
.add("id=" + id)
.add("firstName=" + firstName)
.add("lastName=" + lastName)
.add("email=" + email)
.add("password=******") // sensitive for logging
.toString();
}
}
|
repos\camunda-bpm-platform-master\spring-boot-starter\starter\src\main\java\org\camunda\bpm\spring\boot\starter\property\AdminUserProperty.java
| 1
|
请完成以下Java代码
|
public abstract class VersionedCaffeineTbCache<K extends VersionedCacheKey, V extends Serializable & HasVersion> extends CaffeineTbTransactionalCache<K, V> implements VersionedTbCache<K, V> {
public VersionedCaffeineTbCache(CacheManager cacheManager, String cacheName) {
super(cacheManager, cacheName);
}
@Override
public TbCacheValueWrapper<V> get(K key) {
TbPair<Long, V> versionValuePair = doGet(key);
if (versionValuePair != null) {
return SimpleTbCacheValueWrapper.wrap(versionValuePair.getSecond());
}
return null;
}
@Override
public void put(K key, V value) {
Long version = getVersion(value);
if (version == null) {
return;
}
doPut(key, value, version);
}
private void doPut(K key, V value, Long version) {
lock.lock();
try {
TbPair<Long, V> versionValuePair = doGet(key);
if (versionValuePair == null || version > versionValuePair.getFirst()) {
failAllTransactionsByKey(key);
cache.put(key, wrapValue(value, version));
}
} finally {
lock.unlock();
}
}
private TbPair<Long, V> doGet(K key) {
Cache.ValueWrapper source = cache.get(key);
return source == null ? null : (TbPair<Long, V>) source.get();
}
|
@Override
public void evict(K key) {
lock.lock();
try {
failAllTransactionsByKey(key);
cache.evict(key);
} finally {
lock.unlock();
}
}
@Override
public void evict(K key, Long version) {
if (version == null) {
return;
}
doPut(key, null, version);
}
@Override
void doPutIfAbsent(K key, V value) {
cache.putIfAbsent(key, wrapValue(value, getVersion(value)));
}
private TbPair<Long, V> wrapValue(V value, Long version) {
return TbPair.of(version, value);
}
}
|
repos\thingsboard-master\common\cache\src\main\java\org\thingsboard\server\cache\VersionedCaffeineTbCache.java
| 1
|
请完成以下Java代码
|
public abstract class EvaluationListener {
/**
* Fired before the evaluation of the expression.
*
* @param context The EL context in which the expression will be evaluated
* @param expression The expression that will be evaluated
*/
public void beforeEvaluation(ELContext context, String expression) {
// NO-OP
}
/**
* Fired after the evaluation of the expression.
*
* @param context The EL context in which the expression was evaluated
|
* @param expression The expression that was evaluated
*/
public void afterEvaluation(ELContext context, String expression) {
// NO-OP
}
/**
* Fired after a property has been resolved.
*
* @param context The EL context in which the property was resolved
* @param base The base object on which the property was resolved
* @param property The property that was resolved
*/
public void propertyResolved(ELContext context, Object base, Object property) {
// NO-OP
}
}
|
repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\javax\el\EvaluationListener.java
| 1
|
请完成以下Java代码
|
public Optional<HUEditorView> getPackingHUsViewIfExists(final ViewId packingHUsViewId)
{
final PackingHUsViewKey key = PackingHUsViewKey.ofPackingHUsViewId(packingHUsViewId);
return packingHUsViewsCollection.getByKeyIfExists(key);
}
public Optional<HUEditorView> getPackingHUsViewIfExists(final PickingSlotRowId rowId)
{
final PickingSlotRow rootRow = getRootRowWhichIncludesRowId(rowId);
final PackingHUsViewKey key = extractPackingHUsViewKey(rootRow);
return packingHUsViewsCollection.getByKeyIfExists(key);
}
public HUEditorView computePackingHUsViewIfAbsent(@NonNull final ViewId packingHUsViewId, @NonNull final PackingHUsViewSupplier packingHUsViewFactory)
{
return packingHUsViewsCollection.computeIfAbsent(PackingHUsViewKey.ofPackingHUsViewId(packingHUsViewId), packingHUsViewFactory);
}
public void setPackingHUsView(@NonNull final HUEditorView packingHUsView)
{
|
final ViewId packingHUsViewId = packingHUsView.getViewId();
packingHUsViewsCollection.put(PackingHUsViewKey.ofPackingHUsViewId(packingHUsViewId), packingHUsView);
}
void closePackingHUsView(final ViewId packingHUsViewId, final ViewCloseAction closeAction)
{
final PackingHUsViewKey key = PackingHUsViewKey.ofPackingHUsViewId(packingHUsViewId);
packingHUsViewsCollection.removeIfExists(key)
.ifPresent(packingHUsView -> packingHUsView.close(closeAction));
}
public void handleEvent(final HUExtractedFromPickingSlotEvent event)
{
packingHUsViewsCollection.handleEvent(event);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\pickingslotsClearing\PickingSlotsClearingView.java
| 1
|
请完成以下Java代码
|
public class PlainHUDocument extends AbstractHUDocument
{
private final String displayName;
private final List<IHUDocumentLine> lines;
public PlainHUDocument(final String displayName, final List<IHUDocumentLine> lines)
{
super();
this.displayName = displayName;
this.lines = lines;
}
@Override
public String getDisplayName()
{
|
return displayName;
}
@Override
public List<IHUDocumentLine> getLines()
{
return lines;
}
@Override
public IHUDocument getReversal()
{
return new PlainHUDocument(getDisplayName(), getReversalLines());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\document\impl\PlainHUDocument.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public BigInteger getExternalSeqNo() {
return externalSeqNo;
}
/**
* Sets the value of the externalSeqNo property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setExternalSeqNo(BigInteger value) {
this.externalSeqNo = value;
}
/**
* Gets the value of the buyerGTINTU property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBuyerGTINTU() {
return buyerGTINTU;
}
/**
* Sets the value of the buyerGTINTU property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBuyerGTINTU(String value) {
this.buyerGTINTU = value;
}
/**
* Gets the value of the buyerGTINCU property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBuyerGTINCU() {
return buyerGTINCU;
}
/**
* Sets the value of the buyerGTINCU property.
*
* @param value
|
* allowed object is
* {@link String }
*
*/
public void setBuyerGTINCU(String value) {
this.buyerGTINCU = value;
}
/**
* Gets the value of the buyerEANCU property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBuyerEANCU() {
return buyerEANCU;
}
/**
* Sets the value of the buyerEANCU property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBuyerEANCU(String value) {
this.buyerEANCU = value;
}
/**
* Gets the value of the supplierGTINCU property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSupplierGTINCU() {
return supplierGTINCU;
}
/**
* Sets the value of the supplierGTINCU property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSupplierGTINCU(String value) {
this.supplierGTINCU = value;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_metasfreshinhousev2\de\metas\edi\esb\jaxb\metasfreshinhousev2\EDICctopInvoic500VType.java
| 2
|
请完成以下Java代码
|
public void handleEvent(@NonNull final SupplyRequiredEvent event)
{
handleSupplyRequiredEvent(event.getSupplyRequiredDescriptor());
}
private void handleSupplyRequiredEvent(@NonNull final SupplyRequiredDescriptor descriptor)
{
final ArrayList<MaterialEvent> events = new ArrayList<>();
final MaterialPlanningContext context = helper.createContextOrNull(descriptor);
if (context != null)
{
for (final SupplyRequiredAdvisor advisor : supplyRequiredAdvisors)
{
events.addAll(advisor.createAdvisedEvents(descriptor, context));
}
|
}
if (events.isEmpty())
{
final NoSupplyAdviceEvent noSupplyAdviceEvent = NoSupplyAdviceEvent.of(descriptor.withNewEventId());
Loggables.addLog("No advice events were created. Firing {}", noSupplyAdviceEvent);
postMaterialEventService.enqueueEventNow(noSupplyAdviceEvent);
}
else
{
events.forEach(postMaterialEventService::enqueueEventNow);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.material\planning\src\main\java\de\metas\material\planning\event\SupplyRequiredHandler.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class DeciderJobDemo {
@Autowired
private JobBuilderFactory jobBuilderFactory;
@Autowired
private StepBuilderFactory stepBuilderFactory;
@Autowired
private MyDecider myDecider;
@Bean
public Job deciderJob() {
return jobBuilderFactory.get("deciderJob")
.start(step1())
.next(myDecider)
.from(myDecider).on("weekend").to(step2())
.from(myDecider).on("workingDay").to(step3())
.from(step3()).on("*").to(step4())
.end()
.build();
}
private Step step1() {
return stepBuilderFactory.get("step1")
.tasklet((stepContribution, chunkContext) -> {
System.out.println("执行步骤一操作。。。");
return RepeatStatus.FINISHED;
}).build();
}
private Step step2() {
return stepBuilderFactory.get("step2")
.tasklet((stepContribution, chunkContext) -> {
System.out.println("执行步骤二操作。。。");
return RepeatStatus.FINISHED;
|
}).build();
}
private Step step3() {
return stepBuilderFactory.get("step3")
.tasklet((stepContribution, chunkContext) -> {
System.out.println("执行步骤三操作。。。");
return RepeatStatus.FINISHED;
}).build();
}
private Step step4() {
return stepBuilderFactory.get("step4")
.tasklet((stepContribution, chunkContext) -> {
System.out.println("执行步骤四操作。。。");
return RepeatStatus.FINISHED;
}).build();
}
}
|
repos\SpringAll-master\67.spring-batch-start\src\main\java\cc\mrbird\batch\job\DeciderJobDemo.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public Boolean getExcludeTaskVariables() {
return excludeTaskVariables;
}
public void setExcludeTaskVariables(Boolean excludeTaskVariables) {
this.excludeTaskVariables = excludeTaskVariables;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getExecutionId() {
return executionId;
}
public void setExecutionId(String executionId) {
this.executionId = executionId;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
public String getVariableName() {
return variableName;
}
|
public void setVariableName(String variableName) {
this.variableName = variableName;
}
public String getVariableNameLike() {
return variableNameLike;
}
public void setVariableNameLike(String variableNameLike) {
this.variableNameLike = variableNameLike;
}
@JsonTypeInfo(use = Id.CLASS, defaultImpl = QueryVariable.class)
public List<QueryVariable> getVariables() {
return variables;
}
public void setVariables(List<QueryVariable> variables) {
this.variables = variables;
}
public void setExcludeLocalVariables(Boolean excludeLocalVariables) {
this.excludeLocalVariables = excludeLocalVariables;
}
public Boolean getExcludeLocalVariables() {
return excludeLocalVariables;
}
}
|
repos\flowable-engine-main\modules\flowable-rest\src\main\java\org\flowable\rest\service\api\history\HistoricVariableInstanceQueryRequest.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class MvcConfig implements WebMvcConfigurer {
public MvcConfig() {
super();
}
// API
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
registry.addViewController("/anonymous.html");
registry.addViewController("/login.html");
registry.addViewController("/homepage.html");
registry.addViewController("/console.html");
registry.addViewController("/csrfHome.html");
}
|
@Bean
public ViewResolver viewResolver() {
final InternalResourceViewResolver bean = new InternalResourceViewResolver();
bean.setViewClass(JstlView.class);
bean.setPrefix("/WEB-INF/view/");
bean.setSuffix(".jsp");
return bean;
}
@Override
public void addInterceptors(final InterceptorRegistry registry) {
registry.addInterceptor(new LoggerInterceptor());
registry.addInterceptor(new UserInterceptor());
registry.addInterceptor(new SessionTimerInterceptor());
}
}
|
repos\tutorials-master\spring-security-modules\spring-security-web-mvc-custom\src\main\java\com\baeldung\spring\MvcConfig.java
| 2
|
请完成以下Java代码
|
private PPOrderRoutingBuilder newPPOrderRouting()
{
return PPOrderRouting.builder()
.ppOrderId(ppOrderId)
.routingId(routing.getId())
.durationUnit(routing.getDurationUnit())
.qtyPerBatch(routing.getQtyPerBatch());
}
public PPOrderRoutingProduct createPPOrderRoutingProduct(final PPRoutingProduct product)
{
final PPOrderRoutingProductId productId = product.getActivityId() != null ? PPOrderRoutingProductId.ofRepoId(PPOrderRoutingActivityId.ofRepoIdOrNull(ppOrderId, product.getActivityId().getRepoId()), product.getId()) : null;
return PPOrderRoutingProduct.builder()
.qty(product.getQty())
.seqNo(product.getSeqNo())
.subcontracting(product.isSubcontracting())
.id(productId)
.productId(product.getProductId())
.specification(product.getSpecification())
.build();
}
public PPOrderRoutingActivity createPPOrderRoutingActivity(final PPRoutingActivity activity)
{
final WFDurationUnit durationUnit = activity.getDurationUnit();
final Duration durationPerOneUnit = activity.getDurationPerOneUnit();
final int unitsPerCycle = activity.getUnitsPerCycle();
final Duration durationRequired = WorkingTime.builder()
.durationPerOneUnit(durationPerOneUnit)
.unitsPerCycle(unitsPerCycle)
.qty(qtyOrdered)
.activityTimeUnit(durationUnit)
.build()
.getDuration();
final Quantity zero = qtyOrdered.toZero();
return PPOrderRoutingActivity.builder()
.id(null) // n/a
.type(activity.getType())
.routingActivityId(activity.getId())
.code(PPOrderRoutingActivityCode.ofString(activity.getCode()))
.name(activity.getName())
//
.subcontracting(activity.isSubcontracting())
.subcontractingVendorId(activity.getSubcontractingVendorId())
//
.milestone(activity.isMilestone())
.alwaysAvailableToUser(activity.getAlwaysAvailableToUser())
.userInstructions(activity.getUserInstructions())
//
.resourceId(activity.getResourceId())
|
//
.status(PPOrderRoutingActivityStatus.NOT_STARTED)
//
// Standard values
.durationUnit(durationUnit)
.queuingTime(activity.getQueuingTime())
.setupTime(activity.getSetupTime())
.waitingTime(activity.getWaitingTime())
.movingTime(activity.getMovingTime())
.durationPerOneUnit(durationPerOneUnit)
.unitsPerCycle(unitsPerCycle)
//
// Planned values
.setupTimeRequired(activity.getSetupTime()) // TODO: shall be multiply it by number of batches?
.durationRequired(durationRequired)
.qtyRequired(qtyOrdered)
//
// Reported values
.setupTimeReal(Duration.ZERO)
.durationReal(Duration.ZERO)
.qtyDelivered(zero)
.qtyScrapped(zero)
.qtyRejected(zero)
//
.activityTemplateId(activity.getActivityTemplateId())
//
.rawMaterialsIssueStrategy(activity.getRawMaterialsIssueStrategy())
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\api\impl\CreateOrderRoutingCommand.java
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.