instruction
string
input
string
output
string
source_file
string
priority
int64
请完成以下Java代码
public class ProductsToPick_SetPackingInstructions extends ProductsToPickViewBasedProcess { private final ProductsToPickRowsService rowsService = SpringContextHolder.instance.getBean(ProductsToPickRowsService.class); @Param(parameterName = "M_HU_PI_ID", mandatory = true) private HuPackingInstructionsId p_M_HU_PI_ID; @Override protected ProcessPreconditionsResolution checkPreconditionsApplicable() { if (!isPickerProfile()) { return ProcessPreconditionsResolution.rejectWithInternalReason("only picker shall pack"); } if (!rowsService.anyRowsEligibleForPacking(getSelectedRows())) { return ProcessPreconditionsResolution.rejectWithInternalReason("no eligible rows were selected"); } return ProcessPreconditionsResolution.accept(); }
@Override @RunOutOfTrx protected String doIt() { final ImmutableList<WebuiPickHUResult> result = rowsService.setPackingInstruction(getSelectedRows(), getPackToSpec()); updateViewRowFromPickingCandidate(result); invalidateView(); return MSG_OK; } private PackToSpec getPackToSpec() {return PackToSpec.ofGenericPackingInstructionsId(p_M_HU_PI_ID);} }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\pickingV2\productsToPick\process\ProductsToPick_SetPackingInstructions.java
1
请完成以下Java代码
public ScriptInfo getScriptInfo() { return scriptInfo; } /** * Sets the script info * * @see #getScriptInfo() */ public void setScriptInfo(ScriptInfo scriptInfo) { this.scriptInfo = scriptInfo; } public Object getInstance() { return instance; } public void setInstance(Object instance) { this.instance = instance; } @Override public FlowableListener clone() { FlowableListener clone = new FlowableListener();
clone.setValues(this); return clone; } public void setValues(FlowableListener otherListener) { super.setValues(otherListener); setEvent(otherListener.getEvent()); setSourceState(otherListener.getSourceState()); setTargetState(otherListener.getTargetState()); setImplementation(otherListener.getImplementation()); setImplementationType(otherListener.getImplementationType()); setOnTransaction(otherListener.getOnTransaction()); Optional.ofNullable(otherListener.getScriptInfo()).map(ScriptInfo::clone).ifPresent(this::setScriptInfo); fieldExtensions = new ArrayList<>(); if (otherListener.getFieldExtensions() != null && !otherListener.getFieldExtensions().isEmpty()) { for (FieldExtension extension : otherListener.getFieldExtensions()) { fieldExtensions.add(extension.clone()); } } } }
repos\flowable-engine-main\modules\flowable-cmmn-model\src\main\java\org\flowable\cmmn\model\FlowableListener.java
1
请完成以下Java代码
public ActiveOrHistoricCurrencyAndAmount getInstdAmt() { return instdAmt; } /** * Sets the value of the instdAmt property. * * @param value * allowed object is * {@link ActiveOrHistoricCurrencyAndAmount } * */ public void setInstdAmt(ActiveOrHistoricCurrencyAndAmount value) { this.instdAmt = value; } /** * Gets the value of the eqvtAmt property. * * @return * possible object is
* {@link EquivalentAmount2 } * */ public EquivalentAmount2 getEqvtAmt() { return eqvtAmt; } /** * Sets the value of the eqvtAmt property. * * @param value * allowed object is * {@link EquivalentAmount2 } * */ public void setEqvtAmt(EquivalentAmount2 value) { this.eqvtAmt = value; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.sepa\schema-pain_001_01_03_ch_02\src\main\java-xjc\de\metas\payment\sepa\jaxb\sct\pain_001_001_03_ch_02\AmountType3Choice.java
1
请在Spring Boot框架中完成以下Java代码
public void delete(SuspendedJobEntity jobEntity, boolean fireDeleteEvent) { if (serviceConfiguration.getInternalJobManager() != null) { serviceConfiguration.getInternalJobManager().handleJobDelete(jobEntity); } super.delete(jobEntity, fireDeleteEvent); } protected SuspendedJobEntity createSuspendedJob(AbstractRuntimeJobEntity job) { SuspendedJobEntity newSuspendedJobEntity = create(); newSuspendedJobEntity.setJobHandlerConfiguration(job.getJobHandlerConfiguration()); newSuspendedJobEntity.setCustomValues(job.getCustomValues()); newSuspendedJobEntity.setJobHandlerType(job.getJobHandlerType()); newSuspendedJobEntity.setExclusive(job.isExclusive()); newSuspendedJobEntity.setRepeat(job.getRepeat()); newSuspendedJobEntity.setRetries(job.getRetries());
newSuspendedJobEntity.setEndDate(job.getEndDate()); newSuspendedJobEntity.setExecutionId(job.getExecutionId()); newSuspendedJobEntity.setProcessInstanceId(job.getProcessInstanceId()); newSuspendedJobEntity.setProcessDefinitionId(job.getProcessDefinitionId()); newSuspendedJobEntity.setScopeId(job.getScopeId()); newSuspendedJobEntity.setSubScopeId(job.getSubScopeId()); newSuspendedJobEntity.setScopeType(job.getScopeType()); newSuspendedJobEntity.setScopeDefinitionId(job.getScopeDefinitionId()); // Inherit tenant newSuspendedJobEntity.setTenantId(job.getTenantId()); newSuspendedJobEntity.setJobType(job.getJobType()); return newSuspendedJobEntity; } }
repos\flowable-engine-main\modules\flowable-job-service\src\main\java\org\flowable\job\service\impl\persistence\entity\SuspendedJobEntityManagerImpl.java
2
请完成以下Java代码
public static File getClasspathFile(String filename, ClassLoader classLoader) { if(filename == null) { throw LOG.nullParameter("filename"); } URL fileUrl = null; if (classLoader != null) { fileUrl = classLoader.getResource(filename); } if (fileUrl == null) { // Try the current Thread context classloader classLoader = Thread.currentThread().getContextClassLoader(); fileUrl = classLoader.getResource(filename); if (fileUrl == null) { // Finally, try the classloader for this class classLoader = IoUtil.class.getClassLoader(); fileUrl = classLoader.getResource(filename);
} } if(fileUrl == null) { throw LOG.fileNotFoundException(filename); } try { return new File(fileUrl.toURI()); } catch(URISyntaxException e) { throw LOG.fileNotFoundException(filename, e); } } }
repos\camunda-bpm-platform-master\commons\utils\src\main\java\org\camunda\commons\utils\IoUtil.java
1
请在Spring Boot框架中完成以下Java代码
public class EntityViewImportService extends BaseEntityImportService<EntityViewId, EntityView, EntityExportData<EntityView>> { private final EntityViewService entityViewService; @Lazy @Autowired private TbEntityViewService tbEntityViewService; @Override protected void setOwner(TenantId tenantId, EntityView entityView, IdProvider idProvider) { entityView.setTenantId(tenantId); entityView.setCustomerId(idProvider.getInternalId(entityView.getCustomerId())); } @Override protected EntityView prepare(EntitiesImportCtx ctx, EntityView entityView, EntityView old, EntityExportData<EntityView> exportData, IdProvider idProvider) { entityView.setEntityId(idProvider.getInternalId(entityView.getEntityId())); return entityView; } @Override protected EntityView saveOrUpdate(EntitiesImportCtx ctx, EntityView entityView, EntityExportData<EntityView> exportData, IdProvider idProvider, CompareResult compareResult) { return entityViewService.saveEntityView(entityView); } @Override protected void onEntitySaved(User user, EntityView savedEntityView, EntityView oldEntityView) throws ThingsboardException { tbEntityViewService.updateEntityViewAttributes(user.getTenantId(), savedEntityView, oldEntityView, user); super.onEntitySaved(user, savedEntityView, oldEntityView);
} @Override protected EntityView deepCopy(EntityView entityView) { return new EntityView(entityView); } @Override protected void cleanupForComparison(EntityView e) { super.cleanupForComparison(e); if (e.getCustomerId() != null && e.getCustomerId().isNullUid()) { e.setCustomerId(null); } } @Override public EntityType getEntityType() { return EntityType.ENTITY_VIEW; } }
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\sync\ie\importing\impl\EntityViewImportService.java
2
请完成以下Java代码
public class X_MSV3_Bestellung extends org.compiere.model.PO implements I_MSV3_Bestellung, org.compiere.model.I_Persistent { /** * */ private static final long serialVersionUID = -403113319L; /** Standard Constructor */ public X_MSV3_Bestellung (Properties ctx, int MSV3_Bestellung_ID, String trxName) { super (ctx, MSV3_Bestellung_ID, trxName); /** if (MSV3_Bestellung_ID == 0) { setMSV3_BestellSupportId (0); setMSV3_Bestellung_ID (0); } */ } /** Load Constructor */ public X_MSV3_Bestellung (Properties ctx, ResultSet rs, String trxName) { super (ctx, rs, trxName); } /** Load Meta Data */ @Override protected org.compiere.model.POInfo initPO (Properties ctx) { org.compiere.model.POInfo poi = org.compiere.model.POInfo.getPOInfo (ctx, Table_Name, get_TrxName()); return poi; } /** Set BestellSupportId. @param MSV3_BestellSupportId BestellSupportId */ @Override public void setMSV3_BestellSupportId (int MSV3_BestellSupportId) { set_Value (COLUMNNAME_MSV3_BestellSupportId, Integer.valueOf(MSV3_BestellSupportId)); } /** Get BestellSupportId. @return BestellSupportId */ @Override public int getMSV3_BestellSupportId () { Integer ii = (Integer)get_Value(COLUMNNAME_MSV3_BestellSupportId); if (ii == null) return 0; return ii.intValue(); }
/** Set MSV3_Bestellung. @param MSV3_Bestellung_ID MSV3_Bestellung */ @Override public void setMSV3_Bestellung_ID (int MSV3_Bestellung_ID) { if (MSV3_Bestellung_ID < 1) set_ValueNoCheck (COLUMNNAME_MSV3_Bestellung_ID, null); else set_ValueNoCheck (COLUMNNAME_MSV3_Bestellung_ID, Integer.valueOf(MSV3_Bestellung_ID)); } /** Get MSV3_Bestellung. @return MSV3_Bestellung */ @Override public int getMSV3_Bestellung_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_MSV3_Bestellung_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Id. @param MSV3_Id Id */ @Override public void setMSV3_Id (java.lang.String MSV3_Id) { set_Value (COLUMNNAME_MSV3_Id, MSV3_Id); } /** Get Id. @return Id */ @Override public java.lang.String getMSV3_Id () { return (java.lang.String)get_Value(COLUMNNAME_MSV3_Id); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.vendor.gateway.msv3\src\main\java-gen\de\metas\vertical\pharma\vendor\gateway\msv3\model\X_MSV3_Bestellung.java
1
请在Spring Boot框架中完成以下Java代码
public class SpringBootProcessApplication extends SpringProcessApplication { @Bean public static CamundaDeploymentConfiguration deploymentConfiguration() { return new CamundaDeploymentConfiguration() { @Override public Set<Resource> getDeploymentResources() { return Collections.emptySet(); } @Override public void preInit(ProcessEngineConfigurationImpl configuration) { LOG.skipAutoDeployment(); } @Override public String toString() { return "disableDeploymentResourcePattern"; } }; } @Value("${spring.application.name:null}") protected Optional<String> springApplicationName; protected String contextPath = "/"; @Autowired protected CamundaBpmProperties camundaBpmProperties; @Autowired protected ProcessEngine processEngine; @Autowired protected ApplicationEventPublisher eventPublisher; @Override public void afterPropertiesSet() throws Exception { processApplicationNameFromAnnotation(applicationContext) .apply(springApplicationName) .ifPresent(this::setBeanName); if (camundaBpmProperties.getGenerateUniqueProcessApplicationName()) { setBeanName(CamundaBpmProperties.getUniqueName(CamundaBpmProperties.UNIQUE_APPLICATION_NAME_PREFIX)); } String processEngineName = processEngine.getName(); setDefaultDeployToEngineName(processEngineName); RuntimeContainerDelegate.INSTANCE.get().registerProcessEngine(processEngine);
properties.put(PROP_SERVLET_CONTEXT_PATH, contextPath); super.afterPropertiesSet(); } @Override public void destroy() throws Exception { super.destroy(); RuntimeContainerDelegate.INSTANCE.get().unregisterProcessEngine(processEngine); } @PostDeploy public void onPostDeploy(ProcessEngine processEngine) { eventPublisher.publishEvent(new PostDeployEvent(processEngine)); } @PreUndeploy public void onPreUndeploy(ProcessEngine processEngine) { eventPublisher.publishEvent(new PreUndeployEvent(processEngine)); } @ConditionalOnWebApplication @Configuration class WebApplicationConfiguration implements ServletContextAware { @Override public void setServletContext(ServletContext servletContext) { if (!StringUtils.isEmpty(servletContext.getContextPath())) { contextPath = servletContext.getContextPath(); } } } }
repos\camunda-bpm-platform-master\spring-boot-starter\starter\src\main\java\org\camunda\bpm\spring\boot\starter\SpringBootProcessApplication.java
2
请完成以下Java代码
public class GenConfig { /** * 请求参数 */ private TableRequest request; /** * 包名 */ private String packageName; /** * 作者 */ private String author; /** * 模块名称
*/ private String moduleName; /** * 表前缀 */ private String tablePrefix; /** * 表名称 */ private String tableName; /** * 表备注 */ private String comments; }
repos\spring-boot-demo-master\demo-codegen\src\main\java\com\xkcoding\codegen\entity\GenConfig.java
1
请完成以下Java代码
public int getLockTimeInMillis() { return lockTimeInMillis; } public void setLockTimeInMillis(int lockTimeInMillis) { this.lockTimeInMillis = lockTimeInMillis; } public String getLockOwner() { return lockOwner; } public void setLockOwner(String lockOwner) { this.lockOwner = lockOwner; } public boolean isAutoActivate() { return isAutoActivate; } public void setProcessEngines(List<ProcessEngineImpl> processEngines) { this.processEngines = processEngines; } public void setAutoActivate(boolean isAutoActivate) { this.isAutoActivate = isAutoActivate; } public int getMaxJobsPerAcquisition() { return maxJobsPerAcquisition; } public void setMaxJobsPerAcquisition(int maxJobsPerAcquisition) { this.maxJobsPerAcquisition = maxJobsPerAcquisition; } public float getWaitIncreaseFactor() { return waitIncreaseFactor; } public void setWaitIncreaseFactor(float waitIncreaseFactor) { this.waitIncreaseFactor = waitIncreaseFactor; } public long getMaxWait() { return maxWait; } public void setMaxWait(long maxWait) { this.maxWait = maxWait; } public long getMaxBackoff() { return maxBackoff; } public void setMaxBackoff(long maxBackoff) { this.maxBackoff = maxBackoff; } public int getBackoffDecreaseThreshold() { return backoffDecreaseThreshold;
} public void setBackoffDecreaseThreshold(int backoffDecreaseThreshold) { this.backoffDecreaseThreshold = backoffDecreaseThreshold; } public String getName() { return name; } public Command<AcquiredJobs> getAcquireJobsCmd(int numJobs) { return acquireJobsCmdFactory.getCommand(numJobs); } public AcquireJobsCommandFactory getAcquireJobsCmdFactory() { return acquireJobsCmdFactory; } public void setAcquireJobsCmdFactory(AcquireJobsCommandFactory acquireJobsCmdFactory) { this.acquireJobsCmdFactory = acquireJobsCmdFactory; } public boolean isActive() { return isActive; } public RejectedJobsHandler getRejectedJobsHandler() { return rejectedJobsHandler; } public void setRejectedJobsHandler(RejectedJobsHandler rejectedJobsHandler) { this.rejectedJobsHandler = rejectedJobsHandler; } protected void startJobAcquisitionThread() { if (jobAcquisitionThread == null) { jobAcquisitionThread = new Thread(acquireJobsRunnable, getName()); jobAcquisitionThread.start(); } } protected void stopJobAcquisitionThread() { try { jobAcquisitionThread.join(); } catch (InterruptedException e) { LOG.interruptedWhileShuttingDownjobExecutor(e); } jobAcquisitionThread = null; } public AcquireJobsRunnable getAcquireJobsRunnable() { return acquireJobsRunnable; } public Runnable getExecuteJobsRunnable(List<String> jobIds, ProcessEngineImpl processEngine) { return new ExecuteJobsRunnable(jobIds, processEngine); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\jobexecutor\JobExecutor.java
1
请完成以下Java代码
public boolean hasDepartment() { return fieldSetFlags()[3]; } /** * Clears the value of the 'department' field. * @return This builder. */ public com.baeldung.schema.Employee.Builder clearDepartment() { department = null; fieldSetFlags()[3] = false; return this; } /** * Gets the value of the 'designation' field. * @return The value. */ public java.lang.CharSequence getDesignation() { return designation; } /** * Sets the value of the 'designation' field. * @param value The value of 'designation'. * @return This builder. */ public com.baeldung.schema.Employee.Builder setDesignation(java.lang.CharSequence value) { validate(fields()[4], value); this.designation = value; fieldSetFlags()[4] = true; return this; } /** * Checks whether the 'designation' field has been set. * @return True if the 'designation' field has been set, false otherwise. */ public boolean hasDesignation() { return fieldSetFlags()[4]; } /** * Clears the value of the 'designation' field. * @return This builder. */ public com.baeldung.schema.Employee.Builder clearDesignation() { designation = null; fieldSetFlags()[4] = false; return this; } @Override @SuppressWarnings("unchecked")
public Employee build() { try { Employee record = new Employee(); record.id = fieldSetFlags()[0] ? this.id : (java.lang.Integer) defaultValue(fields()[0]); record.firstName = fieldSetFlags()[1] ? this.firstName : (java.lang.CharSequence) defaultValue(fields()[1]); record.lastName = fieldSetFlags()[2] ? this.lastName : (java.lang.CharSequence) defaultValue(fields()[2]); record.department = fieldSetFlags()[3] ? this.department : (java.lang.CharSequence) defaultValue(fields()[3]); record.designation = fieldSetFlags()[4] ? this.designation : (java.lang.CharSequence) defaultValue(fields()[4]); return record; } catch (java.lang.Exception e) { throw new org.apache.avro.AvroRuntimeException(e); } } } @SuppressWarnings("unchecked") private static final org.apache.avro.io.DatumWriter<Employee> WRITER$ = (org.apache.avro.io.DatumWriter<Employee>)MODEL$.createDatumWriter(SCHEMA$); @Override public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException { WRITER$.write(this, SpecificData.getEncoder(out)); } @SuppressWarnings("unchecked") private static final org.apache.avro.io.DatumReader<Employee> READER$ = (org.apache.avro.io.DatumReader<Employee>)MODEL$.createDatumReader(SCHEMA$); @Override public void readExternal(java.io.ObjectInput in) throws java.io.IOException { READER$.read(this, SpecificData.getDecoder(in)); } }
repos\tutorials-master\spring-cloud-modules\spring-cloud-stream\spring-cloud-stream-kafka\src\main\java\com\baeldung\schema\Employee.java
1
请完成以下Java代码
public class UserDto extends BaseDTO implements Serializable { @ApiModelProperty(value = "ID") private Long id; @ApiModelProperty(value = "角色") private Set<RoleSmallDto> roles; @ApiModelProperty(value = "岗位") private Set<JobSmallDto> jobs; @ApiModelProperty(value = "部门") private DeptSmallDto dept; @ApiModelProperty(value = "部门ID") private Long deptId; @ApiModelProperty(value = "用户名") private String username; @ApiModelProperty(value = "昵称") private String nickName; @ApiModelProperty(value = "邮箱") private String email; @ApiModelProperty(value = "电话") private String phone;
@ApiModelProperty(value = "性别") private String gender; @ApiModelProperty(value = "头像") private String avatarName; @ApiModelProperty(value = "头像路径") private String avatarPath; @ApiModelProperty(value = "密码") private String password; @ApiModelProperty(value = "是否启用") private Boolean enabled; @ApiModelProperty(value = "管理员") @JSONField(serialize = false) private Boolean isAdmin = false; @ApiModelProperty(value = "密码重置时间") private Date pwdResetTime; }
repos\eladmin-master\eladmin-system\src\main\java\me\zhengjie\modules\system\service\dto\UserDto.java
1
请完成以下Java代码
public void setBcc(List<String> bcc) { this.bcc = bcc; } public class Credential { @NotNull private String userName; @Size(max= 15, min=6) private String password; 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; } } }
repos\SpringBoot-Projects-FullStack-master\Part-1 Spring Boot Basic Fund Projects\SpringBootSourceCode\SpringEmailProcess\src\main\java\spring\basic\MailProperties.java
1
请完成以下Java代码
public class VerifyAllEqualListElements { public boolean verifyAllEqualUsingALoop(List<String> list) { for (String s : list) { if (!s.equals(list.get(0))) return false; } return true; } public boolean verifyAllEqualUsingHashSet(List<String> list) { return new HashSet<String>(list).size() <= 1; } public boolean verifyAllEqualUsingFrequency(List<String> list) { return list.isEmpty() || Collections.frequency(list, list.get(0)) == list.size(); } public boolean verifyAllEqualUsingStream(List<String> list) { return list.stream() .distinct() .count() <= 1; } public boolean verifyAllEqualAnotherUsingStream(List<String> list) { return list.isEmpty() || list.stream()
.allMatch(list.get(0)::equals); } public boolean verifyAllEqualUsingGuava(List<String> list) { return Iterables.all(list, new Predicate<String>() { public boolean apply(String s) { return s.equals(list.get(0)); } }); } public boolean verifyAllEqualUsingApacheCommon(List<String> list) { return IterableUtils.matchesAll(list, new org.apache.commons.collections4.Predicate<String>() { public boolean evaluate(String s) { return s.equals(list.get(0)); } }); } }
repos\tutorials-master\core-java-modules\core-java-collections-list-3\src\main\java\com\baeldung\allequalelements\VerifyAllEqualListElements.java
1
请完成以下Java代码
public final boolean isRunning() { return running; } @Override public void execute() { running = true; try { execute0(); } finally { running = false; } } private void execute0() { final int countEnqueued = PMM_GenerateOrders.prepareEnqueuing() .filter(gridTab.createCurrentRecordsQueryFilter(I_PMM_PurchaseCandidate.class)) .confirmRecordsToProcess(this::confirmRecordsToProcess) .enqueue(); // // Refresh rows, because they were updated if (countEnqueued > 0) { gridTab.dataRefreshAll();
} // // Inform the user clientUI.info(windowNo, "Updated", "#" + countEnqueued); } private final boolean confirmRecordsToProcess(final int countToProcess) { return clientUI.ask() .setParentWindowNo(windowNo) .setAdditionalMessage(msgBL.getMsg(Env.getCtx(), MSG_DoYouWantToUpdate_1P, new Object[] { countToProcess })) .setDefaultAnswer(false) .getAnswer(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java\de\metas\procurement\base\order\callout\PMM_CreatePurchaseOrders_Action.java
1
请完成以下Java代码
public AmountAndDirection35 getTtlNetNtry() { return ttlNetNtry; } /** * Sets the value of the ttlNetNtry property. * * @param value * allowed object is * {@link AmountAndDirection35 } * */ public void setTtlNetNtry(AmountAndDirection35 value) { this.ttlNetNtry = value; } /** * Gets the value of the fcstInd property. * * @return * possible object is * {@link Boolean } * */ public Boolean isFcstInd() { return fcstInd; } /** * Sets the value of the fcstInd property. * * @param value * allowed object is * {@link Boolean } * */ public void setFcstInd(Boolean value) { this.fcstInd = value; } /** * Gets the value of the bkTxCd property. * * @return * possible object is * {@link BankTransactionCodeStructure4 } * */ public BankTransactionCodeStructure4 getBkTxCd() { return bkTxCd; } /** * Sets the value of the bkTxCd property. * * @param value
* allowed object is * {@link BankTransactionCodeStructure4 } * */ public void setBkTxCd(BankTransactionCodeStructure4 value) { this.bkTxCd = value; } /** * Gets the value of the avlbty property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the avlbty property. * * <p> * For example, to add a new item, do as follows: * <pre> * getAvlbty().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link CashBalanceAvailability2 } * * */ public List<CashBalanceAvailability2> getAvlbty() { if (avlbty == null) { avlbty = new ArrayList<CashBalanceAvailability2>(); } return this.avlbty; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_04\TotalsPerBankTransactionCode3.java
1
请完成以下Java代码
private Optional<HUReservationEntry> retrieveEntryByVhuId(@NonNull final HuId vhuId) { return queryBL.createQueryBuilder(I_M_HU_Reservation.class) .addOnlyActiveRecordsFilter() .addEqualsFilter(I_M_HU_Reservation.COLUMN_VHU_ID, vhuId) // we have a UC constraint on VHU_ID .create() .firstOnlyOptional(I_M_HU_Reservation.class) .map(HUReservationRepository::toHUReservationEntry); } private static HUReservationDocRef extractDocumentRef(@NonNull final I_M_HU_Reservation record) { return HUReservationDocRef.builder() .salesOrderLineId(OrderLineId.ofRepoIdOrNull(record.getC_OrderLineSO_ID())) .projectId(ProjectId.ofRepoIdOrNull(record.getC_Project_ID())) .pickingJobStepId(PickingJobStepId.ofRepoIdOrNull(record.getM_Picking_Job_Step_ID())) .ddOrderLineId(DDOrderLineId.ofRepoIdOrNull(record.getDD_OrderLine_ID())) .build(); } public void transferReservation( @NonNull final Collection<HUReservationDocRef> from, @NonNull final HUReservationDocRef to, @NonNull final Set<HuId> onlyVHUIds) { if (from.size() == 1 && Objects.equals(from.iterator().next(), to)) {
return; } final List<I_M_HU_Reservation> records = retrieveRecordsByDocumentRef(from, onlyVHUIds); if (records.isEmpty()) { return; } for (final I_M_HU_Reservation record : records) { updateRecordFromDocumentRef(record, to); saveRecord(record); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\reservation\HUReservationRepository.java
1
请完成以下Java代码
public static void main(String[] args) { try { TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); KeyStore trustStore = KeyStore.getInstance(JKS); char[] ksPwd = new char[]{0x63, 0x6C, 0x69, 0x65, 0x6E, 0x74, 0x5F, 0x6B, 0x73, 0x5F, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6F, 0x72, 0x64}; trustStore.load(ResourceUtils.getInputStream(MqttSslClient.class.getClassLoader(), KEY_STORE_FILE), ksPwd); tmf.init(trustStore); KeyStore ks = KeyStore.getInstance(JKS); ks.load(ResourceUtils.getInputStream(MqttSslClient.class.getClassLoader(), KEY_STORE_FILE), ksPwd); KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); char[] clientPwd = new char[]{0x63, 0x6C, 0x69, 0x65, 0x6E, 0x74, 0x5F, 0x6B, 0x65, 0x79, 0x5F, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6F, 0x72, 0x64}; kmf.init(ks, clientPwd); KeyManager[] km = kmf.getKeyManagers(); TrustManager[] tm = tmf.getTrustManagers(); SSLContext sslContext = SSLContext.getInstance(TLS);
sslContext.init(km, tm, null); MqttConnectOptions options = new MqttConnectOptions(); options.setSocketFactory(sslContext.getSocketFactory()); MqttAsyncClient client = new MqttAsyncClient(MQTT_URL, CLIENT_ID, new MemoryPersistence()); client.connect(options); Thread.sleep(3000); MqttMessage message = new MqttMessage(); message.setPayload("{\"key1\":\"value1\", \"key2\":true, \"key3\": 3.0, \"key4\": 4}".getBytes()); client.publish("v1/devices/me/telemetry", message); client.disconnect(); log.info("Disconnected"); System.exit(0); } catch (Exception e) { log.error("Unexpected exception occurred in MqttSslClient", e); } } }
repos\thingsboard-master\tools\src\main\java\org\thingsboard\client\tools\MqttSslClient.java
1
请在Spring Boot框架中完成以下Java代码
public JAXBElement<UnitType> createWidth(UnitType value) { return new JAXBElement<UnitType>(_Width_QNAME, UnitType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >} * * @param value * Java instance representing xml element's value. * @return * the new instance of {@link JAXBElement }{@code <}{@link String }{@code >} */ @XmlElementDecl(namespace = "http://erpel.at/schemas/1p0/documents/extensions/edifact", name = "ZIP") public JAXBElement<String> createZIP(String value) { return new JAXBElement<String>(_ZIP_QNAME, String.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >} * * @param value * Java instance representing xml element's value. * @return
* the new instance of {@link JAXBElement }{@code <}{@link String }{@code >} */ @XmlElementDecl(namespace = "http://erpel.at/schemas/1p0/documents/extensions/edifact", name = "PointOfSales", scope = SLSRPTExtensionType.class) public JAXBElement<String> createSLSRPTExtensionTypePointOfSales(String value) { return new JAXBElement<String>(_SLSRPTExtensionTypePointOfSales_QNAME, String.class, SLSRPTExtensionType.class, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link XMLGregorianCalendar }{@code >} * * @param value * Java instance representing xml element's value. * @return * the new instance of {@link JAXBElement }{@code <}{@link XMLGregorianCalendar }{@code >} */ @XmlElementDecl(namespace = "http://erpel.at/schemas/1p0/documents/extensions/edifact", name = "SalesDate", scope = SLSRPTExtensionType.class) public JAXBElement<XMLGregorianCalendar> createSLSRPTExtensionTypeSalesDate(XMLGregorianCalendar value) { return new JAXBElement<XMLGregorianCalendar>(_SLSRPTExtensionTypeSalesDate_QNAME, XMLGregorianCalendar.class, SLSRPTExtensionType.class, value); } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\extensions\edifact\ObjectFactory.java
2
请完成以下Spring Boot application配置
server.port=8001 logging.level.root=info spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/world?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false spring.datasource.username=root spring.datasource.password=123456 # 下面为连接池的补充设置,应用到上面所有数据源中 # 初始化大小,最小,最大 spring.datasource.initialSize=5 spring.datasource.minIdle=5 spring.datasource.maxActive=20 # 配置获取连接等待超时的时间 spring.datasource.maxWait=60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 spring.datasource.timeBetweenEvictionRunsMillis=60000 # 配置一个连接在池中最小生存的时间,单位是毫秒 spring.datasource.minEvictableIdleTimeMillis=300000 spring.datasour
ce.validationQuery=SELECT 1 FROM DUAL spring.datasource.testWhileIdle=true spring.datasource.testOnBorrow=false spring.datasource.testOnReturn=false # 打开PSCache,并且指定每个连接上PSCache的大小 spring.datasource.poolPreparedStatements=true spring.datasource.maxPoolPreparedStatementPerConnectionSize=20
repos\spring-boot-quick-master\quick-modules\service1\src\main\resources\application.properties
2
请在Spring Boot框架中完成以下Java代码
public class DocBaseAndSubType { public static DocBaseAndSubType of(@NonNull final DocBaseType docBaseType) { return interner.intern(new DocBaseAndSubType(docBaseType, DocSubType.ANY)); } public static DocBaseAndSubType of(@NonNull final String docBaseType, @Nullable final String docSubType) { return interner.intern(new DocBaseAndSubType(DocBaseType.ofCode(docBaseType), DocSubType.ofNullableCode(docSubType))); } public static DocBaseAndSubType of(@NonNull final DocBaseType docBaseType, @Nullable final String docSubType) { return interner.intern(new DocBaseAndSubType(docBaseType, DocSubType.ofNullableCode(docSubType))); } public static DocBaseAndSubType of(@NonNull final DocBaseType docBaseType, @NonNull final DocSubType docSubType) { return interner.intern(new DocBaseAndSubType(docBaseType, docSubType)); } @Nullable public static DocBaseAndSubType ofNullable( @Nullable final String docBaseType, @Nullable final String docSubType) { final String docBaseTypeNorm = StringUtils.trimBlankToNull(docBaseType); return docBaseTypeNorm != null ? of(docBaseTypeNorm, docSubType) : null; } private static final Interner<DocBaseAndSubType> interner = Interners.newStrongInterner(); @NonNull DocBaseType docBaseType; @NonNull DocSubType docSubType; private DocBaseAndSubType( @NonNull final DocBaseType docBaseType, @NonNull final DocSubType docSubType) { this.docBaseType = docBaseType; this.docSubType = docSubType;
} // DocBaseAndSubTypeChecks public boolean isSalesInvoice() {return docBaseType.isSalesInvoice() && docSubType.isNone();} public boolean isPrepaySO() {return docBaseType.isSalesOrder() && docSubType.isPrepay();} public boolean isCallOrder() {return (docBaseType.isSalesOrder() || docBaseType.isPurchaseOrder()) && docSubType.isCallOrder();} public boolean isFrameAgreement() { return ( docBaseType.isSalesOrder() || docBaseType.isPurchaseOrder() ) && docSubType.isFrameAgreement(); } public boolean isMediated() {return (docBaseType.isPurchaseOrder()) && docSubType.isMediated();} public boolean isRequisition() {return (docBaseType.isPurchaseOrder()) && docSubType.isRequisition();} }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\document\DocBaseAndSubType.java
2
请完成以下Java代码
protected void resetListeners(T execution) { execution.setListenerIndex(0); execution.setEventName(null); execution.setEventSource(null); } protected List<DelegateListener<? extends BaseDelegateExecution>> getListeners(CoreModelElement scope, T execution) { if(execution.isSkipCustomListeners()) { return getBuiltinListeners(scope); } else { return scope.getListeners(getEventName()); } } protected List<DelegateListener<? extends BaseDelegateExecution>> getBuiltinListeners(CoreModelElement scope) { return scope.getBuiltInListeners(getEventName()); } protected boolean isSkipNotifyListeners(T execution) {
return false; } protected T eventNotificationsStarted(T execution) { // do nothing return execution; } protected abstract CoreModelElement getScope(T execution); protected abstract String getEventName(); protected abstract void eventNotificationsCompleted(T execution); protected void eventNotificationsFailed(T execution, Exception exception) { if (exception instanceof RuntimeException) { throw (RuntimeException) exception; } else { throw new PvmException("couldn't execute event listener : " + exception.getMessage(), exception); } } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\core\operation\AbstractEventAtomicOperation.java
1
请完成以下Java代码
public String toString() { // NOTE: this is used in list/combo/table renderers return name; } @Override public int hashCode() { return id.hashCode(); } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } final PaymentBatch other = EqualsBuilder.getOther(this, obj); if (other == null) { return false; } return new EqualsBuilder() .append(id, other.id) .isEqual(); } @Override public String getId() { return id; } @Override public Date getDate() { return date; } @Override public ITableRecordReference getRecord() { return record; } public static final class Builder { private String id; private String name; private Date date; private ITableRecordReference record; private IPaymentBatchProvider paymentBatchProvider; private Builder() { super(); } public PaymentBatch build() { return new PaymentBatch(this); } public Builder setId(final String id) { this.id = id; return this; } private String getId() { if (id != null) { return id; } if (record != null) { return record.getTableName() + "#" + record.getRecord_ID(); } throw new IllegalStateException("id is null"); } public Builder setName(final String name) { this.name = name; return this; } private String getName() { if (name != null) { return name; }
if (record != null) { return Services.get(IMsgBL.class).translate(Env.getCtx(), record.getTableName()) + " #" + record.getRecord_ID(); } return ""; } public Builder setDate(final Date date) { this.date = date; return this; } private Date getDate() { if (date == null) { return null; } return (Date)date.clone(); } public Builder setRecord(final Object record) { this.record = TableRecordReference.of(record); return this; } private ITableRecordReference getRecord() { return record; } public Builder setPaymentBatchProvider(IPaymentBatchProvider paymentBatchProvider) { this.paymentBatchProvider = paymentBatchProvider; return this; } private IPaymentBatchProvider getPaymentBatchProvider() { return paymentBatchProvider; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.base\src\main\java\de\metas\banking\bankstatement\match\spi\PaymentBatch.java
1
请完成以下Java代码
public class StartProcessInterceptor implements Serializable { private static final long serialVersionUID = 1L; @Inject BusinessProcess businessProcess; @AroundInvoke public Object invoke(InvocationContext ctx) throws Exception { try { Object result = ctx.proceed(); StartProcess startProcessAnnotation = ctx.getMethod().getAnnotation(StartProcess.class); String key = startProcessAnnotation.value(); Map<String, Object> variables = extractVariables(startProcessAnnotation, ctx); businessProcess.startProcessByKey(key, variables); return result; } catch (InvocationTargetException e) { Throwable cause = e.getCause(); if(cause != null && cause instanceof Exception) { throw (Exception) cause; } else { throw e; } } catch (Exception e) { throw new ProcessEngineException("Error while starting process using @StartProcess on method '"+ctx.getMethod()+"': " + e.getMessage(), e); } } private Map<String, Object> extractVariables(StartProcess startProcessAnnotation, InvocationContext ctx) throws Exception { VariableMap variables = new VariableMapImpl();
for (Field field : ctx.getMethod().getDeclaringClass().getDeclaredFields()) { if (!field.isAnnotationPresent(ProcessVariable.class) && !field.isAnnotationPresent(ProcessVariableTyped.class)) { continue; } field.setAccessible(true); String fieldName = null; ProcessVariable processStartVariable = field.getAnnotation(ProcessVariable.class); if (processStartVariable != null) { fieldName = processStartVariable.value(); } else { ProcessVariableTyped processStartVariableTyped = field.getAnnotation(ProcessVariableTyped.class); fieldName = processStartVariableTyped.value(); } if (fieldName == null || fieldName.length() == 0) { fieldName = field.getName(); } Object value = field.get(ctx.getTarget()); variables.put(fieldName, value); } return variables; } }
repos\camunda-bpm-platform-master\engine-cdi\core\src\main\java\org\camunda\bpm\engine\cdi\impl\annotation\StartProcessInterceptor.java
1
请完成以下Java代码
public org.compiere.model.I_AD_ImpFormat getAD_ImpFormat() { return get_ValueAsPO(COLUMNNAME_AD_ImpFormat_ID, org.compiere.model.I_AD_ImpFormat.class); } @Override public void setAD_ImpFormat(final org.compiere.model.I_AD_ImpFormat AD_ImpFormat) { set_ValueFromPO(COLUMNNAME_AD_ImpFormat_ID, org.compiere.model.I_AD_ImpFormat.class, AD_ImpFormat); } @Override public void setAD_ImpFormat_ID (final int AD_ImpFormat_ID) { if (AD_ImpFormat_ID < 1) set_Value (COLUMNNAME_AD_ImpFormat_ID, null); else set_Value (COLUMNNAME_AD_ImpFormat_ID, AD_ImpFormat_ID); } @Override public int getAD_ImpFormat_ID() { return get_ValueAsInt(COLUMNNAME_AD_ImpFormat_ID); } @Override public void setC_DataImport_ID (final int C_DataImport_ID) { if (C_DataImport_ID < 1) set_ValueNoCheck (COLUMNNAME_C_DataImport_ID, null); else set_ValueNoCheck (COLUMNNAME_C_DataImport_ID, C_DataImport_ID); } @Override public int getC_DataImport_ID() { return get_ValueAsInt(COLUMNNAME_C_DataImport_ID); } /** * DataImport_ConfigType AD_Reference_ID=541535 * Reference name: C_DataImport_ConfigType */ public static final int DATAIMPORT_CONFIGTYPE_AD_Reference_ID=541535;
/** Standard = S */ public static final String DATAIMPORT_CONFIGTYPE_Standard = "S"; /** Bank Statement Import = BSI */ public static final String DATAIMPORT_CONFIGTYPE_BankStatementImport = "BSI"; @Override public void setDataImport_ConfigType (final java.lang.String DataImport_ConfigType) { set_Value (COLUMNNAME_DataImport_ConfigType, DataImport_ConfigType); } @Override public java.lang.String getDataImport_ConfigType() { return get_ValueAsString(COLUMNNAME_DataImport_ConfigType); } @Override public void setInternalName (final @Nullable java.lang.String InternalName) { set_Value (COLUMNNAME_InternalName, InternalName); } @Override public java.lang.String getInternalName() { return get_ValueAsString(COLUMNNAME_InternalName); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_DataImport.java
1
请在Spring Boot框架中完成以下Java代码
private boolean isEnabled(Environment environment) { return environment.getProperty(SECURITY_SSL_ENVIRONMENT_POST_PROCESSOR_ENABLED_PROPERTY, Boolean.class, true); } private void configureSsl(ConfigurableEnvironment environment, String trustedKeyStore) { Properties gemfireSslProperties = new Properties(); gemfireSslProperties.setProperty(SECURITY_SSL_KEYSTORE_PROPERTY, trustedKeyStore); gemfireSslProperties.setProperty(SECURITY_SSL_TRUSTSTORE_PROPERTY, trustedKeyStore); environment.getPropertySources() .addFirst(newPropertySource(GEMFIRE_SSL_PROPERTY_SOURCE_NAME, gemfireSslProperties)); } } static class EnableSslCondition extends AllNestedConditions { public EnableSslCondition() { super(ConfigurationPhase.PARSE_CONFIGURATION); } @ConditionalOnProperty(name = SECURITY_SSL_ENVIRONMENT_POST_PROCESSOR_ENABLED_PROPERTY, havingValue = "true", matchIfMissing = true) static class SpringBootDataGemFireSecuritySslEnvironmentPostProcessorEnabled { } @Conditional(SslTriggersCondition.class) static class AnySslTriggerCondition { } } static class SslTriggersCondition extends AnyNestedCondition {
public SslTriggersCondition() { super(ConfigurationPhase.PARSE_CONFIGURATION); } @Conditional(TrustedKeyStoreIsPresentCondition.class) static class TrustedKeyStoreCondition { } @ConditionalOnProperty(prefix = SECURITY_SSL_PROPERTY_PREFIX, name = { "keystore", "truststore" }) static class SpringDataGemFireSecuritySslKeyStoreAndTruststorePropertiesSet { } @ConditionalOnProperty(SECURITY_SSL_USE_DEFAULT_CONTEXT) static class SpringDataGeodeSslUseDefaultContextPropertySet { } @ConditionalOnProperty({ GEMFIRE_SSL_KEYSTORE_PROPERTY, GEMFIRE_SSL_TRUSTSTORE_PROPERTY }) static class ApacheGeodeSslKeyStoreAndTruststorePropertiesSet { } } static class TrustedKeyStoreIsPresentCondition implements Condition { @Override public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { Environment environment = context.getEnvironment(); return locateKeyStoreInClassPath(environment).isPresent() || locateKeyStoreInFileSystem(environment).isPresent() || locateKeyStoreInUserHome(environment).isPresent(); } } }
repos\spring-boot-data-geode-main\spring-geode-project\spring-geode-autoconfigure\src\main\java\org\springframework\geode\boot\autoconfigure\SslAutoConfiguration.java
2
请完成以下Java代码
public class JsonErrors { public static JsonErrorItem ofThrowable( @NonNull final Throwable throwable, @NonNull final String adLanguage) { return ofThrowable(throwable, adLanguage, null); } public static JsonErrorItem ofThrowable( @NonNull final Throwable throwable, @NonNull final String adLanguage, @Nullable final ITranslatableString detail) { final Throwable cause = AdempiereException.extractCause(throwable); JsonMetasfreshId adIssueId = null; String issueCategory = null; for(Throwable currentException = throwable; currentException != null; currentException = currentException.getCause()) { // Stop if we found what we are looking for if(adIssueId != null && issueCategory != null) { break; } else if (currentException instanceof AdempiereException) { final AdempiereException metasfreshException = (AdempiereException)currentException; if(adIssueId == null && metasfreshException.getAdIssueId() != null) { adIssueId = JsonMetasfreshId.of(metasfreshException.getAdIssueId().getRepoId()); } if(issueCategory == null) { issueCategory = metasfreshException.getIssueCategory().toString(); } } } final JsonErrorItemBuilder builder = JsonErrorItem.builder() .message(AdempiereException.extractMessageTrl(cause).translate(adLanguage)) .errorCode(AdempiereException.extractErrorCodeOrNull(cause)) .userFriendlyError(AdempiereException.isUserValidationError(cause)) .stackTrace(Trace.toOneLineStackTraceString(cause.getStackTrace())) .adIssueId(adIssueId) .issueCategory(issueCategory) .parameters(extractParameters(throwable, adLanguage)) .errorCode(AdempiereException.extractErrorCodeOrNull(throwable))
.throwable(throwable); if (detail != null) { builder.detail(detail.translate(adLanguage)); } return builder.build(); } private static Map<String, String> extractParameters(@NonNull final Throwable throwable, @NonNull final String adLanguage) { return AdempiereException.extractParameters(throwable) .entrySet() .stream() .map(e -> GuavaCollectors.entry(e.getKey(), convertParameterToJson(e.getValue(), adLanguage))) .collect(GuavaCollectors.toImmutableMap()); } @NonNull private static String convertParameterToJson(final Object value, final String adLanguage) { if (Null.isNull(value)) { return "<null>"; } else if (value instanceof ITranslatableString) { return ((ITranslatableString)value).translate(adLanguage); } else if (value instanceof RepoIdAware) { return String.valueOf(((RepoIdAware)value).getRepoId()); } else if (value instanceof ReferenceListAwareEnum) { return ((ReferenceListAwareEnum)value).getCode(); } else { return value.toString(); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.util.web\src\main\java\de\metas\rest_api\utils\JsonErrors.java
1
请完成以下Java代码
public ScriptEngineRequest build() { if (script == null || script.isEmpty()) { throw new FlowableIllegalStateException("A script is required"); } return new ScriptEngineRequest(script, language, scopeContainer, inputVariableContainer != null ? inputVariableContainer : scopeContainer, storeScriptVariables, additionalResolvers, traceEnhancer); } } private ScriptEngineRequest(String script, String language, VariableContainer scopeContainer, VariableContainer inputVariableContainer, boolean storeScriptVariables, List<Resolver> additionalResolvers, ScriptTraceEnhancer errorTraceEnhancer) { this.script = script; this.language = language; this.scopeContainer = scopeContainer; this.inputVariableContainer = inputVariableContainer; this.storeScriptVariables = storeScriptVariables; this.additionalResolvers = additionalResolvers; this.traceEnhancer = errorTraceEnhancer; } /** * @see Builder#(String) */ public String getLanguage() { return language; } /** * @see Builder#(String) */ public String getScript() { return script; } /** * @see Builder#scopeContainer(VariableContainer) */ public VariableContainer getScopeContainer() { return scopeContainer; } /** * @see Builder#inputVariableContainer(VariableContainer) */ public VariableContainer getInputVariableContainer() { return inputVariableContainer;
} /** * @see Builder#storeScriptVariables */ public boolean isStoreScriptVariables() { return storeScriptVariables; } /** * @see Builder#additionalResolver(Resolver) */ public List<Resolver> getAdditionalResolvers() { return additionalResolvers; } /** * @see Builder#traceEnhancer(ScriptTraceEnhancer) */ public ScriptTraceEnhancer getTraceEnhancer() { return traceEnhancer; } @Override public String toString() { return new StringJoiner(", ", ScriptEngineRequest.class.getSimpleName() + "[", "]") .add("language='" + language + "'") .add("script='" + script + "'") .add("variableContainer=" + scopeContainer) .add("storeScriptVariables=" + storeScriptVariables) .toString(); } }
repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\scripting\ScriptEngineRequest.java
1
请在Spring Boot框架中完成以下Java代码
public class Beneficiary { public static Beneficiary ofOrNull(@Nullable final BPartnerId bPartnerId) { if (bPartnerId == null) { return null; } return Beneficiary.of(bPartnerId); } @JsonCreator public static Beneficiary of(@JsonProperty("bPartnerId") @NonNull final BPartnerId bPartnerId) { return new Beneficiary(bPartnerId); } public static int toRepoId(@Nullable final Beneficiary salesRep) { if (salesRep == null) { return 0; } return salesRep.getBPartnerId().getRepoId();
} BPartnerId bPartnerId; private Beneficiary(@NonNull final BPartnerId bPartnerId) { this.bPartnerId = bPartnerId; } @JsonProperty("bPartnerId") public BPartnerId getBPartnerId() { return bPartnerId; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\commission\Beneficiary.java
2
请完成以下Java代码
public String getStartEventId() { return startEventId; } public String getProcessInstanceName() { return processInstanceName; } public String getBusinessKey() { return businessKey; } public String getBusinessStatus() { return businessStatus; } public String getCallbackId() { return callbackId; } public String getCallbackType() { return callbackType; } public String getReferenceId() { return referenceId; } public String getReferenceType() { return referenceType; } public String getStageInstanceId() { return stageInstanceId; } public String getTenantId() { return tenantId; } public String getOverrideDefinitionTenantId() { return overrideDefinitionTenantId; } public String getPredefinedProcessInstanceId() { return predefinedProcessInstanceId; }
public String getOwnerId() { return ownerId; } public String getAssigneeId() { return assigneeId; } public Map<String, Object> getVariables() { return variables; } public Map<String, Object> getTransientVariables() { return transientVariables; } public Map<String, Object> getStartFormVariables() { return startFormVariables; } public String getOutcome() { return outcome; } public Map<String, Object> getExtraFormVariables() { return extraFormVariables; } public FormInfo getExtraFormInfo() { return extraFormInfo; } public String getExtraFormOutcome() { return extraFormOutcome; } public boolean isFallbackToDefaultTenant() { return fallbackToDefaultTenant; } }
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\runtime\ProcessInstanceBuilderImpl.java
1
请完成以下Java代码
protected String doIt() throws Exception { String whereClause = I_C_Location.COLUMNNAME_IsPostalValidated + "=?"; Iterator<I_C_Location> it = new Query(getCtx(), I_C_Location.Table_Name, whereClause, null) .setParameters(false) .setRequiredAccess(Access.WRITE) .iterate(I_C_Location.class); while (it.hasNext()) { cnt_all++; validate(it.next()); if (cnt_all % 100 == 0) { log.info("Progress: OK/Error/Total = " + cnt_ok + "/" + cnt_err + "/" + cnt_all); } } return "@Updated@ OK/Error/Total = " + cnt_ok + "/" + cnt_err + "/" + cnt_all;
} private void validate(I_C_Location location) { try { Services.get(ILocationBL.class).validatePostal(location); InterfaceWrapperHelper.save(location); cnt_ok++; } catch (Exception e) { addLog("Error on " + location + ": " + e.getLocalizedMessage()); cnt_err++; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\location\process\C_Location_Postal_Validate.java
1
请完成以下Java代码
public class HUProductStorages { private final ImmutableMap<ProductId, IHUProductStorage> byProductId; HUProductStorages(final List<IHUProductStorage> productStorages) { this.byProductId = Maps.uniqueIndex(productStorages, IProductStorage::getProductId); } @NonNull public Quantity getQty(@NonNull final ProductId productId) { return getProductStorage(productId).getQty(); }
@NotNull private IHUProductStorage getProductStorage(final @NotNull ProductId productId) { final IHUProductStorage huProductStorage = byProductId.get(productId); if (huProductStorage == null) { throw new AdempiereException("HU does not contain product") .setParameter("huProductStorages", byProductId.values()) .setParameter("productId", productId); } return huProductStorage; } public Set<ProductId> getProductIds() {return byProductId.keySet();} }
repos\metasfresh-new_dawn_uat\backend\de.metas.inventory.mobileui\src\main\java\de\metas\inventory\mobileui\deps\handlingunits\HUProductStorages.java
1
请完成以下Java代码
private Quantity getQuantityInStockingUOM(final BigDecimal qty, final int inventoryUOMId) { final Quantity quantityInStockingUOM; final I_C_UOM inventoryUOM = Services.get(IUOMDAO.class).getById(inventoryUOMId); Check.assume(inventoryUOM != null, " No Unit of measurement was found for the given Id: {}", inventoryUOMId); final I_C_UOM stockingUOM = getProductStockingUOM(); final BigDecimal qtyValueInStockingUOM = Services.get(IUOMConversionBL.class) .convertQty(getProductId(), qty, inventoryUOM, stockingUOM); quantityInStockingUOM = Quantity.of(qtyValueInStockingUOM, stockingUOM); return quantityInStockingUOM;
} @NonNull public Account getInvDifferencesAccount(final AcctSchema as, final BigDecimal amount) { final Account chargeAcct = getChargeAccount(as, amount.negate()); if (chargeAcct != null) { return chargeAcct; } return getAccountProvider().getWarehouseAccount(as.getId(), locatorId.getWarehouseId(), WarehouseAccountType.W_Differences_Acct); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java-legacy\org\compiere\acct\DocLine_Inventory.java
1
请完成以下Java代码
public static String convertDecimalToFractionUsingApacheCommonsMath(double decimal) { Fraction fraction = new Fraction(decimal); return fraction.toString(); } private static String extractRepeatingDecimal(String fractionalPart) { int length = fractionalPart.length(); for (int i = 1; i <= length / 2; i++) { String sub = fractionalPart.substring(0, i); boolean repeating = true; for (int j = i; j + i <= length; j += i) { if (!fractionalPart.substring(j, j + i) .equals(sub)) { repeating = false; break; } } if (repeating) { return sub; } } return ""; }
public static String convertDecimalToFractionUsingGCDRepeating(double decimal) { String decimalStr = String.valueOf(decimal); int indexOfDot = decimalStr.indexOf('.'); String afterDot = decimalStr.substring(indexOfDot + 1); String repeatingNumber = extractRepeatingDecimal(afterDot); if (repeatingNumber == "") { return convertDecimalToFractionUsingGCD(decimal); } else { int n = repeatingNumber.length(); int repeatingValue = Integer.parseInt(repeatingNumber); int integerPart = Integer.parseInt(decimalStr.substring(0, indexOfDot)); long denominator = (long) Math.pow(10, n) - 1; long numerator = repeatingValue + (integerPart * denominator); long gcd = gcd(numerator, denominator); numerator /= gcd; denominator /= gcd; return numerator + "/" + denominator; } } }
repos\tutorials-master\core-java-modules\core-java-numbers-8\src\main\java\com\baeldung\decimaltofraction\DecimalToFraction.java
1
请完成以下Java代码
public class ModelBuilderImpl extends ModelBuilder { private final List<ModelElementTypeBuilderImpl> typeBuilders = new ArrayList<ModelElementTypeBuilderImpl>(); private final ModelImpl model; public ModelBuilderImpl(String modelName) { model = new ModelImpl(modelName); } public ModelBuilder alternativeNamespace(String alternativeNs, String actualNs) { model.declareAlternativeNamespace(alternativeNs, actualNs); return this; } public ModelElementTypeBuilder defineType(Class<? extends ModelElementInstance> modelInstanceType, String typeName) { ModelElementTypeBuilderImpl typeBuilder = new ModelElementTypeBuilderImpl(modelInstanceType, typeName, model); typeBuilders.add(typeBuilder); return typeBuilder; } public ModelElementType defineGenericType(String typeName, String typeNamespaceUri) { ModelElementTypeBuilder typeBuilder = defineType(ModelElementInstance.class, typeName) .namespaceUri(typeNamespaceUri)
.instanceProvider(new ModelTypeInstanceProvider<ModelElementInstance>() { public ModelElementInstance newInstance(ModelTypeInstanceContext instanceContext) { return new ModelElementInstanceImpl(instanceContext); } }); return typeBuilder.build(); } public Model build() { for (ModelElementTypeBuilderImpl typeBuilder : typeBuilders) { typeBuilder.buildTypeHierarchy(model); } for (ModelElementTypeBuilderImpl typeBuilder : typeBuilders) { typeBuilder.performModelBuild(model); } return model; } }
repos\camunda-bpm-platform-master\model-api\xml-model\src\main\java\org\camunda\bpm\model\xml\impl\ModelBuilderImpl.java
1
请在Spring Boot框架中完成以下Java代码
public CategoryEntity getTopCateEntity() { return topCateEntity; } public void setTopCateEntity(CategoryEntity topCateEntity) { this.topCateEntity = topCateEntity; } public CategoryEntity getSubCategEntity() { return subCategEntity; } public void setSubCategEntity(CategoryEntity subCategEntity) { this.subCategEntity = subCategEntity; } public BrandEntity getBrandEntity() { return brandEntity; } public void setBrandEntity(BrandEntity brandEntity) { this.brandEntity = brandEntity; } public ProdStateEnum getProdStateEnum() { return prodStateEnum; } public void setProdStateEnum(ProdStateEnum prodStateEnum) { this.prodStateEnum = prodStateEnum; } public List<ProdImageEntity> getProdImageEntityList() { return prodImageEntityList; } public void setProdImageEntityList(List<ProdImageEntity> prodImageEntityList) { this.prodImageEntityList = prodImageEntityList; } public String getContent() { return content; }
public void setContent(String content) { this.content = content; } public UserEntity getCompanyEntity() { return companyEntity; } public void setCompanyEntity(UserEntity companyEntity) { this.companyEntity = companyEntity; } public int getSales() { return sales; } public void setSales(int sales) { this.sales = sales; } @Override public String toString() { return "ProductEntity{" + "id='" + id + '\'' + ", prodName='" + prodName + '\'' + ", marketPrice='" + marketPrice + '\'' + ", shopPrice='" + shopPrice + '\'' + ", stock=" + stock + ", sales=" + sales + ", weight='" + weight + '\'' + ", topCateEntity=" + topCateEntity + ", subCategEntity=" + subCategEntity + ", brandEntity=" + brandEntity + ", prodStateEnum=" + prodStateEnum + ", prodImageEntityList=" + prodImageEntityList + ", content='" + content + '\'' + ", companyEntity=" + companyEntity + '}'; } }
repos\SpringBoot-Dubbo-Docker-Jenkins-master\Gaoxi-Common-Service-Facade\src\main\java\com\gaoxi\entity\product\ProductEntity.java
2
请完成以下Java代码
public class Comment { @Id @EqualsAndHashCode.Include @Getter private final String id; @Getter @Setter private String body; @Getter @Setter private String authorId; @Getter private final Instant createdAt; @Getter @LastModifiedDate
private final Instant updatedAt; @Builder public Comment(String id, String body, String authorId, Instant createdAt, Instant updatedAt) { this.id = id; this.body = body; this.authorId = authorId; this.createdAt = ofNullable(createdAt).orElse(Instant.now()); this.updatedAt = ofNullable(updatedAt).orElse(this.createdAt); } public boolean isAuthor(User user) { return authorId.equals(user.getId()); } }
repos\realworld-spring-webflux-master\src\main\java\com\realworld\springmongo\article\Comment.java
1
请完成以下Java代码
public List<PurchaseCandidateReminder> getReminders() { assertAuth(); return reminderScheduler.getReminders(); } @PostMapping public synchronized void addReminder(@RequestBody final PurchaseCandidateReminder reminder) { assertAuth(); reminderScheduler.scheduleNotification(reminder); } @GetMapping("/nextDispatchTime") public ZonedDateTime getNextDispatchTime()
{ assertAuth(); return reminderScheduler.getNextDispatchTime(); } @PostMapping("/reinitialize") public List<PurchaseCandidateReminder> reinitialize() { assertAuth(); reminderScheduler.initialize(); return reminderScheduler.getReminders(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\purchasecandidate\reminder\PurchaseCandidateReminderSchedulerRestController.java
1
请完成以下Java代码
public boolean isCreateCounterDocument(final Object document) { final Pair<ICounterDocHandler, IDocument> handlerandDocAction = getHandlerOrNull(document); return handlerandDocAction.getFirst().isCreateCounterDocument(handlerandDocAction.getSecond()); } @Override public IDocument createCounterDocument(final Object document, final boolean async) { if (async) { CreateCounterDocPP.schedule(document); return null; } else { final Pair<ICounterDocHandler, IDocument> handlerandDocAction = getHandlerOrNull(document); return handlerandDocAction.getFirst().createCounterDocument(handlerandDocAction.getSecond()); } } @Override public IModelInterceptor registerHandler(final ICounterDocHandler handler, final String tableName) { Check.assumeNotNull(handler, "Param 'handler' is not null"); Check.assumeNotNull(tableName, "Param 'tableName' is not null"); final ICounterDocHandler oldHandler = handlers.put(tableName, handler); Check.errorIf(oldHandler != null, "Can't register ICounterDocumentHandler {} for table name {}, because ICounterDocumentHandler {} was already regoistered", handler, tableName, oldHandler); final CounterDocHandlerInterceptor counterDocHandlerInterceptor = CounterDocHandlerInterceptor.builder() .setTableName(I_C_Order.Table_Name) .setAsync(true) .build(); return counterDocHandlerInterceptor;
} /** * * @param document * @return may return the {@link NullCounterDocumentHandler}, but never <code>null</code>. */ private Pair<ICounterDocHandler, IDocument> getHandlerOrNull(final Object document) { final String tableName = InterfaceWrapperHelper.getModelTableNameOrNull(document); if (Check.isEmpty(tableName) || !handlers.containsKey(tableName)) { return new Pair<ICounterDocHandler, IDocument>(NullCounterDocumentHandler.instance, null); } final IDocument docAction = Services.get(IDocumentBL.class).getDocumentOrNull(document); if (docAction == null) { return new Pair<ICounterDocHandler, IDocument>(NullCounterDocumentHandler.instance, null); } return new Pair<ICounterDocHandler, IDocument>(handlers.get(tableName), docAction); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\document\impl\CounterDocBL.java
1
请完成以下Java代码
public class ExtractMsgUtil { public static void main(String[] args) { try { getMQMsg(); } catch (Exception e) { e.printStackTrace(); } } public static void getMQMsg() throws JMSException { ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://x.x.x.x:61616"); Connection connection = connectionFactory.createConnection("admin","admin"); connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue("queuename"); QueueBrowser queueBrowser = session.createBrowser(queue);
Enumeration msgs = queueBrowser.getEnumeration(); List<String> temp = new ArrayList<>(); while (msgs.hasMoreElements()) { try { ActiveMQTextMessage msg = (ActiveMQTextMessage)msgs.nextElement(); JSONObject jsonObject = JSON.parseObject(msg.getText()); temp.add(jsonObject.getString("ResumeId")); } catch (Exception e) { e.printStackTrace(); } } System.out.println("save to file"); try { IOUtils.writeLines(temp,"\n",new FileOutputStream(new File("D:\\activemq-resume-msg.txt")), Charset.defaultCharset()); } catch (IOException e) { e.printStackTrace(); } } }
repos\spring-boot-quick-master\quick-activemq\src\main\java\com\mq\utils\ExtractMsgUtil.java
1
请完成以下Java代码
protected void doFilterNestedErrorDispatch(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { doFilter(request, response, filterChain); } /** * Same contract as for {@code doFilter}, but guaranteed to be just invoked once per * request within a single request thread. * <p> * Provides HttpServletRequest and HttpServletResponse arguments instead of the * default ServletRequest and ServletResponse ones. * @param request the request * @param response the response * @param filterChain the FilterChain * @throws ServletException thrown when a non-I/O exception has occurred
* @throws IOException thrown when an I/O exception of some sort has occurred * @see Filter#doFilter */ protected abstract void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException; @Override public void init(FilterConfig config) { } @Override public void destroy() { } }
repos\spring-session-main\spring-session-core\src\main\java\org\springframework\session\web\http\OncePerRequestFilter.java
1
请完成以下Java代码
protected JarFile openJarFile() throws IOException { synchronized (this.archiveLock) { if (this.archive == null) { JarURLConnection connection = connect(); this.useCaches = connection.getUseCaches(); this.archive = connection.getJarFile(); } this.archiveUseCount++; return this.archive; } } @Override protected void closeJarFile() { synchronized (this.archiveLock) { this.archiveUseCount--; } } @Override protected boolean isMultiRelease() { Boolean multiRelease = this.multiRelease; if (multiRelease == null) { synchronized (this.archiveLock) { multiRelease = this.multiRelease; if (multiRelease == null) { // JarFile.isMultiRelease() is final so we must go to the manifest Manifest manifest = getManifest(); Attributes attributes = (manifest != null) ? manifest.getMainAttributes() : null; multiRelease = (attributes != null) && attributes.containsKey(MULTI_RELEASE); this.multiRelease = multiRelease; } } } return multiRelease; } @Override public void gc() {
synchronized (this.archiveLock) { if (this.archive != null && this.archiveUseCount == 0) { try { if (!this.useCaches) { this.archive.close(); } } catch (IOException ex) { // Ignore } this.archive = null; this.archiveEntries = null; } } } private JarURLConnection connect() throws IOException { URLConnection connection = this.url.openConnection(); ResourceUtils.useCachesIfNecessary(connection); Assert.state(connection instanceof JarURLConnection, () -> "URL '%s' did not return a JAR connection".formatted(this.url)); connection.connect(); return (JarURLConnection) connection; } }
repos\spring-boot-4.0.1\module\spring-boot-tomcat\src\main\java\org\springframework\boot\tomcat\servlet\NestedJarResourceSet.java
1
请完成以下Java代码
public class Recapitalize { private static final Set<String> STOP_WORDS = Stream.of("a", "an", "the", "and", "but", "for", "at", "by", "to", "or") .collect(Collectors.toSet()); public static String sentenceCase(List<String> words) { List<String> capitalized = new ArrayList<>(); for (int i = 0; i < words.size(); i++) { String currentWord = words.get(i); if (i == 0) { capitalized.add(capitalizeFirst(currentWord)); } else { capitalized.add(currentWord.toLowerCase()); } } return String.join(" ", capitalized) + "."; }
public static String capitalizeMyTitle(List<String> words) { List<String> capitalized = new ArrayList<>(); for (int i = 0; i < words.size(); i++) { String currentWord = words.get(i); if (i == 0 || !STOP_WORDS.contains(currentWord.toLowerCase())) { capitalized.add(capitalizeFirst(currentWord)); } else { capitalized.add(currentWord.toLowerCase()); } } return String.join(" ", capitalized); } private static String capitalizeFirst(String word) { return word.substring(0, 1).toUpperCase() + word.substring(1).toLowerCase(); } }
repos\tutorials-master\core-java-modules\core-java-regex-2\src\main\java\com\baeldung\regex\camelcasetowords\Recapitalize.java
1
请完成以下Java代码
public BPartnerLocationId getCurrentBPartnerLocationIdOrNull() { final I_I_BPartner currentImportRecord = getCurrentImportRecord(); return currentImportRecord != null ? BPartnerLocationId.ofRepoIdOrNull(currentImportRecord.getC_BPartner_ID(), currentImportRecord.getC_BPartner_Location_ID()) : null; } public void setCurrentBPartnerLocationId(@NonNull final BPartnerLocationId bpLocationId) { final I_I_BPartner currentImportRecord = getCurrentImportRecord(); Check.assumeNotNull(currentImportRecord, "Parameter currentImportRecord is not null"); currentImportRecord.setC_BPartner_Location_ID(bpLocationId.getRepoId()); } public BPartnerContactId getCurrentBPartnerContactIdOrNull()
{ final I_I_BPartner currentImportRecord = getCurrentImportRecord(); return currentImportRecord != null ? BPartnerContactId.ofRepoIdOrNull(currentImportRecord.getC_BPartner_ID(), currentImportRecord.getAD_User_ID()) : null; } public void setCurrentBPartnerContactId(@NonNull final BPartnerContactId bpContactId) { final I_I_BPartner currentImportRecord = getCurrentImportRecord(); Check.assumeNotNull(currentImportRecord, "Parameter currentImportRecord is not null"); currentImportRecord.setAD_User_ID(bpContactId.getRepoId()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\bpartner\impexp\BPartnerImportContext.java
1
请完成以下Java代码
public CurrencyId getCurrencyId() { return rowsData.getCurrencyId(); } public Set<ProductId> getProductIds() { return rowsData.getProductIds(); } public Optional<PriceListVersionId> getSinglePriceListVersionId() { return rowsData.getSinglePriceListVersionId(); } public Optional<PriceListVersionId> getBasePriceListVersionId() { return rowsData.getBasePriceListVersionId(); } public PriceListVersionId getBasePriceListVersionIdOrFail() { return rowsData.getBasePriceListVersionId() .orElseThrow(() -> new AdempiereException("@NotFound@ @M_Pricelist_Version_Base_ID@")); } public List<ProductsProposalRow> getAllRows() { return ImmutableList.copyOf(getRows()); } public void addOrUpdateRows(@NonNull final List<ProductsProposalRowAddRequest> requests)
{ rowsData.addOrUpdateRows(requests); invalidateAll(); } public void patchViewRow(@NonNull final DocumentId rowId, @NonNull final ProductsProposalRowChangeRequest request) { rowsData.patchRow(rowId, request); } public void removeRowsByIds(final Set<DocumentId> rowIds) { rowsData.removeRowsByIds(rowIds); invalidateAll(); } public ProductsProposalView filter(final ProductsProposalViewFilter filter) { rowsData.filter(filter); return this; } @Override public DocumentFilterList getFilters() { return ProductsProposalViewFilters.toDocumentFilters(rowsData.getFilter()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\order\products_proposal\view\ProductsProposalView.java
1
请完成以下Spring Boot application配置
spring.r2dbc.url=${DB_URL:r2dbc:mysql://localhost:3306/baeldung?useSSL=true&requireSSL=true} spring.r2dbc.properties.sslMode=required spring.r2dbc.username=root spring.r2dbc
.password=root spring.r2dbc.pool.enabled=true spring.r2dbc.pool.maxSize=95
repos\tutorials-master\quarkus-modules\quarkus-vs-springboot\spring-project\src\main\resources\application.properties
2
请完成以下Java代码
public class JsonQRCodesGenerateRequestConverters { public static HUQRCodeGenerateRequest toHUQRCodeGenerateRequest( @NonNull final JsonQRCodesGenerateRequest json, @NonNull final IAttributeDAO attributeDAO) { return HUQRCodeGenerateRequest.builder() .count(json.getCount()) .huPackingInstructionsId(json.getHuPackingInstructionsId()) .productId(json.getProductId()) .attributes(json.getAttributes() .stream() .map(json1 -> toHUQRCodeGenerateRequestAttribute(json1, attributeDAO)) .collect(ImmutableList.toImmutableList())) .build(); } private static HUQRCodeGenerateRequest.Attribute toHUQRCodeGenerateRequestAttribute( final JsonQRCodesGenerateRequest.Attribute json, final IAttributeDAO attributeDAO) { final I_M_Attribute attribute = attributeDAO.retrieveAttributeByValue(json.getAttributeCode()); final AttributeId attributeId = AttributeId.ofRepoId(attribute.getM_Attribute_ID()); final HUQRCodeGenerateRequest.Attribute.AttributeBuilder resultBuilder = HUQRCodeGenerateRequest.Attribute.builder() .attributeId(attributeId); return AttributeValueType.ofCode(attribute.getAttributeValueType()) .map(new AttributeValueType.CaseMapper<HUQRCodeGenerateRequest.Attribute>() { @Override public HUQRCodeGenerateRequest.Attribute string() { return resultBuilder.valueString(json.getValue()).build(); }
@Override public HUQRCodeGenerateRequest.Attribute number() { final BigDecimal valueNumber = NumberUtils.asBigDecimal(json.getValue()); return resultBuilder.valueNumber(valueNumber).build(); } @Override public HUQRCodeGenerateRequest.Attribute date() { final LocalDate valueDate = StringUtils.trimBlankToOptional(json.getValue()).map(LocalDate::parse).orElse(null); return resultBuilder.valueDate(valueDate).build(); } @Override public HUQRCodeGenerateRequest.Attribute list() { final String listItemCode = json.getValue(); if (listItemCode != null) { final AttributeListValue listItem = attributeDAO.retrieveAttributeValueOrNull(attributeId, listItemCode); if (listItem == null) { throw new AdempiereException("No M_AttributeValue_ID found for " + attributeId + " and `" + listItemCode + "`"); } return resultBuilder.valueListId(listItem.getId()).build(); } else { return resultBuilder.valueListId(null).build(); } } }); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.mobileui\src\main\java\de\metas\handlingunits\rest_api\JsonQRCodesGenerateRequestConverters.java
1
请完成以下Java代码
public void setName (final java.lang.String Name) { set_Value (COLUMNNAME_Name, Name); } @Override public java.lang.String getName() { return get_ValueAsString(COLUMNNAME_Name); } @Override public org.compiere.model.I_AD_Window getOverrides_Window() { return get_ValueAsPO(COLUMNNAME_Overrides_Window_ID, org.compiere.model.I_AD_Window.class); } @Override public void setOverrides_Window(final org.compiere.model.I_AD_Window Overrides_Window) { set_ValueFromPO(COLUMNNAME_Overrides_Window_ID, org.compiere.model.I_AD_Window.class, Overrides_Window); } @Override public void setOverrides_Window_ID (final int Overrides_Window_ID) { if (Overrides_Window_ID < 1) set_Value (COLUMNNAME_Overrides_Window_ID, null); else set_Value (COLUMNNAME_Overrides_Window_ID, Overrides_Window_ID); } @Override public int getOverrides_Window_ID() { return get_ValueAsInt(COLUMNNAME_Overrides_Window_ID); } @Override public void setProcessing (final boolean Processing) { set_Value (COLUMNNAME_Processing, Processing); } @Override public boolean isProcessing() { return get_ValueAsBoolean(COLUMNNAME_Processing); } /** * WindowType AD_Reference_ID=108 * Reference name: AD_Window Types */ public static final int WINDOWTYPE_AD_Reference_ID=108; /** Single Record = S */ public static final String WINDOWTYPE_SingleRecord = "S"; /** Maintain = M */ public static final String WINDOWTYPE_Maintain = "M"; /** Transaktion = T */ public static final String WINDOWTYPE_Transaktion = "T"; /** Query Only = Q */
public static final String WINDOWTYPE_QueryOnly = "Q"; @Override public void setWindowType (final java.lang.String WindowType) { set_Value (COLUMNNAME_WindowType, WindowType); } @Override public java.lang.String getWindowType() { return get_ValueAsString(COLUMNNAME_WindowType); } @Override public void setWinHeight (final int WinHeight) { set_Value (COLUMNNAME_WinHeight, WinHeight); } @Override public int getWinHeight() { return get_ValueAsInt(COLUMNNAME_WinHeight); } @Override public void setWinWidth (final int WinWidth) { set_Value (COLUMNNAME_WinWidth, WinWidth); } @Override public int getWinWidth() { return get_ValueAsInt(COLUMNNAME_WinWidth); } @Override public void setZoomIntoPriority (final int ZoomIntoPriority) { set_Value (COLUMNNAME_ZoomIntoPriority, ZoomIntoPriority); } @Override public int getZoomIntoPriority() { return get_ValueAsInt(COLUMNNAME_ZoomIntoPriority); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Window.java
1
请完成以下Java代码
public void setShelfLifeMinDays (final int ShelfLifeMinDays) { set_Value (COLUMNNAME_ShelfLifeMinDays, ShelfLifeMinDays); } @Override public int getShelfLifeMinDays() { return get_ValueAsInt(COLUMNNAME_ShelfLifeMinDays); } @Override public void setShipperName (final @Nullable java.lang.String ShipperName) { set_Value (COLUMNNAME_ShipperName, ShipperName); } @Override public java.lang.String getShipperName() { return get_ValueAsString(COLUMNNAME_ShipperName); } @Override public void setShipperRouteCodeName (final @Nullable java.lang.String ShipperRouteCodeName) { set_Value (COLUMNNAME_ShipperRouteCodeName, ShipperRouteCodeName); } @Override public java.lang.String getShipperRouteCodeName() { return get_ValueAsString(COLUMNNAME_ShipperRouteCodeName); } @Override public void setShortDescription (final @Nullable java.lang.String ShortDescription) { set_Value (COLUMNNAME_ShortDescription, ShortDescription); } @Override public java.lang.String getShortDescription() { return get_ValueAsString(COLUMNNAME_ShortDescription); } @Override public void setSwiftCode (final @Nullable java.lang.String SwiftCode) { set_Value (COLUMNNAME_SwiftCode, SwiftCode); } @Override public java.lang.String getSwiftCode() { return get_ValueAsString(COLUMNNAME_SwiftCode); } @Override public void setTaxID (final @Nullable java.lang.String TaxID) { set_Value (COLUMNNAME_TaxID, TaxID); } @Override public java.lang.String getTaxID() { return get_ValueAsString(COLUMNNAME_TaxID);
} @Override public void setTitle (final @Nullable java.lang.String Title) { set_Value (COLUMNNAME_Title, Title); } @Override public java.lang.String getTitle() { return get_ValueAsString(COLUMNNAME_Title); } @Override public void setURL (final @Nullable java.lang.String URL) { set_Value (COLUMNNAME_URL, URL); } @Override public java.lang.String getURL() { return get_ValueAsString(COLUMNNAME_URL); } @Override public void setURL3 (final @Nullable java.lang.String URL3) { set_Value (COLUMNNAME_URL3, URL3); } @Override public java.lang.String getURL3() { return get_ValueAsString(COLUMNNAME_URL3); } @Override public void setVendorCategory (final @Nullable java.lang.String VendorCategory) { set_Value (COLUMNNAME_VendorCategory, VendorCategory); } @Override public java.lang.String getVendorCategory() { return get_ValueAsString(COLUMNNAME_VendorCategory); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_I_BPartner.java
1
请完成以下Java代码
public void setBillBPartnerIdIfAssociation(final I_C_Order order) { final I_C_BP_Group bpartnerGroup = groupDAO.getByBPartnerId(BPartnerId.ofRepoId(order.getC_BPartner_ID())); if (bpartnerGroup.isAssociation()) { order.setBill_BPartner_ID(bpartnerGroup.getBill_BPartner_ID()); order.setBill_Location_ID(bpartnerGroup.getBill_Location_ID()); order.setBill_User_ID(bpartnerGroup.getBill_User_ID()); } else { final BPGroupId parentGroupId = BPGroupId.ofRepoIdOrNull(bpartnerGroup.getParent_BP_Group_ID()); if (parentGroupId != null) { final I_C_BP_Group parentGroup = groupDAO.getById(parentGroupId); if (parentGroup.isAssociation()) { order.setBill_BPartner_ID(parentGroup.getBill_BPartner_ID()); order.setBill_Location_ID(parentGroup.getBill_Location_ID()); order.setBill_User_ID(parentGroup.getBill_User_ID()); }
} } } @DocValidate(timings = ModelValidator.TIMING_AFTER_COMPLETE) public void createOrderPaySchedules(final I_C_Order order) { orderPayScheduleService.createOrderPaySchedules(order); } @DocValidate(timings = ModelValidator.TIMING_AFTER_REACTIVATE) public void deleteOrderPaySchedules(final I_C_Order order) { orderPayScheduleService.deleteByOrderId(OrderId.ofRepoId(order.getC_Order_ID())); } @ModelChange(timings = { ModelValidator.TYPE_AFTER_CHANGE }, ifColumnsChanged = { I_C_Order.COLUMNNAME_LC_Date, I_C_Order.COLUMNNAME_ETA, I_C_Order.COLUMNNAME_BLDate, I_C_Order.COLUMNNAME_InvoiceDate }) public void updateOrderPaySchedules(final I_C_Order order) { orderPayScheduleService.updatePayScheduleStatus(order); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\order\model\interceptor\C_Order.java
1
请在Spring Boot框架中完成以下Java代码
public DataSize getInitialBufferSize() { return this.initialBufferSize; } public void setInitialBufferSize(DataSize initialBufferSize) { this.initialBufferSize = initialBufferSize; } public DataSize getMaxInitialLineLength() { return this.maxInitialLineLength; } public void setMaxInitialLineLength(DataSize maxInitialLineLength) { this.maxInitialLineLength = maxInitialLineLength; } public @Nullable Integer getMaxKeepAliveRequests() { return this.maxKeepAliveRequests; } public void setMaxKeepAliveRequests(@Nullable Integer maxKeepAliveRequests) { this.maxKeepAliveRequests = maxKeepAliveRequests; }
public boolean isValidateHeaders() { return this.validateHeaders; } public void setValidateHeaders(boolean validateHeaders) { this.validateHeaders = validateHeaders; } public @Nullable Duration getIdleTimeout() { return this.idleTimeout; } public void setIdleTimeout(@Nullable Duration idleTimeout) { this.idleTimeout = idleTimeout; } }
repos\spring-boot-4.0.1\module\spring-boot-reactor-netty\src\main\java\org\springframework\boot\reactor\netty\autoconfigure\NettyServerProperties.java
2
请完成以下Java代码
public void initialize(ConfigurableApplicationContext configurableApplicationContext) { try { Resource resource = configurableApplicationContext.getResource("classpath:configprops.json"); Map readValue = new ObjectMapper().readValue(resource.getInputStream(), Map.class); Set<Map.Entry> set = readValue.entrySet(); List<MapPropertySource> propertySources = convertEntrySet(set, Optional.empty()); for (PropertySource propertySource : propertySources) { configurableApplicationContext.getEnvironment() .getPropertySources() .addFirst(propertySource); } } catch (IOException e) { throw new RuntimeException(e); } } private static List<MapPropertySource> convertEntrySet(Set<Map.Entry> entrySet, Optional<String> parentKey) { return entrySet.stream() .map((Map.Entry e) -> convertToPropertySourceList(e, parentKey)) .flatMap(Collection::stream) .collect(Collectors.toList());
} private static List<MapPropertySource> convertToPropertySourceList(Map.Entry e, Optional<String> parentKey) { String key = parentKey.map(s -> s + ".") .orElse("") + (String) e.getKey(); Object value = e.getValue(); return covertToPropertySourceList(key, value); } @SuppressWarnings("unchecked") private static List<MapPropertySource> covertToPropertySourceList(String key, Object value) { if (value instanceof LinkedHashMap) { LinkedHashMap map = (LinkedHashMap) value; Set<Map.Entry> entrySet = map.entrySet(); return convertEntrySet(entrySet, Optional.ofNullable(key)); } String finalKey = CUSTOM_PREFIX + key; return Collections.singletonList(new MapPropertySource(finalKey, Collections.singletonMap(finalKey, value))); } }
repos\tutorials-master\spring-boot-modules\spring-boot-properties-3\src\main\java\com\baeldung\properties\json\JsonPropertyContextInitializer.java
1
请完成以下Java代码
public void setDocStatus (final java.lang.String DocStatus) { set_Value (COLUMNNAME_DocStatus, DocStatus); } @Override public java.lang.String getDocStatus() { return get_ValueAsString(COLUMNNAME_DocStatus); } @Override public void setExternalId (final @Nullable java.lang.String ExternalId) { set_Value (COLUMNNAME_ExternalId, ExternalId); } @Override public java.lang.String getExternalId() { return get_ValueAsString(COLUMNNAME_ExternalId); } @Override public void setHelp (final @Nullable java.lang.String Help) { set_Value (COLUMNNAME_Help, Help); } @Override public java.lang.String getHelp() { return get_ValueAsString(COLUMNNAME_Help); } @Override public void setIsDefault (final boolean IsDefault) { set_Value (COLUMNNAME_IsDefault, IsDefault); } @Override public boolean isDefault() { return get_ValueAsBoolean(COLUMNNAME_IsDefault); } @Override public void setM_Forecast_ID (final int M_Forecast_ID) { if (M_Forecast_ID < 1) set_ValueNoCheck (COLUMNNAME_M_Forecast_ID, null); else set_ValueNoCheck (COLUMNNAME_M_Forecast_ID, M_Forecast_ID); } @Override public int getM_Forecast_ID() { return get_ValueAsInt(COLUMNNAME_M_Forecast_ID); } @Override public void setM_PriceList_ID (final int M_PriceList_ID) { if (M_PriceList_ID < 1) set_Value (COLUMNNAME_M_PriceList_ID, null); else set_Value (COLUMNNAME_M_PriceList_ID, M_PriceList_ID); } @Override public int getM_PriceList_ID() { return get_ValueAsInt(COLUMNNAME_M_PriceList_ID); } @Override public void setM_Warehouse_ID (final int M_Warehouse_ID) { if (M_Warehouse_ID < 1) set_Value (COLUMNNAME_M_Warehouse_ID, null); else set_Value (COLUMNNAME_M_Warehouse_ID, M_Warehouse_ID);
} @Override public int getM_Warehouse_ID() { return get_ValueAsInt(COLUMNNAME_M_Warehouse_ID); } @Override public void setName (final java.lang.String Name) { set_Value (COLUMNNAME_Name, Name); } @Override public java.lang.String getName() { return get_ValueAsString(COLUMNNAME_Name); } @Override public void setProcessed (final boolean Processed) { set_ValueNoCheck (COLUMNNAME_Processed, Processed); } @Override public boolean isProcessed() { return get_ValueAsBoolean(COLUMNNAME_Processed); } @Override public void setProcessing (final boolean Processing) { set_Value (COLUMNNAME_Processing, Processing); } @Override public boolean isProcessing() { return get_ValueAsBoolean(COLUMNNAME_Processing); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Forecast.java
1
请完成以下Java代码
public boolean process(Sentence sentence) { Utility.normalize(sentence); try { convertCorpus(sentence, bw); bw.newLine(); } catch (IOException e) { throw new RuntimeException(e); } return false; } }); bw.close(); } /** * 导出特征模板 * * @param templatePath * @throws IOException */ public void dumpTemplate(String templatePath) throws IOException {
BufferedWriter bw = IOUtil.newBufferedWriter(templatePath); String template = getTemplate(); bw.write(template); bw.close(); } /** * 获取特征模板 * * @return */ public String getTemplate() { String template = getDefaultFeatureTemplate(); if (model != null && model.getFeatureTemplateArray() != null) { StringBuilder sbTemplate = new StringBuilder(); for (FeatureTemplate featureTemplate : model.getFeatureTemplateArray()) { sbTemplate.append(featureTemplate.getTemplate()).append('\n'); } } return template; } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\model\crf\CRFTagger.java
1
请完成以下Java代码
public String getTableName() { return I_M_InOut.Table_Name; } @Override public Optional<DocOutBoundRecipients> provideMailRecipient(@NonNull final DocOutboundLogMailRecipientRequest request) { final I_M_InOut inOutRecord = request.getRecordRef() .getModel(I_M_InOut.class); final boolean propagateToDocOutboundLog = orderEmailPropagationSysConfigRepository.isPropagateToDocOutboundLog( ClientAndOrgId.ofClientAndOrg(request.getClientId(), request.getOrgId())); final String inoutEmail = propagateToDocOutboundLog ? inOutRecord.getEMail() : null; final String locationEmail = inoutBL.getLocationEmail(InOutId.ofRepoId(inOutRecord.getM_InOut_ID())); if (inOutRecord.getAD_User_ID() > 0) { final DocOutBoundRecipient inOutUser = recipientRepository.getById(DocOutBoundRecipientId.ofRepoId(inOutRecord.getAD_User_ID())); if (Check.isNotBlank(inoutEmail)) { return DocOutBoundRecipients.optionalOfTo(inOutUser.withEmailAddress(inoutEmail)); } if (Check.isNotBlank(inOutUser.getEmailAddress())) { return DocOutBoundRecipients.optionalOfTo(inOutUser); } if (Check.isNotBlank(locationEmail)) { return DocOutBoundRecipients.optionalOfTo(inOutUser.withEmailAddress(locationEmail)); } } final BPartnerId bpartnerId = BPartnerId.ofRepoId(inOutRecord.getC_BPartner_ID()); final User billContact = bpartnerBL.retrieveContactOrNull( IBPartnerBL.RetrieveContactRequest .builder() .bpartnerId(bpartnerId) .bPartnerLocationId(BPartnerLocationId.ofRepoId(bpartnerId, inOutRecord.getC_BPartner_Location_ID()))
.contactType(IBPartnerBL.RetrieveContactRequest.ContactType.BILL_TO_DEFAULT) .build()); if (billContact != null && billContact.getId() != null) { final DocOutBoundRecipientId recipientId = DocOutBoundRecipientId.ofRepoId(billContact.getId().getRepoId()); final DocOutBoundRecipient docOutBoundRecipient = recipientRepository.getById(recipientId); if (Check.isNotBlank(inoutEmail)) { return DocOutBoundRecipients.optionalOfTo(docOutBoundRecipient.withEmailAddress(inoutEmail)); } if (Check.isNotBlank(locationEmail)) { return DocOutBoundRecipients.optionalOfTo(docOutBoundRecipient.withEmailAddress(locationEmail)); } if (Check.isNotBlank(docOutBoundRecipient.getEmailAddress())) { return DocOutBoundRecipients.optionalOfTo(docOutBoundRecipient); } } return Optional.empty(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.document.archive\de.metas.document.archive.base\src\main\java\de\metas\document\archive\mailrecipient\impl\InOutDocOutboundLogMailRecipientProvider.java
1
请完成以下Java代码
public java.lang.String getc_print_job_name() { return (java.lang.String)get_Value(COLUMNNAME_c_print_job_name); } @Override public void setdocument (java.lang.String document) { set_Value (COLUMNNAME_document, document); } @Override public java.lang.String getdocument() { return (java.lang.String)get_Value(COLUMNNAME_document); } @Override public void setDocumentNo (java.lang.String DocumentNo) { set_Value (COLUMNNAME_DocumentNo, DocumentNo); } @Override public java.lang.String getDocumentNo() { return (java.lang.String)get_Value(COLUMNNAME_DocumentNo); } @Override public void setFirstname (java.lang.String Firstname) { set_Value (COLUMNNAME_Firstname, Firstname); } @Override public java.lang.String getFirstname() { return (java.lang.String)get_Value(COLUMNNAME_Firstname); } @Override public void setGrandTotal (java.math.BigDecimal GrandTotal) {
set_Value (COLUMNNAME_GrandTotal, GrandTotal); } @Override public java.math.BigDecimal getGrandTotal() { BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_GrandTotal); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setLastname (java.lang.String Lastname) { set_Value (COLUMNNAME_Lastname, Lastname); } @Override public java.lang.String getLastname() { return (java.lang.String)get_Value(COLUMNNAME_Lastname); } @Override public void setprintjob (java.lang.String printjob) { set_Value (COLUMNNAME_printjob, printjob); } @Override public java.lang.String getprintjob() { return (java.lang.String)get_Value(COLUMNNAME_printjob); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.printing\de.metas.printing.base\src\main\java-gen\de\metas\printing\model\X_RV_Printing_Bericht_List_Per_Print_Job.java
1
请完成以下Java代码
public void onCollectionRemove(Object collection, Serializable key) throws CallbackException { // TODO Auto-generated method stub } @Override public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException { // TODO Auto-generated method stub } @Override public void preFlush(Iterator entities) throws CallbackException { // TODO Auto-generated method stub } @Override public void postFlush(Iterator entities) throws CallbackException { // TODO Auto-generated method stub } @Override public Boolean isTransient(Object entity) { // TODO Auto-generated method stub return null; } @Override public int[] findDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) { // TODO Auto-generated method stub return null; } @Override public Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException { // TODO Auto-generated method stub return null; }
@Override public String getEntityName(Object object) throws CallbackException { // TODO Auto-generated method stub return null; } @Override public Object getEntity(String entityName, Serializable id) throws CallbackException { // TODO Auto-generated method stub return null; } @Override public void afterTransactionBegin(Transaction tx) { // TODO Auto-generated method stub } @Override public void beforeTransactionCompletion(Transaction tx) { // TODO Auto-generated method stub } @Override public void afterTransactionCompletion(Transaction tx) { // TODO Auto-generated method stub } @Override public String onPrepareStatement(String sql) { // TODO Auto-generated method stub return null; } }
repos\tutorials-master\persistence-modules\hibernate5\src\main\java\com\baeldung\hibernate\interceptors\CustomInterceptorImpl.java
1
请完成以下Java代码
public List<TrackData1> getTrckData() { if (trckData == null) { trckData = new ArrayList<TrackData1>(); } return this.trckData; } /** * Gets the value of the cardSctyCd property. * * @return * possible object is * {@link CardSecurityInformation1 } * */ public CardSecurityInformation1 getCardSctyCd() {
return cardSctyCd; } /** * Sets the value of the cardSctyCd property. * * @param value * allowed object is * {@link CardSecurityInformation1 } * */ public void setCardSctyCd(CardSecurityInformation1 value) { this.cardSctyCd = value; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_04\PlainCardData1.java
1
请完成以下Java代码
public void deleteAttachmentsByTaskProcessInstanceIds(List<String> processInstanceIds) { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("taskProcessInstanceIds", processInstanceIds); deleteAttachments(parameters); } public void deleteAttachmentsByTaskCaseInstanceIds(List<String> caseInstanceIds) { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("caseInstanceIds", caseInstanceIds); deleteAttachments(parameters); } protected void deleteAttachments(Map<String, Object> parameters) { getDbEntityManager().deletePreserveOrder(ByteArrayEntity.class, "deleteAttachmentByteArraysByIds", parameters); getDbEntityManager().deletePreserveOrder(AttachmentEntity.class, "deleteAttachmentByIds", parameters); } public Attachment findAttachmentByTaskIdAndAttachmentId(String taskId, String attachmentId) { checkHistoryEnabled(); Map<String, String> parameters = new HashMap<String, String>(); parameters.put("taskId", taskId); parameters.put("id", attachmentId); return (AttachmentEntity) getDbEntityManager().selectOne("selectAttachmentByTaskIdAndAttachmentId", parameters); }
public DbOperation deleteAttachmentsByRemovalTime(Date removalTime, int minuteFrom, int minuteTo, int batchSize) { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("removalTime", removalTime); if (minuteTo - minuteFrom + 1 < 60) { parameters.put("minuteFrom", minuteFrom); parameters.put("minuteTo", minuteTo); } parameters.put("batchSize", batchSize); return getDbEntityManager() .deletePreserveOrder(AttachmentEntity.class, "deleteAttachmentsByRemovalTime", new ListQueryParameterObject(parameters, 0, batchSize)); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\AttachmentManager.java
1
请完成以下Java代码
public void handleReversalForInvoice(final I_C_Invoice invoice) { try (final MDCCloseable ignored = TableRecordMDC.putTableRecordReference(invoice)) { Services.get(IInvoiceCandBL.class).handleReversalForInvoice(invoice); } if (invoice.getReversal_ID() > 0) { invoiceWithDetailsService.copyDetailsToReversal(InvoiceId.ofRepoId(invoice.getC_Invoice_ID()), InvoiceId.ofRepoId(invoice.getReversal_ID())); } } @DocValidate(timings = { ModelValidator.TIMING_AFTER_VOID }) public void handleVoidingForInvoice(final I_C_Invoice invoice) { try (final MDCCloseable ignored = TableRecordMDC.putTableRecordReference(invoice)) { Services.get(IInvoiceCandBL.class).handleVoidingForInvoice(invoice); } } @DocValidate(timings = { ModelValidator.TIMING_AFTER_COMPLETE })
public void closePartiallyInvoiced_InvoiceCandidates(final I_C_Invoice invoice) { try (final MDCCloseable ignored = TableRecordMDC.putTableRecordReference(invoice)) { Services.get(IInvoiceCandBL.class).closePartiallyInvoiced_InvoiceCandidates(invoice); } } @DocValidate(timings = { ModelValidator.TIMING_BEFORE_REVERSECORRECT, ModelValidator.TIMING_BEFORE_REVERSEACCRUAL }) public void candidatesUnProcess(final I_C_Invoice invoice) { try (final MDCCloseable ignored = TableRecordMDC.putTableRecordReference(invoice)) { Services.get(IInvoiceCandBL.class).candidates_unProcess(invoice); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\modelvalidator\C_Invoice.java
1
请完成以下Java代码
public boolean isActive() {return po.isActive();} @Override public PostingStatus getPostingStatus() {return PostingStatus.ofNullableCode(po.get_ValueAsString("Posted"));} @Override public boolean hasColumnName(final String columnName) {return po.getPOInfo().hasColumnName(columnName);} @Override public int getValueAsIntOrZero(final String columnName) { final int index = po.get_ColumnIndex(columnName); if (index != -1) { final Integer ii = (Integer)po.get_Value(index); if (ii != null) { return ii; } } return 0; } @Override @Nullable public <T extends RepoIdAware> T getValueAsIdOrNull(final String columnName, final IntFunction<T> idOrNullMapper) { final int index = po.get_ColumnIndex(columnName); if (index < 0) { return null; } final Object valueObj = po.get_Value(index); final Integer valueInt = NumberUtils.asInteger(valueObj, null); if (valueInt == null) { return null; } return idOrNullMapper.apply(valueInt); } @Override @Nullable public LocalDateAndOrgId getValueAsLocalDateOrNull(@NonNull final String columnName, @NonNull final Function<OrgId, ZoneId> timeZoneMapper) { final int index = po.get_ColumnIndex(columnName); if (index != -1) { final Timestamp ts = po.get_ValueAsTimestamp(index); if (ts != null) { final OrgId orgId = OrgId.ofRepoId(po.getAD_Org_ID()); return LocalDateAndOrgId.ofTimestamp(ts, orgId, timeZoneMapper);
} } return null; } @Override @Nullable public Boolean getValueAsBooleanOrNull(@NonNull final String columnName) { final int index = po.get_ColumnIndex(columnName); if (index != -1) { final Object valueObj = po.get_Value(index); return DisplayType.toBoolean(valueObj, null); } return null; } @Override @Nullable public String getValueAsString(@NonNull final String columnName) { final int index = po.get_ColumnIndex(columnName); if (index != -1) { final Object valueObj = po.get_Value(index); return valueObj != null ? valueObj.toString() : null; } return null; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\doc\POAcctDocModel.java
1
请完成以下Java代码
public void setIssgAgt(BranchAndFinancialInstitutionIdentification4 value) { this.issgAgt = value; } /** * Gets the value of the sttlmPlc property. * * @return * possible object is * {@link BranchAndFinancialInstitutionIdentification4 } * */ public BranchAndFinancialInstitutionIdentification4 getSttlmPlc() { return sttlmPlc; } /** * Sets the value of the sttlmPlc property. * * @param value * allowed object is * {@link BranchAndFinancialInstitutionIdentification4 } * */ public void setSttlmPlc(BranchAndFinancialInstitutionIdentification4 value) { this.sttlmPlc = value; } /** * Gets the value of the prtry property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the prtry property. *
* <p> * For example, to add a new item, do as follows: * <pre> * getPrtry().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link ProprietaryAgent2 } * * */ public List<ProprietaryAgent2> getPrtry() { if (prtry == null) { prtry = new ArrayList<ProprietaryAgent2>(); } return this.prtry; } }
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\TransactionAgents2.java
1
请在Spring Boot框架中完成以下Java代码
public Boolean getUseLock() { return useLock; } public void setUseLock(Boolean useLock) { this.useLock = useLock; } public Duration getLockWaitTime() { return lockWaitTime; } public void setLockWaitTime(Duration lockWaitTime) { this.lockWaitTime = lockWaitTime; } public Boolean getThrowExceptionOnDeploymentFailure() {
return throwExceptionOnDeploymentFailure; } public void setThrowExceptionOnDeploymentFailure(Boolean throwExceptionOnDeploymentFailure) { this.throwExceptionOnDeploymentFailure = throwExceptionOnDeploymentFailure; } public String getLockName() { return lockName; } public void setLockName(String lockName) { this.lockName = lockName; } } }
repos\flowable-engine-main\modules\flowable-spring-boot\flowable-spring-boot-starters\flowable-spring-boot-autoconfigure\src\main\java\org\flowable\spring\boot\FlowableAutoDeploymentProperties.java
2
请在Spring Boot框架中完成以下Java代码
public @Nullable Duration getConnectionTimeout() { return this.connectionTimeout; } public void setConnectionTimeout(@Nullable Duration connectionTimeout) { this.connectionTimeout = connectionTimeout; } public DataSize getH2cMaxContentLength() { return this.h2cMaxContentLength; } public void setH2cMaxContentLength(DataSize h2cMaxContentLength) { this.h2cMaxContentLength = h2cMaxContentLength; } public DataSize getInitialBufferSize() { return this.initialBufferSize; } public void setInitialBufferSize(DataSize initialBufferSize) { this.initialBufferSize = initialBufferSize; } public DataSize getMaxInitialLineLength() { return this.maxInitialLineLength; } public void setMaxInitialLineLength(DataSize maxInitialLineLength) { this.maxInitialLineLength = maxInitialLineLength; } public @Nullable Integer getMaxKeepAliveRequests() { return this.maxKeepAliveRequests; } public void setMaxKeepAliveRequests(@Nullable Integer maxKeepAliveRequests) {
this.maxKeepAliveRequests = maxKeepAliveRequests; } public boolean isValidateHeaders() { return this.validateHeaders; } public void setValidateHeaders(boolean validateHeaders) { this.validateHeaders = validateHeaders; } public @Nullable Duration getIdleTimeout() { return this.idleTimeout; } public void setIdleTimeout(@Nullable Duration idleTimeout) { this.idleTimeout = idleTimeout; } }
repos\spring-boot-4.0.1\module\spring-boot-reactor-netty\src\main\java\org\springframework\boot\reactor\netty\autoconfigure\NettyServerProperties.java
2
请完成以下Java代码
public void setPercentOfBasePoints (final @Nullable BigDecimal PercentOfBasePoints) { set_ValueNoCheck (COLUMNNAME_PercentOfBasePoints, PercentOfBasePoints); } @Override public BigDecimal getPercentOfBasePoints() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PercentOfBasePoints); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setPointsBase_Forecasted (final @Nullable BigDecimal PointsBase_Forecasted) { set_ValueNoCheck (COLUMNNAME_PointsBase_Forecasted, PointsBase_Forecasted); } @Override public BigDecimal getPointsBase_Forecasted() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PointsBase_Forecasted); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setPointsBase_Invoiceable (final @Nullable BigDecimal PointsBase_Invoiceable) { set_ValueNoCheck (COLUMNNAME_PointsBase_Invoiceable, PointsBase_Invoiceable); } @Override public BigDecimal getPointsBase_Invoiceable() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PointsBase_Invoiceable); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setPointsBase_Invoiced (final @Nullable BigDecimal PointsBase_Invoiced) { set_ValueNoCheck (COLUMNNAME_PointsBase_Invoiced, PointsBase_Invoiced); } @Override public BigDecimal getPointsBase_Invoiced() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PointsBase_Invoiced); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setPointsSum_Settled (final @Nullable BigDecimal PointsSum_Settled) { set_ValueNoCheck (COLUMNNAME_PointsSum_Settled, PointsSum_Settled); } @Override
public BigDecimal getPointsSum_Settled() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PointsSum_Settled); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setPointsSum_ToSettle (final @Nullable BigDecimal PointsSum_ToSettle) { set_ValueNoCheck (COLUMNNAME_PointsSum_ToSettle, PointsSum_ToSettle); } @Override public BigDecimal getPointsSum_ToSettle() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PointsSum_ToSettle); return bd != null ? bd : BigDecimal.ZERO; } @Override 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 setQtyEntered (final @Nullable BigDecimal QtyEntered) { set_ValueNoCheck (COLUMNNAME_QtyEntered, QtyEntered); } @Override public BigDecimal getQtyEntered() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyEntered); return bd != null ? bd : BigDecimal.ZERO; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java-gen\de\metas\contracts\commission\model\X_C_Commission_Overview_V.java
1
请完成以下Java代码
public int getPerms() { return perms; } public Resource getResource() { return resource; } public void setResource(Resource resource) { this.resource = resource; if (resource != null) { resourceType = resource.resourceType(); } } public int getResourceType() { return resourceType; } public String getResourceId() { return resourceId; }
public void setResourceId(String resourceId) { this.resourceId = resourceId; } public String getResourceIdQueryParam() { return resourceIdQueryParam; } public void setResourceIdQueryParam(String resourceIdQueryParam) { this.resourceIdQueryParam = resourceIdQueryParam; } public Long getAuthorizationNotFoundReturnValue() { return authorizationNotFoundReturnValue; } public void setAuthorizationNotFoundReturnValue(Long authorizationNotFoundReturnValue) { this.authorizationNotFoundReturnValue = authorizationNotFoundReturnValue; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\db\PermissionCheck.java
1
请完成以下Java代码
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 void confirm(org.springframework.amqp.rabbit.support.CorrelationData correlationData, boolean ack, String cause) { // 消息回调确认失败处理 if (!ack && correlationData instanceof CorrelationData) { CorrelationData correlationDataExtends = (CorrelationData) correlationData; //消息发送失败,就进行重试,重试过后还不能成功就记录到数据库 if (correlationDataExtends.getRetryCount() < systemConfig.getMqRetryCount()) { logger.info("MQ消息发送失败,消息重发,消息ID:{},重发次数:{},消息体:{}", correlationDataExtends.getId(), correlationDataExtends.getRetryCount(), JSON.toJSONString(correlationDataExtends.getMessage())); // 将重试次数加一 correlationDataExtends.setRetryCount(correlationDataExtends.getRetryCount() + 1); // 重发发消息 this.convertAndSend(correlationDataExtends.getExchange(), correlationDataExtends.getRoutingKey(), correlationDataExtends.getMessage(), correlationDataExtends); } else { //消息重试发送失败,将消息放到数据库等待补发 logger.warn("MQ消息重发失败,消息入库,消息ID:{},消息体:{}", correlationData.getId(), JSON.toJSONString(correlationDataExtends.getMessage())); // TODO 保存消息到数据库 } } else { logger.info("消息发送成功,消息ID:{}", correlationData.getId()); } } /** * 用于实现消息发送到RabbitMQ交换器,但无相应队列与交换器绑定时的回调。 * 在脑裂的情况下会出现这种情况 */ @Override public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) { logger.error("MQ消息发送失败,replyCode:{}, replyText:{},exchange:{},routingKey:{},消息体:{}", replyCode, replyText, exchange, routingKey, JSON.toJSONString(message.getBody())); // TODO 保存消息到数据库 } /** * 消息相关数据(消息ID) * * @param message * @return */ private CorrelationData correlationData(Object message) { return new CorrelationData(UUID.randomUUID().toString(), message); } /** * 发送消息
* * @param exchange 交换机名称 * @param routingKey 路由key * @param message 消息内容 * @param correlationData 消息相关数据(消息ID) * @throws AmqpException */ private void convertAndSend(String exchange, String routingKey, final Object message, CorrelationData correlationData) throws AmqpException { try { rabbitTemplate.convertAndSend(exchange, routingKey, message, correlationData); } catch (Exception e) { logger.error("MQ消息发送异常,消息ID:{},消息体:{}, exchangeName:{}, routingKey:{}", correlationData.getId(), JSON.toJSONString(message), exchange, routingKey, e); // TODO 保存消息到数据库 } } @Override public void afterPropertiesSet() throws Exception { rabbitTemplate.setConfirmCallback(this); rabbitTemplate.setReturnCallback(this); } }
repos\spring-boot-student-master\spring-boot-student-rabbitmq\src\main\java\com\xiaolyuh\mq\sender\RabbitSender.java
1
请在Spring Boot框架中完成以下Java代码
public static void throwIfDoesNotExist(ConfigDataResource resource, Path pathToCheck) { throwIfNot(resource, Files.exists(pathToCheck)); } /** * Throw a {@link ConfigDataNotFoundException} if the specified {@link File} does not * exist. * @param resource the config data resource * @param fileToCheck the file to check */ public static void throwIfDoesNotExist(ConfigDataResource resource, File fileToCheck) { throwIfNot(resource, fileToCheck.exists()); } /**
* Throw a {@link ConfigDataNotFoundException} if the specified {@link Resource} does * not exist. * @param resource the config data resource * @param resourceToCheck the resource to check */ public static void throwIfDoesNotExist(ConfigDataResource resource, Resource resourceToCheck) { throwIfNot(resource, resourceToCheck.exists()); } private static void throwIfNot(ConfigDataResource resource, boolean check) { if (!check) { throw new ConfigDataResourceNotFoundException(resource); } } }
repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\context\config\ConfigDataResourceNotFoundException.java
2
请完成以下Java代码
public int getM_Product_ID() { return get_ValueAsInt(COLUMNNAME_M_Product_ID); } @Override public void setName (final java.lang.String Name) { set_Value (COLUMNNAME_Name, Name); } @Override public java.lang.String getName() { return get_ValueAsString(COLUMNNAME_Name); } @Override public void setPlannedAmt (final BigDecimal PlannedAmt) { set_Value (COLUMNNAME_PlannedAmt, PlannedAmt); } @Override public BigDecimal getPlannedAmt() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PlannedAmt); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setPriceActual (final @Nullable BigDecimal PriceActual) { set_Value (COLUMNNAME_PriceActual, PriceActual); } @Override public BigDecimal getPriceActual() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PriceActual); return bd != null ? bd : BigDecimal.ZERO; } /** * ProjInvoiceRule AD_Reference_ID=383 * Reference name: C_Project InvoiceRule */ public static final int PROJINVOICERULE_AD_Reference_ID=383; /** None = - */ public static final String PROJINVOICERULE_None = "-"; /** Committed Amount = C */ public static final String PROJINVOICERULE_CommittedAmount = "C"; /** Time&Material max Comitted = c */ public static final String PROJINVOICERULE_TimeMaterialMaxComitted = "c"; /** Time&Material = T */ public static final String PROJINVOICERULE_TimeMaterial = "T"; /** Product Quantity = P */ public static final String PROJINVOICERULE_ProductQuantity = "P"; @Override public void setProjInvoiceRule (final java.lang.String ProjInvoiceRule) { set_Value (COLUMNNAME_ProjInvoiceRule, ProjInvoiceRule); } @Override public java.lang.String getProjInvoiceRule() { return get_ValueAsString(COLUMNNAME_ProjInvoiceRule); }
@Override public 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 setStartDate (final @Nullable java.sql.Timestamp StartDate) { set_Value (COLUMNNAME_StartDate, StartDate); } @Override public java.sql.Timestamp getStartDate() { return get_ValueAsTimestamp(COLUMNNAME_StartDate); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_ProjectPhase.java
1
请在Spring Boot框架中完成以下Java代码
public String getExceptionMessage() { return exceptionMessage; } @Override public void setExceptionMessage(String exceptionMessage) { this.exceptionMessage = StringUtils.abbreviate(exceptionMessage, JobInfo.MAX_EXCEPTION_MESSAGE_LENGTH); } @Override public ByteArrayRef getExceptionByteArrayRef() { return exceptionByteArrayRef; } @Override public void setExceptionByteArrayRef(ByteArrayRef exceptionByteArrayRef) { this.exceptionByteArrayRef = exceptionByteArrayRef; } private String getJobByteArrayRefAsString(ByteArrayRef jobByteArrayRef) { if (jobByteArrayRef == null) { return null; } return jobByteArrayRef.asString(getEngineType()); } protected String getEngineType() { if (StringUtils.isNotEmpty(scopeType)) { return scopeType; } else { return ScopeTypes.BPMN; } } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName().replace("Impl", "")).append("[") .append("id=").append(id) .append(", jobHandlerType=").append(jobHandlerType)
.append(", jobType=").append(jobType); if (category != null) { sb.append(", category=").append(category); } if (elementId != null) { sb.append(", elementId=").append(elementId); } if (correlationId != null) { sb.append(", correlationId=").append(correlationId); } if (executionId != null) { sb.append(", processInstanceId=").append(processInstanceId) .append(", executionId=").append(executionId); } else if (scopeId != null) { sb.append(", scopeId=").append(scopeId) .append(", subScopeId=").append(subScopeId) .append(", scopeType=").append(scopeType); } if (processDefinitionId != null) { sb.append(", processDefinitionId=").append(processDefinitionId); } else if (scopeDefinitionId != null) { if (scopeId == null) { sb.append(", scopeType=").append(scopeType); } sb.append(", scopeDefinitionId=").append(scopeDefinitionId); } if (StringUtils.isNotEmpty(tenantId)) { sb.append(", tenantId=").append(tenantId); } sb.append("]"); return sb.toString(); } }
repos\flowable-engine-main\modules\flowable-job-service\src\main\java\org\flowable\job\service\impl\persistence\entity\AbstractJobEntityImpl.java
2
请完成以下Java代码
public static GridTab getGridTabForTableAndWindow(final Properties ctx, final int windowNo, final int AD_Window_ID, final int AD_Table_ID, final boolean startWithEmptyQuery) { final GridWindowVO wVO = GridWindowVO.create(ctx, windowNo, AdWindowId.ofRepoId(AD_Window_ID)); if (wVO == null) { MWindow w = new MWindow(Env.getCtx(), AD_Window_ID, null); throw new AdempiereException("No access to window - " + w.getName() + " (AD_Window_ID=" + AD_Window_ID + ")"); } final GridWindow gridWindow = new GridWindow(wVO); // GridTab tab = null; int tabIndex = -1; for (int i = 0; i < gridWindow.getTabCount(); i++) { GridTab t = gridWindow.getTab(i); if (t.getAD_Table_ID() == AD_Table_ID) { tab = t; tabIndex = i; break;
} } if (tab == null) { throw new AdempiereException("No Tab found for AD_Table_ID=" + AD_Table_ID + ", Window:" + gridWindow.getName()); } gridWindow.initTab(tabIndex); // if (startWithEmptyQuery) { tab.setQuery(MQuery.getEqualQuery("1", "2")); tab.query(false); } return tab; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\util\MiscUtils.java
1
请完成以下Java代码
public void setOnTuesday (boolean OnTuesday) { set_Value (COLUMNNAME_OnTuesday, Boolean.valueOf(OnTuesday)); } /** Get Dienstag. @return Dienstags verfügbar */ @Override public boolean isOnTuesday () { Object oo = get_Value(COLUMNNAME_OnTuesday); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Mittwoch. @param OnWednesday Mittwochs verfügbar */ @Override public void setOnWednesday (boolean OnWednesday) { set_Value (COLUMNNAME_OnWednesday, Boolean.valueOf(OnWednesday)); } /** Get Mittwoch. @return Mittwochs verfügbar */ @Override public boolean isOnWednesday () {
Object oo = get_Value(COLUMNNAME_OnWednesday); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Gültig ab. @param ValidFrom Gültig ab inklusiv (erster Tag) */ @Override public void setValidFrom (java.sql.Timestamp ValidFrom) { set_Value (COLUMNNAME_ValidFrom, ValidFrom); } /** Get Gültig ab. @return Gültig ab inklusiv (erster Tag) */ @Override public java.sql.Timestamp getValidFrom () { return (java.sql.Timestamp)get_Value(COLUMNNAME_ValidFrom); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Phonecall_Schema_Version.java
1
请完成以下Java代码
public void setInterrupting(boolean isInterrupting) { this.isInterrupting = isInterrupting; } public List<FormProperty> getFormProperties() { return formProperties; } public void setFormProperties(List<FormProperty> formProperties) { this.formProperties = formProperties; } public String getValidateFormFields() { return validateFormFields; } public void setValidateFormFields(String validateFormFields) { this.validateFormFields = validateFormFields; } @Override public StartEvent clone() { StartEvent clone = new StartEvent(); clone.setValues(this); return clone;
} public void setValues(StartEvent otherEvent) { super.setValues(otherEvent); setInitiator(otherEvent.getInitiator()); setFormKey(otherEvent.getFormKey()); setSameDeployment(otherEvent.isInterrupting); setInterrupting(otherEvent.isInterrupting); setValidateFormFields(otherEvent.validateFormFields); formProperties = new ArrayList<>(); if (otherEvent.getFormProperties() != null && !otherEvent.getFormProperties().isEmpty()) { for (FormProperty property : otherEvent.getFormProperties()) { formProperties.add(property.clone()); } } } }
repos\flowable-engine-main\modules\flowable-bpmn-model\src\main\java\org\flowable\bpmn\model\StartEvent.java
1
请在Spring Boot框架中完成以下Java代码
public void processUsingApproachFivePublishingToDifferentParallelThreads(Flux<Foo> flux) { LOGGER.info("starting approach five-parallel!"); flux.map(FooNameHelper::concatAndSubstringFooName) .publishOn(Schedulers.newParallel("five-parallel-foo")) .log() .map(FooNameHelper::concatAndSubstringFooName) .map(foo -> reportResult(foo, "FIVE-PARALLEL")) .publishOn(Schedulers.newSingle("five-parallel-bar")) .map(FooNameHelper::concatAndSubstringFooName) .doOnError(error -> LOGGER.error("Approach 5-parallel failed!", error)) .subscribeOn(Schedulers.newParallel("five-parallel-starter")) .subscribe(); } public void processUsingApproachFivePublishingToDifferentSingleThreads(Flux<Foo> flux) { LOGGER.info("starting approach five-single!");
flux.log() .subscribeOn(Schedulers.newSingle("five-single-starter")) .map(FooNameHelper::concatAndSubstringFooName) .publishOn(Schedulers.newSingle("five-single-foo")) .map(FooNameHelper::concatAndSubstringFooName) .map(FooQuantityHelper::divideFooQuantity) .map(foo -> reportResult(foo, "FIVE-SINGLE")) .publishOn(Schedulers.newSingle("five-single-bar")) .map(FooNameHelper::concatAndSubstringFooName) .doOnError(error -> LOGGER.error("Approach 5-single failed!", error)) .subscribe(); } }
repos\tutorials-master\spring-reactive-modules\spring-reactive\src\main\java\com\baeldung\reactive\debugging\consumer\service\FooService.java
2
请完成以下Java代码
final class ReflectiveMethodAuthorizationDeniedHandler implements MethodAuthorizationDeniedHandler { private final Log logger = LogFactory.getLog(getClass()); private final Class<?> targetClass; private final Class<?> managerClass; ReflectiveMethodAuthorizationDeniedHandler(Class<?> targetClass, Class<?> managerClass) { this.logger.debug( "Will attempt to instantiate handlerClass attributes using reflection since no application context was supplied to " + managerClass); this.targetClass = targetClass; this.managerClass = managerClass; } @Override public @Nullable Object handleDeniedInvocation(MethodInvocation methodInvocation, AuthorizationResult authorizationResult) { return constructMethodAuthorizationDeniedHandler().handleDeniedInvocation(methodInvocation, authorizationResult); } @Override public @Nullable Object handleDeniedInvocationResult(MethodInvocationResult methodInvocationResult, AuthorizationResult authorizationResult) { return constructMethodAuthorizationDeniedHandler().handleDeniedInvocationResult(methodInvocationResult, authorizationResult);
} private MethodAuthorizationDeniedHandler constructMethodAuthorizationDeniedHandler() { try { return ((MethodAuthorizationDeniedHandler) this.targetClass.getConstructor().newInstance()); } catch (Exception ex) { throw new IllegalArgumentException("Failed to construct instance of " + this.targetClass + ". Please either add a public default constructor to the class " + " or publish an instance of it as a Spring bean. If you publish it as a Spring bean, " + " either add `@EnableMethodSecurity` to your configuration or " + " provide the `ApplicationContext` directly to " + this.managerClass, ex); } } }
repos\spring-security-main\core\src\main\java\org\springframework\security\authorization\method\ReflectiveMethodAuthorizationDeniedHandler.java
1
请在Spring Boot框架中完成以下Java代码
public void setCallbackType(String callbackType) { this.callbackType = callbackType; } @ApiModelProperty(example = "123") public String getReferenceId() { return referenceId; } public void setReferenceId(String referenceId) { this.referenceId = referenceId; } @ApiModelProperty(example = "event-to-cmmn-1.1-case") public String getReferenceType() { return referenceType; } public void setReferenceType(String referenceType) { this.referenceType = referenceType; } public List<RestVariable> getVariables() { return variables; } public void setVariables(List<RestVariable> variables) { this.variables = variables; }
public void addVariable(RestVariable variable) { variables.add(variable); } public void setTenantId(String tenantId) { this.tenantId = tenantId; } @ApiModelProperty(example = "null") public String getTenantId() { return tenantId; } public boolean isCompleted() { return completed; } public void setCompleted(boolean completed) { this.completed = completed; } }
repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\runtime\caze\CaseInstanceResponse.java
2
请完成以下Java代码
public final void dispose() { if(_disposed) { return; } _disposed = true; super.dispose(); if (!m_accept) { cmd_reject(); } final JFrame dummyParentFrame = getOwner(); dummyParentFrame.dispose(); } private boolean _disposed = false; /** * @return our dummy parent frame * @see #createDummyParentFrame() */ @Override public JFrame getOwner() { return (JFrame) super.getOwner(); }
/** * Is Accepted * * @return true if accepted */ public final boolean isAccepted() { return m_accept; } // isAccepted /** * Reject License */ public final void cmd_reject() { String info = "License rejected or expired"; try { info = s_res.getString("License_rejected"); } catch (Exception e) { } log.error(info); System.exit(10); } // cmd_reject } // IniDialog
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\util\IniDialog.java
1
请完成以下Java代码
public void setC_Workplace_ID (final int C_Workplace_ID) { if (C_Workplace_ID < 1) set_Value (COLUMNNAME_C_Workplace_ID, null); else set_Value (COLUMNNAME_C_Workplace_ID, C_Workplace_ID); } @Override public int getC_Workplace_ID() { return get_ValueAsInt(COLUMNNAME_C_Workplace_ID); } @Override public void setC_Workplace_ProductCategory_ID (final int C_Workplace_ProductCategory_ID) { if (C_Workplace_ProductCategory_ID < 1) set_ValueNoCheck (COLUMNNAME_C_Workplace_ProductCategory_ID, null); else set_ValueNoCheck (COLUMNNAME_C_Workplace_ProductCategory_ID, C_Workplace_ProductCategory_ID); } @Override public int getC_Workplace_ProductCategory_ID() { return get_ValueAsInt(COLUMNNAME_C_Workplace_ProductCategory_ID);
} @Override public void setM_Product_Category_ID (final 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, M_Product_Category_ID); } @Override public int getM_Product_Category_ID() { return get_ValueAsInt(COLUMNNAME_M_Product_Category_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Workplace_ProductCategory.java
1
请完成以下Java代码
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ProductQty other = (ProductQty)obj; if (productId != other.productId) return false; if (qty == null) { if (other.qty != null) return false; } else if (!qty.equals(other.qty)) return false; return true; }
@Override public String toString() { return "ProductQty [productId=" + productId + ", qty=" + qty + "]"; } public int getProductId() { return productId; } public BigDecimal getQty() { return qty; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\adempiere\model\ProductQty.java
1
请在Spring Boot框架中完成以下Java代码
public class PermissionInterceptor implements AsyncHandlerInterceptor { @Resource private LoginService loginService; @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { if (!(handler instanceof HandlerMethod)) { return true; // proceed with the next interceptor } // if need login boolean needLogin = true; boolean needAdminuser = false; HandlerMethod method = (HandlerMethod)handler; PermissionLimit permission = method.getMethodAnnotation(PermissionLimit.class); if (permission!=null) { needLogin = permission.limit();
needAdminuser = permission.adminuser(); } if (needLogin) { XxlJobUser loginUser = loginService.ifLogin(request, response); if (loginUser == null) { response.setStatus(302); response.setHeader("location", request.getContextPath()+"/toLogin"); return false; } if (needAdminuser && loginUser.getRole()!=1) { throw new RuntimeException(I18nUtil.getString("system_permission_limit")); } request.setAttribute(LoginService.LOGIN_IDENTITY_KEY, loginUser); } return true; // proceed with the next interceptor } }
repos\JeecgBoot-main\jeecg-boot\jeecg-server-cloud\jeecg-visual\jeecg-cloud-xxljob\src\main\java\com\xxl\job\admin\controller\interceptor\PermissionInterceptor.java
2
请完成以下Java代码
private AdWindowId getCustomizationWindowId(@Nullable final AdWindowId adWindowId) { return adWindowId != null ? customizedWindowInfoMap.getCustomizedWindowInfo(adWindowId).map(CustomizedWindowInfo::getCustomizationWindowId).orElse(adWindowId) : null; } public Builder setSourceRoleDisplayName(final ITranslatableString sourceRoleDisplayName) { this.sourceRoleDisplayName = sourceRoleDisplayName; return this; } public Builder setTarget_Reference_AD(final int targetReferenceId) { this.targetReferenceId = ReferenceId.ofRepoIdOrNull(targetReferenceId); targetTableRefInfo = null; // lazy return this; } private ReferenceId getTarget_Reference_ID() { return Check.assumeNotNull(targetReferenceId, "targetReferenceId is set"); } private ADRefTable getTargetTableRefInfoOrNull() { if (targetTableRefInfo == null) { targetTableRefInfo = retrieveTableRefInfo(getTarget_Reference_ID()); } return targetTableRefInfo; } public Builder setTargetRoleDisplayName(final ITranslatableString targetRoleDisplayName) { this.targetRoleDisplayName = targetRoleDisplayName; return this;
} public ITranslatableString getTargetRoleDisplayName() { return targetRoleDisplayName; } public Builder setIsTableRecordIdTarget(final boolean isReferenceTarget) { isTableRecordIDTarget = isReferenceTarget; return this; } private boolean isTableRecordIdTarget() { return isTableRecordIDTarget; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\document\references\related_documents\relation_type\SpecificRelationTypeRelatedDocumentsProvider.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(); } /** Set Referenced Document. @param C_ReferenceNo_Doc_ID Referenced Document */ @Override public void setC_ReferenceNo_Doc_ID (int C_ReferenceNo_Doc_ID) { if (C_ReferenceNo_Doc_ID < 1) set_ValueNoCheck (COLUMNNAME_C_ReferenceNo_Doc_ID, null); else set_ValueNoCheck (COLUMNNAME_C_ReferenceNo_Doc_ID, Integer.valueOf(C_ReferenceNo_Doc_ID)); } /** Get Referenced Document. @return Referenced Document */ @Override public int getC_ReferenceNo_Doc_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_ReferenceNo_Doc_ID); if (ii == null) return 0; return ii.intValue(); } @Override public de.metas.document.refid.model.I_C_ReferenceNo getC_ReferenceNo() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_C_ReferenceNo_ID, de.metas.document.refid.model.I_C_ReferenceNo.class); } @Override public void setC_ReferenceNo(de.metas.document.refid.model.I_C_ReferenceNo C_ReferenceNo) { set_ValueFromPO(COLUMNNAME_C_ReferenceNo_ID, de.metas.document.refid.model.I_C_ReferenceNo.class, C_ReferenceNo); } /** Set Reference No. @param C_ReferenceNo_ID Reference No */ @Override public void setC_ReferenceNo_ID (int C_ReferenceNo_ID) { if (C_ReferenceNo_ID < 1) set_ValueNoCheck (COLUMNNAME_C_ReferenceNo_ID, null);
else set_ValueNoCheck (COLUMNNAME_C_ReferenceNo_ID, Integer.valueOf(C_ReferenceNo_ID)); } /** Get Reference No. @return Reference No */ @Override public int getC_ReferenceNo_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_ReferenceNo_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.document.refid\src\main\java-gen\de\metas\document\refid\model\X_C_ReferenceNo_Doc.java
1
请完成以下Java代码
public boolean isDisplayedUI(final I_M_Attribute attribute, final Set<ProductId> productIds) { return false; } @Override public boolean isMandatory(final @NonNull I_M_Attribute attribute, final Set<ProductId> productIds, final boolean isMaterialReceipt) { return false; } @Override public void pushUp() { // nothing } @Override public void pushUpRollback() { // nothing } @Override public void pushDown() { // nothing } @Override public void saveChangesIfNeeded() { // nothing // NOTE: not throwing UnsupportedOperationException because this storage contains no attributes so it will never have something to change } @Override public void setSaveOnChange(final boolean saveOnChange) { // nothing // NOTE: not throwing UnsupportedOperationException because this storage contains no attributes so it will never have something to change } @Override public IAttributeStorageFactory getAttributeStorageFactory() { throw new UnsupportedOperationException(); } @Nullable @Override public UOMType getQtyUOMTypeOrNull() { // no UOMType available return null; }
@Override public String toString() { return "NullAttributeStorage []"; } @Override public BigDecimal getStorageQtyOrZERO() { // no storage quantity available; assume ZERO return BigDecimal.ZERO; } /** * @return <code>false</code>. */ @Override public boolean isVirtual() { return false; } @Override public boolean isNew(final I_M_Attribute attribute) { throw new AttributeNotFoundException(attribute, this); } /** * @return true, i.e. never disposed */ @Override public boolean assertNotDisposed() { return true; // not disposed } @Override public boolean assertNotDisposedTree() { return true; // not disposed } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\attribute\storage\impl\NullAttributeStorage.java
1
请完成以下Java代码
public List<Map.Entry<String, Double>> getKeywordsOf(Object id) { return getKeywordsOf(id, 10); } public List<Map.Entry<String, Double>> getKeywordsOf(Object id, int size) { Map<String, Double> tfidfs = tfidfMap.get(id); if (tfidfs == null) return null; return topN(tfidfs, size); } private List<Map.Entry<String, Double>> topN(Map<String, Double> tfidfs, int size) { MaxHeap<Map.Entry<String, Double>> heap = new MaxHeap<Map.Entry<String, Double>>(size, new Comparator<Map.Entry<String, Double>>() { @Override public int compare(Map.Entry<String, Double> o1, Map.Entry<String, Double> o2) { return o1.getValue().compareTo(o2.getValue()); } }); heap.addAll(tfidfs.entrySet()); return heap.toList(); } public Set<Object> documents() { return tfMap.keySet(); } public Map<Object, Map<String, Double>> getTfMap() { return tfMap; } public List<Map.Entry<String, Double>> sortedAllTf() { return sort(allTf()); } public List<Map.Entry<String, Integer>> sortedAllTfInt() { return doubleToInteger(sortedAllTf()); }
public Map<String, Double> allTf() { Map<String, Double> result = new HashMap<String, Double>(); for (Map<String, Double> d : tfMap.values()) { for (Map.Entry<String, Double> tf : d.entrySet()) { Double f = result.get(tf.getKey()); if (f == null) { result.put(tf.getKey(), tf.getValue()); } else { result.put(tf.getKey(), f + tf.getValue()); } } } return result; } private static List<Map.Entry<String, Double>> sort(Map<String, Double> map) { List<Map.Entry<String, Double>> list = new ArrayList<Map.Entry<String, Double>>(map.entrySet()); Collections.sort(list, new Comparator<Map.Entry<String, Double>>() { @Override public int compare(Map.Entry<String, Double> o1, Map.Entry<String, Double> o2) { return o2.getValue().compareTo(o1.getValue()); } }); return list; } private static List<Map.Entry<String, Integer>> doubleToInteger(List<Map.Entry<String, Double>> list) { List<Map.Entry<String, Integer>> result = new ArrayList<Map.Entry<String, Integer>>(list.size()); for (Map.Entry<String, Double> entry : list) { result.add(new AbstractMap.SimpleEntry<String, Integer>(entry.getKey(), entry.getValue().intValue())); } return result; } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\mining\word\TfIdfCounter.java
1
请完成以下Java代码
public class DmnTypeDefinitionImpl implements DmnTypeDefinition { protected static final DmnEngineLogger LOG = DmnLogger.ENGINE_LOGGER; protected String typeName; protected DmnDataTypeTransformer transformer; public DmnTypeDefinitionImpl(String typeName, DmnDataTypeTransformer transformer) { this.typeName = typeName; this.transformer = transformer; } @Override public TypedValue transform(Object value) { if (value == null) { return Variables.untypedNullValue(); } else { return transformNotNullValue(value); } } protected TypedValue transformNotNullValue(Object value) { ensureNotNull("transformer", transformer); try { return transformer.transform(value); } catch (IllegalArgumentException e) { throw LOG.invalidValueForTypeDefinition(typeName, value); } } public String getTypeName() { return typeName; }
public void setTypeName(String typeName) { this.typeName = typeName; } public void setTransformer(DmnDataTypeTransformer transformer) { this.transformer = transformer; } @Override public String toString() { return "DmnTypeDefinitionImpl{" + "typeName='" + typeName + '\'' + '}'; } }
repos\camunda-bpm-platform-master\engine-dmn\engine\src\main\java\org\camunda\bpm\dmn\engine\impl\type\DmnTypeDefinitionImpl.java
1
请完成以下Java代码
public class EuclideanAlgorithm { public static int gcd(int number1, int number2) { if (number1 == 0 || number2 == 0) { return number1 + number2; } else { int absNumber1 = Math.abs(number1); int absNumber2 = Math.abs(number2); int biggerValue = Math.max(absNumber1, absNumber2); int smallerValue = Math.min(absNumber1, absNumber2); return gcd(biggerValue % smallerValue, smallerValue); } } public static int lcm(int number1, int number2) { if (number1 == 0 || number2 == 0) return 0; else {
int gcd = gcd(number1, number2); return Math.abs(number1 * number2) / gcd; } } public static int lcmForArray(int[] numbers) { int lcm = numbers[0]; for (int i = 1; i <= numbers.length - 1; i++) { lcm = lcm(lcm, numbers[i]); } return lcm; } public static int lcmByLambda(int... numbers) { return Arrays.stream(numbers).reduce(1, (lcmSoFar, currentNumber) -> Math.abs(lcmSoFar * currentNumber) / gcd(lcmSoFar, currentNumber)); } }
repos\tutorials-master\core-java-modules\core-java-numbers-2\src\main\java\com\baeldung\lcm\EuclideanAlgorithm.java
1
请在Spring Boot框架中完成以下Java代码
public String getRegisterTimeStart() { return registerTimeStart; } public void setRegisterTimeStart(String registerTimeStart) { this.registerTimeStart = registerTimeStart; } public String getRegisterTimeEnd() { return registerTimeEnd; } public void setRegisterTimeEnd(String registerTimeEnd) { this.registerTimeEnd = registerTimeEnd; } public Integer getOrderByRegisterTime() { return orderByRegisterTime; } public void setOrderByRegisterTime(Integer orderByRegisterTime) { this.orderByRegisterTime = orderByRegisterTime; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @Override public String toString() { return "UserQueryReq{" + "id='" + id + '\'' +
", username='" + username + '\'' + ", password='" + password + '\'' + ", phone='" + phone + '\'' + ", mail='" + mail + '\'' + ", registerTimeStart='" + registerTimeStart + '\'' + ", registerTimeEnd='" + registerTimeEnd + '\'' + ", userType=" + userType + ", userState=" + userState + ", roleId='" + roleId + '\'' + ", orderByRegisterTime=" + orderByRegisterTime + ", page=" + page + ", numPerPage=" + numPerPage + '}'; } }
repos\SpringBoot-Dubbo-Docker-Jenkins-master\Gaoxi-Common-Service-Facade\src\main\java\com\gaoxi\req\user\UserQueryReq.java
2
请完成以下Java代码
public AlbertaUser save(final @NonNull AlbertaUser user) { final I_AD_User_Alberta record = InterfaceWrapperHelper.loadOrNew(user.getUserAlbertaId(), I_AD_User_Alberta.class); record.setAD_User_ID(user.getUserId().getRepoId()); record.setTimestamp(TimeUtil.asTimestamp(user.getTimestamp())); record.setTitle(user.getTitle() != null ? user.getTitle().getCode() : null); record.setGender(user.getGender() != null ? user.getGender().getCode() : null); InterfaceWrapperHelper.save(record); return toAlbertaUser(record); } @NonNull public Optional<AlbertaUser> getByUserId(final @NonNull UserId userId) { return queryBL.createQueryBuilder(I_AD_User_Alberta.class) .addOnlyActiveRecordsFilter() .addEqualsFilter(I_AD_User_Alberta.COLUMNNAME_AD_User_ID, userId) .create() .firstOnlyOptional(I_AD_User_Alberta.class) .map(this::toAlbertaUser);
} @NonNull public AlbertaUser toAlbertaUser(final @NonNull I_AD_User_Alberta record) { final UserAlbertaId userAlbertaId = UserAlbertaId.ofRepoId(record.getAD_User_Alberta_ID()); final UserId userId = UserId.ofRepoId(record.getAD_User_ID()); return AlbertaUser.builder() .userAlbertaId(userAlbertaId) .userId(userId) .title(TitleType.ofCodeNullable(record.getTitle())) .gender(GenderType.ofCodeNullable(record.getGender())) .timestamp(TimeUtil.asInstant(record.getTimestamp())) .build(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.healthcare.alberta\src\main\java\de\metas\vertical\healthcare\alberta\bpartner\user\AlbertaUserRepository.java
1
请完成以下Java代码
public class CorrelationHandlerResult { /** * @see MessageCorrelationResultType#Execution * @see MessageCorrelationResultType#ProcessDefinition */ protected MessageCorrelationResultType resultType; protected ExecutionEntity executionEntity; protected ProcessDefinitionEntity processDefinitionEntity; protected String startEventActivityId; public static CorrelationHandlerResult matchedExecution(ExecutionEntity executionEntity) { CorrelationHandlerResult messageCorrelationResult = new CorrelationHandlerResult(); messageCorrelationResult.resultType = MessageCorrelationResultType.Execution; messageCorrelationResult.executionEntity = executionEntity; return messageCorrelationResult; } public static CorrelationHandlerResult matchedProcessDefinition(ProcessDefinitionEntity processDefinitionEntity, String startEventActivityId) { CorrelationHandlerResult messageCorrelationResult = new CorrelationHandlerResult(); messageCorrelationResult.processDefinitionEntity = processDefinitionEntity; messageCorrelationResult.startEventActivityId = startEventActivityId; messageCorrelationResult.resultType = MessageCorrelationResultType.ProcessDefinition; return messageCorrelationResult; }
// getters //////////////////////////////////////////// public ExecutionEntity getExecutionEntity() { return executionEntity; } public ProcessDefinitionEntity getProcessDefinitionEntity() { return processDefinitionEntity; } public String getStartEventActivityId() { return startEventActivityId; } public MessageCorrelationResultType getResultType() { return resultType; } public Execution getExecution() { return executionEntity; } public ProcessDefinition getProcessDefinition() { return processDefinitionEntity; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\runtime\CorrelationHandlerResult.java
1
请完成以下Java代码
public boolean removeContainer(MessageListenerContainer container) { return this.containers.remove(container); } @Override public synchronized void start() { if (!this.running) { this.containers.forEach(container -> { LOGGER.debug(() -> "Starting: " + container); container.start(); }); this.running = true; } } @Override public synchronized void stop() { if (this.running) { this.containers.forEach(container -> container.stop());
this.running = false; } } @Override public synchronized boolean isRunning() { return this.running; } @Override public String toString() { return "ContainerGroup [name=" + this.name + ", containers=" + this.containers + "]"; } }
repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\listener\ContainerGroup.java
1
请完成以下Java代码
public void setCurrentLifecycleListener(PlanItemInstanceLifecycleListener lifecycleListener, FlowableListener flowableListener) { this.currentLifecycleListener = lifecycleListener; this.currentFlowableListener = flowableListener; } public String getLocalizedName() { return localizedName; } @Override public void setLocalizedName(String localizedName) { this.localizedName = localizedName; } @Override public boolean isPlannedForActivationInMigration() { return plannedForActivationInMigration; } @Override public void setPlannedForActivationInMigration(boolean plannedForActivationInMigration) { this.plannedForActivationInMigration = plannedForActivationInMigration; } @Override public boolean isStateChangeUnprocessed() { return stateChangeUnprocessed; } @Override public void setStateChangeUnprocessed(boolean stateChangeUnprocessed) { this.stateChangeUnprocessed = stateChangeUnprocessed; } @Override public Map<String, Object> getPlanItemInstanceLocalVariables() { Map<String, Object> variables = new HashMap<>(); if (queryVariables != null) { for (VariableInstance variableInstance : queryVariables) { if (variableInstance.getId() != null && variableInstance.getSubScopeId() != null) { variables.put(variableInstance.getName(), variableInstance.getValue()); } } } return variables; } @Override public List<VariableInstanceEntity> getQueryVariables() { if (queryVariables == null && Context.getCommandContext() != null) { queryVariables = new VariableInitializingList(); } return queryVariables; }
public void setQueryVariables(List<VariableInstanceEntity> queryVariables) { this.queryVariables = queryVariables; } @Override public String toString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("PlanItemInstance with id: ") .append(id); if (getName() != null) { stringBuilder.append(", name: ").append(getName()); } stringBuilder.append(", definitionId: ") .append(planItemDefinitionId) .append(", state: ") .append(state); if (elementId != null) { stringBuilder.append(", elementId: ").append(elementId); } stringBuilder .append(", caseInstanceId: ") .append(caseInstanceId) .append(", caseDefinitionId: ") .append(caseDefinitionId); if (StringUtils.isNotEmpty(tenantId)) { stringBuilder.append(", tenantId=").append(tenantId); } return stringBuilder.toString(); } }
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\persistence\entity\PlanItemInstanceEntityImpl.java
1
请在Spring Boot框架中完成以下Java代码
public Deployment deploy(String url, String name, String category) { Deployment deploy = createDeployment().addClasspathResource(url).name(name).category(category).deploy(); return deploy; } @Override public Deployment deploy(String url, String pngUrl, String name, String category) { Deployment deploy = createDeployment().addClasspathResource(url).addClasspathResource(pngUrl) .name(name).category(category).deploy(); return deploy; } @Override public boolean exist(String processDefinitionKey) { ProcessDefinitionQuery processDefinitionQuery = createProcessDefinitionQuery().processDefinitionKey(processDefinitionKey); long count = processDefinitionQuery.count(); return count > 0 ? true : false; } @Override public Deployment deploy(String name, String tenantId, String category, InputStream in) { return createDeployment().addInputStream(name + BPMN_FILE_SUFFIX, in) .name(name) .tenantId(tenantId) .category(category) .deploy(); } @Override public ProcessDefinition queryByProcessDefinitionKey(String processDefinitionKey) {
ProcessDefinition processDefinition = createProcessDefinitionQuery() .processDefinitionKey(processDefinitionKey) .active().singleResult(); return processDefinition; } @Override public Deployment deployName(String deploymentName) { List<Deployment> list = repositoryService .createDeploymentQuery() .deploymentName(deploymentName).list(); Assert.notNull(list, "list must not be null"); return list.get(0); } @Override public void addCandidateStarterUser(String processDefinitionKey, String userId) { repositoryService.addCandidateStarterUser(processDefinitionKey, userId); } }
repos\spring-boot-quick-master\quick-flowable\src\main\java\com\quick\flowable\service\handler\ProcessHandler.java
2
请完成以下Java代码
public void setProcessing (final boolean Processing) { set_Value (COLUMNNAME_Processing, Processing); } @Override public boolean isProcessing() { return get_ValueAsBoolean(COLUMNNAME_Processing); } @Override public void setRegistry (final @Nullable java.lang.String Registry) { set_Value (COLUMNNAME_Registry, Registry); } @Override public java.lang.String getRegistry() { return get_ValueAsString(COLUMNNAME_Registry); } @Override public void setSecretKey_2FA (final @Nullable java.lang.String SecretKey_2FA) { set_Value (COLUMNNAME_SecretKey_2FA, SecretKey_2FA); } @Override public java.lang.String getSecretKey_2FA() { return get_ValueAsString(COLUMNNAME_SecretKey_2FA); } @Override public void setSeqNo (final int SeqNo) { set_Value (COLUMNNAME_SeqNo, SeqNo); } @Override public int getSeqNo() { return get_ValueAsInt(COLUMNNAME_SeqNo); } @Override public void setSupervisor_ID (final int Supervisor_ID) { if (Supervisor_ID < 1) set_Value (COLUMNNAME_Supervisor_ID, null); else set_Value (COLUMNNAME_Supervisor_ID, Supervisor_ID); } @Override public int getSupervisor_ID() { return get_ValueAsInt(COLUMNNAME_Supervisor_ID); }
@Override public void setTimestamp (final @Nullable java.sql.Timestamp Timestamp) { throw new IllegalArgumentException ("Timestamp is virtual column"); } @Override public java.sql.Timestamp getTimestamp() { return get_ValueAsTimestamp(COLUMNNAME_Timestamp); } @Override public void setTitle (final @Nullable java.lang.String Title) { set_Value (COLUMNNAME_Title, Title); } @Override public java.lang.String getTitle() { return get_ValueAsString(COLUMNNAME_Title); } @Override public void setUnlockAccount (final @Nullable java.lang.String UnlockAccount) { set_Value (COLUMNNAME_UnlockAccount, UnlockAccount); } @Override public java.lang.String getUnlockAccount() { return get_ValueAsString(COLUMNNAME_UnlockAccount); } @Override public void setUserPIN (final @Nullable java.lang.String UserPIN) { set_Value (COLUMNNAME_UserPIN, UserPIN); } @Override public java.lang.String getUserPIN() { return get_ValueAsString(COLUMNNAME_UserPIN); } @Override public void setValue (final @Nullable java.lang.String Value) { set_Value (COLUMNNAME_Value, Value); } @Override public java.lang.String getValue() { return get_ValueAsString(COLUMNNAME_Value); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_User.java
1
请完成以下Java代码
public UserEventListenerInstanceQuery planItemDefinitionId(String planItemDefinitionId) { innerQuery.planItemDefinitionId(planItemDefinitionId); return this; } @Override public UserEventListenerInstanceQuery name(String name) { innerQuery.planItemInstanceName(name); return this; } @Override public UserEventListenerInstanceQuery stageInstanceId(String stageInstanceId) { innerQuery.stageInstanceId(stageInstanceId); return this; } @Override public UserEventListenerInstanceQuery stateAvailable() { innerQuery.planItemInstanceStateAvailable(); return this; } @Override public UserEventListenerInstanceQuery stateUnavailable() { innerQuery.planItemInstanceStateUnavailable(); return this; } @Override public UserEventListenerInstanceQuery stateSuspended() { innerQuery.planItemInstanceState(PlanItemInstanceState.SUSPENDED); return this; } @Override public UserEventListenerInstanceQuery orderByName() { innerQuery.orderByName(); return this; } @Override public UserEventListenerInstanceQuery asc() { innerQuery.asc(); return this; } @Override public UserEventListenerInstanceQuery desc() { innerQuery.desc(); return this; } @Override public UserEventListenerInstanceQuery orderBy(QueryProperty property) { innerQuery.orderBy(property); return this; } @Override
public UserEventListenerInstanceQuery orderBy(QueryProperty property, NullHandlingOnOrder nullHandlingOnOrder) { innerQuery.orderBy(property, nullHandlingOnOrder); return this; } @Override public long count() { return innerQuery.count(); } @Override public UserEventListenerInstance singleResult() { PlanItemInstance instance = innerQuery.singleResult(); return UserEventListenerInstanceImpl.fromPlanItemInstance(instance); } @Override public List<UserEventListenerInstance> list() { return convertPlanItemInstances(innerQuery.list()); } @Override public List<UserEventListenerInstance> listPage(int firstResult, int maxResults) { return convertPlanItemInstances(innerQuery.listPage(firstResult, maxResults)); } protected List<UserEventListenerInstance> convertPlanItemInstances(List<PlanItemInstance> instances) { if (instances == null) { return null; } return instances.stream().map(UserEventListenerInstanceImpl::fromPlanItemInstance).collect(Collectors.toList()); } }
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\runtime\UserEventListenerInstanceQueryImpl.java
1
请完成以下Java代码
public void setDiffFromPrevDay(int diffFromPrevDay) { this.diffFromPrevDay = diffFromPrevDay; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public int getLatestTotalCases() { return latestTotalCases;
} public void setLatestTotalCases(int latestTotalCases) { this.latestTotalCases = latestTotalCases; } @Override public String toString() { return "LocationStats{" + "state='" + state + '\'' + ", country='" + country + '\'' + ", latestTotalCases=" + latestTotalCases + '}'; } }
repos\Spring-Boot-Advanced-Projects-main\spring covid-19\src\main\java\io\alanbinu\coronavirustracker\models\LocationStats.java
1
请完成以下Java代码
private Optional<CashBalance3> findOPBDCashBalance() { return accountStatement2.getBal() .stream() .filter(AccountStatement2Wrapper::isOPBDCashBalance) .findFirst(); } @NonNull private Optional<CashBalance3> findPRCDCashBalance() { return accountStatement2.getBal() .stream() .filter(AccountStatement2Wrapper::isPRCDCashBalance) .findFirst(); } private static boolean isPRCDCashBalance(@NonNull final CashBalance3 cashBalance)
{ final BalanceType12Code balanceTypeCode = cashBalance.getTp().getCdOrPrtry().getCd(); return BalanceType12Code.PRCD.equals(balanceTypeCode); } private static boolean isOPBDCashBalance(@NonNull final CashBalance3 cashBalance) { final BalanceType12Code balanceTypeCode = cashBalance.getTp().getCdOrPrtry().getCd(); return BalanceType12Code.OPBD.equals(balanceTypeCode); } private static boolean isCRDTCashBalance(@NonNull final CashBalance3 cashBalance) { return CRDT.equals(cashBalance.getCdtDbtInd()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java\de\metas\banking\camt53\wrapper\v02\AccountStatement2Wrapper.java
1
请完成以下Java代码
public final class TenantId extends UUIDBased implements EntityId { @JsonIgnore static final ConcurrentReferenceHashMap<UUID, TenantId> tenants = new ConcurrentReferenceHashMap<>(16, ReferenceType.SOFT); @JsonIgnore public static final TenantId SYS_TENANT_ID = TenantId.fromUUID(EntityId.NULL_UUID); @Serial private static final long serialVersionUID = 1L; @JsonCreator public static TenantId fromUUID(@JsonProperty("id") UUID id) { return tenants.computeIfAbsent(id, TenantId::new); } // Please, use TenantId.fromUUID instead // Default constructor is still available due to possible usage in extensions
@Deprecated public TenantId(UUID id) { super(id); } @JsonIgnore public boolean isSysTenantId() { return this.equals(SYS_TENANT_ID); } @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "string", example = "TENANT", allowableValues = "TENANT") @Override public EntityType getEntityType() { return EntityType.TENANT; } }
repos\thingsboard-master\common\data\src\main\java\org\thingsboard\server\common\data\id\TenantId.java
1
请完成以下Java代码
public void setAD_Sequence_ProjectValue_ID (final int AD_Sequence_ProjectValue_ID) { if (AD_Sequence_ProjectValue_ID < 1) set_Value (COLUMNNAME_AD_Sequence_ProjectValue_ID, null); else set_Value (COLUMNNAME_AD_Sequence_ProjectValue_ID, AD_Sequence_ProjectValue_ID); } @Override public int getAD_Sequence_ProjectValue_ID() { return get_ValueAsInt(COLUMNNAME_AD_Sequence_ProjectValue_ID); } @Override public void setC_ProjectType_ID (final int C_ProjectType_ID) { if (C_ProjectType_ID < 1) set_ValueNoCheck (COLUMNNAME_C_ProjectType_ID, null); else set_ValueNoCheck (COLUMNNAME_C_ProjectType_ID, C_ProjectType_ID); } @Override public int getC_ProjectType_ID() { return get_ValueAsInt(COLUMNNAME_C_ProjectType_ID); } @Override public void setDescription (final @Nullable java.lang.String Description) { set_Value (COLUMNNAME_Description, Description); } @Override public java.lang.String getDescription() { return get_ValueAsString(COLUMNNAME_Description); } @Override public void setHelp (final @Nullable java.lang.String Help) { set_Value (COLUMNNAME_Help, Help); } @Override public java.lang.String getHelp() { return get_ValueAsString(COLUMNNAME_Help); } @Override public void setName (final java.lang.String Name) { set_Value (COLUMNNAME_Name, Name);
} @Override public java.lang.String getName() { return get_ValueAsString(COLUMNNAME_Name); } /** * ProjectCategory AD_Reference_ID=288 * Reference name: C_ProjectType Category */ public static final int PROJECTCATEGORY_AD_Reference_ID=288; /** General = N */ public static final String PROJECTCATEGORY_General = "N"; /** AssetProject = A */ public static final String PROJECTCATEGORY_AssetProject = "A"; /** WorkOrderJob = W */ public static final String PROJECTCATEGORY_WorkOrderJob = "W"; /** ServiceChargeProject = S */ public static final String PROJECTCATEGORY_ServiceChargeProject = "S"; /** ServiceOrRepair = R */ public static final String PROJECTCATEGORY_ServiceOrRepair = "R"; /** SalesPurchaseOrder = O */ public static final String PROJECTCATEGORY_SalesPurchaseOrder = "O"; @Override public void setProjectCategory (final java.lang.String ProjectCategory) { set_ValueNoCheck (COLUMNNAME_ProjectCategory, ProjectCategory); } @Override public java.lang.String getProjectCategory() { return get_ValueAsString(COLUMNNAME_ProjectCategory); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_ProjectType.java
1
请完成以下Java代码
public String getDisplay() { return getText(); } // getDisplay /** * key Pressed * @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent) * @param e */ @Override public void keyPressed(KeyEvent e) { } // keyPressed /** * key Released * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent) * @param e */ @Override public void keyReleased(KeyEvent e) { } // keyReleased
/** * key Typed * @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent) * @param e */ @Override public void keyTyped(KeyEvent e) { } // keyTyped @Override public final ICopyPasteSupportEditor getCopyPasteSupport() { return copyPasteSupport; } @Override public boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) { // NOTE: overridden just to make it public return super.processKeyBinding(ks, e, condition, pressed); } } // CTextField
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\swing\CTextField.java
1