instruction
string
input
string
output
string
source_file
string
priority
int64
请在Spring Boot框架中完成以下Java代码
public class OmsOrderReturnReasonServiceImpl implements OmsOrderReturnReasonService { @Autowired private OmsOrderReturnReasonMapper returnReasonMapper; @Override public int create(OmsOrderReturnReason returnReason) { returnReason.setCreateTime(new Date()); return returnReasonMapper.insert(returnReason); } @Override public int update(Long id, OmsOrderReturnReason returnReason) { returnReason.setId(id); return returnReasonMapper.updateByPrimaryKey(returnReason); } @Override public int delete(List<Long> ids) { OmsOrderReturnReasonExample example = new OmsOrderReturnReasonExample(); example.createCriteria().andIdIn(ids); return returnReasonMapper.deleteByExample(example); } @Override public List<OmsOrderReturnReason> list(Integer pageSize, Integer pageNum) { PageHelper.startPage(pageNum,pageSize); OmsOrderReturnReasonExample example = new OmsOrderReturnReasonExample(); example.setOrderByClause("sort desc"); return returnReasonMapper.selectByExample(example); }
@Override public int updateStatus(List<Long> ids, Integer status) { if(!status.equals(0)&&!status.equals(1)){ return 0; } OmsOrderReturnReason record = new OmsOrderReturnReason(); record.setStatus(status); OmsOrderReturnReasonExample example = new OmsOrderReturnReasonExample(); example.createCriteria().andIdIn(ids); return returnReasonMapper.updateByExampleSelective(record,example); } @Override public OmsOrderReturnReason getItem(Long id) { return returnReasonMapper.selectByPrimaryKey(id); } }
repos\mall-master\mall-admin\src\main\java\com\macro\mall\service\impl\OmsOrderReturnReasonServiceImpl.java
2
请完成以下Java代码
public I_AD_InfoColumn getAD_InfoColumn() { return infoColumn; } @Override public String getLabel(int index) { return Msg.translate(Env.getCtx(), "SponsorNo"); } @Override public int getParameterCount() { return 1; } @Override public Object getParameterToComponent(int index) { return null; } @Override public Object getParameterValue(int index, boolean returnValueTo) { if (index == 0) return getText(); else return null; } @Override
public String[] getWhereClauses(List<Object> params) { final SponsorNoObject sno = getSponsorNoObject(); final String searchText = getText(); if (sno == null && !Check.isEmpty(searchText, true)) return new String[]{"1=2"}; if (sno == null) return null; final Timestamp date = TimeUtil.trunc(Env.getContextAsDate(Env.getCtx(), "#Date"), TimeUtil.TRUNC_DAY); // final String whereClause = "EXISTS (SELECT 1 FROM C_Sponsor_Salesrep ssr" + " JOIN C_Sponsor sp ON (ssr.C_Sponsor_ID = sp.C_Sponsor_ID)" + " WHERE " + bpartnerTableAlias + ".C_BPartner_ID = sp.C_BPartner_ID" + " AND ssr.C_Sponsor_Parent_ID = ?" + ")" + " AND ? BETWEEN ssr.Validfrom AND Validto" + " AND ssr.C_BPartner_ID > 0"; params.add(sno.getSponsorID()); params.add(date); return new String[]{whereClause}; } public IInfoSimple getParent() { return parent; } protected abstract SponsorNoObject getSponsorNoObject(); }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\org\compiere\apps\search\InfoQueryCriteriaBPSonsorAbstract.java
1
请完成以下Java代码
public static String upload(InputStream stream, String relativePath) { String filePath = null; String fileUrl = relativePath; initOss(endPoint, accessKeyId, accessKeySecret); if (oConvertUtils.isNotEmpty(staticDomain) && staticDomain.toLowerCase().startsWith(CommonConstant.STR_HTTP)) { filePath = staticDomain + SymbolConstant.SINGLE_SLASH + relativePath; } else { filePath = "https://" + bucketName + "." + endPoint + SymbolConstant.SINGLE_SLASH + fileUrl; } PutObjectResult result = ossClient.putObject(bucketName, fileUrl.toString(),stream); // 设置权限(公开读) ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead); if (result != null) { log.info("------OSS文件上传成功------" + fileUrl); } return filePath; } /** * 替换前缀,防止key不一致导致获取不到文件 * @param objectName 文件上传路径 key * @param customBucket 自定义桶
* @date 2022-01-20 * @author lsq * @return */ private static String replacePrefix(String objectName,String customBucket){ log.info("------replacePrefix---替换前---objectName:{}",objectName); if(oConvertUtils.isNotEmpty(staticDomain)){ objectName= objectName.replace(staticDomain+SymbolConstant.SINGLE_SLASH,""); }else{ String newBucket = bucketName; if(oConvertUtils.isNotEmpty(customBucket)){ newBucket = customBucket; } String path ="https://" + newBucket + "." + endPoint + SymbolConstant.SINGLE_SLASH; objectName = objectName.replace(path,""); } log.info("------replacePrefix---替换后---objectName:{}",objectName); return objectName; } }
repos\JeecgBoot-main\jeecg-boot\jeecg-boot-base-core\src\main\java\org\jeecg\common\util\oss\OssBootUtil.java
1
请在Spring Boot框架中完成以下Java代码
public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age;
} public String getPosition() { return position; } public void setPosition(String position) { this.position = position; } @Override public String toString() { return "Employee [id=" + id + ", name=" + name + ", position=" + position + "]"; } }
repos\sample-spring-microservices-new-master\department-service\src\main\java\pl\piomin\services\department\model\Employee.java
2
请完成以下Java代码
class LabelFieldNameFactory { private final HashMap<AdUIElementId, String> fieldNamesById = new HashMap<>(); private final HashSet<String> fieldNames = new HashSet<>(); public String getFieldName(@NonNull final AdUIElementId uiElementId) { final String fieldName = fieldNamesById.get(uiElementId); if (fieldName == null) { throw new AdempiereException("No label field name registered for " + uiElementId); } return fieldName; } public String createFieldName(@NonNull final AdUIElementId uiElementId, @NonNull final String labelsTableName) { String existingFieldName = fieldNamesById.get(uiElementId); if (existingFieldName != null) { return existingFieldName; } for (int i = 1; i <= 100; i++) { String fieldName; if (i == 1) { fieldName = WindowConstants.FIELDNAME_Labels_Prefix + labelsTableName; } else
{ fieldName = WindowConstants.FIELDNAME_Labels_Prefix + labelsTableName + "_" + i; } if (!fieldNames.contains(fieldName)) { registerFieldName(uiElementId, fieldName); return fieldName; } } String fieldName = WindowConstants.FIELDNAME_Labels_Prefix + uiElementId.getRepoId(); registerFieldName(uiElementId, fieldName); return fieldName; } private void registerFieldName(final @NonNull AdUIElementId uiElementId, final String fieldName) { fieldNamesById.put(uiElementId, fieldName); fieldNames.add(fieldName); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\descriptor\factory\standard\LabelFieldNameFactory.java
1
请完成以下Java代码
private void saveSysConfig(final String sysconfigName, final String sysconfigValue) { if (!DB.isConnected()) { logger.warn("DB not connected. Cannot write: " + sysconfigName + "=" + sysconfigValue); return; } developerModeBL.executeAsSystem(new ContextRunnable() { @Override public void run(Properties sysCtx) { sysConfigBL.setValue(sysconfigName, sysconfigValue, ClientId.SYSTEM, OrgId.ANY); } }); } private String createSysConfigName(Object key) { return createSysConfigPrefix() + "." + key.toString(); } private String createSysConfigPrefix() { return SYSCONFIG_PREFIX + lookAndFeelId; } public void loadAllFromSysConfigTo(final UIDefaults uiDefaults) { if (!DB.isConnected()) { return; } final String prefix = createSysConfigPrefix() + "."; final boolean removePrefix = true; final Properties ctx = Env.getCtx(); final ClientAndOrgId clientAndOrgId = ClientAndOrgId.ofClientAndOrg(Env.getAD_Client_ID(ctx), Env.getAD_Org_ID(ctx));
final Map<String, String> map = sysConfigBL.getValuesForPrefix(prefix, removePrefix, clientAndOrgId); for (final Map.Entry<String, String> mapEntry : map.entrySet()) { final String key = mapEntry.getKey(); final String valueStr = mapEntry.getValue(); try { final Object value = serializer.fromString(valueStr); uiDefaults.put(key, value); } catch (Exception ex) { logger.warn("Failed loading " + key + ": " + valueStr + ". Skipped.", ex); } } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\plaf\SysConfigUIDefaultsRepository.java
1
请在Spring Boot框架中完成以下Java代码
public class DeliveredQtyItem { Quantity qtyInStockUom; Quantity qtyNominal; Quantity qtyCatch; Quantity qtyOverride; /** default: {@code false} */ boolean inDispute; /** Usually we ignore items where this is false; but sometimes we still need the items to exist none the less */ boolean completedOrClosed; @Builder @JsonCreator private DeliveredQtyItem(
@JsonProperty("qtyInStockUom") @NonNull final Quantity qtyInStockUom, @JsonProperty("qtyNominal") @NonNull final Quantity qtyNominal, @JsonProperty("qtyCatch") @Nullable final Quantity qtyCatch, @JsonProperty("qtyOverride") @Nullable final Quantity qtyOverride, @JsonProperty("completedOrClosed") final boolean completedOrClosed, @JsonProperty("inDispute") @Nullable final Boolean inDispute) { this.qtyInStockUom = qtyInStockUom; this.qtyNominal = qtyNominal; this.qtyCatch = qtyCatch; this.qtyOverride = qtyOverride; this.completedOrClosed = completedOrClosed; this.inDispute = coalesceNotNull(inDispute, false); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\internalbusinesslogic\DeliveredQtyItem.java
2
请在Spring Boot框架中完成以下Java代码
public PmsPermission getByPermissionName(String permissionName) { return pmsPermissionDao.getByPermissionName(permissionName); } /** * 检查权限是否已存在 * * @param permission * @return */ public PmsPermission getByPermission(String permission) { return pmsPermissionDao.getByPermission(permission); } /** * 检查权限名称是否已存在(其他id) * * @param permissionName * @param id * @return */ public PmsPermission getByPermissionNameNotEqId(String permissionName, Long id) { return pmsPermissionDao.getByPermissionNameNotEqId(permissionName, id); } /** * pmsPermissionDao 删除 * * @param permission */ public void delete(Long permissionId) { pmsPermissionDao.delete(permissionId); } /** * 根据角色查找角色对应的功能权限ID集 * * @param roleId * @return
*/ public String getPermissionIdsByRoleId(Long roleId) { List<PmsRolePermission> rmList = pmsRolePermissionDao.listByRoleId(roleId); StringBuffer actionIds = new StringBuffer(); if (rmList != null && !rmList.isEmpty()) { for (PmsRolePermission rm : rmList) { actionIds.append(rm.getPermissionId()).append(","); } } return actionIds.toString(); } /** * 查询所有的权限 */ public List<PmsPermission> listAll() { Map<String, Object> paramMap = new HashMap<String, Object>(); return pmsPermissionDao.listBy(paramMap); } }
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\permission\service\impl\PmsPermissionServiceImpl.java
2
请完成以下Java代码
public ProcessInstanceBuilder linkedProcessInstanceId(String linkedProcessInstanceId) { this.linkedProcessInstanceId = linkedProcessInstanceId; return this; } @Override public ProcessInstanceBuilder linkedProcessInstanceType(String linkedProcessInstanceType) { this.linkedProcessInstanceType = linkedProcessInstanceType; return this; } public boolean hasProcessDefinitionIdOrKey() { return this.getProcessDefinitionId() != null || this.getProcessDefinitionKey() != null; } public ProcessInstance start() { return runtimeService.startProcessInstance(this); } public ProcessInstance create() { return runtimeService.createProcessInstance(this); } public String getProcessDefinitionId() { return processDefinitionId; } public String getProcessDefinitionKey() { return processDefinitionKey; } public String getMessageName() { return messageName; } public String getProcessInstanceName() { return processInstanceName; } public String getBusinessKey() { return businessKey; } public String getLinkedProcessInstanceId() {
return linkedProcessInstanceId; } public String getLinkedProcessInstanceType() { return linkedProcessInstanceType; } public String getTenantId() { return tenantId; } public Map<String, Object> getVariables() { return variables; } public Map<String, Object> getTransientVariables() { return transientVariables; } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\runtime\ProcessInstanceBuilderImpl.java
1
请完成以下Java代码
public ProcessEngineException cannotDestroySubordinateInNonScope(MigratingActivityInstance activityInstance) { return new ProcessEngineException(exceptionMessage( "006", "{}", "Cannot destroy a subordinate of activity instance '{}'. Activity '{}' is not a scope", activityInstance.getActivityInstance().getId(), activityInstance.getActivityInstance().getActivityId())); } public ProcessEngineException cannotAttachToTransitionInstance(MigratingInstance attachingInstance) { return new ProcessEngineException(exceptionMessage( "007", "{}", "Cannot attach instance '{}' to a transition instance", attachingInstance)); } public BadUserRequestException processDefinitionDoesNotExist(String processDefinitionId, String type) { return new BadUserRequestException(exceptionMessage( "008", "{} process definition with id '{}' does not exist", type, processDefinitionId )); } public ProcessEngineException cannotMigrateBetweenTenants(String sourceTenantId, String targetTenantId) { return new ProcessEngineException(exceptionMessage( "09", "Cannot migrate process instances between processes of different tenants ('{}' != '{}')", sourceTenantId, targetTenantId)); } public ProcessEngineException cannotMigrateInstanceBetweenTenants(String processInstanceId, String sourceTenantId, String targetTenantId) { String detailMessage = null; if (sourceTenantId != null) { detailMessage = exceptionMessage( "010", "Cannot migrate process instance '{}' to a process definition of a different tenant ('{}' != '{}')", processInstanceId, sourceTenantId, targetTenantId);
} else { detailMessage = exceptionMessage( "010", "Cannot migrate process instance '{}' without tenant to a process definition with a tenant ('{}')", processInstanceId, targetTenantId); } return new ProcessEngineException(detailMessage); } public ProcessEngineException cannotHandleChild(MigratingScopeInstance scopeInstance, MigratingProcessElementInstance childCandidate) { return new ProcessEngineException( exceptionMessage( "011", "Scope instance of type {} cannot have child of type {}", scopeInstance.getClass().getSimpleName(), childCandidate.getClass().getSimpleName()) ); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\migration\MigrationLogger.java
1
请在Spring Boot框架中完成以下Java代码
private static class DDOrderCandidateAllocCandidate { @NonNull DDOrderCandidateId ddOrderCandidateId; @NonNull Quantity qty; public DDOrderCandidateAlloc.DDOrderCandidateAllocBuilder toDDOrderCandidateAlloc() { return DDOrderCandidateAlloc.builder() .ddOrderCandidateId(ddOrderCandidateId) .qty(qty); } } @Getter @RequiredArgsConstructor private static class LineAggregate { @NonNull private final LineAggregationKey key; @NonNull private Quantity qty; @NonNull private final ArrayList<DDOrderCandidateAllocCandidate> allocations = new ArrayList<>(); public LineAggregate(@NonNull final LineAggregationKey key) { this.key = key;
this.qty = Quantitys.zero(key.getUomId()); } public void add(@NonNull final DDOrderCandidate candidate) { add(DDOrderCandidateAllocCandidate.builder() .ddOrderCandidateId(candidate.getIdNotNull()) .qty(candidate.getQtyToProcess()) .build()); } private void add(@NonNull final DDOrderCandidateAllocCandidate alloc) { this.qty = this.qty.add(alloc.getQty()); this.allocations.add(alloc); } public boolean isEligibleToCreate() { return qty.signum() != 0; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\de\metas\distribution\ddordercandidate\DDOrderCandidateProcessCommand.java
2
请在Spring Boot框架中完成以下Java代码
public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getIsbn() { return isbn; } public void setIsbn(String isbn) { this.isbn = isbn; } public Author getAuthor() { return author; } public void setAuthor(Author author) { this.author = author; } @Override public boolean equals(Object obj) { if (this == obj) { return true; }
if (getClass() != obj.getClass()) { return false; } return id != null && id.equals(((Book) obj).id); } @Override public int hashCode() { return 2021; } @Override public String toString() { return "Book{" + "id=" + id + ", title=" + title + ", isbn=" + isbn + '}'; } }
repos\Hibernate-SpringBoot-master\HibernateSpringBootJoinTableRepositoryInheritance\src\main\java\com\bookstore\entity\Book.java
2
请在Spring Boot框架中完成以下Java代码
public Users timestamp(OffsetDateTime timestamp) { this.timestamp = timestamp; return this; } /** * Der Zeitstempel der letzten Änderung * @return timestamp **/ @Schema(description = "Der Zeitstempel der letzten Änderung") public OffsetDateTime getTimestamp() { return timestamp; } public void setTimestamp(OffsetDateTime timestamp) { this.timestamp = timestamp; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Users users = (Users) o; return Objects.equals(this._id, users._id) && Objects.equals(this.firstName, users.firstName) && Objects.equals(this.lastName, users.lastName) && Objects.equals(this.email, users.email) && Objects.equals(this.timestamp, users.timestamp); }
@Override public int hashCode() { return Objects.hash(_id, firstName, lastName, email, timestamp); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Users {\n"); sb.append(" _id: ").append(toIndentedString(_id)).append("\n"); sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); sb.append(" email: ").append(toIndentedString(email)).append("\n"); sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\alberta\alberta-patient-api\src\main\java\io\swagger\client\model\Users.java
2
请完成以下Java代码
public static void main(String args[]) { SpringApplication.run(Application.class, args); } @Autowired JdbcTemplate jdbcTemplate; @Override public void run(String... strings) throws Exception { log.info("Creating tables"); jdbcTemplate.execute("DROP TABLE IF EXISTS customers"); jdbcTemplate.execute("CREATE TABLE customers(" + "id SERIAL, first_name VARCHAR(255), last_name VARCHAR(255))"); // Split up the array of whole names into an array of first/last names List<Object[]> splitUpNames = Arrays.asList("John Woo", "Jeff Dean", "Josh Bloch", "Josh Long").stream()
.map(name -> name.split(" ")) .collect(Collectors.toList()); // Use a Java 8 stream to print out each tuple of the list splitUpNames.forEach(name -> log.info(String.format("Inserting customer record for %s %s", name[0], name[1]))); // Uses JdbcTemplate's batchUpdate operation to bulk load data jdbcTemplate.batchUpdate("INSERT INTO customers(first_name, last_name) VALUES (?,?)", splitUpNames); log.info("Querying for customer records where first_name = 'Josh':"); jdbcTemplate.query( "SELECT id, first_name, last_name FROM customers WHERE first_name = ?", new Object[]{"Josh"}, (rs, rowNum) -> new Customer(rs.getLong("id"), rs.getString("first_name"), rs.getString("last_name")) ).forEach(customer -> log.info(customer.toString())); } }
repos\spring-boot-quick-master\quick-jdbc\src\main\java\com\quick\jdbc\Application.java
1
请在Spring Boot框架中完成以下Java代码
public final class TomcatServletWebServerAutoConfiguration { private final TomcatServerProperties tomcatProperties; TomcatServletWebServerAutoConfiguration(TomcatServerProperties tomcatProperties) { this.tomcatProperties = tomcatProperties; } @Bean @ConditionalOnMissingBean(value = ServletWebServerFactory.class, search = SearchStrategy.CURRENT) TomcatServletWebServerFactory tomcatServletWebServerFactory( ObjectProvider<TomcatConnectorCustomizer> connectorCustomizers, ObjectProvider<TomcatContextCustomizer> contextCustomizers, ObjectProvider<TomcatProtocolHandlerCustomizer<?>> protocolHandlerCustomizers) { TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(); factory.getConnectorCustomizers().addAll(connectorCustomizers.orderedStream().toList()); factory.getContextCustomizers().addAll(contextCustomizers.orderedStream().toList()); factory.getProtocolHandlerCustomizers().addAll(protocolHandlerCustomizers.orderedStream().toList());
return factory; } @Bean TomcatServletWebServerFactoryCustomizer tomcatServletWebServerFactoryCustomizer( TomcatServerProperties tomcatProperties) { return new TomcatServletWebServerFactoryCustomizer(tomcatProperties); } @Bean @ConditionalOnProperty(name = "server.forward-headers-strategy", havingValue = "framework") ForwardedHeaderFilterCustomizer tomcatForwardedHeaderFilterCustomizer(ServerProperties serverProperties) { return (filter) -> filter.setRelativeRedirects(this.tomcatProperties.isUseRelativeRedirects()); } }
repos\spring-boot-4.0.1\module\spring-boot-tomcat\src\main\java\org\springframework\boot\tomcat\autoconfigure\servlet\TomcatServletWebServerAutoConfiguration.java
2
请完成以下Java代码
public synchronized void setApplicationServer(String applicationServerVersion) { this.applicationServer = new ApplicationServerImpl(applicationServerVersion); } public Map<String, CommandCounter> getCommands() { return commands; } public String getCamundaIntegration() { return camundaIntegration; } public void setCamundaIntegration(String camundaIntegration) { this.camundaIntegration = camundaIntegration; } public LicenseKeyDataImpl getLicenseKey() { return licenseKey; } public void setLicenseKey(LicenseKeyDataImpl licenseKey) { this.licenseKey = licenseKey; } public synchronized Set<String> getWebapps() { return webapps; } public synchronized void setWebapps(Set<String> webapps) { this.webapps = webapps; } public void markOccurrence(String name) { markOccurrence(name, 1); } public void markOccurrence(String name, long times) { CommandCounter counter = commands.get(name); if (counter == null) { synchronized (commands) { if (counter == null) { counter = new CommandCounter(name); commands.put(name, counter); } } }
counter.mark(times); } public synchronized void addWebapp(String webapp) { if (!webapps.contains(webapp)) { webapps.add(webapp); } } public void clearCommandCounts() { commands.clear(); } public void clear() { commands.clear(); licenseKey = null; applicationServer = null; webapps.clear(); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\diagnostics\DiagnosticsRegistry.java
1
请在Spring Boot框架中完成以下Java代码
public class Order { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Integer id; @Column(nullable=false, name="cust_name") private String customerName; @Column(nullable=false, name="cust_email") private String customerEmail; @OneToMany(mappedBy="order") private Set<OrderItem> orderItems; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getCustomerName() { return customerName; } public void setCustomerName(String customerName) {
this.customerName = customerName; } public String getCustomerEmail() { return customerEmail; } public void setCustomerEmail(String customerEmail) { this.customerEmail = customerEmail; } public Set<OrderItem> getOrderItems() { return orderItems; } public void setOrderItems(Set<OrderItem> orderItems) { this.orderItems = orderItems; } }
repos\Spring-Boot-Advanced-Projects-main\springboot-multiple-datasources\src\main\java\net\alanbinu\springboot\springbootmultipledatasources\orders\entities\Order.java
2
请完成以下Java代码
public CashBalanceAvailabilityDate1 getDt() { return dt; } /** * Sets the value of the dt property. * * @param value * allowed object is * {@link CashBalanceAvailabilityDate1 } * */ public void setDt(CashBalanceAvailabilityDate1 value) { this.dt = value; } /** * Gets the value of the amt property. * * @return * possible object is * {@link ActiveOrHistoricCurrencyAndAmount } * */ 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; } }
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\CashBalanceAvailability2.java
1
请完成以下Java代码
public int getC_ReferenceNo_Type_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_ReferenceNo_Type_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Beschreibung. @param Description Beschreibung */ @Override public void setDescription (java.lang.String Description) { set_Value (COLUMNNAME_Description, Description); } /** Get Beschreibung. @return Beschreibung */ @Override public java.lang.String getDescription () { return (java.lang.String)get_Value(COLUMNNAME_Description); } /** * EntityType AD_Reference_ID=389 * Reference name: _EntityTypeNew */ public static final int ENTITYTYPE_AD_Reference_ID=389; /** Set Entitäts-Art. @param EntityType Dictionary Entity Type; Determines ownership and synchronization */ @Override
public void setEntityType (java.lang.String EntityType) { set_Value (COLUMNNAME_EntityType, EntityType); } /** Get Entitäts-Art. @return Dictionary Entity Type; Determines ownership and synchronization */ @Override public java.lang.String getEntityType () { return (java.lang.String)get_Value(COLUMNNAME_EntityType); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.document.refid\src\main\java-gen\de\metas\document\refid\model\X_C_ReferenceNo_Type_Table.java
1
请完成以下Java代码
public void setAD_Table_ID (int AD_Table_ID) { if (AD_Table_ID < 1) set_ValueNoCheck (COLUMNNAME_AD_Table_ID, null); else set_ValueNoCheck (COLUMNNAME_AD_Table_ID, Integer.valueOf(AD_Table_ID)); } /** Get DB-Tabelle. @return Database Table information */ @Override public int getAD_Table_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_AD_Table_ID); if (ii == null) return 0; return ii.intValue(); } @Override public org.compiere.model.I_AD_User getAD_User() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_AD_User_ID, org.compiere.model.I_AD_User.class); } @Override public void setAD_User(org.compiere.model.I_AD_User AD_User) { set_ValueFromPO(COLUMNNAME_AD_User_ID, org.compiere.model.I_AD_User.class, AD_User); } /** Set Ansprechpartner. @param AD_User_ID User within the system - Internal or Business Partner Contact */ @Override public void setAD_User_ID (int AD_User_ID) { if (AD_User_ID < 0) set_ValueNoCheck (COLUMNNAME_AD_User_ID, null); else set_ValueNoCheck (COLUMNNAME_AD_User_ID, Integer.valueOf(AD_User_ID)); } /** Get Ansprechpartner. @return User within the system - Internal or Business Partner Contact */ @Override public int getAD_User_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_ID); if (ii == null) return 0; return ii.intValue(); } @Override
public org.compiere.model.I_AD_UserGroup getAD_UserGroup() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_AD_UserGroup_ID, org.compiere.model.I_AD_UserGroup.class); } @Override public void setAD_UserGroup(org.compiere.model.I_AD_UserGroup AD_UserGroup) { set_ValueFromPO(COLUMNNAME_AD_UserGroup_ID, org.compiere.model.I_AD_UserGroup.class, AD_UserGroup); } /** Set Nutzergruppe. @param AD_UserGroup_ID Nutzergruppe */ @Override public void setAD_UserGroup_ID (int AD_UserGroup_ID) { if (AD_UserGroup_ID < 1) set_ValueNoCheck (COLUMNNAME_AD_UserGroup_ID, null); else set_ValueNoCheck (COLUMNNAME_AD_UserGroup_ID, Integer.valueOf(AD_UserGroup_ID)); } /** Get Nutzergruppe. @return Nutzergruppe */ @Override public int getAD_UserGroup_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_AD_UserGroup_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Datensatz-ID. @param Record_ID Direct internal record ID */ @Override public void setRecord_ID (int Record_ID) { if (Record_ID < 0) set_ValueNoCheck (COLUMNNAME_Record_ID, null); else set_ValueNoCheck (COLUMNNAME_Record_ID, Integer.valueOf(Record_ID)); } /** Get Datensatz-ID. @return Direct internal record ID */ @Override public int getRecord_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_Record_ID); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Private_Access.java
1
请完成以下Spring Boot application配置
#第三方登陆配置 social: oauth: GITHUB: client-id: 233************ client-secret: 233************************************ redirect-uri: ${social.domain}/oauth/redirect/github GITEE: client-id: 233************ client-secret: 233************************************ redirect-uri: ${social.domain}/oauth/redirect/gitee WECHAT_OPEN: client-id: 233************ client-secret: 233************************************ redirect-uri: ${social.domain}/oauth/redirect/wechat QQ: client-id: 233************ client-secret: 233*****
******************************* redirect-uri: ${social.domain}/oauth/redirect/qq DINGTALK: client-id: 233************ client-secret: 233************************************ redirect-uri: ${social.domain}/oauth/redirect/dingtalk
repos\SpringBlade-master\blade-auth\src\main\resources\application.yml
2
请完成以下Java代码
public void setName (java.lang.String Name) { set_Value (COLUMNNAME_Name, Name); } @Override public java.lang.String getName() { return (java.lang.String)get_Value(COLUMNNAME_Name); } @Override public void setSeqNo (int SeqNo) { set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo)); } @Override public int getSeqNo()
{ return get_ValueAsInt(COLUMNNAME_SeqNo); } @Override public void setValue (java.lang.String Value) { set_Value (COLUMNNAME_Value, Value); } @Override public java.lang.String getValue() { return (java.lang.String)get_Value(COLUMNNAME_Value); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\de\metas\fresh\model\X_M_CommodityNumber.java
1
请完成以下Java代码
public org.compiere.model.I_AD_Issue getAD_Issue() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_AD_Issue_ID, org.compiere.model.I_AD_Issue.class); } @Override public void setAD_Issue(org.compiere.model.I_AD_Issue AD_Issue) { set_ValueFromPO(COLUMNNAME_AD_Issue_ID, org.compiere.model.I_AD_Issue.class, AD_Issue); } /** Set System-Problem. @param AD_Issue_ID Automatically created or manually entered System Issue */ @Override public void setAD_Issue_ID (int AD_Issue_ID) { if (AD_Issue_ID < 1) set_ValueNoCheck (COLUMNNAME_AD_Issue_ID, null); else set_ValueNoCheck (COLUMNNAME_AD_Issue_ID, Integer.valueOf(AD_Issue_ID)); } /** Get System-Problem. @return Automatically created or manually entered System Issue */ @Override public int getAD_Issue_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_AD_Issue_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Java-Klasse. @param Classname Java-Klasse */ @Override public void setClassname (java.lang.String Classname) { set_ValueNoCheck (COLUMNNAME_Classname, Classname); } /** Get Java-Klasse. @return Java-Klasse */ @Override public java.lang.String getClassname () { return (java.lang.String)get_Value(COLUMNNAME_Classname); } /** Set Fehler. @param IsError Ein Fehler ist bei der Durchführung aufgetreten */ @Override public void setIsError (boolean IsError) { set_Value (COLUMNNAME_IsError, Boolean.valueOf(IsError)); } /** Get Fehler. @return Ein Fehler ist bei der Durchführung aufgetreten */ @Override public boolean isError () { Object oo = get_Value(COLUMNNAME_IsError); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Message Text.
@param MsgText Textual Informational, Menu or Error Message */ @Override public void setMsgText (java.lang.String MsgText) { set_ValueNoCheck (COLUMNNAME_MsgText, MsgText); } /** Get Message Text. @return Textual Informational, Menu or Error Message */ @Override public java.lang.String getMsgText () { return (java.lang.String)get_Value(COLUMNNAME_MsgText); } /** 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.adempiere.adempiere\base\src\main\java-gen\de\metas\event\model\X_AD_EventLog_Entry.java
1
请在Spring Boot框架中完成以下Java代码
public class OrderLineCandidate { @NonNull OrderId orderId; @NonNull ProductId productId; @NonNull ImmutableAttributeSet attributes; @Nullable HUPIItemProductId piItemProductId; @NonNull Quantity qty; @Nullable HuPackingInstructionsId luId; @Nullable Quantity luQty;
@Nullable ShipmentAllocationBestBeforePolicy bestBeforePolicy; @Nullable BPartnerId bpartnerId; @NonNull SOTrx soTrx; @Nullable GroupId compensationGroupId; @Nullable ProductBOMLineId explodedFromBOMLineId; }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\ui\web\order\OrderLineCandidate.java
2
请在Spring Boot框架中完成以下Java代码
private static class TrustAnyHostnameVerifier implements HostnameVerifier { public boolean verify(String hostname, SSLSession session) { return true; } } private static class TrustAnyHostnameVerifierOld implements com.sun.net.ssl.HostnameVerifier{ public boolean verify(String arg0, String arg1) { return true; } } public static ClientKeyStore loadClientKeyStore(String keyStorePath, String keyStorePass, String privateKeyPass){ try{ return loadClientKeyStore(new FileInputStream(keyStorePath), keyStorePass, privateKeyPass); }catch(Exception e){ logger.error("loadClientKeyFactory fail : "+e.getMessage(), e); return null; } } public static ClientKeyStore loadClientKeyStore(InputStream keyStoreStream, String keyStorePass, String privateKeyPass){ try{ KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); KeyStore ks = KeyStore.getInstance("JKS"); ks.load(keyStoreStream, keyStorePass.toCharArray()); kmf.init(ks, privateKeyPass.toCharArray()); return new ClientKeyStore(kmf); }catch(Exception e){ logger.error("loadClientKeyFactory fail : "+e.getMessage(), e); return null; } } public static TrustKeyStore loadTrustKeyStore(String keyStorePath, String keyStorePass){ try{ return loadTrustKeyStore(new FileInputStream(keyStorePath), keyStorePass); }catch(Exception e){ logger.error("loadTrustCertFactory fail : "+e.getMessage(), e);
return null; } } public static TrustKeyStore loadTrustKeyStore(InputStream keyStoreStream, String keyStorePass){ try{ TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); KeyStore ks = KeyStore.getInstance("JKS"); ks.load(keyStoreStream, keyStorePass.toCharArray()); tmf.init(ks); return new TrustKeyStore(tmf); }catch(Exception e){ logger.error("loadTrustCertFactory fail : "+e.getMessage(), e); return null; } } }
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\trade\utils\httpclient\SimpleHttpUtils.java
2
请完成以下Java代码
protected Object createDiscordNotification(InstanceEvent event, Instance instance) { Map<String, Object> body = new HashMap<>(); body.put("content", createContent(event, instance)); body.put("tts", tts); if (avatarUrl != null) { body.put("avatar_url", avatarUrl); } if (username != null) { body.put("username", username); } HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); headers.add(HttpHeaders.USER_AGENT, "RestTemplate"); return new HttpEntity<>(body, headers); } @Override protected String getDefaultMessage() { return DEFAULT_MESSAGE; } @Nullable public URI getWebhookUrl() { return webhookUrl; } public void setWebhookUrl(@Nullable URI webhookUrl) { this.webhookUrl = webhookUrl; } public boolean isTts() { return tts; }
public void setTts(boolean tts) { this.tts = tts; } @Nullable public String getUsername() { return username; } public void setUsername(@Nullable String username) { this.username = username; } @Nullable public String getAvatarUrl() { return avatarUrl; } public void setAvatarUrl(@Nullable String avatarUrl) { this.avatarUrl = avatarUrl; } public void setRestTemplate(RestTemplate restTemplate) { this.restTemplate = restTemplate; } }
repos\spring-boot-admin-master\spring-boot-admin-server\src\main\java\de\codecentric\boot\admin\server\notify\DiscordNotifier.java
1
请完成以下Java代码
public void afterEnqueueAfterSave(final I_C_Printing_Queue queueItem, final I_AD_Archive IGNORED) { final IQueryBL queryBL = Services.get(IQueryBL.class); final List<I_C_Printing_Queue_Recipient> recipients = queryBL.createQueryBuilder(I_C_Printing_Queue_Recipient.class, queueItem) .addOnlyActiveRecordsFilter() // we must retrieve ALL; the caller shall decide .addEqualsFilter(I_C_Printing_Queue_Recipient.COLUMN_C_Printing_Queue_ID, queueItem.getC_Printing_Queue_ID()) .create() .list(); if (recipients.isEmpty()) { resetToUserPrintingQueueRecipient(queueItem); } else { for (final I_C_Printing_Queue_Recipient queueRecipient : recipients) { final I_AD_User userToPrint = InterfaceWrapperHelper.loadOutOfTrx(queueRecipient.getAD_User_ToPrint_ID(), I_AD_User.class); final int newUserToPrintId = getEffectiveUserToPrint(userToPrint, new HashSet<>()).getAD_User_ID(); queueRecipient.setAD_User_ToPrint_ID(newUserToPrintId); InterfaceWrapperHelper.save(queueRecipient); } } }
private void resetToUserPrintingQueueRecipient(final I_C_Printing_Queue queueItem) { final I_AD_User itemUser = Services.get(IUserDAO.class).getByIdInTrx(UserId.ofRepoId(queueItem.getAD_User_ID()), I_AD_User.class); final int userToPrintId = getEffectiveUserToPrint(itemUser, new HashSet<>()).getAD_User_ID(); final IPrintingQueueBL printingQueueBL = Services.get(IPrintingQueueBL.class); printingQueueBL.setPrintoutForOtherUsers(queueItem, ImmutableSet.of(userToPrintId)); } private I_AD_User getEffectiveUserToPrint(final I_AD_User user, final Set<Integer> alreadSeenUserIDs) { if (user.getC_Printing_Queue_Recipient_ID() <= 0) { return user; } if (!alreadSeenUserIDs.add(user.getC_Printing_Queue_Recipient_ID())) { return user; } return getEffectiveUserToPrint(user.getC_Printing_Queue_Recipient(), alreadSeenUserIDs); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.printing\de.metas.printing.base\src\main\java\de\metas\printing\spi\impl\C_Printing_Queue_RecipientHandler.java
1
请完成以下Java代码
public void setPP_Order_Node_Asset_ID (int PP_Order_Node_Asset_ID) { if (PP_Order_Node_Asset_ID < 1) set_ValueNoCheck (COLUMNNAME_PP_Order_Node_Asset_ID, null); else set_ValueNoCheck (COLUMNNAME_PP_Order_Node_Asset_ID, Integer.valueOf(PP_Order_Node_Asset_ID)); } /** Get Manufacturing Order Activity Asset. @return Manufacturing Order Activity Asset */ public int getPP_Order_Node_Asset_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_PP_Order_Node_Asset_ID); if (ii == null) return 0; return ii.intValue(); } public org.eevolution.model.I_PP_Order_Node getPP_Order_Node() throws RuntimeException { return (org.eevolution.model.I_PP_Order_Node)MTable.get(getCtx(), org.eevolution.model.I_PP_Order_Node.Table_Name) .getPO(getPP_Order_Node_ID(), get_TrxName()); } /** Set Manufacturing Order Activity. @param PP_Order_Node_ID Manufacturing Order Activity */ public void setPP_Order_Node_ID (int PP_Order_Node_ID) { if (PP_Order_Node_ID < 1) set_ValueNoCheck (COLUMNNAME_PP_Order_Node_ID, null); else set_ValueNoCheck (COLUMNNAME_PP_Order_Node_ID, Integer.valueOf(PP_Order_Node_ID)); } /** Get Manufacturing Order Activity. @return Manufacturing Order Activity */ public int getPP_Order_Node_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_PP_Order_Node_ID); if (ii == null) return 0; return ii.intValue(); } public org.eevolution.model.I_PP_Order_Workflow getPP_Order_Workflow() throws RuntimeException {
return (org.eevolution.model.I_PP_Order_Workflow)MTable.get(getCtx(), org.eevolution.model.I_PP_Order_Workflow.Table_Name) .getPO(getPP_Order_Workflow_ID(), get_TrxName()); } /** Set Manufacturing Order Workflow. @param PP_Order_Workflow_ID Manufacturing Order Workflow */ public void setPP_Order_Workflow_ID (int PP_Order_Workflow_ID) { if (PP_Order_Workflow_ID < 1) set_ValueNoCheck (COLUMNNAME_PP_Order_Workflow_ID, null); else set_ValueNoCheck (COLUMNNAME_PP_Order_Workflow_ID, Integer.valueOf(PP_Order_Workflow_ID)); } /** Get Manufacturing Order Workflow. @return Manufacturing Order Workflow */ public int getPP_Order_Workflow_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_PP_Order_Workflow_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\eevolution\model\X_PP_Order_Node_Asset.java
1
请完成以下Java代码
public class C_Dunning_Candidate_Create extends JavaProcess { private static final String PARAM_DunningDate = "DunningDate"; private Timestamp p_DunningDate = null; private static final String PARAM_IsFullUpdate = "IsFullUpdate"; private boolean p_IsFullUpdate = false; final private ITrxManager trxManager = Services.get(ITrxManager.class); @Override protected void prepare() { // Defaults p_DunningDate = Env.getContextAsDate(getCtx(), "#Date"); p_IsFullUpdate = false; for (ProcessInfoParameter para : getParametersAsArray()) { if (para.getParameter() == null) { // skip if no parameter value continue; } final String name = para.getParameterName(); if (PARAM_DunningDate.equals(name)) { p_DunningDate = para.getParameterAsTimestamp(); } else if (PARAM_IsFullUpdate.equals(name)) { p_IsFullUpdate = para.getParameterAsBoolean(); } } } @Override protected String doIt() { final IDunningDAO dunningDAO = Services.get(IDunningDAO.class); // // Generate dunning candidates for (final I_C_Dunning dunning : dunningDAO.retrieveDunnings()) { for (final I_C_DunningLevel dunningLevel : dunningDAO.retrieveDunningLevels(dunning)) { generateCandidates(dunningLevel); }
} return MSG_OK; } private void generateCandidates(final I_C_DunningLevel dunningLevel) { final IDunningBL dunningBL = Services.get(IDunningBL.class); trxManager.runInNewTrx(new TrxRunnableAdapter() { @Override public void run(String localTrxName) throws Exception { final IDunningContext context = dunningBL.createDunningContext(getCtx(), dunningLevel, p_DunningDate, get_TrxName()); context.setProperty(IDunningCandidateProducer.CONTEXT_FullUpdate, p_IsFullUpdate); final int countDelete = Services.get(IDunningDAO.class).deleteNotProcessedCandidates(context, dunningLevel); addLog("@C_DunningLevel@ " + dunningLevel.getName() + ": " + countDelete + " record(s) deleted"); final int countCreateUpdate = dunningBL.createDunningCandidates(context); addLog("@C_DunningLevel@ " + dunningLevel.getName() + ": " + countCreateUpdate + " record(s) created/updated"); } }); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.dunning\src\main\java\de\metas\dunning\process\C_Dunning_Candidate_Create.java
1
请完成以下Java代码
public SqlAndParams negate() { if (sql.isEmpty()) { return this; } return new SqlAndParams("NOT (" + this.sql + ")", this.sqlParams); } // // // --------------- // // public static class Builder { private StringBuilder sql = null; private ArrayList<Object> sqlParams = null; private Builder() { } /** * @deprecated I think you wanted to call {@link #build()} */ @Override @Deprecated public String toString() { return MoreObjects.toStringHelper(this) .add("sql", sql) .add("sqlParams", sqlParams) .toString(); } public SqlAndParams build() { final String sql = this.sql != null ? this.sql.toString() : ""; final Object[] sqlParamsArray = sqlParams != null ? sqlParams.toArray() : null; return new SqlAndParams(sql, sqlParamsArray); } public Builder clear() { sql = null; sqlParams = null; return this; } public boolean isEmpty() { return length() <= 0 && !hasParameters(); } public int length() { return sql != null ? sql.length() : 0; } public boolean hasParameters() { return sqlParams != null && !sqlParams.isEmpty(); } public int getParametersCount() { return sqlParams != null ? sqlParams.size() : 0; }
public Builder appendIfHasParameters(@NonNull final CharSequence sql) { if (hasParameters()) { return append(sql); } else { return this; } } public Builder appendIfNotEmpty(@NonNull final CharSequence sql, @Nullable final Object... sqlParams) { if (!isEmpty()) { append(sql, sqlParams); } return this; } public Builder append(@NonNull final CharSequence sql, @Nullable final Object... sqlParams) { final List<Object> sqlParamsList = sqlParams != null && sqlParams.length > 0 ? Arrays.asList(sqlParams) : null; return append(sql, sqlParamsList); } public Builder append(@NonNull final CharSequence sql, @Nullable final List<Object> sqlParams) { if (sql.length() > 0) { if (this.sql == null) { this.sql = new StringBuilder(); } this.sql.append(sql); } if (sqlParams != null && !sqlParams.isEmpty()) { if (this.sqlParams == null) { this.sqlParams = new ArrayList<>(); } this.sqlParams.addAll(sqlParams); } return this; } public Builder append(@NonNull final SqlAndParams other) { return append(other.sql, other.sqlParams); } public Builder append(@NonNull final SqlAndParams.Builder other) { return append(other.sql, other.sqlParams); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\view\descriptor\SqlAndParams.java
1
请完成以下Java代码
public void setOvertimeAmt (BigDecimal OvertimeAmt) { set_Value (COLUMNNAME_OvertimeAmt, OvertimeAmt); } /** Get Overtime Amount. @return Hourly Overtime Rate */ public BigDecimal getOvertimeAmt () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_OvertimeAmt); if (bd == null) return Env.ZERO; return bd; } /** Set Overtime Cost. @param OvertimeCost Hourly Overtime Cost */ public void setOvertimeCost (BigDecimal OvertimeCost) { set_Value (COLUMNNAME_OvertimeCost, OvertimeCost); } /** Get Overtime Cost. @return Hourly Overtime Cost */ public BigDecimal getOvertimeCost () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_OvertimeCost); if (bd == null) return Env.ZERO; return bd; } /** Set Valid from. @param ValidFrom Valid from including this date (first day) */ public void setValidFrom (Timestamp ValidFrom) { set_Value (COLUMNNAME_ValidFrom, ValidFrom); } /** Get Valid from. @return Valid from including this date (first day) */
public Timestamp getValidFrom () { return (Timestamp)get_Value(COLUMNNAME_ValidFrom); } /** Set Valid to. @param ValidTo Valid to including this date (last day) */ public void setValidTo (Timestamp ValidTo) { set_Value (COLUMNNAME_ValidTo, ValidTo); } /** Get Valid to. @return Valid to including this date (last day) */ public Timestamp getValidTo () { return (Timestamp)get_Value(COLUMNNAME_ValidTo); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_UserRemuneration.java
1
请完成以下Java代码
public void setIsLoginIncorrect (final boolean IsLoginIncorrect) { set_Value (COLUMNNAME_IsLoginIncorrect, IsLoginIncorrect); } @Override public boolean isLoginIncorrect() { return get_ValueAsBoolean(COLUMNNAME_IsLoginIncorrect); } @Override public void setLoginDate (final @Nullable java.sql.Timestamp LoginDate) { set_Value (COLUMNNAME_LoginDate, LoginDate); } @Override public java.sql.Timestamp getLoginDate() { return get_ValueAsTimestamp(COLUMNNAME_LoginDate); } @Override public void setLoginUsername (final @Nullable java.lang.String LoginUsername) { set_Value (COLUMNNAME_LoginUsername, LoginUsername); } @Override public java.lang.String getLoginUsername() { return get_ValueAsString(COLUMNNAME_LoginUsername); } @Override public void setProcessed (final boolean Processed) { set_ValueNoCheck (COLUMNNAME_Processed, Processed); } @Override public boolean isProcessed() { return get_ValueAsBoolean(COLUMNNAME_Processed); } @Override public void setRemote_Addr (final @Nullable java.lang.String Remote_Addr) { set_ValueNoCheck (COLUMNNAME_Remote_Addr, Remote_Addr);
} @Override public java.lang.String getRemote_Addr() { return get_ValueAsString(COLUMNNAME_Remote_Addr); } @Override public void setRemote_Host (final @Nullable java.lang.String Remote_Host) { set_ValueNoCheck (COLUMNNAME_Remote_Host, Remote_Host); } @Override public java.lang.String getRemote_Host() { return get_ValueAsString(COLUMNNAME_Remote_Host); } @Override public void setWebSession (final @Nullable java.lang.String WebSession) { set_ValueNoCheck (COLUMNNAME_WebSession, WebSession); } @Override public java.lang.String getWebSession() { return get_ValueAsString(COLUMNNAME_WebSession); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Session.java
1
请在Spring Boot框架中完成以下Java代码
public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getMail() {
return mail; } public void setMail(String mail) { this.mail = mail; } @Override public String toString() { return "LoginReq{" + "username='" + username + '\'' + ", password='" + password + '\'' + ", phone='" + phone + '\'' + ", mail='" + mail + '\'' + '}'; } }
repos\SpringBoot-Dubbo-Docker-Jenkins-master\Gaoxi-Common-Service-Facade\src\main\java\com\gaoxi\req\user\LoginReq.java
2
请完成以下Java代码
public JAXBElement<byte[]> createEncryptionMethodTypeOAEPparams(byte[] value) { return new JAXBElement<byte[]>(_EncryptionMethodTypeOAEPparams_QNAME, byte[].class, EncryptionMethodType.class, ((byte[]) value)); } /** * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >} * * @param value * Java instance representing xml element's value. * @return * the new instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >} */ @XmlElementDecl(namespace = "http://www.w3.org/2001/04/xmlenc#", name = "KA-Nonce", scope = AgreementMethodType.class) public JAXBElement<byte[]> createAgreementMethodTypeKANonce(byte[] value) { return new JAXBElement<byte[]>(_AgreementMethodTypeKANonce_QNAME, byte[].class, AgreementMethodType.class, ((byte[]) value)); } /** * Create an instance of {@link JAXBElement }{@code <}{@link KeyInfoType }{@code >} * * @param value * Java instance representing xml element's value. * @return * the new instance of {@link JAXBElement }{@code <}{@link KeyInfoType }{@code >} */ @XmlElementDecl(namespace = "http://www.w3.org/2001/04/xmlenc#", name = "OriginatorKeyInfo", scope = AgreementMethodType.class) public JAXBElement<KeyInfoType> createAgreementMethodTypeOriginatorKeyInfo(KeyInfoType value) { return new JAXBElement<KeyInfoType>(_AgreementMethodTypeOriginatorKeyInfo_QNAME, KeyInfoType.class, AgreementMethodType.class, value); }
/** * Create an instance of {@link JAXBElement }{@code <}{@link KeyInfoType }{@code >} * * @param value * Java instance representing xml element's value. * @return * the new instance of {@link JAXBElement }{@code <}{@link KeyInfoType }{@code >} */ @XmlElementDecl(namespace = "http://www.w3.org/2001/04/xmlenc#", name = "RecipientKeyInfo", scope = AgreementMethodType.class) public JAXBElement<KeyInfoType> createAgreementMethodTypeRecipientKeyInfo(KeyInfoType value) { return new JAXBElement<KeyInfoType>(_AgreementMethodTypeRecipientKeyInfo_QNAME, KeyInfoType.class, AgreementMethodType.class, value); } }
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_request\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\request\ObjectFactory.java
1
请完成以下Java代码
public void setPOReference (final @Nullable java.lang.String POReference) { set_ValueNoCheck (COLUMNNAME_POReference, POReference); } @Override public java.lang.String getPOReference() { return get_ValueAsString(COLUMNNAME_POReference); } @Override public void setPostingType (final @Nullable java.lang.String PostingType) { set_ValueNoCheck (COLUMNNAME_PostingType, PostingType); } @Override public java.lang.String getPostingType() { return get_ValueAsString(COLUMNNAME_PostingType); } @Override public void setRV_DATEV_Export_Fact_Acct_Invoice_ID (final int RV_DATEV_Export_Fact_Acct_Invoice_ID) { if (RV_DATEV_Export_Fact_Acct_Invoice_ID < 1) set_ValueNoCheck (COLUMNNAME_RV_DATEV_Export_Fact_Acct_Invoice_ID, null); else set_ValueNoCheck (COLUMNNAME_RV_DATEV_Export_Fact_Acct_Invoice_ID, RV_DATEV_Export_Fact_Acct_Invoice_ID); } @Override public int getRV_DATEV_Export_Fact_Acct_Invoice_ID() { return get_ValueAsInt(COLUMNNAME_RV_DATEV_Export_Fact_Acct_Invoice_ID); }
@Override public void setTaxAmtSource (final @Nullable BigDecimal TaxAmtSource) { set_ValueNoCheck (COLUMNNAME_TaxAmtSource, TaxAmtSource); } @Override public BigDecimal getTaxAmtSource() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_TaxAmtSource); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setVATCode (final @Nullable java.lang.String VATCode) { set_ValueNoCheck (COLUMNNAME_VATCode, VATCode); } @Override public java.lang.String getVATCode() { return get_ValueAsString(COLUMNNAME_VATCode); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.datev\src\main\java-gen\de\metas\datev\model\X_RV_DATEV_Export_Fact_Acct_Invoice.java
1
请完成以下Java代码
public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getVerifyEmail() { return verifyEmail; } public void setVerifyEmail(String verifyEmail) { this.verifyEmail = verifyEmail; }
public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getVerifyPassword() { return verifyPassword; } public void setVerifyPassword(String verifyPassword) { this.verifyPassword = verifyPassword; } }
repos\tutorials-master\spring-web-modules\spring-mvc-basics\src\main\java\com\baeldung\customvalidator\NewUserForm.java
1
请在Spring Boot框架中完成以下Java代码
public HistoricTaskLogEntryBuilder subScopeId(String subScopeId) { this.subScopeId = subScopeId; return this; } @Override public HistoricTaskLogEntryBuilder scopeType(String scopeType) { this.scopeType = scopeType; return this; } @Override public HistoricTaskLogEntryBuilder tenantId(String tenantId) { this.tenantId = tenantId; return this; } @Override public String getType() { return type; } @Override public String getTaskId() { return taskId; } @Override public Date getTimeStamp() { return timeStamp; } @Override public String getUserId() { return userId; } @Override public String getData() { return data; } @Override public String getExecutionId() { return executionId; }
@Override public String getProcessInstanceId() { return processInstanceId; } @Override public String getProcessDefinitionId() { return processDefinitionId; } @Override public String getScopeId() { return scopeId; } @Override public String getScopeDefinitionId() { return scopeDefinitionId; } @Override public String getSubScopeId() { return subScopeId; } @Override public String getScopeType() { return scopeType; } @Override public String getTenantId() { return tenantId; } @Override public void create() { // add is not supported by default throw new RuntimeException("Operation is not supported"); } }
repos\flowable-engine-main\modules\flowable-task-service\src\main\java\org\flowable\task\service\impl\BaseHistoricTaskLogEntryBuilderImpl.java
2
请完成以下Java代码
public Object getPrincipal() { return getAccessToken(); } @Override public Object getCredentials() { return getAccessToken(); } /** * Returns the DPoP-bound access token. * @return the DPoP-bound access token */ public String getAccessToken() { return this.accessToken; } /** * Returns the DPoP Proof {@link Jwt}. * @return the DPoP Proof {@link Jwt} */ public String getDPoPProof() { return this.dPoPProof; } /**
* Returns the value of the HTTP method of the request. * @return the value of the HTTP method of the request */ public String getMethod() { return this.method; } /** * Returns the value of the HTTP resource URI of the request, without query and * fragment parts. * @return the value of the HTTP resource URI of the request */ public String getResourceUri() { return this.resourceUri; } }
repos\spring-security-main\oauth2\oauth2-resource-server\src\main\java\org\springframework\security\oauth2\server\resource\authentication\DPoPAuthenticationToken.java
1
请完成以下Java代码
public class X_M_Shipper_RoutingCode extends org.compiere.model.PO implements I_M_Shipper_RoutingCode, org.compiere.model.I_Persistent { private static final long serialVersionUID = 1719554458L; /** Standard Constructor */ public X_M_Shipper_RoutingCode (final Properties ctx, final int M_Shipper_RoutingCode_ID, @Nullable final String trxName) { super (ctx, M_Shipper_RoutingCode_ID, trxName); } /** Load Constructor */ public X_M_Shipper_RoutingCode (final Properties ctx, final ResultSet rs, @Nullable final String trxName) { super (ctx, rs, trxName); } /** Load Meta Data */ @Override protected org.compiere.model.POInfo initPO(final Properties ctx) { return org.compiere.model.POInfo.getPOInfo(Table_Name); } @Override public org.compiere.model.I_M_Shipper getM_Shipper() { return get_ValueAsPO(COLUMNNAME_M_Shipper_ID, org.compiere.model.I_M_Shipper.class); } @Override public void setM_Shipper(final org.compiere.model.I_M_Shipper M_Shipper) { set_ValueFromPO(COLUMNNAME_M_Shipper_ID, org.compiere.model.I_M_Shipper.class, M_Shipper); } @Override public void setM_Shipper_ID (final int M_Shipper_ID) { if (M_Shipper_ID < 1) set_Value (COLUMNNAME_M_Shipper_ID, null); else set_Value (COLUMNNAME_M_Shipper_ID, M_Shipper_ID); } @Override public int getM_Shipper_ID() { return get_ValueAsInt(COLUMNNAME_M_Shipper_ID); } @Override public void setM_Shipper_RoutingCode_ID (final int M_Shipper_RoutingCode_ID)
{ if (M_Shipper_RoutingCode_ID < 1) set_ValueNoCheck (COLUMNNAME_M_Shipper_RoutingCode_ID, null); else set_ValueNoCheck (COLUMNNAME_M_Shipper_RoutingCode_ID, M_Shipper_RoutingCode_ID); } @Override public int getM_Shipper_RoutingCode_ID() { return get_ValueAsInt(COLUMNNAME_M_Shipper_RoutingCode_ID); } @Override public void setName (final @Nullable java.lang.String Name) { set_Value (COLUMNNAME_Name, Name); } @Override public java.lang.String getName() { return get_ValueAsString(COLUMNNAME_Name); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Shipper_RoutingCode.java
1
请完成以下Java代码
public class SharedObjectWithLock { private static final Logger LOG = LoggerFactory.getLogger(SharedObjectWithLock.class); private ReentrantLock lock = new ReentrantLock(true); private int counter = 0; void perform() { lock.lock(); LOG.info("Thread - " + Thread.currentThread().getName() + " acquired the lock"); try { LOG.info("Thread - " + Thread.currentThread().getName() + " processing"); counter++; } catch (Exception exception) { LOG.error(" Interrupted Exception ", exception); } finally { lock.unlock(); LOG.info("Thread - " + Thread.currentThread().getName() + " released the lock"); } } private void performTryLock() { LOG.info("Thread - " + Thread.currentThread().getName() + " attempting to acquire the lock"); try { boolean isLockAcquired = lock.tryLock(2, TimeUnit.SECONDS); if (isLockAcquired) { try { LOG.info("Thread - " + Thread.currentThread().getName() + " acquired the lock"); LOG.info("Thread - " + Thread.currentThread().getName() + " processing"); sleep(1000); } finally { lock.unlock(); LOG.info("Thread - " + Thread.currentThread().getName() + " released the lock"); } } } catch (InterruptedException exception) { LOG.error(" Interrupted Exception ", exception); } LOG.info("Thread - " + Thread.currentThread().getName() + " could not acquire the lock"); } public ReentrantLock getLock() { return lock;
} boolean isLocked() { return lock.isLocked(); } boolean hasQueuedThreads() { return lock.hasQueuedThreads(); } int getCounter() { return counter; } public static void main(String[] args) { final int threadCount = 2; final ExecutorService service = Executors.newFixedThreadPool(threadCount); final SharedObjectWithLock object = new SharedObjectWithLock(); service.execute(object::perform); service.execute(object::performTryLock); service.shutdown(); } }
repos\tutorials-master\core-java-modules\core-java-concurrency-advanced\src\main\java\com\baeldung\concurrent\locks\SharedObjectWithLock.java
1
请在Spring Boot框架中完成以下Java代码
public void save(Customer customer) { repository.save(customer); } /** * 查询所有客户列表 * @return 客户列表 */ public Iterable<Customer> findAll() { return repository.findAll(); } /** * 通过名查找某个客户 * @param firstName * @return
*/ public Customer findByFirstName(String firstName) { return repository.findByFirstName(firstName); } /** * 通过姓查找客户列表 * @param lastName * @return */ public List<Customer> findByLastName(String lastName) { return repository.findByLastName(lastName); } }
repos\SpringBootBucket-master\springboot-mongodb\src\main\java\com\xncoding\pos\service\CustomerService.java
2
请在Spring Boot框架中完成以下Java代码
public class AdSchedulerId implements RepoIdAware { @JsonCreator public static AdSchedulerId ofRepoId(final int repoId) { return new AdSchedulerId(repoId); } @Nullable public static AdSchedulerId ofRepoIdOrNull(final int repoId) { return repoId > 0 ? new AdSchedulerId(repoId) : null; } int repoId;
private AdSchedulerId(final int repoId) { this.repoId = Check.assumeGreaterThanZero(repoId, "AD_Scheduler_ID"); } @Override @JsonValue public int getRepoId() { return repoId; } public static int toRepoId(@Nullable final AdSchedulerId id) { return id != null ? id.getRepoId() : -1; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\scheduler\AdSchedulerId.java
2
请完成以下Java代码
public void setM_Product_ID (final int M_Product_ID) { if (M_Product_ID < 1) set_Value (COLUMNNAME_M_Product_ID, null); else set_Value (COLUMNNAME_M_Product_ID, M_Product_ID); } @Override public int getM_Product_ID() { return get_ValueAsInt(COLUMNNAME_M_Product_ID); } @Override public void setPP_WF_Node_Product_ID (final int PP_WF_Node_Product_ID) { if (PP_WF_Node_Product_ID < 1) set_ValueNoCheck (COLUMNNAME_PP_WF_Node_Product_ID, null); else set_ValueNoCheck (COLUMNNAME_PP_WF_Node_Product_ID, PP_WF_Node_Product_ID); } @Override public int getPP_WF_Node_Product_ID() { return get_ValueAsInt(COLUMNNAME_PP_WF_Node_Product_ID); } @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); } @Override public void setSpecification (final @Nullable java.lang.String Specification) { set_Value (COLUMNNAME_Specification, Specification); } @Override public java.lang.String getSpecification() { return get_ValueAsString(COLUMNNAME_Specification); } @Override public void setYield (final @Nullable BigDecimal Yield) { set_Value (COLUMNNAME_Yield, Yield); } @Override public BigDecimal getYield() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Yield); 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_PP_WF_Node_Product.java
1
请完成以下Java代码
public class C_Flatrate_Term_Change_Product extends JavaProcess implements IProcessPrecondition { private final IFlatrateBL flatrateBL = Services.get(IFlatrateBL.class); private final IOrgDAO orgDAO = Services.get(IOrgDAO.class); @Param(parameterName = I_C_Flatrate_Term.COLUMNNAME_M_Product_ID, mandatory = true) private int p_M_Product_ID; @Override public ProcessPreconditionsResolution checkPreconditionsApplicable(final @NonNull IProcessPreconditionsContext context) { if (context.isNoSelection()) { return ProcessPreconditionsResolution.rejectBecauseNoSelection(); } if (context.isMoreThanOneSelected()) { return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection(); } if(ProcessUtil.isFlatFeeContract(context)) { return ProcessPreconditionsResolution.rejectWithInternalReason("Not supported for FlatFee contracts"); } return ProcessPreconditionsResolution .acceptIf(I_C_Flatrate_Term.Table_Name.equals(context.getTableName())); } @Override protected String doIt() throws Exception { updateFlatrateTermProductAndPrice(); return MSG_OK; } private void updateFlatrateTermProductAndPrice() { final I_C_Flatrate_Term term = flatrateBL.getById(retrieveSelectedFlatrateTermId()); C_Flatrate_Term_Change_ProcessHelper.throwExceptionIfTermHasInvoices(term); updateFlatrateTermProductAndPrice(term); updateNextFlatrateTermProductAndPrice(term); }
private void updateFlatrateTermProductAndPrice(@NonNull final I_C_Flatrate_Term term) { final LocalDate date = TimeUtil.asLocalDate(term.getStartDate(), orgDAO.getTimeZone(OrgId.ofRepoId(term.getAD_Org_ID()))); final FlatrateTermPriceRequest request = FlatrateTermPriceRequest.builder() .flatrateTerm(term) .productId(retrieveSelectedProductId()) .priceDate(date) .build(); flatrateBL.updateFlatrateTermProductAndPrice(request); } private void updateNextFlatrateTermProductAndPrice(@NonNull final I_C_Flatrate_Term term) { final ImmutableList<I_C_Flatrate_Term> termstoUpdate = flatrateBL.retrieveNextFlatrateTerms(term); termstoUpdate.forEach(this::updateFlatrateTermProductAndPrice); } final FlatrateTermId retrieveSelectedFlatrateTermId() { return FlatrateTermId.ofRepoId(getRecord_ID()); } final ProductId retrieveSelectedProductId() { return ProductId.ofRepoId(p_M_Product_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\flatrate\process\C_Flatrate_Term_Change_Product.java
1
请完成以下Java代码
public String getClazz() { if (clazz == null) { return "general"; } else { return clazz; } } /** * Sets the value of the clazz property. * * @param value * allowed object is * {@link String } * */ public void setClazz(String value) { this.clazz = value; } /** * Gets the value of the sectionMajor property. * * @return * possible object is * {@link String } * */ public String getSectionMajor() { return sectionMajor; } /** * Sets the value of the sectionMajor property. * * @param value * allowed object is * {@link String } * */ public void setSectionMajor(String value) { this.sectionMajor = value; } /** * Gets the value of the hasExpenseLoading property. * * @return * possible object is * {@link Boolean } *
*/ public boolean isHasExpenseLoading() { if (hasExpenseLoading == null) { return true; } else { return hasExpenseLoading; } } /** * Sets the value of the hasExpenseLoading property. * * @param value * allowed object is * {@link Boolean } * */ public void setHasExpenseLoading(Boolean value) { this.hasExpenseLoading = value; } /** * Gets the value of the doCostAssessment property. * * @return * possible object is * {@link Boolean } * */ public boolean isDoCostAssessment() { if (doCostAssessment == null) { return false; } else { return doCostAssessment; } } /** * Sets the value of the doCostAssessment property. * * @param value * allowed object is * {@link Boolean } * */ public void setDoCostAssessment(Boolean value) { this.doCostAssessment = value; } }
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_request\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\request\XtraStationaryType.java
1
请在Spring Boot框架中完成以下Java代码
public Result<String> saveTools(@RequestBody SaveToolsDTO dto) { return airagMcpService.saveTools(dto.getId(), dto.getTools()); } /** * 通过id删除 * * @param id * @return */ @Operation(summary = "MCP-通过id删除") @DeleteMapping(value = "/delete") public Result<String> delete(@RequestParam(name = "id", required = true) String id) { airagMcpService.removeById(id); return Result.OK("删除成功!"); } /** * 通过id查询 * * @param id * @return */ @Operation(summary = "MCP-通过id查询") @GetMapping(value = "/queryById") public Result<AiragMcp> queryById(@RequestParam(name = "id", required = true) String id) { AiragMcp airagMcp = airagMcpService.getById(id); if (airagMcp == null) { return Result.error("未找到对应数据"); } return Result.OK(airagMcp); } /** * 导出excel * * @param request * @param airagMcp
*/ // @RequiresPermissions("llm:airag_mcp:exportXls") @RequestMapping(value = "/exportXls") public ModelAndView exportXls(HttpServletRequest request, AiragMcp airagMcp) { return super.exportXls(request, airagMcp, AiragMcp.class, "MCP"); } /** * 通过excel导入数据 * * @param request * @param response * @return */ // @RequiresPermissions("llm:airag_mcp:importExcel") @RequestMapping(value = "/importExcel", method = RequestMethod.POST) public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { return super.importExcel(request, response, AiragMcp.class); } }
repos\JeecgBoot-main\jeecg-boot\jeecg-boot-module\jeecg-boot-module-airag\src\main\java\org\jeecg\modules\airag\llm\controller\AiragMcpController.java
2
请完成以下Java代码
public void setDescription (java.lang.String Description) { set_Value (COLUMNNAME_Description, Description); } /** Get Beschreibung. @return Beschreibung */ @Override public java.lang.String getDescription () { return (java.lang.String)get_Value(COLUMNNAME_Description); } @Override public org.compiere.model.I_M_Product_Category getM_Product_Category() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_M_Product_Category_ID, org.compiere.model.I_M_Product_Category.class); } @Override public void setM_Product_Category(org.compiere.model.I_M_Product_Category M_Product_Category) { set_ValueFromPO(COLUMNNAME_M_Product_Category_ID, org.compiere.model.I_M_Product_Category.class, M_Product_Category); } /** Set Produkt-Kategorie. @param M_Product_Category_ID Category of a Product */ @Override public void setM_Product_Category_ID (int M_Product_Category_ID) { if (M_Product_Category_ID < 1) set_Value (COLUMNNAME_M_Product_Category_ID, null); else set_Value (COLUMNNAME_M_Product_Category_ID, Integer.valueOf(M_Product_Category_ID)); } /** Get Produkt-Kategorie. @return Category of a Product */ @Override public int getM_Product_Category_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_Category_ID); if (ii == null) return 0; return ii.intValue(); } @Override public org.compiere.model.I_M_Product getM_Product() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_M_Product_ID, org.compiere.model.I_M_Product.class); } @Override
public void setM_Product(org.compiere.model.I_M_Product M_Product) { set_ValueFromPO(COLUMNNAME_M_Product_ID, org.compiere.model.I_M_Product.class, M_Product); } /** Set Produkt. @param M_Product_ID Produkt, Leistung, Artikel */ @Override public void setM_Product_ID (int M_Product_ID) { if (M_Product_ID < 1) set_Value (COLUMNNAME_M_Product_ID, null); else set_Value (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID)); } /** Get Produkt. @return Produkt, Leistung, Artikel */ @Override public int getM_Product_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.rfq\src\main\java-gen\de\metas\rfq\model\X_C_RfQ_TopicSubscriberOnly.java
1
请完成以下Java代码
public final class CompositeDefaultViewProfileIdProvider implements DefaultViewProfileIdProvider { public static final CompositeDefaultViewProfileIdProvider of(final List<DefaultViewProfileIdProvider> providers) { return new CompositeDefaultViewProfileIdProvider(providers); } private final PlainDefaultViewProfileIdProvider overrides; private final ImmutableList<DefaultViewProfileIdProvider> providers; private final PlainDefaultViewProfileIdProvider fallback; private CompositeDefaultViewProfileIdProvider(final List<DefaultViewProfileIdProvider> providers) { overrides = new PlainDefaultViewProfileIdProvider(); fallback = new PlainDefaultViewProfileIdProvider(); this.providers = ImmutableList.<DefaultViewProfileIdProvider> builder() .add(overrides) .addAll(providers) .add(fallback) .build(); } @Override public ViewProfileId getDefaultProfileIdByWindowId(final WindowId windowId)
{ return providers.stream() .map(provider -> provider.getDefaultProfileIdByWindowId(windowId)) .filter(Objects::nonNull) .findFirst() .orElse(ViewProfileId.NULL); } public void setDefaultProfileIdOverride(WindowId windowId, ViewProfileId profileId) { overrides.setDefaultProfileId(windowId, profileId); } public void setDefaultProfileIdFallback(WindowId windowId, ViewProfileId profileId) { fallback.setDefaultProfileId(windowId, profileId); } public void setDefaultProfileIdFallbackIfAbsent(WindowId windowId, ViewProfileId profileId) { fallback.setDefaultProfileIdIfAbsent(windowId, profileId); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\view\CompositeDefaultViewProfileIdProvider.java
1
请完成以下Java代码
public class ErrorIconType extends IconType { @Override public String getFillValue() { return "none"; } @Override public String getStrokeValue() { return "#585858"; } @Override public String getDValue() { return " M21.820839 10.171502 L18.36734 23.58992 L12.541380000000002 13.281818999999999 L8.338651200000001 19.071607 L12.048949000000002 5.832305699999999 L17.996148000000005 15.132659 L21.820839 10.171502 z"; } public void drawIcon( final int imageX, final int imageY, final int iconPadding, final ProcessDiagramSVGGraphics2D svgGenerator ) { Element gTag = svgGenerator.getDOMFactory().createElementNS(null, SVGGraphics2D.SVG_G_TAG); gTag.setAttributeNS(null, "transform", "translate(" + (imageX - 6) + "," + (imageY - 3) + ")"); Element pathTag = svgGenerator.getDOMFactory().createElementNS(null, SVGGraphics2D.SVG_PATH_TAG); pathTag.setAttributeNS(null, "d", this.getDValue()); pathTag.setAttributeNS(null, "style", this.getStyleValue()); pathTag.setAttributeNS(null, "fill", this.getFillValue()); pathTag.setAttributeNS(null, "stroke", this.getStrokeValue()); gTag.appendChild(pathTag); svgGenerator.getExtendDOMGroupManager().addElement(gTag);
} @Override public String getAnchorValue() { return null; } @Override public String getStyleValue() { return "fill:none;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10"; } @Override public Integer getWidth() { return 17; } @Override public Integer getHeight() { return 22; } @Override public String getStrokeWidth() { return null; } }
repos\Activiti-develop\activiti-core\activiti-image-generator\src\main\java\org\activiti\image\impl\icon\ErrorIconType.java
1
请完成以下Java代码
public String getCaseDefinitionName() { return caseDefinitionName; } public void setCaseDefinitionName(String caseDefinitionName) { this.caseDefinitionName = caseDefinitionName; } public int getCaseDefinitionVersion() { return caseDefinitionVersion; } public void setCaseDefinitionVersion(int caseDefinitionVersion) { this.caseDefinitionVersion = caseDefinitionVersion; } public Integer getHistoryTimeToLive() { return historyTimeToLive; } public void setHistoryTimeToLive(Integer historyTimeToLive) { this.historyTimeToLive = historyTimeToLive; } public long getFinishedCaseInstanceCount() { return finishedCaseInstanceCount; } public void setFinishedCaseInstanceCount(Long finishedCaseInstanceCount) { this.finishedCaseInstanceCount = finishedCaseInstanceCount;
} public long getCleanableCaseInstanceCount() { return cleanableCaseInstanceCount; } public void setCleanableCaseInstanceCount(Long cleanableCaseInstanceCount) { this.cleanableCaseInstanceCount = cleanableCaseInstanceCount; } public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } public String toString() { return this.getClass().getSimpleName() + "[caseDefinitionId = " + caseDefinitionId + ", caseDefinitionKey = " + caseDefinitionKey + ", caseDefinitionName = " + caseDefinitionName + ", caseDefinitionVersion = " + caseDefinitionVersion + ", historyTimeToLive = " + historyTimeToLive + ", finishedCaseInstanceCount = " + finishedCaseInstanceCount + ", cleanableCaseInstanceCount = " + cleanableCaseInstanceCount + ", tenantId = " + tenantId + "]"; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\CleanableHistoricCaseInstanceReportResultEntity.java
1
请在Spring Boot框架中完成以下Java代码
public RestartItemProcessor itemProcessor() { return new RestartItemProcessor(); } @Bean public ItemWriter<String> itemWriter() { return items -> { System.out.println("Writing items:"); for (String item : items) { System.out.println("- " + item); } }; } static class RestartItemProcessor implements ItemProcessor<String, String> { private boolean failOnItem3 = true;
public void setFailOnItem3(boolean failOnItem3) { this.failOnItem3 = failOnItem3; } @Override public String process(String item) throws Exception { System.out.println("Processing: " + item + " (failOnItem3=" + failOnItem3 + ")"); if (failOnItem3 && item.equals("Item3")) { throw new RuntimeException("Simulated failure on Item3"); } return "PROCESSED " + item; } } }
repos\tutorials-master\spring-batch-2\src\main\java\com\baeldung\restartjob\BatchConfig.java
2
请完成以下Java代码
private static final void updateRfQResponseLinesStatus(final I_C_RfQResponse rfqResponse, final List<I_C_RfQResponseLine> rfqResponseLines) { for (final I_C_RfQResponseLine rfqResponseLine : rfqResponseLines) { rfqResponseLine.setDocStatus(rfqResponse.getDocStatus()); rfqResponseLine.setProcessed(rfqResponse.isProcessed()); InterfaceWrapperHelper.save(rfqResponseLine); } } @Override public void approveIt(final DocumentTableFields docFields) { } @Override public void rejectIt(final DocumentTableFields docFields) { throw new UnsupportedOperationException(); } @Override public void voidIt(final DocumentTableFields docFields) { throw new UnsupportedOperationException(); } @Override public void closeIt(final DocumentTableFields docFields) { final I_C_RfQResponse rfqResponse = extractRfQResponse(docFields); rfqEventDispacher.fireBeforeClose(rfqResponse); // // Mark as closed rfqResponse.setDocStatus(X_C_RfQResponse.DOCSTATUS_Closed); rfqResponse.setDocAction(X_C_RfQResponse.DOCACTION_None); rfqResponse.setProcessed(true); InterfaceWrapperHelper.save(rfqResponse); updateRfQResponseLinesStatus(rfqResponse); // rfqEventDispacher.fireAfterClose(rfqResponse); // Make sure it's saved InterfaceWrapperHelper.save(rfqResponse); } @Override public void unCloseIt(final DocumentTableFields docFields)
{ final I_C_RfQResponse rfqResponse = extractRfQResponse(docFields); // rfqEventDispacher.fireBeforeUnClose(rfqResponse); // // Mark as NOT closed rfqResponse.setDocStatus(X_C_RfQResponse.DOCSTATUS_Completed); InterfaceWrapperHelper.save(rfqResponse); updateRfQResponseLinesStatus(rfqResponse); // rfqEventDispacher.fireAfterUnClose(rfqResponse); // Make sure it's saved InterfaceWrapperHelper.save(rfqResponse); } @Override public void reverseCorrectIt(final DocumentTableFields docFields) { throw new UnsupportedOperationException(); } @Override public void reverseAccrualIt(final DocumentTableFields docFields) { throw new UnsupportedOperationException(); } @Override public void reactivateIt(final DocumentTableFields docFields) { final I_C_RfQResponse rfqResponse = extractRfQResponse(docFields); rfqResponse.setDocAction(IDocument.ACTION_Complete); rfqResponse.setDocAction(IDocument.ACTION_Complete); rfqResponse.setProcessed(false); updateRfQResponseLinesStatus(rfqResponse); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.rfq\src\main\java\de\metas\rfq\RfQResponseDocumentHandler.java
1
请在Spring Boot框架中完成以下Java代码
public void init() { configuratorsBeforeInit(); initDataManagers(); initEntityManagers(); configuratorsAfterInit(); } // Data managers /////////////////////////////////////////////////////////// public void initDataManagers() { if (batchDataManager == null) { batchDataManager = new MybatisBatchDataManager(this); } if (batchPartDataManager == null) { batchPartDataManager = new MybatisBatchPartDataManager(this); } } public void initEntityManagers() { if (batchEntityManager == null) { batchEntityManager = new BatchEntityManagerImpl(this, batchDataManager); } if (batchPartEntityManager == null) { batchPartEntityManager = new BatchPartEntityManagerImpl(this, batchPartDataManager); } } // getters and setters // ////////////////////////////////////////////////////// public BatchServiceConfiguration getIdentityLinkServiceConfiguration() { return this; } public BatchService getBatchService() { return batchService; } public BatchServiceConfiguration setBatchService(BatchService batchService) { this.batchService = batchService; return this; } public BatchDataManager getBatchDataManager() { return batchDataManager; } public BatchServiceConfiguration setBatchDataManager(BatchDataManager batchDataManager) { this.batchDataManager = batchDataManager; return this; } public BatchPartDataManager getBatchPartDataManager() { return batchPartDataManager; } public BatchServiceConfiguration setBatchPartDataManager(BatchPartDataManager batchPartDataManager) {
this.batchPartDataManager = batchPartDataManager; return this; } public BatchEntityManager getBatchEntityManager() { return batchEntityManager; } public BatchServiceConfiguration setBatchEntityManager(BatchEntityManager batchEntityManager) { this.batchEntityManager = batchEntityManager; return this; } public BatchPartEntityManager getBatchPartEntityManager() { return batchPartEntityManager; } public BatchServiceConfiguration setBatchPartEntityManager(BatchPartEntityManager batchPartEntityManager) { this.batchPartEntityManager = batchPartEntityManager; return this; } @Override public ObjectMapper getObjectMapper() { return objectMapper; } @Override public BatchServiceConfiguration setObjectMapper(ObjectMapper objectMapper) { this.objectMapper = objectMapper; return this; } }
repos\flowable-engine-main\modules\flowable-batch-service\src\main\java\org\flowable\batch\service\BatchServiceConfiguration.java
2
请完成以下Spring Boot application配置
spring.application.name: api-gateway spring.main.web-application-type=reactive eureka.instance.hostname=localhost spring.cloud.discovery.enabled=true #eureka.instance.prefer-ip-address=true httpbin=http://httpbin.org #### DEBUG #### #logging.level.org.springframework.cloud.gateway=DEBUG #
spring.cloud.gateway.httpclient.wiretap=true #spring.cloud.gateway.httpserver.wiretap=true #logging.level.reactor.netty=DEBUG
repos\tutorials-master\spring-cloud-modules\gateway-exception-management\src\main\resources\application.properties
2
请完成以下Java代码
public String getYAxisLabel() { return m_Y_AxisLabel; } /** * * @param axisLabel */ public void setYAxisLabel(String axisLabel) { m_Y_AxisLabel = axisLabel; } /** * * @return graph column list */ public ArrayList<GraphColumn> loadData() { // Calculated MMeasure measure = getMGoal().getMeasure(); if (measure == null) { log.warn("No Measure for " + getMGoal()); return null;
} ArrayList<GraphColumn>list = measure.getGraphColumnList(getMGoal()); pieDataset = new DefaultPieDataset(); dataset = new DefaultCategoryDataset(); for (int i = 0; i < list.size(); i++){ String series = m_X_AxisLabel; if (list.get(i).getDate() != null) { Calendar cal = Calendar.getInstance(); cal.setTime(list.get(i).getDate()); series = Integer.toString(cal.get(Calendar.YEAR)); } dataset.addValue(list.get(i).getValue(), series, list.get(i).getLabel()); linearDataset.addValue(list.get(i).getValue(), m_X_AxisLabel, list.get(i).getLabel()); pieDataset.setValue(list.get(i).getLabel(), list.get(i).getValue()); } return list; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\adempiere\apps\graph\GraphBuilder.java
1
请完成以下Java代码
private BPartnerId getBPartnerId(final NewRecordDescriptor.ProcessNewRecordDocumentRequest request) { if (request.getTriggeringDocumentPath() == null) { throw new AdempiereException("Unknown triggering path"); } if (request.getTriggeringField() == null) { throw new AdempiereException("Unknown triggering field"); } final String bpartnerFieldName = getBPartnerFieldName(request.getTriggeringField()); final Document triggeringDocument = documentCollection.getDocumentReadonly(request.getTriggeringDocumentPath()); return triggeringDocument.getFieldView(bpartnerFieldName) .getValueAsId(BPartnerId.class) .orElseThrow(() -> new AdempiereException("No bpartner ID found")); } @NonNull
private static String getBPartnerFieldName(@NonNull final String triggeringField) { switch (triggeringField) { case I_C_Order.COLUMNNAME_C_BPartner_Location_ID: return I_C_Order.COLUMNNAME_C_BPartner_ID; case I_C_Order.COLUMNNAME_Bill_Location_ID: return I_C_Order.COLUMNNAME_Bill_BPartner_ID; case I_C_Order.COLUMNNAME_HandOver_Location_ID: return I_C_Order.COLUMNNAME_HandOver_Partner_ID; case I_C_Order.COLUMNNAME_DropShip_Location_ID: return I_C_Order.COLUMNNAME_DropShip_BPartner_ID; default: throw new AdempiereException("Unknown triggering field: " + triggeringField); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\bpartner\quickinput\BPartnerLocationQuickInputConfiguration.java
1
请完成以下Java代码
public class QueueKey { private final ServiceType type; @With private final String queueName; private final TenantId tenantId; public QueueKey(ServiceType type, Queue queue) { this.type = type; this.queueName = queue.getName(); this.tenantId = queue.getTenantId(); } public QueueKey(ServiceType type, QueueRoutingInfo queueRoutingInfo) { this.type = type; this.queueName = queueRoutingInfo.getQueueName(); this.tenantId = queueRoutingInfo.getTenantId(); } public QueueKey(ServiceType type, TenantId tenantId) { this.type = type; this.queueName = DataConstants.MAIN_QUEUE_NAME; this.tenantId = tenantId != null ? tenantId : TenantId.SYS_TENANT_ID; } public QueueKey(ServiceType type) { this.type = type; this.queueName = DataConstants.MAIN_QUEUE_NAME; this.tenantId = TenantId.SYS_TENANT_ID;
} public QueueKey(ServiceType type, String queueName) { this.type = type; this.queueName = queueName; this.tenantId = TenantId.SYS_TENANT_ID; } @Override public String toString() { return "QK(" + queueName + "," + type + "," + (TenantId.SYS_TENANT_ID.equals(tenantId) ? "system" : tenantId) + ')'; } }
repos\thingsboard-master\common\queue\src\main\java\org\thingsboard\server\queue\discovery\QueueKey.java
1
请在Spring Boot框架中完成以下Java代码
public Order receive(long id) { Order order = orders.get(id); System.out.println(" try to receiver,order no:" + id); if (!sendEvent(MessageBuilder.withPayload(OrderStatusChangeEventEnum.RECEIVED) .setHeader("order", order).build())) { System.out.println(" deliver fail,error,order no:" + id); } return orders.get(id); } @Override public Map<Long, Order> getOrders() { return orders; } /** * send transient event * @param message * @return
*/ private synchronized boolean sendEvent(Message<OrderStatusChangeEventEnum> message) { boolean result = false; try { orderStateMachine.start(); result = orderStateMachine.sendEvent(message); } catch (Exception e) { e.printStackTrace(); } finally { if (Objects.nonNull(message)) { Order order = (Order) message.getHeaders().get("order"); if (Objects.nonNull(order) && Objects.equals(order.getOrderStatus(), OrderStatusEnum.FINISH)) { orderStateMachine.stop(); } } } return result; } }
repos\springboot-demo-master\Statemachine\src\main\java\com\et\statemachine\service\OrderServiceImpl.java
2
请完成以下Java代码
public AttributeListValue getCreateAttributeValue(final IContextAware context, final ICountryAware countryAware) { final Properties ctx = context.getCtx(); final String trxName = context.getTrxName(); Check.assumeNotNull(countryAware, "countryAware not null"); final I_C_Country country = countryAware.getC_Country(); Check.assumeNotNull(country, "country not null"); final SOTrx soTrx = SOTrx.ofBoolean(countryAware.isSOTrx()); final String inAusLand = getAttributeStringValueByCountryId(country.getC_Country_ID()); final AttributeListValue existingAttributeValue = Services.get(IInAusLandAttributeDAO.class).retrieveInAusLandAttributeValue(ctx, inAusLand); final AttributeAction attributeAction = Services.get(IAttributesBL.class).getAttributeAction(ctx); if (existingAttributeValue == null) { if (attributeAction == AttributeAction.Error) { throw new AdempiereException(MSG_NoInAusLandAttribute, new Object[] { inAusLand }); } else if (attributeAction == AttributeAction.GenerateNew) { final I_M_Attribute inAusLandAttribute = Services.get(IInAusLandAttributeDAO.class).retrieveInAusLandAttribute(ctx); final IAttributeValueGenerator generator = Services.get(IAttributesBL.class).getAttributeValueGenerator(inAusLandAttribute); if (generator == null) { throw new NoAttributeGeneratorException(country.getCountryCode()); } return generator.generateAttributeValue(ctx, I_C_Country.Table_ID, country.getC_Country_ID(), false, trxName); // SO Trx doesn't matter here } else if (attributeAction == AttributeAction.Ignore) { // Ignore: do now throw error, no not generate new attribute } else { throw new AdempiereException("@NotSupported@ AttributeAction " + attributeAction); } return existingAttributeValue;
} else { if (!existingAttributeValue.isMatchingSOTrx(soTrx)) { if (attributeAction == AttributeAction.Error) { throw new AttributeRestrictedException(ctx, soTrx, existingAttributeValue, country.getCountryCode()); } // We have an attribute value, but it is marked for a different transaction. Change type to "null", to make it available for both. final IAttributeDAO attributesRepo = Services.get(IAttributeDAO.class); return attributesRepo.changeAttributeValue(AttributeListValueChangeRequest.builder() .id(existingAttributeValue.getId()) .availableForTrx(AttributeListValueTrxRestriction.ANY_TRANSACTION) .build()); } else { return existingAttributeValue; } } } @Override public String getAttributeStringValueByCountryId(final int countryId) { if (CountryId.SWITZERLAND.getRepoId() == countryId) { return ATTRIBUTEVALUE_INLAND; } else { return ATTRIBUTEVALUE_AUSLAND; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.fresh\de.metas.fresh.base\src\main\java\org\adempiere\mm\attributes\api\impl\InAusLandAttributeBL.java
1
请在Spring Boot框架中完成以下Java代码
public class StaticConfig { @Value("${jeecg.oss.accessKey:}") private String accessKeyId; @Value("${jeecg.oss.secretKey:}") private String accessKeySecret; @Value(value = "${spring.mail.username:}") private String emailFrom; /** * 是否开启定时发送 */ @Value(value = "${spring.mail.timeJobSend:false}") private Boolean timeJobSend;
// /** // * 签名密钥串 // */ // @Value(value = "${jeecg.signatureSecret}") // private String signatureSecret; /*@Bean public void initStatic() { DySmsHelper.setAccessKeyId(accessKeyId); DySmsHelper.setAccessKeySecret(accessKeySecret); EmailSendMsgHandle.setEmailFrom(emailFrom); }*/ }
repos\JeecgBoot-main\jeecg-boot\jeecg-boot-base-core\src\main\java\org\jeecg\config\StaticConfig.java
2
请完成以下Java代码
public void remove() { delegate.remove(); } }; } @Override public void set(int index, String value) { jsonNode.set(index, value); } @Override public void set(int index, Boolean value) { jsonNode.set(index, value); } @Override public void set(int index, Short value) { jsonNode.set(index, value); } @Override public void set(int index, Integer value) { jsonNode.set(index, value); } @Override public void set(int index, Long value) { jsonNode.set(index, value); } @Override public void set(int index, Double value) { jsonNode.set(index, value); } @Override public void set(int index, BigDecimal value) { jsonNode.set(index, value); } @Override public void set(int index, BigInteger value) { jsonNode.set(index, value); } @Override public void setNull(int index) { jsonNode.setNull(index); } @Override public void set(int index, FlowableJsonNode value) { jsonNode.set(index, asJsonNode(value)); } @Override public void add(Short value) {
jsonNode.add(value); } @Override public void add(Integer value) { jsonNode.add(value); } @Override public void add(Long value) { jsonNode.add(value); } @Override public void add(Float value) { jsonNode.add(value); } @Override public void add(Double value) { jsonNode.add(value); } @Override public void add(byte[] value) { jsonNode.add(value); } @Override public void add(String value) { jsonNode.add(value); } @Override public void add(Boolean value) { jsonNode.add(value); } @Override public void add(BigDecimal value) { jsonNode.add(value); } @Override public void add(BigInteger value) { jsonNode.add(value); } @Override public void add(FlowableJsonNode value) { jsonNode.add(asJsonNode(value)); } @Override public void addNull() { jsonNode.addNull(); } }
repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\json\jackson2\FlowableJackson2ArrayNode.java
1
请在Spring Boot框架中完成以下Java代码
public RelyingPartyRegistration findUniqueByAssertingPartyEntityId(String entityId) { return registrations().findUniqueByAssertingPartyEntityId(entityId); } @Override public void forEach(Consumer<? super RelyingPartyRegistration> action) { registrations().forEach(action); } @Override public Spliterator<RelyingPartyRegistration> spliterator() { return registrations().spliterator(); } private IterableRelyingPartyRegistrationRepository registrations() { return this.cache.get("registrations", this.registrationLoader); }
/** * Use this cache for the completed {@link RelyingPartyRegistration} instances. * * <p> * Defaults to {@link ConcurrentMapCache}, meaning that the registrations are cached * without expiry. To turn off the cache, use * {@link org.springframework.cache.support.NoOpCache}. * @param cache the {@link Cache} to use */ public void setCache(Cache cache) { Assert.notNull(cache, "cache cannot be null"); this.cache = cache; } }
repos\spring-security-main\saml2\saml2-service-provider\src\main\java\org\springframework\security\saml2\provider\service\registration\CachingRelyingPartyRegistrationRepository.java
2
请在Spring Boot框架中完成以下Java代码
public HistoricEntityLinkEntity findHistoricEntityLinkByQuery(InternalEntityLinkQuery<HistoricEntityLinkEntity> query) { return getEntity("selectHistoricEntityLinksByQuery", query, (SingleCachedEntityMatcher<HistoricEntityLinkEntity>) query, true); } @Override public void deleteHistoricEntityLinksByScopeIdAndType(String scopeId, String scopeType) { Map<String, String> parameters = new HashMap<>(); parameters.put("scopeId", scopeId); parameters.put("scopeType", scopeType); getDbSqlSession().delete("deleteHistoricEntityLinksByScopeIdAndScopeType", parameters, HistoricEntityLinkEntityImpl.class); } @Override public void deleteHistoricEntityLinksByScopeDefinitionIdAndType(String scopeDefinitionId, String scopeType) { Map<String, String> parameters = new HashMap<>(); parameters.put("scopeDefinitionId", scopeDefinitionId); parameters.put("scopeType", scopeType); getDbSqlSession().delete("deleteHistoricEntityLinksByScopeDefinitionIdAndScopeType", parameters, HistoricEntityLinkEntityImpl.class); } @Override public void bulkDeleteHistoricEntityLinksForScopeTypeAndScopeIds(String scopeType, Collection<String> scopeIds) { Map<String, Object> parameters = new HashMap<>(); parameters.put("scopeType", scopeType);
parameters.put("scopeIds", createSafeInValuesList(scopeIds)); getDbSqlSession().delete("bulkDeleteHistoricEntityLinksForScopeTypeAndScopeIds", parameters, HistoricEntityLinkEntityImpl.class); } @Override public void deleteHistoricEntityLinksForNonExistingProcessInstances() { getDbSqlSession().delete("bulkDeleteHistoricProcessEntityLinks", null, HistoricEntityLinkEntityImpl.class); } @Override public void deleteHistoricEntityLinksForNonExistingCaseInstances() { getDbSqlSession().delete("bulkDeleteHistoricCaseEntityLinks", null, HistoricEntityLinkEntityImpl.class); } @Override protected IdGenerator getIdGenerator() { return entityLinkServiceConfiguration.getIdGenerator(); } }
repos\flowable-engine-main\modules\flowable-entitylink-service\src\main\java\org\flowable\entitylink\service\impl\persistence\entity\data\impl\MybatisHistoricEntityLinkDataManager.java
2
请完成以下Java代码
public boolean isReadOnly(ELContext context, Object base, Object property) { Objects.requireNonNull(context, "context is null"); if (base == null || property == null) { return false; } BeanProperty beanProperty = property(base, property); if (beanProperty == null) { return false; } context.setPropertyResolved(base, property); if (this.readOnly) { return true; } return beanProperty.isReadOnly(base); } @Override public Class<?> getCommonPropertyType(ELContext context, Object base) { if (base == null) { return null; } return Object.class; } abstract static class BeanProperties { protected final Map<String, BeanProperty> properties; protected final Class<?> type; BeanProperties(Class<?> type) throws ELException { this.type = type; this.properties = new HashMap<>(); } private BeanProperty get(String name) { return this.properties.get(name); } private Class<?> getType() { return type; } } abstract static class BeanProperty { private final Class<?> type; private final Class<?> owner; private Method read; private Method write; BeanProperty(Class<?> owner, Class<?> type) { this.owner = owner; this.type = type; } public Class<?> getPropertyType() { return this.type; } public boolean isReadOnly(Object base) { return write(base) == null; } private Method write(Object base) { if (this.write == null) { this.write = Util.getMethod(this.owner, base, getWriteMethod()); } return this.write; } private Method read(Object base) { if (this.read == null) { this.read = Util.getMethod(this.owner, base, getReadMethod()); } return this.read; } abstract Method getWriteMethod(); abstract Method getReadMethod(); abstract String getName(); } private BeanProperty property(Object base, Object property) { Class<?> type = base.getClass(); String prop = property.toString(); BeanProperties props = this.cache.get(type.getName());
if (props == null || type != props.getType()) { props = BeanSupport.getInstance().getBeanProperties(type); this.cache.put(type.getName(), props); } return props.get(prop); } private static final class ConcurrentCache<K, V> { private final int size; private final Map<K, V> eden; private final Map<K, V> longterm; ConcurrentCache(int size) { this.size = size; this.eden = new ConcurrentHashMap<>(size); this.longterm = new WeakHashMap<>(size); } public V get(K key) { V value = this.eden.get(key); if (value == null) { synchronized (longterm) { value = this.longterm.get(key); } if (value != null) { this.eden.put(key, value); } } return value; } public void put(K key, V value) { if (this.eden.size() >= this.size) { synchronized (longterm) { this.longterm.putAll(this.eden); } this.eden.clear(); } this.eden.put(key, value); } } }
repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\javax\el\BeanELResolver.java
1
请完成以下Java代码
public BigDecimal getFirstFee() { return firstFee; } public void setFirstFee(BigDecimal firstFee) { this.firstFee = firstFee; } public BigDecimal getContinueWeight() { return continueWeight; } public void setContinueWeight(BigDecimal continueWeight) { this.continueWeight = continueWeight; } public BigDecimal getContinmeFee() { return continmeFee; } public void setContinmeFee(BigDecimal continmeFee) { this.continmeFee = continmeFee; } public String getDest() {
return dest; } public void setDest(String dest) { this.dest = dest; } @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(", name=").append(name); sb.append(", chargeType=").append(chargeType); sb.append(", firstWeight=").append(firstWeight); sb.append(", firstFee=").append(firstFee); sb.append(", continueWeight=").append(continueWeight); sb.append(", continmeFee=").append(continmeFee); sb.append(", dest=").append(dest); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); } }
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\PmsFeightTemplate.java
1
请完成以下Java代码
protected org.compiere.model.POInfo initPO(final Properties ctx) { return org.compiere.model.POInfo.getPOInfo(Table_Name); } @Override public void setCarrier_Service_ID (final int Carrier_Service_ID) { if (Carrier_Service_ID < 1) set_Value (COLUMNNAME_Carrier_Service_ID, null); else set_Value (COLUMNNAME_Carrier_Service_ID, Carrier_Service_ID); } @Override public int getCarrier_Service_ID() { return get_ValueAsInt(COLUMNNAME_Carrier_Service_ID); } @Override public void setCarrier_ShipmentOrder_ID (final int Carrier_ShipmentOrder_ID) { if (Carrier_ShipmentOrder_ID < 1) set_Value (COLUMNNAME_Carrier_ShipmentOrder_ID, null); else set_Value (COLUMNNAME_Carrier_ShipmentOrder_ID, Carrier_ShipmentOrder_ID);
} @Override public int getCarrier_ShipmentOrder_ID() { return get_ValueAsInt(COLUMNNAME_Carrier_ShipmentOrder_ID); } @Override public void setCarrier_ShipmentOrder_Service_ID (final int Carrier_ShipmentOrder_Service_ID) { if (Carrier_ShipmentOrder_Service_ID < 1) set_ValueNoCheck (COLUMNNAME_Carrier_ShipmentOrder_Service_ID, null); else set_ValueNoCheck (COLUMNNAME_Carrier_ShipmentOrder_Service_ID, Carrier_ShipmentOrder_Service_ID); } @Override public int getCarrier_ShipmentOrder_Service_ID() { return get_ValueAsInt(COLUMNNAME_Carrier_ShipmentOrder_Service_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_Carrier_ShipmentOrder_Service.java
1
请完成以下Java代码
protected I_M_HU_LUTU_Configuration createM_HU_LUTU_Configuration(final I_M_HU_LUTU_Configuration template) { final I_M_HU_LUTU_Configuration lutuConfigurationNew = InterfaceWrapperHelper.copy() .setFrom(template) .copyToNew(I_M_HU_LUTU_Configuration.class); adjustLUTUConfiguration(lutuConfigurationNew, getM_ReceiptSchedule()); // NOTE: don't save it return lutuConfigurationNew; } private void adjustLUTUConfiguration(final I_M_HU_LUTU_Configuration lutuConfig, final I_M_ReceiptSchedule receiptSchedule) { if (lutuConfigurationFactory.isNoLU(lutuConfig)) { // // Adjust TU lutuConfig.setIsInfiniteQtyTU(false); lutuConfig.setQtyTU(BigDecimal.ONE); } else { // // Adjust LU lutuConfig.setIsInfiniteQtyLU(false); lutuConfig.setQtyLU(BigDecimal.ONE); // // Adjust TU // * if the standard QtyTU is less than how much is available to be received => enforce the available Qty // * else always take the standard QtyTU // see https://github.com/metasfresh/metasfresh-webui/issues/228
{ final BigDecimal qtyToMoveTU = huReceiptScheduleBL.getQtyToMoveTU(receiptSchedule); if (qtyToMoveTU.signum() > 0 && qtyToMoveTU.compareTo(lutuConfig.getQtyTU()) < 0) { lutuConfig.setQtyTU(qtyToMoveTU); } } // Adjust CU if TU can hold an infinite qty, but the material receipt is of course finite, so we need to adjust the LUTU Configuration. // Otherwise, receiving using the default configuration will not work. final BigDecimal qtyTU = lutuConfig.getQtyTU(); if (lutuConfig.isInfiniteQtyCU() && qtyTU.signum() > 0) { lutuConfig.setIsInfiniteQtyCU(false); final BigDecimal qtyToMoveCU = receiptSchedule.getQtyToMove().divide(qtyTU, RoundingMode.UP); lutuConfig.setQtyCUsPerTU(qtyToMoveCU); } } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\process\WEBUI_M_ReceiptSchedule_ReceiveHUs_UsingDefaults.java
1
请完成以下Java代码
public String modelChange(final PO po, final int type) throws Exception { // shall never reach this point throw new IllegalStateException("Not supported: po=" + po + ", type=" + type); } @Override public String docValidate(final PO po, final int timing) { // shall never reach this point throw new IllegalStateException("Not supported: po=" + po + ", timing=" + timing); } /** * * @return {@link ModelValidationEngine} which was used on registration */ public ModelValidationEngine getEngine() { return engine; } private void registerArchiveAwareTables() { final Properties ctx = Env.getCtx(); final List<I_AD_Column> archiveColumns = new Query(ctx, I_AD_Column.Table_Name, I_AD_Column.COLUMNNAME_ColumnName + "=?", ITrx.TRXNAME_None) .setParameters(org.compiere.model.I_AD_Archive.COLUMNNAME_AD_Archive_ID) .setOnlyActiveRecords(true) .list(I_AD_Column.class); if (archiveColumns.isEmpty()) {
return; } // // Services final IADProcessDAO adProcessDAO = Services.get(IADProcessDAO.class); final AdProcessId processId = adProcessDAO.retrieveProcessIdByClassIfUnique(ExportArchivePDF.class); if (processId == null) { final AdempiereException ex = new AdempiereException("No AD_Process_ID found for " + ExportArchivePDF.class); Archive_Main_Validator.logger.error(ex.getLocalizedMessage(), ex); return; } for (final I_AD_Column column : archiveColumns) { if (!DisplayType.isLookup(column.getAD_Reference_ID())) { continue; } final AdTableId adTableId = AdTableId.ofRepoId(column.getAD_Table_ID()); adProcessDAO.registerTableProcess(adTableId, processId); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.document.archive\de.metas.document.archive.base\src\main\java\de\metas\document\archive\interceptor\Archive_Main_Validator.java
1
请在Spring Boot框架中完成以下Java代码
public class PackageableRowsRepository { private final IOrgDAO orgDAO = Services.get(IOrgDAO.class); private final Supplier<LookupDataSource> orderLookup; private final Supplier<LookupDataSource> productLookup; private final Supplier<LookupDataSource> bpartnerLookup; public PackageableRowsRepository( @NonNull final LookupDataSourceFactory lookupDataSourceFactory) { // creating those LookupDataSources requires DB access. So, to allow this component to be initialized early during startup // and also to allow it to be unit-tested (when the lookups are not part of the test), I use those suppliers. orderLookup = Suppliers.memoize(() -> lookupDataSourceFactory.searchInTableLookup(I_C_Order.Table_Name)); productLookup = Suppliers.memoize(() -> lookupDataSourceFactory.searchInTableLookup(I_M_Product.Table_Name)); bpartnerLookup = Suppliers.memoize(() -> lookupDataSourceFactory.searchInTableLookup(I_C_BPartner.Table_Name)); } private List<PackageableRow> retrieveRowsByShipmentScheduleIds(final ViewId viewId, final Set<ShipmentScheduleId> shipmentScheduleIds) { if (shipmentScheduleIds.isEmpty()) { return ImmutableList.of(); } return Services.get(IPackagingDAO.class).getByShipmentScheduleIds(shipmentScheduleIds) .stream() .map(packageable -> createPackageableRow(viewId, packageable)) .collect(ImmutableList.toImmutableList()); } private PackageableRow createPackageableRow(final ViewId viewId, final Packageable packageable) { final Quantity qtyPickedOrDelivered = packageable.getQtyPickedOrDelivered(); final Optional<OrderLineId> orderLineId = Optional.ofNullable(packageable.getSalesOrderLineIdOrNull());
return PackageableRow.builder() .shipmentScheduleId(packageable.getShipmentScheduleId()) .salesOrderLineId(orderLineId) .viewId(viewId) // .order(orderLookup.get().findById(packageable.getSalesOrderId())) .product(productLookup.get().findById(packageable.getProductId())) .bpartner(bpartnerLookup.get().findById(packageable.getCustomerId())) .preparationDate(packageable.getPreparationDate().toZonedDateTime(orgDAO::getTimeZone)) // .qtyOrdered(packageable.getQtyOrdered()) .qtyPicked(qtyPickedOrDelivered) // .build(); } public PackageableRowsData createRowsData( @NonNull final ViewId viewId, @NonNull final Set<ShipmentScheduleId> shipmentScheduleIds) { if (shipmentScheduleIds.isEmpty()) { return PackageableRowsData.EMPTY; } final Set<ShipmentScheduleId> shipmentScheduleIdsCopy = ImmutableSet.copyOf(shipmentScheduleIds); return PackageableRowsData.ofSupplier(() -> retrieveRowsByShipmentScheduleIds(viewId, shipmentScheduleIdsCopy)); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\picking\packageable\PackageableRowsRepository.java
2
请完成以下Java代码
public String getName() { return name; } public ILogicExpression getExpression() { return expression; } /** * @return which parameters were used while evaluating and which was their value */ public Map<CtxName, String> getUsedParameters() { return usedParameters == null ? ImmutableMap.of() : usedParameters; } private static final class Constant extends LogicExpressionResult { private Constant(final boolean value) { super(null, value, value ? ConstantLogicExpression.TRUE : ConstantLogicExpression.FALSE, null); } @Override public String toString() { return value ? "TRUE" : "FALSE";
} } private static final class NamedConstant extends LogicExpressionResult { private transient String _toString = null; // lazy private NamedConstant(final String name, final boolean value) { super(name, value, value ? ConstantLogicExpression.TRUE : ConstantLogicExpression.FALSE, null); } @Override public String toString() { if (_toString == null) { _toString = MoreObjects.toStringHelper(value ? "TRUE" : "FALSE") .omitNullValues() .addValue(name) .toString(); } return _toString; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\expression\api\LogicExpressionResult.java
1
请完成以下Java代码
public abstract class RegistrationBean implements ServletContextInitializer, Ordered { private static final Log logger = LogFactory.getLog(RegistrationBean.class); private int order = Ordered.LOWEST_PRECEDENCE; private boolean enabled = true; @Override public final void onStartup(ServletContext servletContext) throws ServletException { String description = getDescription(); if (!isEnabled()) { logger.info(StringUtils.capitalize(description) + " was not registered (disabled)"); return; } register(description, servletContext); } /** * Return a description of the registration. For example "Servlet resourceServlet" * @return a description of the registration */ protected abstract String getDescription(); /** * Register this bean with the servlet context. * @param description a description of the item being registered * @param servletContext the servlet context */ protected abstract void register(String description, ServletContext servletContext); /** * Flag to indicate that the registration is enabled. * @param enabled the enabled to set */ public void setEnabled(boolean enabled) { this.enabled = enabled; } /** * Return if the registration is enabled.
* @return if enabled (default {@code true}) */ public boolean isEnabled() { return this.enabled; } /** * Set the order of the registration bean. * @param order the order */ public void setOrder(int order) { this.order = order; } /** * Get the order of the registration bean. * @return the order */ @Override public int getOrder() { return this.order; } }
repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\web\servlet\RegistrationBean.java
1
请完成以下Java代码
public DocBaseAndSubType getDocBaseAndSubTypeById(@NonNull final DocTypeId docTypeId) { final I_C_DocType docTypeRecord = getById(docTypeId); return DocBaseAndSubType.of(docTypeRecord.getDocBaseType(), docTypeRecord.getDocSubType()); } @NonNull public ImmutableList<I_C_DocType> retrieveForSelection(@NonNull final PInstanceId pinstanceId) { return queryBL .createQueryBuilder(I_C_DocType.class) .setOnlySelection(pinstanceId) .orderBy(I_C_DocType.COLUMNNAME_C_DocType_ID) .create() .listImmutable(); } @EqualsAndHashCode @ToString private static class DocBaseTypeCountersMap { public static DocBaseTypeCountersMap ofMap(@NonNull final ImmutableMap<DocBaseType, DocBaseType> map) { return !map.isEmpty() ? new DocBaseTypeCountersMap(map) : EMPTY; } private static final DocBaseTypeCountersMap EMPTY = new DocBaseTypeCountersMap(ImmutableMap.of()); private final ImmutableMap<DocBaseType, DocBaseType> counterDocBaseTypeByDocBaseType; private DocBaseTypeCountersMap(@NonNull final ImmutableMap<DocBaseType, DocBaseType> map) { this.counterDocBaseTypeByDocBaseType = map; }
public Optional<DocBaseType> getCounterDocBaseTypeByDocBaseType(@NonNull final DocBaseType docBaseType) { return Optional.ofNullable(counterDocBaseTypeByDocBaseType.get(docBaseType)); } } @NonNull private ImmutableSet<DocTypeId> retrieveDocTypeIdsByInvoicingPoolId(@NonNull final DocTypeInvoicingPoolId docTypeInvoicingPoolId) { return queryBL.createQueryBuilder(I_C_DocType.class) .addOnlyActiveRecordsFilter() .addEqualsFilter(I_C_DocType.COLUMNNAME_C_DocType_Invoicing_Pool_ID, docTypeInvoicingPoolId) .create() .idsAsSet(DocTypeId::ofRepoId); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\document\impl\DocTypeDAO.java
1
请完成以下Java代码
public Claims parseJWT(String jwt) { try { Claims claims = Jwts.parser().setSigningKey(jwtConfig.getKey()).parseClaimsJws(jwt).getBody(); String username = claims.getSubject(); String redisKey = Consts.REDIS_JWT_KEY_PREFIX + username; // 校验redis中的JWT是否存在 Long expire = stringRedisTemplate.getExpire(redisKey, TimeUnit.MILLISECONDS); if (Objects.isNull(expire) || expire <= 0) { throw new SecurityException(Status.TOKEN_EXPIRED); } // 校验redis中的JWT是否与当前的一致,不一致则代表用户已注销/用户在不同设备登录,均代表JWT已过期 String redisToken = stringRedisTemplate.opsForValue().get(redisKey); if (!StrUtil.equals(jwt, redisToken)) { throw new SecurityException(Status.TOKEN_OUT_OF_CTRL); } return claims; } catch (ExpiredJwtException e) { log.error("Token 已过期"); throw new SecurityException(Status.TOKEN_EXPIRED); } catch (UnsupportedJwtException e) { log.error("不支持的 Token"); throw new SecurityException(Status.TOKEN_PARSE_ERROR); } catch (MalformedJwtException e) { log.error("Token 无效"); throw new SecurityException(Status.TOKEN_PARSE_ERROR); } catch (SignatureException e) { log.error("无效的 Token 签名"); throw new SecurityException(Status.TOKEN_PARSE_ERROR); } catch (IllegalArgumentException e) { log.error("Token 参数不存在"); throw new SecurityException(Status.TOKEN_PARSE_ERROR); } } /** * 设置JWT过期
* * @param request 请求 */ public void invalidateJWT(HttpServletRequest request) { String jwt = getJwtFromRequest(request); String username = getUsernameFromJWT(jwt); // 从redis中清除JWT stringRedisTemplate.delete(Consts.REDIS_JWT_KEY_PREFIX + username); } /** * 根据 jwt 获取用户名 * * @param jwt JWT * @return 用户名 */ public String getUsernameFromJWT(String jwt) { Claims claims = parseJWT(jwt); return claims.getSubject(); } /** * 从 request 的 header 中获取 JWT * * @param request 请求 * @return JWT */ public String getJwtFromRequest(HttpServletRequest request) { String bearerToken = request.getHeader("Authorization"); if (StrUtil.isNotBlank(bearerToken) && bearerToken.startsWith("Bearer ")) { return bearerToken.substring(7); } return null; } }
repos\spring-boot-demo-master\demo-rbac-security\src\main\java\com\xkcoding\rbac\security\util\JwtUtil.java
1
请完成以下Java代码
public int getC_ProjectTask_ID() { if (m_ioLine == null) { return 0; } return m_ioLine.getC_ProjectTask_ID(); } /** * Get Activity * * @return project phase if based on shipment line and 0 for charge based */ public int getC_Activity_ID() { if (m_ioLine == null) { return 0; } return m_ioLine.getC_Activity_ID(); } public int getC_Order_ID() { if (m_ioLine == null) { return 0; } return m_ioLine.getC_Order_ID(); } /** * Get Campaign * * @return campaign if based on shipment line and 0 for charge based */ public int getC_Campaign_ID() { if (m_ioLine == null) { return 0; } return m_ioLine.getC_Campaign_ID(); } /** * Get Org Trx * * @return Org Trx if based on shipment line and 0 for charge based */ public int getAD_OrgTrx_ID() { if (m_ioLine == null) { return 0; } return m_ioLine.getAD_OrgTrx_ID(); } /** * Get User1 * * @return user1 if based on shipment line and 0 for charge based */ public int getUser1_ID() { if (m_ioLine == null)
{ return 0; } return m_ioLine.getUser1_ID(); } /** * Get User2 * * @return user2 if based on shipment line and 0 for charge based */ public int getUser2_ID() { if (m_ioLine == null) { return 0; } return m_ioLine.getUser2_ID(); } /** * Get Attribute Set Instance * * @return ASI if based on shipment line and 0 for charge based */ public int getM_AttributeSetInstance_ID() { if (m_ioLine == null) { return 0; } return m_ioLine.getM_AttributeSetInstance_ID(); } /** * Get Locator * * @return locator if based on shipment line and 0 for charge based */ public int getM_Locator_ID() { if (m_ioLine == null) { return 0; } return m_ioLine.getM_Locator_ID(); } /** * Get Tax * * @return Tax based on Invoice/Order line and Tax exempt for charge based */ public int getC_Tax_ID() { return taxId; } } // MRMALine
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MRMALine.java
1
请在Spring Boot框架中完成以下Java代码
public BigDecimal getBigDecimal(String name) { return getBigDecimal(name, null); } public BigDecimal getBigDecimal(String name, BigDecimal defaultValue) { String resultStr = getRequest().getParameter(name); if (resultStr != null) { try { return BigDecimal.valueOf(Double.parseDouble(resultStr)); } catch (Exception e) { return defaultValue; } } return defaultValue; } /** * 根据参数名从HttpRequest中获取String类型的参数值,无值则返回"" . * * @param key * . * @return String . */ public String getString_UrlDecode_UTF8(String key) { try { return URLDecoder.decode(this.getString(key), UTF_8); } catch (Exception e) { return ""; } } public String getString_UrlDecode_GBK(String key) { try { return new String(getString(key.toString()).getBytes("GBK"), "UTF-8"); } catch (Exception e) { return ""; } } /** * 获取客户端的IP地址 * * @return */ public String getIpAddr(HttpServletRequest request) { String ipAddress = null; ipAddress = request.getHeader("x-forwarded-for"); if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { ipAddress = request.getHeader("Proxy-Client-IP"); } if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { ipAddress = request.getHeader("WL-Proxy-Client-IP"); } if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { ipAddress = request.getRemoteAddr(); if (ipAddress.equals("127.0.0.1") || ipAddress.equals("0:0:0:0:0:0:0:1")) { // 根据网卡取本机配置的IP InetAddress inet = null; try { inet = InetAddress.getLocalHost(); } catch (UnknownHostException e) { e.printStackTrace(); } ipAddress = inet.getHostAddress(); } } // 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割 if (ipAddress != null && ipAddress.length() > 15) {
if (ipAddress.indexOf(",") > 0) { ipAddress = ipAddress.substring(0, ipAddress.indexOf(",")); } } return ipAddress; } /** * 获取refererUrl */ public String getRefererUrl(HttpServletRequest request) { return request.getHeader("referer"); } /** * * @param request * 请求 * @return 返回请求的数据流 * @throws IOException */ public String parseRequestString(HttpServletRequest request) throws IOException { String inputLine; String notityXml = ""; while ((inputLine = request.getReader().readLine()) != null) { notityXml += inputLine; } request.getReader().close(); return notityXml; } /** * 把json对象串转换成map对象 * @param jsonObjStr e.g. {'name':'get','int':1,'double',1.1,'null':null} * @return Map */ public HashMap<String, String> convertToMap(JSONParam[] params) { HashMap<String, String> map = new HashMap<String, String>(); for(JSONParam param:params){ map.put(param.getName(), param.getValue()); } return map; } }
repos\roncoo-pay-master\roncoo-pay-web-merchant\src\main\java\com\roncoo\pay\controller\common\BaseController.java
2
请完成以下Java代码
public void add(Channel channel) { channels.put(channel.id(), channel); logger.info("[add][一个连接({})加入]", channel.id()); } /** * 添加指定用户到 {@link #userChannels} 中 * * @param channel Channel * @param user 用户 */ public void addUser(Channel channel, String user) { Channel existChannel = channels.get(channel.id()); if (existChannel == null) { logger.error("[addUser][连接({}) 不存在]", channel.id()); return; } // 设置属性 channel.attr(CHANNEL_ATTR_KEY_USER).set(user); // 添加到 userChannels userChannels.put(user, channel); } /** * 将 Channel 从 {@link #channels} 和 {@link #userChannels} 中移除 * * @param channel Channel */ public void remove(Channel channel) { // 移除 channels channels.remove(channel.id()); // 移除 userChannels if (channel.hasAttr(CHANNEL_ATTR_KEY_USER)) { userChannels.remove(channel.attr(CHANNEL_ATTR_KEY_USER).get()); } logger.info("[remove][一个连接({})离开]", channel.id()); } /** * 向指定用户发送消息 * * @param user 用户
* @param invocation 消息体 */ public void send(String user, Invocation invocation) { // 获得用户对应的 Channel Channel channel = userChannels.get(user); if (channel == null) { logger.error("[send][连接不存在]"); return; } if (!channel.isActive()) { logger.error("[send][连接({})未激活]", channel.id()); return; } // 发送消息 channel.writeAndFlush(invocation); } /** * 向所有用户发送消息 * * @param invocation 消息体 */ public void sendAll(Invocation invocation) { for (Channel channel : channels.values()) { if (!channel.isActive()) { logger.error("[send][连接({})未激活]", channel.id()); return; } // 发送消息 channel.writeAndFlush(invocation); } } }
repos\SpringBoot-Labs-master\lab-67\lab-67-netty-demo\lab-67-netty-demo-server\src\main\java\cn\iocoder\springboot\lab67\nettyserverdemo\server\NettyChannelManager.java
1
请完成以下Java代码
public class DBRes_ar extends ListResourceBundle { /** Data */ static final Object[][] contents = new String[][]{ { "CConnectionDialog", "\u0631\u0628\u0637 \u0643\u0645\u0628\u064a\u0631" }, { "Name", "\u0627\u0644\u0627\u0650\u0633\u0645" }, { "AppsHost", "\u0645\u0636\u064a\u0641 \u0627\u0644\u062a\u0637\u0628\u064a\u0642\u0627\u062a" }, { "AppsPort", "\u0627\u0644\u062a\u0637\u0628\u064a\u0642\u0627\u062a \u0645\u0646\u0641\u062f" }, { "TestApps", "\u062c\u0631\u0628 \u0645\u0648\u0632\u0639 \u0627\u0644\u062a\u0637\u0628\u064a\u0642\u0627\u062a" }, { "DBHost", "\u0645\u0636\u064a\u0641 \u0642\u0627\u0639\u062f\u0629 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a" }, { "DBPort", "\u0645\u0646\u0641\u0630 \u0642\u0627\u0639\u062f\u0629 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a" }, { "DBName", "\u0627\u0650\u0633\u0645 \u0642\u0627\u0639\u062f\u0629 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a" }, { "DBUidPwd", "\u0627\u0644\u0645\u0633\u062a\u0639\u0645\u0644\\u0643\u0644\u0645\u0629 \u0627\u0644\u0633\u0631" }, { "ViaFirewall", "\u0639\u0628\u0631 \u062c\u062f\u0627\u0631 \u0646\u0627\u0631\u064a" }, { "FWHost", "\u0645\u0636\u064a\u0641 \u0627\u0644\u062c\u062f\u0627\u0631 \u0627\u0644\u0646\u0627\u0631\u064a" }, { "FWPort", "\u0645\u0646\u0641\u0630 \u0627\u0644\u062c\u062f\u0627\u0631 \u0627\u0644\u0646\u0627\u0631\u064a" }, { "TestConnection", "\u0645\u0646\u0641\u0630 \u0628\u0646\u0643 \u0627\u0644\u0645\u0639\u0644\u0648\u0645\u0627\u062a" }, { "Type", "\u0646\u0648\u0639 \u0642\u0627\u0639\u062f\u0629 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a" }, { "BequeathConnection", "\u062a\u0631\u0643\u0629 \u0627\u0644\u0631\u0651\u064e\u0628\u0637" }, { "Overwrite", "\u0627\u0633\u062d\u0642" }, { "RMIoverHTTP", "HTTP \u0645\u0631\u0651\u0631 \u0627\u0644\u0643\u0627\u0626\u0646\u0627\u062a \u0639\u0628\u0631 \u0646\u0641\u0642" },
{ "ConnectionError", "\u062e\u0637\u0623 \u0623\u062b\u0646\u0627\u0621 \u0627\u0644\u0631\u0628\u0637" }, { "ServerNotActive", "\u0627\u0644\u0645\u0648\u0632\u0639 \u0644\u0627 \u064a\u0639\u0645\u0644" } }; /** * Get Contsnts * @return contents * @uml.property name="contents" */ public Object[][] getContents() { return contents; } // getContent } // DBRes_ar_TN
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\db\connectiondialog\i18n\DBRes_ar.java
1
请完成以下Java代码
public final class JSONNullValue { public static Object wrapIfNull(@Nullable final Object value) { return value != null && !isNull(value) ? value : instance; } public static boolean isNull(@Nullable final Object value) { return value == null || value instanceof JSONNullValue || value instanceof Null; } public static final transient JSONNullValue instance = new JSONNullValue(); private JSONNullValue()
{ } @Override public String toString() { return "null"; } @Nullable public static Object toNullIfInstance(@Nullable final Object jsonValueObj) { return !isNull(jsonValueObj) ? jsonValueObj : null; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\datatypes\json\JSONNullValue.java
1
请完成以下Java代码
private BigDecimal getQty() { final BigDecimal qty = (BigDecimal)fieldQty.getValue(); return qty == null ? BigDecimal.ZERO : qty; } private void setQtyConv(final BigDecimal qtyConv) { fieldQtyConv.setValue(qtyConv, true); } private void setDescription(final String description) { fieldDescription.setValue(description, true); } private <T> T toModel(final Class<T> modelClass, final Object idObj) { final int id = toID(idObj); if (id <= 0) { return null; } return InterfaceWrapperHelper.create(getCtx(), id, modelClass, ITrx.TRXNAME_None); } private static final int toID(final Object idObj) { if (idObj == null) { return -1; } else if (idObj instanceof Number) { return ((Number)idObj).intValue(); } else { return -1; } } private void doConvert(final String reason) { // Reset setDescription(null); setQtyConv(null); final I_C_UOM uomFrom = getC_UOM(); final I_C_UOM uomTo = getC_UOM_To(); if (uomFrom == null || uomTo == null) { return; } final I_M_Product product = getM_Product();
final BigDecimal qty = getQty(); try { final BigDecimal qtyConv; if (product != null) { final UOMConversionContext conversionCtx = UOMConversionContext.of(product); qtyConv = uomConversionBL.convertQty(conversionCtx, qty, uomFrom, uomTo); } else { qtyConv = uomConversionBL.convert(uomFrom, uomTo, qty).orElse(null); } setQtyConv(qtyConv); setDescription("Converted " + NumberUtils.stripTrailingDecimalZeros(qty) + " " + uomFrom.getUOMSymbol() + " to " + NumberUtils.stripTrailingDecimalZeros(qtyConv) + " " + uomTo.getUOMSymbol() + "<br>Product: " + (product == null ? "-" : product.getName()) + "<br>Reason: " + reason); } catch (final Exception e) { setDescription(e.getLocalizedMessage()); // because this is a test form, printing the exception directly to console it's totally fine. // More, if we would log it as WARNING/SEVERE, an AD_Issue would be created, but we don't want that. e.printStackTrace(); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\de\metas\uom\form\UOMConversionCheckFormPanel.java
1
请在Spring Boot框架中完成以下Java代码
public String getUsername() { return username; } @Override public boolean isAccountNonExpired() { return true; } @Override public boolean isAccountNonLocked() { return true; } @Override public boolean isCredentialsNonExpired() { return true; }
@Override public boolean isEnabled() { return true; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; UserDetailsImpl user = (UserDetailsImpl) o; return Objects.equals(id, user.id); } }
repos\tutorials-master\spring-security-modules\spring-security-core\src\main\java\com\baeldung\jwtsignkey\userservice\UserDetailsImpl.java
2
请完成以下Java代码
public de.metas.handlingunits.model.I_M_HU getVHU() { return get_ValueAsPO(COLUMNNAME_VHU_ID, de.metas.handlingunits.model.I_M_HU.class); } @Override public void setVHU(final de.metas.handlingunits.model.I_M_HU VHU) { set_ValueFromPO(COLUMNNAME_VHU_ID, de.metas.handlingunits.model.I_M_HU.class, VHU); } @Override public void setVHU_ID (final int VHU_ID) { if (VHU_ID < 1) set_ValueNoCheck (COLUMNNAME_VHU_ID, null); else set_ValueNoCheck (COLUMNNAME_VHU_ID, VHU_ID); } @Override public int getVHU_ID() { return get_ValueAsInt(COLUMNNAME_VHU_ID); } @Override public de.metas.handlingunits.model.I_M_HU getVHU_Source() { return get_ValueAsPO(COLUMNNAME_VHU_Source_ID, de.metas.handlingunits.model.I_M_HU.class); } @Override public void setVHU_Source(final de.metas.handlingunits.model.I_M_HU VHU_Source) { set_ValueFromPO(COLUMNNAME_VHU_Source_ID, de.metas.handlingunits.model.I_M_HU.class, VHU_Source); } @Override public void setVHU_Source_ID (final int VHU_Source_ID) { if (VHU_Source_ID < 1) set_Value (COLUMNNAME_VHU_Source_ID, null); else set_Value (COLUMNNAME_VHU_Source_ID, VHU_Source_ID); } @Override
public int getVHU_Source_ID() { return get_ValueAsInt(COLUMNNAME_VHU_Source_ID); } /** * VHUStatus AD_Reference_ID=540478 * Reference name: HUStatus */ public static final int VHUSTATUS_AD_Reference_ID=540478; /** Planning = P */ public static final String VHUSTATUS_Planning = "P"; /** Active = A */ public static final String VHUSTATUS_Active = "A"; /** Destroyed = D */ public static final String VHUSTATUS_Destroyed = "D"; /** Picked = S */ public static final String VHUSTATUS_Picked = "S"; /** Shipped = E */ public static final String VHUSTATUS_Shipped = "E"; /** Issued = I */ public static final String VHUSTATUS_Issued = "I"; @Override public void setVHUStatus (final java.lang.String VHUStatus) { set_ValueNoCheck (COLUMNNAME_VHUStatus, VHUStatus); } @Override public java.lang.String getVHUStatus() { return get_ValueAsString(COLUMNNAME_VHUStatus); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java-gen\de\metas\handlingunits\model\X_M_HU_Trace.java
1
请完成以下Java代码
final class MarkExpiredWhereWarnDateExceededCommand { // services private static final Logger logger = LogManager.getLogger(MarkExpiredWhereWarnDateExceededCommand.class); private final HUWithExpiryDatesRepository huWithExpiryDatesRepository; private final IHandlingUnitsBL handlingUnitsBL; private final IHUTrxBL huTrxBL; // parameters private final LocalDate today; // status private int countChecked; private int countUpdated; @Builder private MarkExpiredWhereWarnDateExceededCommand( @NonNull final HUWithExpiryDatesRepository huWithExpiryDatesRepository, @NonNull final IHandlingUnitsBL handlingUnitsBL, @NonNull final IHUTrxBL huTrxBL, // @NonNull final LocalDate today) { this.huWithExpiryDatesRepository = huWithExpiryDatesRepository; this.handlingUnitsBL = handlingUnitsBL; this.huTrxBL = huTrxBL; this.today = today; } public static class MarkExpiredWhereWarnDateExceededCommandBuilder { public MarkExpiredWhereWarnDateExceededResult execute() { return build().execute(); } } public MarkExpiredWhereWarnDateExceededResult execute() { huWithExpiryDatesRepository.streamByWarnDateExceeded(today) .map(HUWithExpiryDates::getHuId) .forEach(this::markExpiredInOwnTrx); return MarkExpiredWhereWarnDateExceededResult.builder() .countChecked(countChecked) .countUpdated(countUpdated) .build(); } private void markExpiredInOwnTrx(@NonNull final HuId huId) { huTrxBL.process((Consumer<IHUContext>)huContext -> markExpiredUsingHUContext(huId, huContext)); } private void markExpiredUsingHUContext( @NonNull final HuId huId,
@NonNull final IHUContext huContext) { try { countChecked++; final IAttributeStorage huAttributes = getHUAttributes(huId, huContext); final String expiredOld = huAttributes.getValueAsString(HUAttributeConstants.ATTR_Expired); if (HUAttributeConstants.ATTR_Expired_Value_Expired.equals(expiredOld)) { Loggables.addLog("Already marked as Expired: M_HU_ID={}", huId); return; } huAttributes.setSaveOnChange(true); huAttributes.setValue(HUAttributeConstants.ATTR_Expired, HUAttributeConstants.ATTR_Expired_Value_Expired); countUpdated++; Loggables.addLog("Successfully processed M_HU_ID={}", huId); } catch (final AdempiereException ex) { Loggables.addLog("!!! Failed processing M_HU_ID={}: {} !!!", huId, ex.getLocalizedMessage()); logger.warn("Failed processing M_HU_ID={}. Skipped", huId, ex); } } private IAttributeStorage getHUAttributes(@NonNull final HuId huId, @NonNull final IHUContext huContext) { final I_M_HU hu = handlingUnitsBL.getById(huId); return huContext .getHUAttributeStorageFactory() .getAttributeStorage(hu); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\expiry\MarkExpiredWhereWarnDateExceededCommand.java
1
请完成以下Java代码
public int getC_BPartner_Location_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_BPartner_Location_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Description. @param Description Optional short description of the record */ public void setDescription (String Description) { set_Value (COLUMNNAME_Description, Description); } /** Get Description. @return Optional short description of the record */ public String getDescription () { return (String)get_Value(COLUMNNAME_Description); } /** Set Create Single Order. @param IsCreateSingleOrder For all shipments create one Order */ public void setIsCreateSingleOrder (boolean IsCreateSingleOrder) { set_Value (COLUMNNAME_IsCreateSingleOrder, Boolean.valueOf(IsCreateSingleOrder)); } /** Get Create Single Order. @return For all shipments create one Order */ public boolean isCreateSingleOrder () { Object oo = get_Value(COLUMNNAME_IsCreateSingleOrder); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Distribution Run. @param M_DistributionRun_ID Distribution Run create Orders to distribute products to a selected list of partners */ public void setM_DistributionRun_ID (int M_DistributionRun_ID) { if (M_DistributionRun_ID < 1) set_ValueNoCheck (COLUMNNAME_M_DistributionRun_ID, null); else set_ValueNoCheck (COLUMNNAME_M_DistributionRun_ID, Integer.valueOf(M_DistributionRun_ID)); } /** Get Distribution Run. @return Distribution Run create Orders to distribute products to a selected list of partners
*/ public int getM_DistributionRun_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_DistributionRun_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Name. @param Name Alphanumeric identifier of the entity */ public void setName (String Name) { set_Value (COLUMNNAME_Name, Name); } /** Get Name. @return Alphanumeric identifier of the entity */ public String getName () { return (String)get_Value(COLUMNNAME_Name); } /** Get Record ID/ColumnName @return ID/ColumnName pair */ public KeyNamePair getKeyNamePair() { return new KeyNamePair(get_ID(), getName()); } /** Set Process Now. @param Processing Process Now */ public void setProcessing (boolean Processing) { set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing)); } /** Get Process Now. @return Process Now */ public boolean isProcessing () { Object oo = get_Value(COLUMNNAME_Processing); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_DistributionRun.java
1
请完成以下Java代码
private ImmutablePair<String, Object> getFirstNonNullModelValue(final T model) { for (final String columnName : columnNames) { if (InterfaceWrapperHelper.isNull(model, columnName)) { continue; } final Object modelValue = InterfaceWrapperHelper.getValue(model, columnName).orElse(null); if (modelValue != null) { return ImmutablePair.of(columnName, modelValue); } } return null; } @Override public String getSql() { buildSql(); return sqlWhereClause; } @Override public List<Object> getSqlParams(final Properties ctx) { return getSqlParams(); } public List<Object> getSqlParams() { buildSql(); return sqlParams; } private boolean sqlBuilt = false; private String sqlWhereClause = null; private List<Object> sqlParams = null; private void buildSql() { if (sqlBuilt) {
return; } final StringBuilder sqlWhereClause = new StringBuilder(); final List<Object> sqlParams; final String sqlColumnNames = modifier.getColumnSql("COALESCE(" + String.join(",", columnNames) + ")"); sqlWhereClause.append(sqlColumnNames); if (value == null) { sqlWhereClause.append(" IS NULL"); sqlParams = null; } else { sqlParams = new ArrayList<>(); sqlWhereClause.append("=").append(modifier.getValueSql(value, sqlParams)); } this.sqlWhereClause = sqlWhereClause.toString(); this.sqlParams = sqlParams != null && !sqlParams.isEmpty() ? Collections.unmodifiableList(sqlParams) : ImmutableList.of(); this.sqlBuilt = true; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\dao\impl\CoalesceEqualsQueryFilter.java
1
请完成以下Java代码
private String convert (int number) { /* special case */ if (number == 0) return "ZERO"; String prefix = ""; if (number < 0) { number = -number; prefix = "MENYS"; } String soFar = ""; int place = 0; do { int n = number % 1000; if (n != 0) { String s = convertLessThanOneThousand (n); if (s.startsWith ("DOS CENTS", 1)) { s = s.replaceFirst ("DOS CENTS", "DOS-CENTS"); } if (s.startsWith ("TRES CENTS", 1)) { s = s.replaceFirst ("TRES CENTS", "TRES-CENTS"); } if (s.startsWith ("QUATRE CENTS", 1)) { s = s.replaceFirst ("QUATRE CENTS", "QUATRE-CENTS"); } if (s.startsWith ("CINC CENTS", 1)) { s = s.replaceFirst ("CINC CENTS", "CINC-CENTS"); } if (s.startsWith ("SIS CENTS", 1)) { s = s.replaceFirst ("SIS CENTS", "SIS-CENTS"); } if (s.startsWith ("SET CENTS", 1)) { s = s.replaceFirst ("SET CENTS", "SET-CENTS"); } if (s.startsWith ("VUIT CENTS", 1)) { s = s.replaceFirst ("VUIT CENTS", "VUIT-CENTS"); } if (s.startsWith ("NOU CENTS", 1)) { s = s.replaceFirst ("NOU CENTS", "NOU-CENTS"); } if (s.equals(" UN")) { soFar = majorNames[place] + soFar; } else
soFar = s + majorNames[place] + soFar; } place++; number /= 1000; } while (number > 0); return (prefix + soFar).trim (); } // convert /************************************************************************** * Get Amount in Words * @param amount numeric amount (352.80) * @return amount in words (three*five*two 80/100) * @throws Exception */ public String getAmtInWords (String amount) throws Exception { if (amount == null) return amount; // StringBuffer sb = new StringBuffer (); // int pos = amount.lastIndexOf ('.'); // Old int pos = amount.lastIndexOf (','); // int pos2 = amount.lastIndexOf (','); // Old int pos2 = amount.lastIndexOf ('.'); if (pos2 > pos) pos = pos2; String oldamt = amount; // amount = amount.replaceAll (",", ""); // Old amount = amount.replaceAll( "\\.",""); // int newpos = amount.lastIndexOf ('.'); // Old int newpos = amount.lastIndexOf (','); int pesos = Integer.parseInt (amount.substring (0, newpos)); sb.append (convert (pesos)); for (int i = 0; i < oldamt.length (); i++) { if (pos == i) // we are done { String cents = oldamt.substring (i + 1); sb.append (' ') .append (cents) .append ("/100"); // .append ("/100 EUROS"); break; } } return sb.toString (); } // getAmtInWords } // AmtInWords_CA
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\util\AmtInWords_CA.java
1
请完成以下Java代码
public abstract class RedisHelper { private static Logger logger = LoggerFactory.getLogger(RedisHelper.class); /** * scan 实现 * * @param redisTemplate redisTemplate * @param pattern 表达式,如:abc*,找出所有以abc开始的键 */ public static Set<String> scan(RedisTemplate<String, Object> redisTemplate, String pattern) throws NoSuchFieldException { return redisTemplate.execute((RedisCallback<Set<String>>) connection -> { if (connection instanceof RedisClusterConnection) { //集群模式 return redisTemplate.keys(pattern); } // 单机模式
Set<String> keysTmp = new HashSet<>(); try (Cursor<byte[]> cursor = connection.scan(new ScanOptions.ScanOptionsBuilder() .match(pattern) .count(10000).build())) { while (cursor.hasNext()) { keysTmp.add(new String(cursor.next(), "Utf-8")); } } catch (Exception e) { throw new RuntimeException(e); } return keysTmp; }); } }
repos\spring-boot-student-master\spring-boot-student-data-redis\src\main\java\com\xiaolyuh\helper\RedisHelper.java
1
请完成以下Java代码
class MainMethod { private final Method method; MainMethod() { this(Thread.currentThread()); } MainMethod(Thread thread) { Assert.notNull(thread, "'thread' must not be null"); this.method = getMainMethod(thread); } private Method getMainMethod(Thread thread) { StackTraceElement[] stackTrace = thread.getStackTrace(); for (int i = stackTrace.length - 1; i >= 0; i--) { StackTraceElement element = stackTrace[i]; if ("main".equals(element.getMethodName()) && !isLoaderClass(element.getClassName())) { Method method = getMainMethod(element); if (method != null) { return method; } } } throw new IllegalStateException("Unable to find main method"); } private boolean isLoaderClass(String className) { return className.startsWith("org.springframework.boot.loader."); } private @Nullable Method getMainMethod(StackTraceElement element) { try { Class<?> elementClass = Class.forName(element.getClassName()); Method method = getMainMethod(elementClass); if (Modifier.isStatic(method.getModifiers())) { return method; } } catch (Exception ex) { // Ignore } return null; }
private static Method getMainMethod(Class<?> clazz) throws Exception { try { return clazz.getDeclaredMethod("main", String[].class); } catch (NoSuchMethodException ex) { return clazz.getDeclaredMethod("main"); } } /** * Returns the actual main method. * @return the main method */ Method getMethod() { return this.method; } /** * Return the name of the declaring class. * @return the declaring class name */ String getDeclaringClassName() { return this.method.getDeclaringClass().getName(); } }
repos\spring-boot-4.0.1\module\spring-boot-devtools\src\main\java\org\springframework\boot\devtools\restart\MainMethod.java
1
请完成以下Java代码
public void onRefresh(final ICalloutRecord calloutRecord) { try { tabCallout.onRefresh(calloutRecord); } catch (final Exception e) { handleException("onRefresh", calloutRecord, e); } } @Override public void onRefreshAll(final ICalloutRecord calloutRecord) { try { tabCallout.onRefreshAll(calloutRecord); } catch (final Exception e) { handleException("onRefreshAll", calloutRecord, e); } } @Override public void onAfterQuery(final ICalloutRecord calloutRecord) { try { tabCallout.onAfterQuery(calloutRecord); } catch (final Exception e) {
handleException("onAfterQuery", calloutRecord, e); } } private static final class StatefulExceptionHandledTabCallout extends ExceptionHandledTabCallout implements IStatefulTabCallout { private StatefulExceptionHandledTabCallout(final IStatefulTabCallout tabCallout) { super(tabCallout); } @Override public void onInit(final ICalloutRecord calloutRecord) { try { ((IStatefulTabCallout)tabCallout).onInit(calloutRecord); } catch (final Exception e) { handleException("onInit", calloutRecord, e); } } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\ui\spi\ExceptionHandledTabCallout.java
1
请完成以下Java代码
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代码
protected String[] tokenizeJobConfiguration(String jobConfiguration) { String[] configuration = new String[2]; if (jobConfiguration != null ) { String[] configParts = jobConfiguration.split("\\$"); if (configuration.length > 2) { throw new ProcessEngineException("Illegal async continuation job handler configuration: '" + jobConfiguration + "': exprecting one part or two parts seperated by '$'."); } configuration[0] = configParts[0]; if (configParts.length == 2) { configuration[1] = configParts[1]; } } return configuration; } public static class AsyncContinuationConfiguration implements JobHandlerConfiguration { protected String atomicOperation; protected String transitionId; public String getAtomicOperation() { return atomicOperation; } public void setAtomicOperation(String atomicOperation) { this.atomicOperation = atomicOperation; } public String getTransitionId() { return transitionId; } public void setTransitionId(String transitionId) {
this.transitionId = transitionId; } @Override public String toCanonicalString() { String configuration = atomicOperation; if(transitionId != null) { // store id of selected transition in case this is async after. // id is not serialized with the execution -> we need to remember it as // job handler configuration. configuration += "$" + transitionId; } return configuration; } } public void onDelete(AsyncContinuationConfiguration configuration, JobEntity jobEntity) { // do nothing } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\jobexecutor\AsyncContinuationJobHandler.java
1
请在Spring Boot框架中完成以下Java代码
public class ClientController { @Autowired private DiscoveryClient discoveryClient; @Autowired private ClientConfig config; @Autowired private TravelAgencyService travelAgencyService; @RequestMapping("/deals") public String getDeals() { return travelAgencyService.getDeals(); } @GetMapping public String load() { RestTemplate restTemplate = new RestTemplate();
String resourceUrl = "http://travel-agency-service:8080"; ResponseEntity<String> response = restTemplate.getForEntity(resourceUrl, String.class); String serviceList = ""; if (discoveryClient != null) { List<String> services = this.discoveryClient.getServices(); for (String service : services) { List<ServiceInstance> instances = this.discoveryClient.getInstances(service); serviceList += ("[" + service + " : " + ((!CollectionUtils.isEmpty(instances)) ? instances.size() : 0) + " instances ]"); } } return String.format(config.getMessage(), response.getBody(), serviceList); } }
repos\tutorials-master\spring-cloud-modules\spring-cloud-kubernetes\kubernetes-guide\client-service\src\main\java\com\baeldung\spring\cloud\kubernetes\client\ClientController.java
2
请完成以下Java代码
protected org.compiere.model.POInfo initPO(final Properties ctx) { return org.compiere.model.POInfo.getPOInfo(Table_Name); } /** * Access AD_Reference_ID=540962 * Reference name: AD_User_Access */ public static final int ACCESS_AD_Reference_ID=540962; /** Read = R */ public static final String ACCESS_Read = "R"; /** Write = W */ public static final String ACCESS_Write = "W"; /** Report = P */ public static final String ACCESS_Report = "P"; /** Export = E */ public static final String ACCESS_Export = "E"; @Override public void setAccess (final java.lang.String Access) { set_Value (COLUMNNAME_Access, Access); } @Override public java.lang.String getAccess() { return get_ValueAsString(COLUMNNAME_Access); } @Override public org.compiere.model.I_AD_Role getAD_Role() { return get_ValueAsPO(COLUMNNAME_AD_Role_ID, org.compiere.model.I_AD_Role.class); } @Override public void setAD_Role(final org.compiere.model.I_AD_Role AD_Role) { set_ValueFromPO(COLUMNNAME_AD_Role_ID, org.compiere.model.I_AD_Role.class, AD_Role); } @Override public void setAD_Role_ID (final int AD_Role_ID) { if (AD_Role_ID < 0) set_Value (COLUMNNAME_AD_Role_ID, null); else
set_Value (COLUMNNAME_AD_Role_ID, AD_Role_ID); } @Override public int getAD_Role_ID() { return get_ValueAsInt(COLUMNNAME_AD_Role_ID); } @Override public void setAD_Role_TableOrg_Access_ID (final int AD_Role_TableOrg_Access_ID) { if (AD_Role_TableOrg_Access_ID < 1) set_ValueNoCheck (COLUMNNAME_AD_Role_TableOrg_Access_ID, null); else set_ValueNoCheck (COLUMNNAME_AD_Role_TableOrg_Access_ID, AD_Role_TableOrg_Access_ID); } @Override public int getAD_Role_TableOrg_Access_ID() { return get_ValueAsInt(COLUMNNAME_AD_Role_TableOrg_Access_ID); } @Override public void setAD_Table_ID (final int AD_Table_ID) { if (AD_Table_ID < 1) set_Value (COLUMNNAME_AD_Table_ID, null); else set_Value (COLUMNNAME_AD_Table_ID, AD_Table_ID); } @Override public int getAD_Table_ID() { return get_ValueAsInt(COLUMNNAME_AD_Table_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Role_TableOrg_Access.java
1
请完成以下Java代码
public class S_Resource_PrintQRCodes extends ViewBasedProcessTemplate implements IProcessPrecondition { private final ResourceQRCodePrintService resourceQRCodePrintService = SpringContextHolder.instance.getBean(ResourceQRCodePrintService.class); @Override protected ProcessPreconditionsResolution checkPreconditionsApplicable() { if (getSelectedRowIds().isEmpty()) { return ProcessPreconditionsResolution.rejectBecauseNoSelection().toInternal(); } return ProcessPreconditionsResolution.accept(); } @Override protected String doIt() { final ImmutableSet<ResourceId> resourceIds = getSelectedResourceIds(); final QRCodePDFResource pdf = resourceQRCodePrintService.createPDF(resourceIds); getResult().setReportData(pdf, pdf.getFilename(), pdf.getContentType()); return MSG_OK; } private ImmutableSet<ResourceId> getSelectedResourceIds() { final IView view = getView(); return getSelectedRowIdsAsSet() .stream() .map(view::getTableRecordReferenceOrNull) .filter(Objects::nonNull) .map(recordRef -> ResourceId.ofRepoId(recordRef.getRecord_ID())) .collect(ImmutableSet.toImmutableSet()); } private Set<DocumentId> getSelectedRowIdsAsSet()
{ final IView view = getView(); final DocumentIdsSelection rowIds = getSelectedRowIds(); final Set<DocumentId> rowIdsEffective; if (rowIds.isEmpty()) { return ImmutableSet.of(); } else if (rowIds.isAll()) { rowIdsEffective = view.streamByIds(DocumentIdsSelection.ALL) .map(IViewRow::getId) .collect(ImmutableSet.toImmutableSet()); } else { rowIdsEffective = rowIds.toSet(); } return rowIdsEffective; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\resource\process\S_Resource_PrintQRCodes.java
1
请完成以下Java代码
public void onElementIDChanged(final I_AD_Menu menu) { final IADElementDAO adElementDAO = Services.get(IADElementDAO.class); if (!IElementTranslationBL.DYNATTR_AD_Menu_UpdateTranslations.getValue(menu, true)) { // do not copy translations from element to menu return; } final I_AD_Element menuElement = adElementDAO.getById(menu.getAD_Element_ID()); if (menuElement == null) { // nothing to do. It was not yet set return; } menu.setName(menuElement.getName()); menu.setDescription(menuElement.getDescription()); menu.setWEBUI_NameBrowse(menuElement.getWEBUI_NameBrowse()); menu.setWEBUI_NameNew(menuElement.getWEBUI_NameNew());
menu.setWEBUI_NameNewBreadcrumb(menuElement.getWEBUI_NameNewBreadcrumb()); } @ModelChange(timings = { ModelValidator.TYPE_AFTER_NEW, ModelValidator.TYPE_AFTER_CHANGE }, ifColumnsChanged = I_AD_Menu.COLUMNNAME_AD_Element_ID) public void updateTranslationsForElement(final I_AD_Menu menu) { final AdElementId menuElementId = AdElementId.ofRepoIdOrNull(menu.getAD_Element_ID()); if (menuElementId == null) { // nothing to do. It was not yet set return; } Services.get(IElementTranslationBL.class).updateMenuTranslationsFromElement(menuElementId); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\menu\model\interceptor\AD_Menu.java
1
请完成以下Java代码
public void setSendEMail (final boolean SendEMail) { set_Value (COLUMNNAME_SendEMail, SendEMail); } @Override public boolean isSendEMail() { return get_ValueAsBoolean(COLUMNNAME_SendEMail); } @Override public void setSeqNo (final int SeqNo) { set_Value (COLUMNNAME_SeqNo, SeqNo); } @Override public int getSeqNo() { return get_ValueAsInt(COLUMNNAME_SeqNo); } @Override public org.compiere.model.I_C_ElementValue getUser1() { return get_ValueAsPO(COLUMNNAME_User1_ID, org.compiere.model.I_C_ElementValue.class); } @Override public void setUser1(final org.compiere.model.I_C_ElementValue User1) { set_ValueFromPO(COLUMNNAME_User1_ID, org.compiere.model.I_C_ElementValue.class, User1); } @Override public void setUser1_ID (final int User1_ID) { if (User1_ID < 1) set_Value (COLUMNNAME_User1_ID, null); else set_Value (COLUMNNAME_User1_ID, User1_ID); } @Override public int getUser1_ID() { return get_ValueAsInt(COLUMNNAME_User1_ID); } @Override public org.compiere.model.I_C_ElementValue getUser2() { return get_ValueAsPO(COLUMNNAME_User2_ID, org.compiere.model.I_C_ElementValue.class); } @Override public void setUser2(final org.compiere.model.I_C_ElementValue User2) {
set_ValueFromPO(COLUMNNAME_User2_ID, org.compiere.model.I_C_ElementValue.class, User2); } @Override public void setUser2_ID (final int User2_ID) { if (User2_ID < 1) set_Value (COLUMNNAME_User2_ID, null); else set_Value (COLUMNNAME_User2_ID, User2_ID); } @Override public int getUser2_ID() { return get_ValueAsInt(COLUMNNAME_User2_ID); } @Override public void setVolume (final @Nullable BigDecimal Volume) { set_Value (COLUMNNAME_Volume, Volume); } @Override public BigDecimal getVolume() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Volume); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setWeight (final @Nullable BigDecimal Weight) { set_Value (COLUMNNAME_Weight, Weight); } @Override public BigDecimal getWeight() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Weight); return bd != null ? bd : BigDecimal.ZERO; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_DD_Order.java
1
请完成以下Java代码
public void setRows (int rows) { m_textArea.setRows(rows); } /** * Get Rows * @return rows */ public int getRows() { return m_textArea.getRows(); } /** * Set Text Caret Position * @param pos */ public void setCaretPosition (int pos) { m_textArea.setCaretPosition (pos); } /** * Get Text Caret Position * @return position */ public int getCaretPosition() { return m_textArea.getCaretPosition(); } /** * Set Text Editable * @param edit */ public void setEditable (boolean edit) { m_textArea.setEditable(edit); } /** * Is Text Editable * @return true if editable */ public boolean isEditable() { return m_textArea.isEditable(); } /** * Set Text Line Wrap * @param wrap */ public void setLineWrap (boolean wrap) { m_textArea.setLineWrap (wrap); } /** * Set Text Wrap Style Word * @param word */ public void setWrapStyleWord (boolean word) { m_textArea.setWrapStyleWord (word); } /** * Set Opaque * @param isOpaque */ @Override public void setOpaque (boolean isOpaque) { // JScrollPane & Viewport is always not Opaque if (m_textArea == null) // during init of JScrollPane super.setOpaque(isOpaque); else m_textArea.setOpaque(isOpaque); } // setOpaque
/** * Set Text Margin * @param m insets */ public void setMargin (Insets m) { if (m_textArea != null) m_textArea.setMargin(m); } // setMargin /** * AddFocusListener * @param l */ @Override public void addFocusListener (FocusListener l) { if (m_textArea == null) // during init super.addFocusListener(l); else m_textArea.addFocusListener(l); } /** * Add Text Mouse Listener * @param l */ @Override public void addMouseListener (MouseListener l) { m_textArea.addMouseListener(l); } /** * Add Text Key Listener * @param l */ @Override public void addKeyListener (KeyListener l) { m_textArea.addKeyListener(l); } /** * Add Text Input Method Listener * @param l */ @Override public void addInputMethodListener (InputMethodListener l) { m_textArea.addInputMethodListener(l); } /** * Get text Input Method Requests * @return requests */ @Override public InputMethodRequests getInputMethodRequests() { return m_textArea.getInputMethodRequests(); } /** * Set Text Input Verifier * @param l */ @Override public void setInputVerifier (InputVerifier l) { m_textArea.setInputVerifier(l); } @Override public final ICopyPasteSupportEditor getCopyPasteSupport() { return copyPasteSupport; } } // CTextArea
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\swing\CTextArea.java
1
请完成以下Java代码
public void setDefaultTargetUrl(String defaultTargetUrl) { Assert.isTrue(UrlUtils.isValidRedirectUrl(defaultTargetUrl), "defaultTarget must start with '/' or with 'http(s)'"); this.defaultTargetUrl = defaultTargetUrl; } /** * If <code>true</code>, will always redirect to the value of {@code defaultTargetUrl} * (defaults to <code>false</code>). */ public void setAlwaysUseDefaultTargetUrl(boolean alwaysUseDefaultTargetUrl) { this.alwaysUseDefaultTargetUrl = alwaysUseDefaultTargetUrl; } protected boolean isAlwaysUseDefaultTargetUrl() { return this.alwaysUseDefaultTargetUrl; } /** * If this property is set, the current request will be checked for this a parameter * with this name and the value used as the target URL if present. * @param targetUrlParameter the name of the parameter containing the encoded target * URL. Defaults to null. */ public void setTargetUrlParameter(String targetUrlParameter) { if (targetUrlParameter != null) { Assert.hasText(targetUrlParameter, "targetUrlParameter cannot be empty"); } this.targetUrlParameter = targetUrlParameter; } protected @Nullable String getTargetUrlParameter() { return this.targetUrlParameter; } /** * Allows overriding of the behaviour when redirecting to a target URL. * @param redirectStrategy {@link RedirectStrategy} to use */
public void setRedirectStrategy(RedirectStrategy redirectStrategy) { Assert.notNull(redirectStrategy, "redirectStrategy cannot be null"); this.redirectStrategy = redirectStrategy; } protected RedirectStrategy getRedirectStrategy() { return this.redirectStrategy; } /** * If set to {@code true} the {@code Referer} header will be used (if available). * Defaults to {@code false}. */ public void setUseReferer(boolean useReferer) { this.useReferer = useReferer; } }
repos\spring-security-main\web\src\main\java\org\springframework\security\web\authentication\AbstractAuthenticationTargetUrlRequestHandler.java
1
请完成以下Java代码
class ErrorsCollector { @NonNull private final IADWindowDAO adWindowDAO = Services.get(IADWindowDAO.class); @NonNull private final String adLanguage; @NonNull private final ArrayList<JsonWindowsHealthCheckResponse.Entry> errors = new ArrayList<>(); @Nullable @Getter private AdWindowId currentWindowId; @Nullable private String _currentWindowName; @Builder private ErrorsCollector(@NonNull final String adLanguage) { this.adLanguage = adLanguage; } public List<JsonWindowsHealthCheckResponse.Entry> getCollectedErrors() { return ImmutableList.copyOf(errors); } public int getCollectedErrorsCount() { return errors.size(); } public void setCurrentWindow(@NonNull final AdWindowId windowId) { setCurrentWindow(windowId, null); } public void setCurrentWindow(@NonNull final DocumentEntityDescriptor entityDescriptor) { setCurrentWindow(entityDescriptor.getWindowId().toAdWindowId(), entityDescriptor.getCaption().translate(adLanguage)); } public void setCurrentWindow(@NonNull final AdWindowId windowId, @Nullable final String windowName) { this.currentWindowId = windowId; this._currentWindowName = windowName; } public void clearCurrentWindow() { this.currentWindowId = null; this._currentWindowName = null; } @Nullable public String getCurrentWindowName() { if (this._currentWindowName == null && this.currentWindowId != null)
{ this._currentWindowName = adWindowDAO.retrieveWindowName(currentWindowId).translate(adLanguage); } return this._currentWindowName; } public void collectError(@NonNull final String errorMessage) { errors.add(JsonWindowsHealthCheckResponse.Entry.builder() .windowId(WindowId.of(currentWindowId)) .windowName(getCurrentWindowName()) .errorMessage(errorMessage) .build()); } public void collectError(@NonNull final Throwable exception) { errors.add(JsonWindowsHealthCheckResponse.Entry.builder() .windowId(WindowId.of(currentWindowId)) .windowName(getCurrentWindowName()) .error(JsonErrors.ofThrowable(exception, adLanguage)) .build()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\health\ErrorsCollector.java
1
请完成以下Java代码
public void setR_InterestArea_ID (int R_InterestArea_ID) { if (R_InterestArea_ID < 1) set_ValueNoCheck (COLUMNNAME_R_InterestArea_ID, null); else set_ValueNoCheck (COLUMNNAME_R_InterestArea_ID, Integer.valueOf(R_InterestArea_ID)); } /** Get Interest Area. @return Interest Area or Topic */ public int getR_InterestArea_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_R_InterestArea_ID); 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_R_InterestArea.java
1
请在Spring Boot框架中完成以下Java代码
public class InvoiceVerificationRunId implements RepoIdAware { int repoId; @NonNull InvoiceVerificationSetId invoiceVerificationSetId; @Nullable public static InvoiceVerificationRunId cast(@Nullable final RepoIdAware repoIdAware) { return (InvoiceVerificationRunId)repoIdAware; } public static InvoiceVerificationRunId ofRepoId(@NonNull final InvoiceVerificationSetId invoiceVerificationSetId, final int invoiceVerificationRunId) { return new InvoiceVerificationRunId(invoiceVerificationSetId, invoiceVerificationRunId); } public static InvoiceVerificationRunId ofRepoId(final int invoiceVerificationSetId, final int invoiceVerificationRunId) { return new InvoiceVerificationRunId(InvoiceVerificationSetId.ofRepoId(invoiceVerificationSetId), invoiceVerificationRunId); } @Nullable public static InvoiceVerificationRunId ofRepoIdOrNull( @Nullable final Integer invoiceVerificationSetId, @Nullable final Integer invoiceVerificationRunId) { return invoiceVerificationSetId != null && invoiceVerificationSetId > 0 && invoiceVerificationRunId != null && invoiceVerificationRunId > 0 ? ofRepoId(invoiceVerificationSetId, invoiceVerificationRunId) : null; } @Nullable public static InvoiceVerificationRunId ofRepoIdOrNull( @Nullable final InvoiceVerificationSetId bpartnerId, final int bpartnerLocationId) { return bpartnerId != null && bpartnerLocationId > 0 ? ofRepoId(bpartnerId, bpartnerLocationId) : null; } private InvoiceVerificationRunId(@NonNull final InvoiceVerificationSetId invoiceVerificationSetId, final int bpartnerLocationId) {
this.repoId = Check.assumeGreaterThanZero(bpartnerLocationId, "bpartnerLocationId"); this.invoiceVerificationSetId = invoiceVerificationSetId; } public static int toRepoId(final InvoiceVerificationRunId invoiceVerificationRunId) { return toRepoIdOr(invoiceVerificationRunId, -1); } public static int toRepoIdOr(final InvoiceVerificationRunId bpLocationId, final int defaultValue) { return bpLocationId != null ? bpLocationId.getRepoId() : defaultValue; } public static boolean equals(final InvoiceVerificationRunId id1, final InvoiceVerificationRunId id2) { return Objects.equals(id1, id2); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\invoice\InvoiceVerificationRunId.java
2