instruction
string
input
string
output
string
source_file
string
priority
int64
请完成以下Java代码
private Object retrieveRowIdPart(final ResultSet rs, final String columnName, final Class<?> sqlValueClass) { try { if (Integer.class.equals(sqlValueClass) || int.class.equals(sqlValueClass)) { final int rowIdPart = rs.getInt(columnName); if (rs.wasNull()) { return null; } return rowIdPart; } else if (String.class.equals(sqlValueClass)) { return rs.getString(columnName); } else { throw new AdempiereException("Unsupported type " + sqlValueClass + " for " + columnName); } } catch (final SQLException ex) { throw new DBException("Failed fetching " + columnName + " (" + sqlValueClass + ")", ex); } }
@Value @Builder private static class KeyColumnNameInfo { @NonNull String keyColumnName; @NonNull String webuiSelectionColumnName; boolean isNullable; public String getEffectiveColumnName(@NonNull final MappingType mappingType) { if (mappingType == MappingType.SOURCE_TABLE) { return keyColumnName; } else if (mappingType == MappingType.WEBUI_SELECTION_TABLE) { return webuiSelectionColumnName; } else { // shall not happen throw new AdempiereException("Unknown mapping type: " + mappingType); } } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\view\descriptor\SqlViewKeyColumnNamesMap.java
1
请完成以下Java代码
public void setDivideAlphabetic(double divideAlphabetic) { this.divideAlphabetic = divideAlphabetic; } public double getModulo() { return modulo; } public void setModulo(double modulo) { this.modulo = modulo; } public double getModuloAlphabetic() { return moduloAlphabetic; } public void setModuloAlphabetic(double moduloAlphabetic) { this.moduloAlphabetic = moduloAlphabetic; } public double getPowerOf() { return powerOf; } public void setPowerOf(double powerOf) { this.powerOf = powerOf; } public double getBrackets() { return brackets; }
public void setBrackets(double brackets) { this.brackets = brackets; } @Override public String toString() { return "SpelArithmetic{" + "add=" + add + ", addString='" + addString + '\'' + ", subtract=" + subtract + ", multiply=" + multiply + ", divide=" + divide + ", divideAlphabetic=" + divideAlphabetic + ", modulo=" + modulo + ", moduloAlphabetic=" + moduloAlphabetic + ", powerOf=" + powerOf + ", brackets=" + brackets + '}'; } }
repos\tutorials-master\spring-spel\src\main\java\com\baeldung\spring\spel\examples\SpelArithmetic.java
1
请在Spring Boot框架中完成以下Java代码
public class CreateFlatrateTermRequest { @NonNull IContextAware context; @NonNull OrgId orgId; /** * the partner to be used as <code>Bill_BPartner</code> and <code>DropShip_BPartner</code>. Also this partner's sales rep and billto location are used. */ @NonNull I_C_BPartner bPartner; @NonNull I_C_Flatrate_Conditions conditions; /** * the start date for the new term */ @NonNull Timestamp startDate; @Nullable Timestamp endDate; /**
* may be <code>null</code>. If set, then this value is used for <code>C_FLatrate_Term.AD_User_InCharge_ID</code>. Otherwise, the method tries * <code>C_BPartner.SalesRep_ID</code> */ @Nullable I_AD_User userInCharge; /** * may be <code>null</code>. If set, then this value is used for <code>C_Flatrate_Term.M_Product_ID</code>. */ @Nullable ProductAndCategoryId productAndCategoryId; boolean isSimulation; /** * if <code>true</code>, then attempt to complete the new term */ boolean completeIt; }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\FlatrateTermRequest\CreateFlatrateTermRequest.java
2
请完成以下Java代码
public BpmnModel getBpmnModel() { return bpmnModel; } public void setBpmnModel(BpmnModel bpmnModel) { this.bpmnModel = bpmnModel; } public ActivityBehaviorFactory getActivityBehaviorFactory() { return activityBehaviorFactory; } public void setActivityBehaviorFactory(ActivityBehaviorFactory activityBehaviorFactory) { this.activityBehaviorFactory = activityBehaviorFactory; } public ListenerFactory getListenerFactory() { return listenerFactory; } public void setListenerFactory(ListenerFactory listenerFactory) { this.listenerFactory = listenerFactory; } public ExpressionManager getExpressionManager() { return expressionManager; } public void setExpressionManager(ExpressionManager expressionManager) { this.expressionManager = expressionManager; } public Map<String, TransitionImpl> getSequenceFlows() { return sequenceFlows; } public ProcessDefinitionEntity getCurrentProcessDefinition() { return currentProcessDefinition; } public void setCurrentProcessDefinition(ProcessDefinitionEntity currentProcessDefinition) { this.currentProcessDefinition = currentProcessDefinition; } public FlowElement getCurrentFlowElement() { return currentFlowElement; } public void setCurrentFlowElement(FlowElement currentFlowElement) { this.currentFlowElement = currentFlowElement; } public ActivityImpl getCurrentActivity() { return currentActivity; } public void setCurrentActivity(ActivityImpl currentActivity) { this.currentActivity = currentActivity; } public void setCurrentSubProcess(SubProcess subProcess) { currentSubprocessStack.push(subProcess);
} public SubProcess getCurrentSubProcess() { return currentSubprocessStack.peek(); } public void removeCurrentSubProcess() { currentSubprocessStack.pop(); } public void setCurrentScope(ScopeImpl scope) { currentScopeStack.push(scope); } public ScopeImpl getCurrentScope() { return currentScopeStack.peek(); } public void removeCurrentScope() { currentScopeStack.pop(); } public BpmnParse setSourceSystemId(String systemId) { sourceSystemId = systemId; return this; } public String getSourceSystemId() { return this.sourceSystemId; } }
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\bpmn\parser\BpmnParse.java
1
请完成以下Java代码
public class JsonAPIResponse { @JsonProperty("res") @Getter(AccessLevel.NONE) private JsonResult res; @JsonProperty("prod") private JsonProduct prod; @JsonProperty("pack") private JsonPackage pack; @JsonProperty("tx") @Getter(AccessLevel.NONE) private JsonTransaction tx; public String getResultCode() { return res != null ? res.getCode() : null; }
public String getResultMessage() { return res != null ? res.getMessage() : null; } public boolean isTransactionSet() { return tx != null; } public String getServerTransactionId() { return tx != null ? tx.getServerTransactionId() : null; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.securpharm\src\main\java\de\metas\vertical\pharma\securpharm\client\schema\JsonAPIResponse.java
1
请完成以下Java代码
public void setDiscountDate (final @Nullable java.sql.Timestamp DiscountDate) { set_Value (COLUMNNAME_DiscountDate, DiscountDate); } @Override public java.sql.Timestamp getDiscountDate() { return get_ValueAsTimestamp(COLUMNNAME_DiscountDate); } @Override public void setDueAmt (final BigDecimal DueAmt) { set_Value (COLUMNNAME_DueAmt, DueAmt); } @Override public BigDecimal getDueAmt() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_DueAmt); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setDueDate (final java.sql.Timestamp DueDate) { set_Value (COLUMNNAME_DueDate, DueDate); } @Override public java.sql.Timestamp getDueDate() { return get_ValueAsTimestamp(COLUMNNAME_DueDate); } @Override public void setIsValid (final boolean IsValid) { set_Value (COLUMNNAME_IsValid, IsValid); }
@Override public boolean isValid() { return get_ValueAsBoolean(COLUMNNAME_IsValid); } @Override public void setProcessed (final boolean Processed) { set_Value (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_C_InvoicePaySchedule.java
1
请完成以下Java代码
public void setPackageSize (java.lang.String PackageSize) { set_Value (COLUMNNAME_PackageSize, PackageSize); } /** Get Pck. Gr.. @return Pck. Gr. */ @Override public java.lang.String getPackageSize () { return (java.lang.String)get_Value(COLUMNNAME_PackageSize); } /** Set Menge. @param Qty Menge */
@Override public void setQty (java.math.BigDecimal Qty) { set_Value (COLUMNNAME_Qty, Qty); } /** Get Menge. @return Menge */ @Override public java.math.BigDecimal getQty () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty); if (bd == null) return BigDecimal.ZERO; return bd; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Shipment_Declaration_Line.java
1
请在Spring Boot框架中完成以下Java代码
public void init() { super.init(getPrefix()); } @AfterStartUp(order = AfterStartUp.REGULAR_SERVICE) @Override public void afterStartUp() { super.afterStartUp(); onStartUp(); startupLock.lock(); try { for (PartitionChangeEvent partitionChangeEvent : pendingEvents) { log.info("Handling partition change event: {}", partitionChangeEvent); try { onPartitionChangeEvent(partitionChangeEvent); } catch (Throwable t) { log.error("Failed to handle partition change event: {}", partitionChangeEvent, t); } } started = true; pendingEvents = null; } finally { startupLock.unlock(); } } @Override protected void onTbApplicationEvent(PartitionChangeEvent event) { log.debug("Received partition change event: {}", event);
if (!started) { startupLock.lock(); try { if (!started) { log.debug("App not started yet, storing event for later: {}", event); pendingEvents.add(event); return; } } finally { startupLock.unlock(); } } log.info("Handling partition change event: {}", event); onPartitionChangeEvent(event); } protected abstract void onStartUp(); protected abstract void onPartitionChangeEvent(PartitionChangeEvent event); protected abstract String getPrefix(); }
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\queue\processing\AbstractPartitionBasedConsumerService.java
2
请在Spring Boot框架中完成以下Java代码
public class ConfigureDataSources { // setting MySQL data source and Flyway migration for "authorsdb" @Primary @Bean(name = "configMySql") @ConfigurationProperties("app.datasource.ds1") public DataSourceProperties firstDataSourceProperties() { return new DataSourceProperties(); } @Primary @Bean(name = "configFlywayMySql") public FlywayDs1Properties firstFlywayProperties() { return new FlywayDs1Properties(); } @Primary @Bean(name = "dataSourceMySql") @ConfigurationProperties("app.datasource.ds1") public HikariDataSource firstDataSource(@Qualifier("configMySql") DataSourceProperties properties) { return properties.initializeDataSourceBuilder().type(HikariDataSource.class) .build(); } @Primary @FlywayDataSource @Bean(initMethod = "migrate") public Flyway primaryFlyway(@Qualifier("dataSourceMySql") HikariDataSource primaryDataSource, @Qualifier("configFlywayMySql") FlywayDs1Properties properties) { return Flyway.configure() .dataSource(primaryDataSource) .locations(properties.getLocation()) .load(); } // configure PostgreSQL data source and Flyway migration for "booksdb" @Bean(name = "configPostgreSql") @ConfigurationProperties("app.datasource.ds2") public DataSourceProperties secondDataSourceProperties() { return new DataSourceProperties();
} @Bean(name = "configFlywayPostgreSql") public FlywayDs2Properties secondFlywayProperties() { return new FlywayDs2Properties(); } @Bean(name = "dataSourcePostgreSql") @ConfigurationProperties("app.datasource.ds2") public HikariDataSource secondDataSource(@Qualifier("configPostgreSql") DataSourceProperties properties) { return properties.initializeDataSourceBuilder().type(HikariDataSource.class) .build(); } @FlywayDataSource @Bean(initMethod = "migrate") public Flyway secondFlyway(@Qualifier("dataSourcePostgreSql") HikariDataSource secondDataSource, @Qualifier("configFlywayPostgreSql") FlywayDs2Properties properties) { return Flyway.configure() .dataSource(secondDataSource) .schemas(properties.getSchema()) .locations(properties.getLocation()) .load(); } }
repos\Hibernate-SpringBoot-master\HibernateSpringBootFlywayTwoVendors\src\main\java\com\bookstore\config\ConfigureDataSources.java
2
请完成以下Java代码
public void setTerminationReason (final @Nullable java.lang.String TerminationReason) { set_Value (COLUMNNAME_TerminationReason, TerminationReason); } @Override public java.lang.String getTerminationReason() { return get_ValueAsString(COLUMNNAME_TerminationReason); } /** * Type_Conditions AD_Reference_ID=540271 * Reference name: Type_Conditions */ public static final int TYPE_CONDITIONS_AD_Reference_ID=540271; /** FlatFee = FlatFee */ public static final String TYPE_CONDITIONS_FlatFee = "FlatFee"; /** HoldingFee = HoldingFee */ public static final String TYPE_CONDITIONS_HoldingFee = "HoldingFee"; /** Subscription = Subscr */ public static final String TYPE_CONDITIONS_Subscription = "Subscr"; /** Refundable = Refundable */ public static final String TYPE_CONDITIONS_Refundable = "Refundable"; /** QualityBasedInvoicing = QualityBsd */ public static final String TYPE_CONDITIONS_QualityBasedInvoicing = "QualityBsd"; /** Procurement = Procuremnt */ public static final String TYPE_CONDITIONS_Procurement = "Procuremnt"; /** Refund = Refund */ public static final String TYPE_CONDITIONS_Refund = "Refund"; /** Commission = Commission */ public static final String TYPE_CONDITIONS_Commission = "Commission"; /** MarginCommission = MarginCommission */ public static final String TYPE_CONDITIONS_MarginCommission = "MarginCommission"; /** Mediated commission = MediatedCommission */ public static final String TYPE_CONDITIONS_MediatedCommission = "MediatedCommission"; /** LicenseFee = LicenseFee */ public static final String TYPE_CONDITIONS_LicenseFee = "LicenseFee"; /** CallOrder = CallOrder */ public static final String TYPE_CONDITIONS_CallOrder = "CallOrder"; @Override public void setType_Conditions (final java.lang.String Type_Conditions) { set_ValueNoCheck (COLUMNNAME_Type_Conditions, Type_Conditions); }
@Override public java.lang.String getType_Conditions() { return get_ValueAsString(COLUMNNAME_Type_Conditions); } /** * Type_Flatrate AD_Reference_ID=540264 * Reference name: Type_Flatrate */ public static final int TYPE_FLATRATE_AD_Reference_ID=540264; /** NONE = NONE */ public static final String TYPE_FLATRATE_NONE = "NONE"; /** Corridor_Percent = LIPE */ public static final String TYPE_FLATRATE_Corridor_Percent = "LIPE"; /** Reported Quantity = RPTD */ public static final String TYPE_FLATRATE_ReportedQuantity = "RPTD"; @Override public void setType_Flatrate (final @Nullable java.lang.String Type_Flatrate) { throw new IllegalArgumentException ("Type_Flatrate is virtual column"); } @Override public java.lang.String getType_Flatrate() { return get_ValueAsString(COLUMNNAME_Type_Flatrate); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java-gen\de\metas\contracts\model\X_C_Flatrate_Term.java
1
请完成以下Java代码
public String toString() { if (_toString == null) { _toString = (hostName != null ? hostName : "") + "/" + hostAddress; } return _toString; } @Override public int hashCode() { if (_hashcode == null) { _hashcode = Objects.hash(hostName, hostAddress); } return _hashcode; } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj instanceof HostIdentifier)
{ final HostIdentifier other = (HostIdentifier)obj; return Objects.equals(hostName, other.hostName) && Objects.equals(hostAddress, other.hostAddress); } else { return false; } } @Override public String getIP() { return hostAddress; } @Override public String getHostName() { return hostName; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\org\adempiere\util\net\NetUtils.java
1
请完成以下Java代码
public static <T> CommonResult<T> unauthorized(T data) { return new CommonResult<T>(ResultCode.UNAUTHORIZED.getCode(), ResultCode.UNAUTHORIZED.getMessage(), data); } /** * 未授权返回结果 */ public static <T> CommonResult<T> forbidden(T data) { return new CommonResult<T>(ResultCode.FORBIDDEN.getCode(), ResultCode.FORBIDDEN.getMessage(), data); } public long getCode() { return code; } public void setCode(long code) { this.code = code; }
public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public T getData() { return data; } public void setData(T data) { this.data = data; } }
repos\mall-master\mall-common\src\main\java\com\macro\mall\common\api\CommonResult.java
1
请完成以下Java代码
public class Callout_AD_Menu extends CalloutEngine { public String onAD_Window_ID(final ICalloutField calloutField) { final I_AD_Menu menu = calloutField.getModel(I_AD_Menu.class); final AdWindowId windowId = AdWindowId.ofRepoIdOrNull(menu.getAD_Window_ID()); if (windowId == null) { return NO_ERROR; } final I_AD_Window w = Services.get(IADWindowDAO.class).getWindowByIdInTrx(windowId); menu.setAD_Element_ID(w.getAD_Element_ID()); menu.setName(w.getName()); menu.setDescription(w.getDescription()); menu.setEntityType(w.getEntityType()); menu.setInternalName(w.getInternalName()); return NO_ERROR; } public String onAD_Process_ID(final ICalloutField calloutField) { final I_AD_Menu menu = calloutField.getModel(I_AD_Menu.class); if (menu.getAD_Process_ID() <= 0) return ""; I_AD_Process p = menu.getAD_Process(); menu.setName(p.getName()); menu.setDescription(p.getDescription()); if (!"D".equals(p.getEntityType())) menu.setEntityType(p.getEntityType()); menu.setInternalName(p.getValue()); return ""; } public String onAD_Form_ID(final ICalloutField calloutField) { final I_AD_Menu menu = calloutField.getModel(I_AD_Menu.class); if (menu.getAD_Form_ID() <= 0) return ""; I_AD_Form f = menu.getAD_Form(); menu.setName(f.getName());
menu.setDescription(f.getDescription()); if (!"D".equals(f.getEntityType())) menu.setEntityType(f.getEntityType()); return ""; } public String onAD_Task_ID(final ICalloutField calloutField) { final I_AD_Menu menu = calloutField.getModel(I_AD_Menu.class); if (menu.getAD_Task_ID() <= 0) return ""; I_AD_Task t = menu.getAD_Task(); menu.setName(t.getName()); menu.setDescription(t.getDescription()); if (!"D".equals(t.getEntityType())) menu.setEntityType(t.getEntityType()); return ""; } public String onAD_Workflow_ID(final ICalloutField calloutField) { final I_AD_Menu menu = calloutField.getModel(I_AD_Menu.class); if (menu.getAD_Workflow_ID() <= 0) return ""; I_AD_Workflow wf = menu.getAD_Workflow(); menu.setName(wf.getName()); menu.setDescription(wf.getDescription()); if (!"D".equals(wf.getEntityType())) menu.setEntityType(wf.getEntityType()); menu.setInternalName(wf.getValue()); return ""; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\compiere\model\Callout_AD_Menu.java
1
请完成以下Java代码
public void setM_BannedManufacturer_ID (int M_BannedManufacturer_ID) { if (M_BannedManufacturer_ID < 1) set_ValueNoCheck (COLUMNNAME_M_BannedManufacturer_ID, null); else set_ValueNoCheck (COLUMNNAME_M_BannedManufacturer_ID, Integer.valueOf(M_BannedManufacturer_ID)); } /** Get Banned Manufacturer . @return Banned Manufacturer */ @Override public int getM_BannedManufacturer_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_BannedManufacturer_ID); if (ii == null) return 0; return ii.intValue(); } @Override public org.compiere.model.I_C_BPartner getManufacturer() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_Manufacturer_ID, org.compiere.model.I_C_BPartner.class); } @Override public void setManufacturer(org.compiere.model.I_C_BPartner Manufacturer) { set_ValueFromPO(COLUMNNAME_Manufacturer_ID, org.compiere.model.I_C_BPartner.class, Manufacturer); } /** Set Hersteller. @param Manufacturer_ID Hersteller des Produktes
*/ @Override public void setManufacturer_ID (int Manufacturer_ID) { if (Manufacturer_ID < 1) set_Value (COLUMNNAME_Manufacturer_ID, null); else set_Value (COLUMNNAME_Manufacturer_ID, Integer.valueOf(Manufacturer_ID)); } /** Get Hersteller. @return Hersteller des Produktes */ @Override public int getManufacturer_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_Manufacturer_ID); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_BannedManufacturer.java
1
请完成以下Java代码
public void setC_Flatrate_DataEntry_Detail_ID (final int C_Flatrate_DataEntry_Detail_ID) { if (C_Flatrate_DataEntry_Detail_ID < 1) set_ValueNoCheck (COLUMNNAME_C_Flatrate_DataEntry_Detail_ID, null); else set_ValueNoCheck (COLUMNNAME_C_Flatrate_DataEntry_Detail_ID, C_Flatrate_DataEntry_Detail_ID); } @Override public int getC_Flatrate_DataEntry_Detail_ID() { return get_ValueAsInt(COLUMNNAME_C_Flatrate_DataEntry_Detail_ID); } @Override public de.metas.contracts.model.I_C_Flatrate_DataEntry getC_Flatrate_DataEntry() { return get_ValueAsPO(COLUMNNAME_C_Flatrate_DataEntry_ID, de.metas.contracts.model.I_C_Flatrate_DataEntry.class); } @Override public void setC_Flatrate_DataEntry(final de.metas.contracts.model.I_C_Flatrate_DataEntry C_Flatrate_DataEntry) { set_ValueFromPO(COLUMNNAME_C_Flatrate_DataEntry_ID, de.metas.contracts.model.I_C_Flatrate_DataEntry.class, C_Flatrate_DataEntry); } @Override public void setC_Flatrate_DataEntry_ID (final int C_Flatrate_DataEntry_ID) { if (C_Flatrate_DataEntry_ID < 1) set_ValueNoCheck (COLUMNNAME_C_Flatrate_DataEntry_ID, null); else set_ValueNoCheck (COLUMNNAME_C_Flatrate_DataEntry_ID, C_Flatrate_DataEntry_ID); } @Override public int getC_Flatrate_DataEntry_ID() { return get_ValueAsInt(COLUMNNAME_C_Flatrate_DataEntry_ID); } @Override public void setC_UOM_ID (final int C_UOM_ID) { if (C_UOM_ID < 1) set_Value (COLUMNNAME_C_UOM_ID, null); else set_Value (COLUMNNAME_C_UOM_ID, C_UOM_ID); } @Override public int getC_UOM_ID() { return get_ValueAsInt(COLUMNNAME_C_UOM_ID); } @Override public org.compiere.model.I_M_AttributeSetInstance getM_AttributeSetInstance() { return get_ValueAsPO(COLUMNNAME_M_AttributeSetInstance_ID, org.compiere.model.I_M_AttributeSetInstance.class); } @Override public void setM_AttributeSetInstance(final org.compiere.model.I_M_AttributeSetInstance M_AttributeSetInstance) { set_ValueFromPO(COLUMNNAME_M_AttributeSetInstance_ID, org.compiere.model.I_M_AttributeSetInstance.class, M_AttributeSetInstance); } @Override
public void setM_AttributeSetInstance_ID (final int M_AttributeSetInstance_ID) { if (M_AttributeSetInstance_ID < 0) set_Value (COLUMNNAME_M_AttributeSetInstance_ID, null); else set_Value (COLUMNNAME_M_AttributeSetInstance_ID, M_AttributeSetInstance_ID); } @Override public int getM_AttributeSetInstance_ID() { return get_ValueAsInt(COLUMNNAME_M_AttributeSetInstance_ID); } @Override public void setQty_Reported (final @Nullable BigDecimal Qty_Reported) { set_Value (COLUMNNAME_Qty_Reported, Qty_Reported); } @Override public BigDecimal getQty_Reported() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty_Reported); 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); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java-gen\de\metas\contracts\model\X_C_Flatrate_DataEntry_Detail.java
1
请在Spring Boot框架中完成以下Java代码
protected void setNewRepeat(JobEntity timerEntity, int newRepeatValue) { List<String> expression = Arrays.asList(timerEntity.getRepeat().split("/")); expression = expression.subList(1, expression.size()); StringBuilder repeatBuilder = new StringBuilder("R"); repeatBuilder.append(newRepeatValue); for (String value : expression) { repeatBuilder.append("/"); repeatBuilder.append(value); } timerEntity.setRepeat(repeatBuilder.toString()); } protected boolean isValidTime(JobEntity timerEntity, Date newTimerDate, VariableScope variableScope) { BusinessCalendar businessCalendar = serviceConfiguration.getBusinessCalendarManager().getBusinessCalendar( serviceConfiguration.getJobManager().getBusinessCalendarName(timerEntity, variableScope)); return businessCalendar.validateDuedate(timerEntity.getRepeat(), timerEntity.getMaxIterations(), timerEntity.getEndDate(), newTimerDate); } protected Date calculateNextTimer(JobEntity timerEntity, VariableScope variableScope) { BusinessCalendar businessCalendar = serviceConfiguration.getBusinessCalendarManager().getBusinessCalendar( serviceConfiguration.getJobManager().getBusinessCalendarName(timerEntity, variableScope));
return businessCalendar.resolveDuedate(timerEntity.getRepeat(), timerEntity.getMaxIterations()); } protected int calculateRepeatValue(JobEntity timerEntity) { int times = -1; List<String> expression = Arrays.asList(timerEntity.getRepeat().split("/")); if (expression.size() > 1 && expression.get(0).startsWith("R") && expression.get(0).length() > 1) { times = Integer.parseInt(expression.get(0).substring(1)); if (times > 0) { times--; } } return times; } }
repos\flowable-engine-main\modules\flowable-job-service\src\main\java\org\flowable\job\service\impl\persistence\entity\TimerJobEntityManagerImpl.java
2
请在Spring Boot框架中完成以下Java代码
protected void configure(HttpSecurity http) throws Exception { http .headers() .frameOptions().sameOrigin() .and() .authorizeRequests() .antMatchers("/resources/**", "/webjars/**","/assets/**").permitAll() .antMatchers("/").permitAll() .antMatchers("/admin/**").hasRole("ADMIN") .anyRequest().authenticated() .and() .formLogin() .loginPage("/login") .defaultSuccessUrl("/home") .failureUrl("/login?error") .permitAll() .and() .logout() .logoutRequestMatcher(new AntPathRequestMatcher("/logout")) .logoutSuccessUrl("/login?logout") .deleteCookies("my-remember-me-cookie") .permitAll() .and() .rememberMe()
//.key("my-secure-key") .rememberMeCookieName("my-remember-me-cookie") .tokenRepository(persistentTokenRepository()) .tokenValiditySeconds(24 * 60 * 60) .and() .exceptionHandling() ; } PersistentTokenRepository persistentTokenRepository(){ JdbcTokenRepositoryImpl tokenRepositoryImpl = new JdbcTokenRepositoryImpl(); tokenRepositoryImpl.setDataSource(dataSource); return tokenRepositoryImpl; } }
repos\Spring-Boot-Advanced-Projects-main\springboot-thymeleaf-security-demo\src\main\java\net\alanbinu\springbootsecurity\config\WebSecurityConfig.java
2
请在Spring Boot框架中完成以下Java代码
public class ApplicationJob { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; private boolean enabled; private Boolean completed; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; }
public void setName(String name) { this.name = name; } public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public Boolean getCompleted() { return completed; } public void setCompleted(Boolean completed) { this.completed = completed; } }
repos\tutorials-master\spring-quartz\src\main\java\org\baeldung\recovery\custom\ApplicationJob.java
2
请完成以下Java代码
private static BooleanWithReason validatePaymentTermWithBreaks(@NonNull final List<PaymentTermBreak> breaks) { final Percent totalPercent = breaks.stream().map(PaymentTermBreak::getPercent).reduce(Percent.ZERO, Percent::add); if (!totalPercent.isOneHundred()) { return BooleanWithReason.falseBecause("Total percent must be exactly 100%, but it was: " + totalPercent); } return BooleanWithReason.TRUE; } private static BooleanWithReason validatePaymentTermWithSchedules(@NonNull final List<PaySchedule> schedules) { if (schedules.isEmpty()) { return BooleanWithReason.TRUE; } else { final Percent totalPercent = schedules.stream().map(PaySchedule::getPercentage).reduce(Percent.ZERO, Percent::add); if (!totalPercent.isOneHundred()) { return BooleanWithReason.falseBecause("Total percent must be exactly 100%, but it was: " + totalPercent); }
return BooleanWithReason.TRUE; } } public boolean isValid() {return valid.isTrue();} public PaymentTermBreak getBreakById(final @NonNull PaymentTermBreakId id) { Check.assumeNotEmpty(breaksById, "Payment term does not support breaks: {}", this); final PaymentTermBreak paymentTermBreak = breaksById.get(id); if (paymentTermBreak == null) { throw new AdempiereException("No break found for id: " + id); } return paymentTermBreak; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\payment\paymentterm\PaymentTerm.java
1
请完成以下Java代码
public String getPackaging() { return this.packaging; } public void setPackaging(String packaging) { this.packaging = packaging; } public String getApplicationName() { return this.applicationName; } public void setApplicationName(String applicationName) { this.applicationName = applicationName; } public String getLanguage() { return this.language; } public void setLanguage(String language) { this.language = language; } public String getConfigurationFileFormat() { return this.configurationFileFormat; } public void setConfigurationFileFormat(String configurationFileFormat) { this.configurationFileFormat = configurationFileFormat; } public String getPackageName() { if (StringUtils.hasText(this.packageName)) { return this.packageName; } if (StringUtils.hasText(this.groupId) && StringUtils.hasText(this.artifactId)) { return getGroupId() + "." + getArtifactId();
} return null; } public void setPackageName(String packageName) { this.packageName = packageName; } public String getJavaVersion() { return this.javaVersion; } public void setJavaVersion(String javaVersion) { this.javaVersion = javaVersion; } public String getBaseDir() { return this.baseDir; } public void setBaseDir(String baseDir) { this.baseDir = baseDir; } }
repos\initializr-main\initializr-web\src\main\java\io\spring\initializr\web\project\ProjectRequest.java
1
请完成以下Java代码
public String getName() { return this.name; } public Authority name(String name) { this.setName(name); return this; } public void setName(String name) { this.name = name; } @PostLoad @PostPersist public void updateEntityState() { this.setIsPersisted(); } @Override public String getId() { return this.name; } @Transient @Override public boolean isNew() { return !this.isPersisted; } public Authority setIsPersisted() { this.isPersisted = true; return this; } // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Authority)) { return false; } return getName() != null && getName().equals(((Authority) o).getName()); } @Override public int hashCode() { return Objects.hashCode(getName()); } // prettier-ignore @Override public String toString() { return "Authority{" + "name=" + getName() + "}"; } }
repos\tutorials-master\jhipster-8-modules\jhipster-8-monolithic\src\main\java\com\baeldung\jhipster8\domain\Authority.java
1
请完成以下Java代码
public org.compiere.model.I_C_ValidCombination getRealizedGain_A() { return get_ValueAsPO(COLUMNNAME_RealizedGain_Acct, org.compiere.model.I_C_ValidCombination.class); } @Override public void setRealizedGain_A(final org.compiere.model.I_C_ValidCombination RealizedGain_A) { set_ValueFromPO(COLUMNNAME_RealizedGain_Acct, org.compiere.model.I_C_ValidCombination.class, RealizedGain_A); } @Override public void setRealizedGain_Acct (final int RealizedGain_Acct) { set_Value (COLUMNNAME_RealizedGain_Acct, RealizedGain_Acct); } @Override public int getRealizedGain_Acct() { return get_ValueAsInt(COLUMNNAME_RealizedGain_Acct); }
@Override public org.compiere.model.I_C_ValidCombination getRealizedLoss_A() { return get_ValueAsPO(COLUMNNAME_RealizedLoss_Acct, org.compiere.model.I_C_ValidCombination.class); } @Override public void setRealizedLoss_A(final org.compiere.model.I_C_ValidCombination RealizedLoss_A) { set_ValueFromPO(COLUMNNAME_RealizedLoss_Acct, org.compiere.model.I_C_ValidCombination.class, RealizedLoss_A); } @Override public void setRealizedLoss_Acct (final int RealizedLoss_Acct) { set_Value (COLUMNNAME_RealizedLoss_Acct, RealizedLoss_Acct); } @Override public int getRealizedLoss_Acct() { return get_ValueAsInt(COLUMNNAME_RealizedLoss_Acct); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_BP_BankAccount_Acct.java
1
请完成以下Java代码
private SaveDecoupledHUAttributesDAO getDelegateOrNull() { final ITrx trx = trxManager.getThreadInheritedTrx(OnTrxMissingPolicy.ReturnTrxNone); if (trx == null || trxManager.isNull(trx)) { return null; } return trx.getProperty(TRX_PROPERTY_SaveDecoupledHUAttributesDAO); } private SaveDecoupledHUAttributesDAO getDelegate() { final String trxName = trxManager.getThreadInheritedTrxName(); final ITrx trx = trxManager.getTrx(trxName); Check.assumeNotNull(trx, "trx not null for trxName={}", trxName); // // Get an existing storage DAO from transaction. // If no storage DAO exists => create a new one return trx.getProperty(TRX_PROPERTY_SaveDecoupledHUAttributesDAO, () -> { // Create a new attributes storage final SaveDecoupledHUAttributesDAO huAttributesDAO = new SaveDecoupledHUAttributesDAO(dbHUAttributesDAO); // Listen this transaction for COMMIT events // Before committing the transaction, this listener makes sure we are also saving all storages trx.getTrxListenerManager() .newEventListener(TrxEventTiming.BEFORE_COMMIT) .registerHandlingMethod(innerTrx -> { // Get and remove the save-decoupled HU Storage DAO final SaveDecoupledHUAttributesDAO innerHuAttributesDAO = innerTrx.setProperty(TRX_PROPERTY_SaveDecoupledHUAttributesDAO, null); if (innerHuAttributesDAO == null) { // shall not happen, because this handlerMethod is invoked only once, // but silently ignore it return; } // Save everything to database innerHuAttributesDAO.flush(); }); return huAttributesDAO; }); } @Override public I_M_HU_Attribute newHUAttribute(final Object contextProvider) { final SaveDecoupledHUAttributesDAO delegate = getDelegate(); return delegate.newHUAttribute(contextProvider); } @Override public void save(final I_M_HU_Attribute huAttribute) { final SaveDecoupledHUAttributesDAO delegate = getDelegate(); delegate.save(huAttribute); } @Override public void delete(final I_M_HU_Attribute huAttribute) {
final SaveDecoupledHUAttributesDAO delegate = getDelegate(); delegate.delete(huAttribute); } @Override public List<I_M_HU_Attribute> retrieveAllAttributesNoCache(final Collection<HuId> huIds) { final SaveDecoupledHUAttributesDAO delegate = getDelegate(); return delegate.retrieveAllAttributesNoCache(huIds); } @Override public HUAndPIAttributes retrieveAttributesOrdered(final I_M_HU hu) { final SaveDecoupledHUAttributesDAO delegate = getDelegate(); return delegate.retrieveAttributesOrdered(hu); } @Override public I_M_HU_Attribute retrieveAttribute(final I_M_HU hu, final AttributeId attributeId) { final SaveDecoupledHUAttributesDAO delegate = getDelegate(); return delegate.retrieveAttribute(hu, attributeId); } @Override public void flush() { final SaveDecoupledHUAttributesDAO attributesDAO = getDelegateOrNull(); if (attributesDAO != null) { attributesDAO.flush(); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\attribute\impl\SaveOnCommitHUAttributesDAO.java
1
请在Spring Boot框架中完成以下Java代码
class ContextPathElement { @NonNull String name; int id; @JsonCreator public static ContextPathElement ofJson(@NonNull final String json) { try { final int idx = json.indexOf("/"); if (idx > 0) { String name = json.substring(0, idx); int id = Integer.parseInt(json.substring(idx + 1)); return new ContextPathElement(name, id); } else { return new ContextPathElement(json, -1); }
} catch (final Exception ex) { throw new AdempiereException("Failed parsing: " + json, ex); } } public static ContextPathElement ofName(@NonNull final String name) {return new ContextPathElement(name, -1);} public static ContextPathElement ofNameAndId(@NonNull final String name, final int id) {return new ContextPathElement(name, id > 0 ? id : -1);} @Override public String toString() {return toJson();} @JsonValue public String toJson() {return id > 0 ? name + "/" + id : name;} }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\health\ContextPath.java
2
请完成以下Java代码
public int getAD_Tree_ID(PO po) { return UNKNOWN_TreeID; } @Override public int getParent_ID(PO po) { if (I_M_Product_Category.Table_Name.equals(po.get_TableName())) { I_M_Product_Category pc = InterfaceWrapperHelper.create(po, I_M_Product_Category.class); return pc.getM_Product_Category_Parent_ID(); } return UNKNOWN_ParentID; } @Override public String getWhereClause(MTree_Base tree) { return null; } @Override public void setParent_ID(MTree_Base tree, int nodeId, int parentId, String trxName) { final MTable table = MTable.get(tree.getCtx(), tree.getAD_Table_ID()); if (I_M_Product_Category.Table_Name.equals(table.getTableName())) { final I_M_Product_Category pc = InterfaceWrapperHelper.create(table.getPO(nodeId, trxName), I_M_Product_Category.class); pc.setM_Product_Category_Parent_ID(parentId); InterfaceWrapperHelper.save(pc); } } @Override public boolean isParentChanged(PO po) { return po.is_ValueChanged(I_M_Product_Category.COLUMNNAME_M_Product_Category_Parent_ID); } @Override public int getOldParent_ID(PO po) { return po.get_ValueOldAsInt(I_M_Product_Category.COLUMNNAME_M_Product_Category_Parent_ID); } @Override public String getParentIdSQL()
{ return I_M_Product_Category.COLUMNNAME_M_Product_Category_Parent_ID; } @Override public MTreeNode getNodeInfo(GridTab gridTab) { MTreeNode info = super.getNodeInfo(gridTab); info.setAllowsChildren(true); // we always allow children because IsSummary field will be automatically // maintained return info; } @Override public MTreeNode loadNodeInfo(MTree tree, ResultSet rs) throws SQLException { MTreeNode info = super.loadNodeInfo(tree, rs); info.setAllowsChildren(true); // we always allow children because IsSummary field will be automatically info.setImageIndicator(I_M_Product_Category.Table_Name); return info; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\product\tree\spi\impl\MProductCategoryTreeSupport.java
1
请完成以下Java代码
public static TopicRequestDto fromTopicSubscription(TopicSubscription topicSubscription, long clientLockDuration) { Long lockDuration = topicSubscription.getLockDuration(); if (lockDuration == null) { lockDuration = clientLockDuration; } String topicName = topicSubscription.getTopicName(); List<String> variables = topicSubscription.getVariableNames(); String businessKey = topicSubscription.getBusinessKey(); TopicRequestDto topicRequestDto = new TopicRequestDto(topicName, lockDuration, variables, businessKey); if (topicSubscription.getProcessDefinitionId() != null) { topicRequestDto.setProcessDefinitionId(topicSubscription.getProcessDefinitionId()); } if (topicSubscription.getProcessDefinitionIdIn() != null) { topicRequestDto.setProcessDefinitionIdIn(topicSubscription.getProcessDefinitionIdIn()); } if (topicSubscription.getProcessDefinitionKey() != null) { topicRequestDto.setProcessDefinitionKey(topicSubscription.getProcessDefinitionKey()); } if (topicSubscription.getProcessDefinitionKeyIn() != null) { topicRequestDto.setProcessDefinitionKeyIn(topicSubscription.getProcessDefinitionKeyIn()); } if (topicSubscription.isWithoutTenantId()) { topicRequestDto.setWithoutTenantId(topicSubscription.isWithoutTenantId());
} if (topicSubscription.getTenantIdIn() != null) { topicRequestDto.setTenantIdIn(topicSubscription.getTenantIdIn()); } if(topicSubscription.getProcessDefinitionVersionTag() != null) { topicRequestDto.setProcessDefinitionVersionTag(topicSubscription.getProcessDefinitionVersionTag()); } if (topicSubscription.getProcessVariables() != null) { topicRequestDto.setProcessVariables(topicSubscription.getProcessVariables()); } if (topicSubscription.isLocalVariables()) { topicRequestDto.setLocalVariables(topicSubscription.isLocalVariables()); } if(topicSubscription.isIncludeExtensionProperties()) { topicRequestDto.setIncludeExtensionProperties(topicSubscription.isIncludeExtensionProperties()); } return topicRequestDto; } }
repos\camunda-bpm-platform-master\clients\java\client\src\main\java\org\camunda\bpm\client\topic\impl\dto\TopicRequestDto.java
1
请完成以下Java代码
public class HUTransactionBL implements IHUTransactionBL { private final IQueryBL queryBL = Services.get(IQueryBL.class); @Override public IHUTransactionCandidate createLUTransactionForAttributeTransfer( @NonNull final I_M_HU luHU, @NonNull final I_M_HU_PI_Item luItemPI, @NonNull final IAllocationRequest request) { final IHandlingUnitsDAO handlingUnitsDAO = Services.get(IHandlingUnitsDAO.class); final I_M_HU_Item luItem = handlingUnitsDAO.retrieveItemIfExists(luHU, luItemPI).orElse(null); return HUTransactionCandidate.builder() .model(AllocationUtils.getReferencedModel(request)) .huItem(luItem) .vhuItem(null) .productId(request.getProductId()) .quantity(request.getQuantity().toZero()) .date(request.getDate()) .build(); } @Override public boolean isLatestHUTrx(@NonNull final HuId huId, @NonNull final TableRecordReference tableRecordReference) { final TableRecordReference recordRefOfLastTrx = getRecordRefOfLastTrx(huId).orElse(null); return TableRecordReference.equals(tableRecordReference, recordRefOfLastTrx); } private Optional<TableRecordReference> getRecordRefOfLastTrx(final @NonNull HuId huId) { final I_M_HU_Trx_Line lastQtyChangeHUTrx = queryBL .createQueryBuilder(I_M_HU_Trx_Line.class) .addOnlyActiveRecordsFilter() .addEqualsFilter(I_M_HU_Trx_Line.COLUMNNAME_M_HU_ID, huId) .addNotEqualsFilter(I_M_HU_Trx_Line.COLUMNNAME_Qty, 0) .orderByDescending(I_M_HU_Trx_Line.COLUMN_M_HU_Trx_Line_ID) .create() .first();
if (lastQtyChangeHUTrx == null) { return Optional.empty(); } final int counterpartTrxLineId = lastQtyChangeHUTrx.getParent_HU_Trx_Line_ID(); if (counterpartTrxLineId <= 0) { // those are some very old trx return Optional.empty(); } final I_M_HU_Trx_Line counterpartTrxLine = InterfaceWrapperHelper.load(counterpartTrxLineId, I_M_HU_Trx_Line.class); final TableRecordReference recordRef = TableRecordReference.ofOrNull(counterpartTrxLine.getAD_Table_ID(), counterpartTrxLine.getRecord_ID()); return Optional.ofNullable(recordRef); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\hutransaction\impl\HUTransactionBL.java
1
请完成以下Java代码
private List<IScript> getScriptFilesFromProjectDir(final File projectDir, final String defaultProjectName) { final File scriptsRootDir = new File(projectDir, "src/main/sql/postgresql/system"); if (!scriptsRootDir.isDirectory()) { return ImmutableList.of(); } final ArrayList<IScript> scripts = new ArrayList<>(); // // Script files in subfolders // e.g. .../src/main/sql/postgresql/system/10-de.metas.adempiere for (final File subProjectDir : scriptsRootDir.listFiles(File::isDirectory)) { final String projectName = subProjectDir.getName(); for (final File scriptFile : subProjectDir.listFiles(this::isSupportedScriptFile)) { scripts.add(new LocalScript(projectName, scriptFile)); } } // // Script files directly in .../src/main/sql/postgresql/system/ folder for (final File scriptFile : scriptsRootDir.listFiles(File::isFile)) { scripts.add(new LocalScript(defaultProjectName, scriptFile)); } logger.info("Considering {} ({} scripts)", projectDir, scripts.size()); return scripts; }
private boolean isSupportedScriptFile(final File file) { if (!file.exists() || !file.isFile()) { return false; } final String fileExtLC = FileUtils.getFileExtension(file.getName(), false).toLowerCase(); return supportedFileExtensionsLC.contains(fileExtLC); } private static String getDefaultProjectName(final File projectDir) { final File mavenPOMFile = new File(projectDir, "pom.xml"); if (mavenPOMFile.exists()) { final Document xmlDocument = XmlUtils.loadDocument(mavenPOMFile); try { return XmlUtils.getString("/project/properties/migration-sql-basedir", xmlDocument); } catch (Exception ex) { ex.printStackTrace(); // FIXME remove return null; } } else { return null; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.migration\de.metas.migration.cli\src\main\java\de\metas\migration\cli\workspace_migrate\WorkspaceScriptScanner.java
1
请在Spring Boot框架中完成以下Java代码
JavaInfoContributor javaInfoContributor() { return new JavaInfoContributor(); } @Bean @ConditionalOnEnabledInfoContributor(value = "os", fallback = InfoContributorFallback.DISABLE) @Order(DEFAULT_ORDER) OsInfoContributor osInfoContributor() { return new OsInfoContributor(); } @Bean @ConditionalOnEnabledInfoContributor(value = "process", fallback = InfoContributorFallback.DISABLE) @Order(DEFAULT_ORDER) ProcessInfoContributor processInfoContributor() { return new ProcessInfoContributor(); }
@Bean @ConditionalOnEnabledInfoContributor(value = "ssl", fallback = InfoContributorFallback.DISABLE) @Order(DEFAULT_ORDER) SslInfoContributor sslInfoContributor(SslInfo sslInfo) { return new SslInfoContributor(sslInfo); } @Bean @ConditionalOnMissingBean @ConditionalOnEnabledInfoContributor(value = "ssl", fallback = InfoContributorFallback.DISABLE) SslInfo sslInfo(SslBundles sslBundles) { return new SslInfo(sslBundles); } }
repos\spring-boot-4.0.1\module\spring-boot-actuator-autoconfigure\src\main\java\org\springframework\boot\actuate\autoconfigure\info\InfoContributorAutoConfiguration.java
2
请在Spring Boot框架中完成以下Java代码
private BPartnerId getCustomerId(@NonNull final PickingJobLine line) { return CoalesceUtil.coalesceSuppliersNotNull( line::getCustomerId, () -> getJob().getCustomerId() ); } @NonNull private WarehouseId getWarehouseId(@NonNull final PickingJobLine line) { final ShipmentScheduleId shipmentScheduleId = line.getScheduleId().getShipmentScheduleId(); return shipmentSchedules.getById(shipmentScheduleId).getWarehouseId(); } private void log(@NonNull String message) {
log(null, message); } private void log(@Nullable final PickingJobLine line, @NonNull String message) { final StringBuilder sb = new StringBuilder(); if (line != null) { sb.append("Line: ").append(line.getId().getRepoId()).append(" - "); } sb.append(message); String messageFinal = sb.toString(); logger.debug(messageFinal); logs.add(messageFinal); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\job\service\commands\get_next_eligible_line\GetNextEligibleLineToPackCommand.java
2
请在Spring Boot框架中完成以下Java代码
public class CostSegment { @NonNull CostingLevel costingLevel; @NonNull AcctSchemaId acctSchemaId; @NonNull CostTypeId costTypeId; @NonNull ClientId clientId; @NonNull OrgId orgId; @NonNull ProductId productId; @NonNull AttributeSetInstanceId attributeSetInstanceId; @Builder(toBuilder = true) private CostSegment( @NonNull final CostingLevel costingLevel, @NonNull final AcctSchemaId acctSchemaId, @NonNull final CostTypeId costTypeId, @NonNull final ClientId clientId, @NonNull final OrgId orgId, @NonNull final ProductId productId, @NonNull final AttributeSetInstanceId attributeSetInstanceId) { this.costingLevel = costingLevel; this.acctSchemaId = acctSchemaId; this.costTypeId = costTypeId; this.productId = productId; this.clientId = costingLevel.effectiveValue(clientId); this.orgId = costingLevel.effectiveValue(orgId); this.attributeSetInstanceId = costingLevel.effectiveValue(attributeSetInstanceId); } public CostSegment withProductIdAndCostingLevel(@NonNull final ProductId productId, @NonNull final CostingLevel costingLevel) {
return toBuilder() .productId(productId) .costingLevel(costingLevel) .build(); } public CostSegmentAndElement withCostElementId(@NonNull final CostElementId costElementId) { return CostSegmentAndElement.of(this, costElementId); } public boolean isMatching(@NonNull final OrgId orgId) { final OrgId orgIdEffective = costingLevel.effectiveValue(orgId); return OrgId.equals(this.orgId, orgIdEffective); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\costing\CostSegment.java
2
请完成以下Java代码
public class ListQueryParameterObject { protected int maxResults = Integer.MAX_VALUE; protected int firstResult; protected Object parameter; protected String databaseType; public ListQueryParameterObject() {} public ListQueryParameterObject(Object parameter, int firstResult, int maxResults) { this.parameter = parameter; this.firstResult = firstResult; this.maxResults = maxResults; } public int getFirstResult() { return firstResult; } public int getFirstRow() { return firstResult + 1; } public int getLastRow() { if (maxResults == Integer.MAX_VALUE) { return maxResults; } return firstResult + maxResults + 1; } public int getMaxResults() { return maxResults; }
public Object getParameter() { return parameter; } public void setFirstResult(int firstResult) { this.firstResult = firstResult; } public void setMaxResults(int maxResults) { this.maxResults = maxResults; } public void setParameter(Object parameter) { this.parameter = parameter; } public String getOrderBy() { // the default order column return "RES.ID_ asc"; } public String getOrderByColumns() { return getOrderBy(); } public void setDatabaseType(String databaseType) { this.databaseType = databaseType; } public String getDatabaseType() { return databaseType; } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\db\ListQueryParameterObject.java
1
请完成以下Java代码
public double getCostFactor_() { return costFactor_; } public void setCostFactor_(double costFactor_) { this.costFactor_ = costFactor_; } public int getXsize_() { return xsize_; } public void setXsize_(int xsize_) { this.xsize_ = xsize_; } public int getMax_xsize_() { return max_xsize_; } public void setMax_xsize_(int max_xsize_) { this.max_xsize_ = max_xsize_; } public int getThreadNum_() { return threadNum_; } public void setThreadNum_(int threadNum_) { this.threadNum_ = threadNum_; } public List<String> getUnigramTempls_() { return unigramTempls_; } public void setUnigramTempls_(List<String> unigramTempls_) { this.unigramTempls_ = unigramTempls_; }
public List<String> getBigramTempls_() { return bigramTempls_; } public void setBigramTempls_(List<String> bigramTempls_) { this.bigramTempls_ = bigramTempls_; } public List<String> getY_() { return y_; } public void setY_(List<String> y_) { this.y_ = y_; } public List<List<Path>> getPathList_() { return pathList_; } public void setPathList_(List<List<Path>> pathList_) { this.pathList_ = pathList_; } public List<List<Node>> getNodeList_() { return nodeList_; } public void setNodeList_(List<List<Node>> nodeList_) { this.nodeList_ = nodeList_; } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\model\crf\crfpp\FeatureIndex.java
1
请完成以下Java代码
public int getAD_User_ID() { return get_ValueAsInt(COLUMNNAME_AD_User_ID); } /** * IsAllowIssuingAnyHU AD_Reference_ID=319 * Reference name: _YesNo */ public static final int ISALLOWISSUINGANYHU_AD_Reference_ID=319; /** Yes = Y */ public static final String ISALLOWISSUINGANYHU_Yes = "Y"; /** No = N */ public static final String ISALLOWISSUINGANYHU_No = "N"; @Override public void setIsAllowIssuingAnyHU (final @Nullable java.lang.String IsAllowIssuingAnyHU) { set_Value (COLUMNNAME_IsAllowIssuingAnyHU, IsAllowIssuingAnyHU); } @Override public java.lang.String getIsAllowIssuingAnyHU() { return get_ValueAsString(COLUMNNAME_IsAllowIssuingAnyHU); } /** * IsScanResourceRequired AD_Reference_ID=319 * Reference name: _YesNo */ public static final int ISSCANRESOURCEREQUIRED_AD_Reference_ID=319; /** Yes = Y */ public static final String ISSCANRESOURCEREQUIRED_Yes = "Y";
/** No = N */ public static final String ISSCANRESOURCEREQUIRED_No = "N"; @Override public void setIsScanResourceRequired (final @Nullable java.lang.String IsScanResourceRequired) { set_Value (COLUMNNAME_IsScanResourceRequired, IsScanResourceRequired); } @Override public java.lang.String getIsScanResourceRequired() { return get_ValueAsString(COLUMNNAME_IsScanResourceRequired); } @Override public void setMobileUI_UserProfile_MFG_ID (final int MobileUI_UserProfile_MFG_ID) { if (MobileUI_UserProfile_MFG_ID < 1) set_ValueNoCheck (COLUMNNAME_MobileUI_UserProfile_MFG_ID, null); else set_ValueNoCheck (COLUMNNAME_MobileUI_UserProfile_MFG_ID, MobileUI_UserProfile_MFG_ID); } @Override public int getMobileUI_UserProfile_MFG_ID() { return get_ValueAsInt(COLUMNNAME_MobileUI_UserProfile_MFG_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_MobileUI_UserProfile_MFG.java
1
请完成以下Java代码
public ProductId getProductId() { return (ProductId)assumeNotNull(pricingContext.getProductId()); } @NonNull public BPartnerId getBPartnerId() { return (BPartnerId)assumeNotNull(pricingContext.getBPartnerId()); } @NonNull public OrgId getOrgId() { return (OrgId)assumeNotNull(pricingContext.getOrgId()); } @NonNull public CurrencyId getResultCurrencyId() { return (CurrencyId)assumeNotNull(pricingResult.getCurrencyId()); } @NonNull public UomId getResultUomId() { return (UomId)assumeNotNull(pricingResult.getPriceUomId()); } @NonNull public TaxCategoryId getResultTaxCategory() { return (TaxCategoryId)assumeNotNull(pricingResult.getTaxCategoryId()); } @NonNull public LocalDate getResultPriceDate() {
return pricingResult.getPriceDate(); } public boolean isTaxIncluded() { return pricingResult.isTaxIncluded(); } @NonNull public ProductPrice getProductPrice() { return ProductPrice.builder() .productId(getProductId()) .uomId(getResultUomId()) .money(Money.of(pricingResult.getPriceStd(), getResultCurrencyId())) .build(); } private static Object assumeNotNull(@Nullable final Object arg) { Check.assumeNotNull(arg, "applies() - should've taken care of this!"); return arg; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\pricing\trade_margin\CustomerTradeMarginPricingRule.java
1
请完成以下Java代码
public boolean validate(String className) { if (className == null || className.trim().isEmpty()) { return true; } return isPackageAllowed(className) || isClassNameAllowed(className); } protected boolean isPackageAllowed(String className) { if (!isPackageAllowed(className, ALLOWED_PACKAGES)) { return isPackageAllowed(className, allowedPackages); } return true; } protected boolean isPackageAllowed(String className, Collection<String> allowedPackages) { for (String allowedPackage : allowedPackages) { if (!allowedPackage.isEmpty() && className.startsWith(allowedPackage)) { return true; } } return false; } protected boolean isClassNameAllowed(String className) { if (!ALLOWED_CLASSES.contains(className)) { return allowedClasses.contains(className); } return true; } protected void extractElements(String allowedElements, Set<String> set) { if (!set.isEmpty()) {
set.clear(); } if (allowedElements == null) { return; } String allowedElementsSanitized = allowedElements.replaceAll("\\s", ""); if (allowedElementsSanitized.isEmpty()) { return; } String[] classes = allowedElementsSanitized.split(","); for (String className : classes) { set.add(className.trim()); } } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\runtime\DefaultDeserializationTypeValidator.java
1
请完成以下Java代码
public void setCM_WebProject_Domain_ID (int CM_WebProject_Domain_ID) { if (CM_WebProject_Domain_ID < 1) set_ValueNoCheck (COLUMNNAME_CM_WebProject_Domain_ID, null); else set_ValueNoCheck (COLUMNNAME_CM_WebProject_Domain_ID, Integer.valueOf(CM_WebProject_Domain_ID)); } /** Get WebProject Domain. @return Definition of Domainhandling */ public int getCM_WebProject_Domain_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_CM_WebProject_Domain_ID); if (ii == null) return 0; return ii.intValue(); } public I_CM_WebProject getCM_WebProject() throws RuntimeException { return (I_CM_WebProject)MTable.get(getCtx(), I_CM_WebProject.Table_Name) .getPO(getCM_WebProject_ID(), get_TrxName()); } /** Set Web Project. @param CM_WebProject_ID A web project is the main data container for Containers, URLs, Ads, Media etc. */ public void setCM_WebProject_ID (int CM_WebProject_ID) { if (CM_WebProject_ID < 1) set_ValueNoCheck (COLUMNNAME_CM_WebProject_ID, null); else set_ValueNoCheck (COLUMNNAME_CM_WebProject_ID, Integer.valueOf(CM_WebProject_ID)); } /** Get Web Project. @return A web project is the main data container for Containers, URLs, Ads, Media etc. */ public int getCM_WebProject_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_CM_WebProject_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Description. @param Description Optional short description of the record */ public void setDescription (String Description) { set_Value (COLUMNNAME_Description, Description); } /** Get Description. @return Optional short description of the record */ public String getDescription () { return (String)get_Value(COLUMNNAME_Description); } /** Set Fully Qualified Domain Name. @param FQDN Fully Qualified Domain Name i.e. www.comdivision.com */ public void setFQDN (String FQDN) { set_Value (COLUMNNAME_FQDN, FQDN); } /** Get Fully Qualified Domain Name. @return Fully Qualified Domain Name i.e. www.comdivision.com */ public String getFQDN () { return (String)get_Value(COLUMNNAME_FQDN);
} /** Set Comment/Help. @param Help Comment or Hint */ public void setHelp (String Help) { set_Value (COLUMNNAME_Help, Help); } /** Get Comment/Help. @return Comment or Hint */ public String getHelp () { return (String)get_Value(COLUMNNAME_Help); } /** Set Name. @param Name Alphanumeric identifier of the entity */ public void setName (String Name) { set_Value (COLUMNNAME_Name, Name); } /** Get Name. @return Alphanumeric identifier of the entity */ public String getName () { return (String)get_Value(COLUMNNAME_Name); } /** Get Record ID/ColumnName @return ID/ColumnName pair */ public KeyNamePair getKeyNamePair() { return new KeyNamePair(get_ID(), getName()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_CM_WebProject_Domain.java
1
请完成以下Java代码
public Optional<ForecastCreatedEvent> createEventWithLinesAndTiming( @NonNull final I_M_Forecast forecastRecord, @NonNull final DocTimingType timing) { return buildForecast(forecastRecord, timing) .map(forecast -> ForecastCreatedEvent .builder() .forecast(forecast) .eventDescriptor(EventDescriptor.ofClientAndOrg(forecastRecord.getAD_Client_ID(), forecastRecord.getAD_Org_ID())) .build()); } public Optional<ForecastDeletedEvent> createDeletedEvent( @NonNull final I_M_Forecast forecastRecord, @NonNull final DocTimingType timing) { return buildForecast(forecastRecord, timing) .map(forecast -> ForecastDeletedEvent .builder() .forecast(forecast) .eventDescriptor(EventDescriptor.ofClientAndOrg(forecastRecord.getAD_Client_ID(), forecastRecord.getAD_Org_ID())) .build()); } @NonNull private Optional<Forecast> buildForecast( @NonNull final I_M_Forecast forecastRecord, @NonNull final DocTimingType timing) { final List<I_M_ForecastLine> forecastLineRecords = forecastsRepo .retrieveLinesByForecastId(ForecastId.ofRepoId(forecastRecord.getM_Forecast_ID())); if (forecastLineRecords.isEmpty()) { return Optional.empty(); } return Optional.of(Forecast.builder() .forecastId(forecastRecord.getM_Forecast_ID()) .docStatus(timing.getDocStatus()) .forecastLines(forecastLineRecords.stream() .map(line -> createForecastLine(line, forecastRecord)) .collect(ImmutableList.toImmutableList()))
.build()); } private ForecastLine createForecastLine( @NonNull final I_M_ForecastLine forecastLine, @NonNull final I_M_Forecast forecast) { final ProductDescriptor productDescriptor = productDescriptorFactory.createProductDescriptor(forecastLine); final BPartnerId customerId = BPartnerId.ofRepoIdOrNull(CoalesceUtil.firstGreaterThanZero(forecastLine.getC_BPartner_ID(), forecast.getC_BPartner_ID())); final MaterialDescriptor materialDescriptor = MaterialDescriptor.builder() .date(TimeUtil.asInstant(forecastLine.getDatePromised())) .productDescriptor(productDescriptor) .customerId(customerId) .warehouseId(WarehouseId.ofRepoId(forecastLine.getM_Warehouse_ID())) .quantity(forecastLine.getQty()) .build(); return ForecastLine.builder() .forecastLineId(forecastLine.getM_ForecastLine_ID()) .materialDescriptor(materialDescriptor) .build(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\material\interceptor\M_ForecastEventCreator.java
1
请完成以下Java代码
public void setIsManual (boolean IsManual) { set_ValueNoCheck (COLUMNNAME_IsManual, Boolean.valueOf(IsManual)); } /** Get Manuell. @return This is a manual process */ @Override public boolean isManual () { Object oo = get_Value(COLUMNNAME_IsManual); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Sales Transaction. @param IsSOTrx This is a Sales Transaction */ @Override public void setIsSOTrx (boolean IsSOTrx) { set_Value (COLUMNNAME_IsSOTrx, Boolean.valueOf(IsSOTrx)); } /** Get Sales Transaction. @return This is a Sales Transaction */ @Override public boolean isSOTrx () { Object oo = get_Value(COLUMNNAME_IsSOTrx); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Zeile Nr.. @param Line Unique line for this document */ @Override public void setLine (int Line) { set_Value (COLUMNNAME_Line, Integer.valueOf(Line)); } /** Get Zeile Nr.. @return Unique line for this document */ @Override public int getLine () { Integer ii = (Integer)get_Value(COLUMNNAME_Line); if (ii == null) return 0; return ii.intValue(); } /** Set Steuerbetrag. @param TaxAmt
Tax Amount for a document */ @Override public void setTaxAmt (java.math.BigDecimal TaxAmt) { set_ValueNoCheck (COLUMNNAME_TaxAmt, TaxAmt); } /** Get Steuerbetrag. @return Tax Amount for a document */ @Override public java.math.BigDecimal getTaxAmt () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TaxAmt); if (bd == null) return Env.ZERO; return bd; } /** Set Bezugswert. @param TaxBaseAmt Base for calculating the tax amount */ @Override public void setTaxBaseAmt (java.math.BigDecimal TaxBaseAmt) { set_ValueNoCheck (COLUMNNAME_TaxBaseAmt, TaxBaseAmt); } /** Get Bezugswert. @return Base for calculating the tax amount */ @Override public java.math.BigDecimal getTaxBaseAmt () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TaxBaseAmt); if (bd == null) return Env.ZERO; return bd; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_TaxDeclarationLine.java
1
请在Spring Boot框架中完成以下Java代码
public PageSerializationMode getSerializationMode() { return this.serializationMode; } public void setSerializationMode(PageSerializationMode serializationMode) { this.serializationMode = serializationMode; } } /** * Sort properties. */ public static class Sort { /**
* Sort parameter name. */ private String sortParameter = "sort"; public String getSortParameter() { return this.sortParameter; } public void setSortParameter(String sortParameter) { this.sortParameter = sortParameter; } } }
repos\spring-boot-4.0.1\module\spring-boot-data-commons\src\main\java\org\springframework\boot\data\autoconfigure\web\DataWebProperties.java
2
请完成以下Java代码
public void setSpanY (int SpanY) { set_Value (COLUMNNAME_SpanY, Integer.valueOf(SpanY)); } /** Get Row Span. @return Number of rows spanned */ public int getSpanY () { Integer ii = (Integer)get_Value(COLUMNNAME_SpanY); if (ii == null) return 0; return ii.intValue(); } public I_C_POSKeyLayout getSubKeyLayout() throws RuntimeException { return (I_C_POSKeyLayout)MTable.get(getCtx(), I_C_POSKeyLayout.Table_Name) .getPO(getSubKeyLayout_ID(), get_TrxName()); } /** Set Key Layout. @param SubKeyLayout_ID Key Layout to be displayed when this key is pressed */ public void setSubKeyLayout_ID (int SubKeyLayout_ID) { if (SubKeyLayout_ID < 1) set_Value (COLUMNNAME_SubKeyLayout_ID, null); else set_Value (COLUMNNAME_SubKeyLayout_ID, Integer.valueOf(SubKeyLayout_ID)); } /** Get Key Layout. @return Key Layout to be displayed when this key is pressed */ public int getSubKeyLayout_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_SubKeyLayout_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Text. @param Text Text */ public void setText (String Text) { set_Value (COLUMNNAME_Text, Text); } /** Get Text. @return Text */ public String getText () { return (String)get_Value(COLUMNNAME_Text);
} @Override public I_AD_Reference getAD_Reference() throws RuntimeException { return (I_AD_Reference)MTable.get(getCtx(), I_AD_Reference.Table_Name) .getPO(getAD_Reference_ID(), get_TrxName()); } @Override public int getAD_Reference_ID() { Integer ii = (Integer)get_Value(COLUMNNAME_AD_Reference_ID); if (ii == null) return 0; return ii.intValue(); } @Override public void setAD_Reference_ID(int AD_Reference_ID) { if (AD_Reference_ID < 1) set_Value (COLUMNNAME_AD_Reference_ID, null); else set_Value (COLUMNNAME_AD_Reference_ID, Integer.valueOf(AD_Reference_ID)); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_POSKey.java
1
请完成以下Java代码
public boolean hasChildren() { return children != null && children.size() > 0; } @Override public String toString() { return "JwDepartmentTree{" + "children=" + children + "} " + super.toString(); } /** * 静态辅助方法,将list转为tree结构 */ public static List<JdtDepartmentTreeVo> listToTree(List<Department> allDepartment) { // 先找出所有的父级 List<JdtDepartmentTreeVo> treeList = getByParentId(1, allDepartment); Optional<Department> departmentOptional = allDepartment.stream().filter(item -> item.getParent_id() == null).findAny(); Department department = new Department(); //判断是否找到数据 if(departmentOptional.isPresent()){ department = departmentOptional.get(); } getChildrenRecursion(treeList, allDepartment); // 代码逻辑说明: 【issues/6017】钉钉同步部门时没有最顶层的部门名,同步用户时,用户没有部门信息--- JdtDepartmentTreeVo treeVo = new JdtDepartmentTreeVo(department); treeVo.setChildren(treeList); List<JdtDepartmentTreeVo> list = new ArrayList<>();
list.add(treeVo); return list; } private static List<JdtDepartmentTreeVo> getByParentId(Integer parentId, List<Department> allDepartment) { List<JdtDepartmentTreeVo> list = new ArrayList<>(); for (Department department : allDepartment) { if (parentId.equals(department.getParent_id())) { list.add(new JdtDepartmentTreeVo(department)); } } return list; } private static void getChildrenRecursion(List<JdtDepartmentTreeVo> treeList, List<Department> allDepartment) { for (JdtDepartmentTreeVo departmentTree : treeList) { // 递归寻找子级 List<JdtDepartmentTreeVo> children = getByParentId(departmentTree.getDept_id(), allDepartment); if (children.size() > 0) { departmentTree.setChildren(children); getChildrenRecursion(children, allDepartment); } } } }
repos\JeecgBoot-main\jeecg-boot\jeecg-module-system\jeecg-system-biz\src\main\java\org\jeecg\modules\system\vo\thirdapp\JdtDepartmentTreeVo.java
1
请完成以下Java代码
public void setC_BPartner_ID (int C_BPartner_ID) { if (C_BPartner_ID < 1) set_Value (COLUMNNAME_C_BPartner_ID, null); else set_Value (COLUMNNAME_C_BPartner_ID, Integer.valueOf(C_BPartner_ID)); } /** Get Geschäftspartner. @return Bezeichnet einen Geschäftspartner */ @Override public int getC_BPartner_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_BPartner_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Produkt. @param M_Product_ID Produkt, Leistung, Artikel */ @Override public void setM_Product_ID (int M_Product_ID) { if (M_Product_ID < 1) set_ValueNoCheck (COLUMNNAME_M_Product_ID, null); else set_ValueNoCheck (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID)); } /** Get Produkt. @return Produkt, Leistung, Artikel */ @Override public int getM_Product_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID); if (ii == null) return 0; return ii.intValue(); } /** Set UPC/EAN. @param UPC Produktidentifikation (Barcode) durch Universal Product Code oder European Article Number) */ @Override public void setUPC (java.lang.String UPC) { set_Value (COLUMNNAME_UPC, UPC); } /** Get UPC/EAN. @return Produktidentifikation (Barcode) durch Universal Product Code oder European Article Number) */
@Override public java.lang.String getUPC () { return (java.lang.String)get_Value(COLUMNNAME_UPC); } /** Set Verwendet für Kunden. @param UsedForCustomer Verwendet für Kunden */ @Override public void setUsedForCustomer (boolean UsedForCustomer) { set_Value (COLUMNNAME_UsedForCustomer, Boolean.valueOf(UsedForCustomer)); } /** Get Verwendet für Kunden. @return Verwendet für Kunden */ @Override public boolean isUsedForCustomer () { Object oo = get_Value(COLUMNNAME_UsedForCustomer); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java-gen\de\metas\handlingunits\model\X_EDI_M_Product_Lookup_UPC_v.java
1
请在Spring Boot框架中完成以下Java代码
public void bulkDeleteHistoricIdentityLinksForProcessInstanceIds(Collection<String> processInstanceIds) { getDbSqlSession().delete("bulkDeleteHistoricIdentityLinksForProcessInstanceIds", createSafeInValuesList(processInstanceIds), HistoricIdentityLinkEntityImpl.class); } @Override public void bulkDeleteHistoricIdentityLinksForTaskIds(Collection<String> taskIds) { getDbSqlSession().delete("bulkDeleteHistoricIdentityLinksForTaskIds", createSafeInValuesList(taskIds), HistoricIdentityLinkEntityImpl.class); } @Override public void bulkDeleteHistoricIdentityLinksForScopeIdsAndScopeType(Collection<String> scopeIds, String scopeType) { Map<String, Object> parameters = new HashMap<>(); parameters.put("scopeIds", createSafeInValuesList(scopeIds)); parameters.put("scopeType", scopeType); getDbSqlSession().delete("bulkDeleteHistoricIdentityLinksForScopeIdsAndScopeType", parameters, HistoricIdentityLinkEntityImpl.class); } @Override
public void deleteHistoricProcessIdentityLinksForNonExistingInstances() { getDbSqlSession().delete("bulkDeleteHistoricProcessIdentityLinks", null, HistoricIdentityLinkEntityImpl.class); } @Override public void deleteHistoricCaseIdentityLinksForNonExistingInstances() { getDbSqlSession().delete("bulkDeleteHistoricCaseIdentityLinks", null, HistoricIdentityLinkEntityImpl.class); } @Override public void deleteHistoricTaskIdentityLinksForNonExistingInstances() { getDbSqlSession().delete("bulkDeleteHistoricTaskIdentityLinks", null, HistoricIdentityLinkEntityImpl.class); } @Override protected IdGenerator getIdGenerator() { return identityLinkServiceConfiguration.getIdGenerator(); } }
repos\flowable-engine-main\modules\flowable-identitylink-service\src\main\java\org\flowable\identitylink\service\impl\persistence\entity\data\impl\MybatisHistoricIdentityLinkDataManager.java
2
请完成以下Java代码
public void closing(CommandContext commandContext) { // nothing to do } @Override public void closed(CommandContext commandContext) { LoggingSessionUtil.addEngineLoggingData(LoggingSessionConstants.TYPE_COMMAND_CONTEXT_CLOSE, "Closed command context for " + engineType + " engine", engineType, objectMapper); List<ObjectNode> loggingData = loggingSession.getLoggingData(); loggingListener.loggingGenerated(loggingData); } @Override public void closeFailure(CommandContext commandContext) { LoggingSessionUtil.addEngineLoggingData(LoggingSessionConstants.TYPE_COMMAND_CONTEXT_CLOSE_FAILURE, "Exception at closing command context for " + engineType + " engine", engineType, objectMapper); List<ObjectNode> loggingData = loggingSession.getLoggingData(); loggingListener.loggingGenerated(loggingData); } @Override public void afterSessionsFlush(CommandContext commandContext) { // nothing to do } @Override public Integer order() { return 500; } @Override public boolean multipleAllowed() { return false; } public LoggingSession getLoggingSession() { return loggingSession;
} public void setLoggingSession(LoggingSession loggingSession) { this.loggingSession = loggingSession; } public LoggingListener getLoggingListener() { return loggingListener; } public void setLoggingListener(LoggingListener loggingListener) { this.loggingListener = loggingListener; } public String getEngineType() { return engineType; } public void setEngineType(String engineType) { this.engineType = engineType; } }
repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\logging\LoggingSessionCommandContextCloseListener.java
1
请完成以下Java代码
private File suggestFileToSave(final String filename, final String contentType, final boolean temporaryFile) { final String filenameSuggestion; final String fileExtensionSuggestion; if (Check.isEmpty(filename, true)) { String fileExt = null; if (!Check.isEmpty(contentType, true)) { fileExt = MimeType.getExtensionByType(contentType); } if (Check.isEmpty(fileExt, true)) { filenameSuggestion = "data"; } else { filenameSuggestion = "data" + fileExt; } fileExtensionSuggestion = fileExt; } else { filenameSuggestion = filename.trim(); final String mimeType; if (Check.isEmpty(contentType, true)) { mimeType = MimeType.getMimeType(filenameSuggestion); } else { mimeType = contentType.trim(); } fileExtensionSuggestion = MimeType.getExtensionByType(mimeType); } final File fileToUse; if (temporaryFile) { try { fileToUse = File.createTempFile(filenameSuggestion, fileExtensionSuggestion); } catch (final IOException e) { throw new AdempiereException("Cannot create temporary file for " + filenameSuggestion, e); } } else { final JFileChooser fc = new JFileChooser(); fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.setSelectedFile(new File(filenameSuggestion)); if (!Check.isEmpty(fileExtensionSuggestion, true)) { final String fileExtensionSuggestionLC = fileExtensionSuggestion.toLowerCase(); fc.addChoosableFileFilter(new FileFilter() { @Override public String getDescription() { return "*" + fileExtensionSuggestion; } @Override public boolean accept(final File f) { if (f.isDirectory())
{ return true; } return f.getName().toLowerCase().endsWith(fileExtensionSuggestionLC); } }); } if (fc.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) { fileToUse = fc.getSelectedFile(); } else { fileToUse = null; } } return fileToUse; } @Override public String getClientInfo() { final String javaVersion = System.getProperty("java.version"); return new StringBuilder("Swing, java.version=").append(javaVersion).toString(); } @Override public void showWindow(final Object model) { Check.assumeNotNull(model, "model not null"); final int adTableId = InterfaceWrapperHelper.getModelTableId(model); final int recordId = InterfaceWrapperHelper.getId(model); AEnv.zoom(adTableId, recordId); } @Override public IClientUIInvoker invoke() { return new SwingClientUIInvoker(this); } @Override public IClientUIAsyncInvoker invokeAsync() { return new SwingClientUIAsyncInvoker(); } @Override public void showURL(final String url) { try { final URI uri = new URI(url); Desktop.getDesktop().browse(uri); } catch (Exception e) { logger.warn("Failed opening " + url, e.getLocalizedMessage()); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\de\metas\adempiere\form\swing\SwingClientUIInstance.java
1
请完成以下Java代码
public File getLogDirAsFile() { if (logDir == null) { return null; } return new File(logDir); } public File getActiveFileOrNull() { try { final String filename = getActiveFileName(); if (filename == null) { return null; } final File file = new File(filename).getAbsoluteFile(); return file; } catch (Exception e) { addError("Failed fetching active file name", e); return null; } } public List<File> getLogFiles() {
final File logDir = getLogDirAsFile(); if (logDir != null && logDir.isDirectory()) { final File[] logs = logDir.listFiles(logFileNameFilter); for (int i = 0; i < logs.length; i++) { try { logs[i] = logs[i].getCanonicalFile(); } catch (Exception e) { } } return ImmutableList.copyOf(logs); } return ImmutableList.of(); } public void flush() { // TODO } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\logging\MetasfreshTimeBasedRollingPolicy.java
1
请完成以下Java代码
public void setAD_Table_ID (final int AD_Table_ID) { if (AD_Table_ID < 1) set_Value (COLUMNNAME_AD_Table_ID, null); else set_Value (COLUMNNAME_AD_Table_ID, AD_Table_ID); } @Override public int getAD_Table_ID() { return get_ValueAsInt(COLUMNNAME_AD_Table_ID); } @Override public org.compiere.model.I_AD_Val_Rule getAD_Val_Rule() { return get_ValueAsPO(COLUMNNAME_AD_Val_Rule_ID, org.compiere.model.I_AD_Val_Rule.class); } @Override public void setAD_Val_Rule(final org.compiere.model.I_AD_Val_Rule AD_Val_Rule) { set_ValueFromPO(COLUMNNAME_AD_Val_Rule_ID, org.compiere.model.I_AD_Val_Rule.class, AD_Val_Rule); } @Override public void setAD_Val_Rule_ID (final int AD_Val_Rule_ID) { if (AD_Val_Rule_ID < 1) set_Value (COLUMNNAME_AD_Val_Rule_ID, null); else set_Value (COLUMNNAME_AD_Val_Rule_ID, AD_Val_Rule_ID); }
@Override public int getAD_Val_Rule_ID() { return get_ValueAsInt(COLUMNNAME_AD_Val_Rule_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 setWEBUI_Board_ID (final int WEBUI_Board_ID) { if (WEBUI_Board_ID < 1) set_ValueNoCheck (COLUMNNAME_WEBUI_Board_ID, null); else set_ValueNoCheck (COLUMNNAME_WEBUI_Board_ID, WEBUI_Board_ID); } @Override public int getWEBUI_Board_ID() { return get_ValueAsInt(COLUMNNAME_WEBUI_Board_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java-gen\de\metas\ui\web\base\model\X_WEBUI_Board.java
1
请在Spring Boot框架中完成以下Java代码
public class BaseRelatedEdgesService extends AbstractCachedEntityService<RelatedEdgesCacheKey, RelatedEdgesCacheValue, RelatedEdgesEvictEvent> implements RelatedEdgesService { public static final int RELATED_EDGES_CACHE_ITEMS = 1000; public static final PageLink FIRST_PAGE = new PageLink(RELATED_EDGES_CACHE_ITEMS); @Autowired @Lazy private EdgeService edgeService; @TransactionalEventListener(classes = RelatedEdgesEvictEvent.class) @Override public void handleEvictEvent(RelatedEdgesEvictEvent event) { cache.evict(new RelatedEdgesCacheKey(event.getTenantId(), event.getEntityId())); } @Override
public PageData<EdgeId> findEdgeIdsByEntityId(TenantId tenantId, EntityId entityId, PageLink pageLink) { log.trace("Executing findEdgeIdsByEntityId, tenantId [{}], entityId [{}], pageLink [{}]", tenantId, entityId, pageLink); if (!pageLink.equals(FIRST_PAGE)) { return edgeService.findEdgeIdsByTenantIdAndEntityId(tenantId, entityId, pageLink); } return cache.getAndPutInTransaction(new RelatedEdgesCacheKey(tenantId, entityId), () -> new RelatedEdgesCacheValue(edgeService.findEdgeIdsByTenantIdAndEntityId(tenantId, entityId, pageLink)), false).getPageData(); } @Override public void publishRelatedEdgeIdsEvictEvent(TenantId tenantId, EntityId entityId) { log.trace("Executing publishRelatedEdgeIdsEvictEvent, tenantId [{}], entityId [{}]", tenantId, entityId); publishEvictEvent(new RelatedEdgesEvictEvent(tenantId, entityId)); } }
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\edge\BaseRelatedEdgesService.java
2
请完成以下Java代码
public int getPP_Plant_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_PP_Plant_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Verarbeitet. @param Processed Checkbox sagt aus, ob der Beleg verarbeitet wurde. */ @Override public void setProcessed (boolean Processed) { set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed)); }
/** Get Verarbeitet. @return Checkbox sagt aus, ob der Beleg verarbeitet wurde. */ @Override public boolean isProcessed () { Object oo = get_Value(COLUMNNAME_Processed); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.fresh\de.metas.fresh.base\src\main\java-gen\de\metas\fresh\model\X_C_Order_MFGWarehouse_Report.java
1
请完成以下Java代码
public class DpdConversionUtil { /** * dpd wants to store the volume in the format LLLWWWHHH as an Integer. * how am i supposed to store the leading zeroes in an int!!?!?!?!?!?!!? * eg. for * - l = 10 cm * - w = 20 cm * - h = 30 cm * => volume = Integer(magically)(010020030) * wtf dpd?!? * i'm not even shamed of this. */ public static int formatVolume(@NonNull final PackageDimensions packageDimensions) { return Integer.parseInt(String.format("%03d%03d%03d", packageDimensions.getLengthInCM(), packageDimensions.getWidthInCM(), packageDimensions.getHeightInCM())); } /** * Return date as Integer in format `YYYYMMDD` */ public static int formatDate(@NonNull final LocalDate date) { return Integer.parseInt(date.format(DateTimeFormatter.BASIC_ISO_DATE)); } /** * Return Day Of Week as Integer * - 0 = Sunday * - 1 = Monday * - etc. */ public static int getPickupDayOfTheWeek(@NonNull final PickupDate pickupDate) { final DayOfWeek dayOfWeek = pickupDate.getDate().getDayOfWeek(); return dayOfWeek.getValue() % 7; }
/** * Dpd weight UOM is Decagrams (Dag). * <p> * Conversion is: 1dag = 10g => 100dag = 1kg */ public static int convertWeightKgToDag(final int weightInKg) { return weightInKg * 100; } /** * Return the time as Integer in format `hhmm` */ public static int formatTime(@NonNull final LocalTime time) { return Integer.parseInt(time.format(DateTimeFormatter.ofPattern("HHmm"))); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.dpd\src\main\java\de\metas\shipper\gateway\dpd\util\DpdConversionUtil.java
1
请在Spring Boot框架中完成以下Java代码
private String resolveType(MetadataGenerationEnvironment environment) { return environment.getTypeUtils().getType(getDeclaringElement(), getType()); } /** * Resolve the property description. * @param environment the metadata generation environment * @return the property description */ protected abstract String resolveDescription(MetadataGenerationEnvironment environment); /** * Resolve the default value for this property. * @param environment the metadata generation environment * @return the default value or {@code null} */ protected abstract Object resolveDefaultValue(MetadataGenerationEnvironment environment);
/** * Resolve the {@link ItemDeprecation} for this property. * @param environment the metadata generation environment * @return the deprecation or {@code null} */ protected abstract ItemDeprecation resolveItemDeprecation(MetadataGenerationEnvironment environment); /** * Return true if this descriptor is for a property. * @param environment the metadata generation environment * @return if this is a property */ abstract boolean isProperty(MetadataGenerationEnvironment environment); }
repos\spring-boot-4.0.1\configuration-metadata\spring-boot-configuration-processor\src\main\java\org\springframework\boot\configurationprocessor\PropertyDescriptor.java
2
请在Spring Boot框架中完成以下Java代码
class InMemoryRepository implements UserRepository, RoleRepository { private Map<String, User> users = new LinkedHashMap<>(); private Map<String, Role> roles = new LinkedHashMap<>(); @Override public List<User> getAll() { return new ArrayList<>(users.values()); } @Override public void save(User user) { user.setId(UUID.randomUUID().toString()); users.put(user.getId(), user); } @Override public void save(Role role) { role.setId(UUID.randomUUID().toString()); roles.put(role.getId(), role); } @Override
public Role getRoleById(String id) { return roles.get(id); } @Override public Role getRoleByName(String name) { return roles.values() .stream() .filter(role -> role.getName().equalsIgnoreCase(name)) .findFirst() .orElse(null); } @Override public void deleteAll() { users.clear(); roles.clear(); } }
repos\tutorials-master\patterns-modules\design-patterns-architectural\src\main\java\com\baeldung\dtopattern\domain\InMemoryRepository.java
2
请完成以下Java代码
protected final String getColumnName() { final GridField gridField = getGridField(); if (gridField == null) { return null; } final String columnName = gridField.getColumnName(); return columnName; } protected final Object getFieldValue() { final IContextMenuActionContext context = getContext(); if (context == null) { return null; } // // Get value when in Grid Mode final VTable vtable = context.getVTable(); final int row = context.getViewRow(); final int column = context.getViewColumn(); if (vtable != null && row >= 0 && column >= 0) { final Object value = vtable.getValueAt(row, column); return value; } // Get value when in single mode else { final GridField gridField = getGridField(); if (gridField == null) { return null; } final Object value = gridField.getValue(); return value; } } protected final GridController getGridController() { final IContextMenuActionContext context = getContext(); if (context == null) { return null; } final VTable vtable = context.getVTable();
final Component comp; if (vtable != null) { comp = vtable; } else { final VEditor editor = getEditor(); if (editor instanceof Component) { comp = (Component)editor; } else { comp = null; } } Component p = comp; while (p != null) { if (p instanceof GridController) { return (GridController)p; } p = p.getParent(); } return null; } protected final boolean isGridMode() { final GridController gc = getGridController(); if (gc == null) { return false; } final boolean gridMode = !gc.isSingleRow(); return gridMode; } @Override public KeyStroke getKeyStroke() { return null; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\org\adempiere\ui\AbstractContextMenuAction.java
1
请完成以下Java代码
private void cmd_updateArchive() { final I_AD_Archive ar = m_archives[m_index]; boolean update = false; if (!isSame(nameField.getText(), ar.getName())) { String newText = nameField.getText(); if (newText != null && newText.length() > 0) { ar.setName(newText); update = true; } } if (!isSame(descriptionField.getText(), ar.getDescription())) { ar.setDescription(descriptionField.getText()); update = true; } if (!isSame(helpField.getText(), ar.getHelp())) { ar.setHelp(helpField.getText()); update = true; } log.info("Update=" + update); if (update) { InterfaceWrapperHelper.save(ar); } // m_index++; updateVDisplay(false); } // cmd_updateArchive /** * Query Directly * * @param isReport report * @param AD_Table_ID table * @param Record_ID tecord */ public void query(boolean isReport, int AD_Table_ID, int Record_ID) { log.info("Report=" + isReport + ", AD_Table_ID=" + AD_Table_ID + ",Record_ID=" + Record_ID); reportField.setSelected(isReport); m_AD_Table_ID = AD_Table_ID; m_Record_ID = Record_ID; cmd_query(); } // query /************************************************************************** * Create Query
*/ private void cmd_query() { boolean reports = reportField.isSelected(); KeyNamePair process = (KeyNamePair)processField.getSelectedItem(); KeyNamePair table = (KeyNamePair)tableField.getSelectedItem(); Integer C_BPartner_ID = (Integer)bPartnerField.getValue(); String name = nameQField.getText(); String description = descriptionQField.getText(); String help = helpQField.getText(); KeyNamePair createdBy = (KeyNamePair)createdByQField.getSelectedItem(); Timestamp createdFrom = createdQFrom.getTimestamp(); Timestamp createdTo = createdQTo.getTimestamp(); cmd_query(reports, process, table, C_BPartner_ID, name, description, help, createdBy, createdFrom, createdTo); // Display panel.setSelectedIndex(1); m_index = 1; updateVDisplay(false); } // cmd_query } // ArchiveViewer
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\apps\form\ArchiveViewer.java
1
请完成以下Java代码
public abstract class AbstractEventAtomicOperation implements AtomicOperation { @Override public boolean isAsync(InterpretableExecution execution) { return false; } @Override public void execute(InterpretableExecution execution) { ScopeImpl scope = getScope(execution); List<ExecutionListener> executionListeners = scope.getExecutionListeners(getEventName()); int executionListenerIndex = execution.getExecutionListenerIndex(); if (executionListeners.size() > executionListenerIndex) { execution.setEventName(getEventName()); execution.setEventSource(scope); ExecutionListener listener = executionListeners.get(executionListenerIndex); try { listener.notify(execution); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new PvmException("couldn't execute event listener : " + e.getMessage(), e); }
execution.setExecutionListenerIndex(executionListenerIndex + 1); execution.performOperation(this); } else { execution.setExecutionListenerIndex(0); execution.setEventName(null); execution.setEventSource(null); eventNotificationsCompleted(execution); } } protected abstract ScopeImpl getScope(InterpretableExecution execution); protected abstract String getEventName(); protected abstract void eventNotificationsCompleted(InterpretableExecution execution); }
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\pvm\runtime\AbstractEventAtomicOperation.java
1
请完成以下Java代码
public IOException unableToRewindReader() { return new IOException(exceptionMessage("007", "Unable to rewind input stream: rewind buffering limit exceeded")); } public SpinDataFormatException multipleProvidersForDataformat(String dataFormatName) { return new SpinDataFormatException(exceptionMessage("008", "Multiple providers found for dataformat '{}'", dataFormatName)); } public void logDataFormats(Collection<DataFormat<?>> formats) { if (isInfoEnabled()) { for (DataFormat<?> format : formats) { logDataFormat(format); } } } protected void logDataFormat(DataFormat<?> dataFormat) { logInfo("009", "Discovered Spin data format: {}[name = {}]", dataFormat.getClass().getName(), dataFormat.getName()); } public void logDataFormatProvider(DataFormatProvider provider) { if (isInfoEnabled()) { logInfo("010", "Discovered Spin data format provider: {}[name = {}]", provider.getClass().getName(), provider.getDataFormatName()); }
} @SuppressWarnings("rawtypes") public void logDataFormatConfigurator(DataFormatConfigurator configurator) { if (isInfoEnabled()) { logInfo("011", "Discovered Spin data format configurator: {}[dataformat = {}]", configurator.getClass(), configurator.getDataFormatClass().getName()); } } public SpinDataFormatException classNotFound(String classname, ClassNotFoundException cause) { return new SpinDataFormatException(exceptionMessage("012", "Class {} not found ", classname), cause); } public void tryLoadingClass(String classname, ClassLoader cl) { logDebug("013", "Try loading class '{}' using classloader '{}'.", classname, cl); } }
repos\camunda-bpm-platform-master\spin\core\src\main\java\org\camunda\spin\impl\logging\SpinCoreLogger.java
1
请完成以下Java代码
void run(EncryptionService encryptionService, ConfigurableApplicationContext context, String encryptPrefix, String encryptSuffix, String decryptPrefix, String decryptSuffix) throws MojoExecutionException { run(encryptionService, getFullFilePath(context), encryptPrefix, encryptSuffix, decryptPrefix, decryptSuffix); } /** * Run the encryption task. * * @param encryptionService the service for encryption * @param fullPath the path to operate on * @param encryptPrefix encryption prefix * @param encryptSuffix encryption suffix * @param decryptPrefix decryption prefix * @param decryptSuffix decryption suffix */ abstract void run(EncryptionService encryptionService, Path fullPath, String encryptPrefix, String encryptSuffix, String decryptPrefix, String decryptSuffix) throws MojoExecutionException;
/** * Construct the full file path, relative to the active environment. * * @param context the context (for retrieving active environments) * @return the full path * @throws MojoExecutionException if the file does not exist */ private Path getFullFilePath(final ApplicationContext context) throws MojoExecutionException { try { return context.getResource(path).getFile().toPath(); } catch (IOException e) { throw new MojoExecutionException("Unable to open configuration file", e); } } }
repos\jasypt-spring-boot-master\jasypt-maven-plugin\src\main\java\com\ulisesbocchio\jasyptmavenplugin\mojo\AbstractFileJasyptMojo.java
1
请在Spring Boot框架中完成以下Java代码
public class PrintableScannedCode { @NonNull ScannedCode code; @NonNull String displayable; @NonNull public static PrintableScannedCode of(@NonNull ScannedCode scannedCode) { return builder() .code(scannedCode) .displayable(scannedCode.getAsString()) .build(); } @Nullable public static PrintableScannedCode ofNullable(@Nullable PrintableQRCode qrCode) {return qrCode != null ? of(qrCode) : null;} @NonNull
public static PrintableScannedCode of(@NonNull PrintableQRCode qrCode) { return builder() .code(ScannedCode.ofString(qrCode.getQrCode())) .displayable(qrCode.getDisplayableString()) .build(); } public JsonPrintableScannedCode toJson() { return JsonPrintableScannedCode.builder() .code(code) .displayable(displayable) .build(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\scannable_code\PrintableScannedCode.java
2
请完成以下Java代码
public void addRelations(User user, Iterable<Long> roleIds, String fieldName) { final Set<Role> roles = user.getRoles(); roles.addAll(roleRepository.findAllById(roleIds)); user.setRoles(roles); userRepository.save(user); } @Override public void removeRelations(User user, Iterable<Long> roleIds, String fieldName) { final Set<Role> roles = user.getRoles(); roles.removeAll(roleRepository.findAllById(roleIds)); user.setRoles(roles); userRepository.save(user); } @Override public Role findOneTarget(Long sourceId, String fieldName, QuerySpec querySpec) { // not for many-to-many return null; }
@Override public ResourceList<Role> findManyTargets(Long sourceId, String fieldName, QuerySpec querySpec) { final Optional<User> userOptional = userRepository.findById(sourceId); User user = userOptional.isPresent() ? userOptional.get() : new User(); return querySpec.apply(user.getRoles()); } @Override public Class<User> getSourceResourceClass() { return User.class; } @Override public Class<Role> getTargetResourceClass() { return Role.class; } }
repos\tutorials-master\spring-katharsis\src\main\java\com\baeldung\persistence\katharsis\UserToRoleRelationshipRepository.java
1
请完成以下Java代码
public List<Queue> findAllQueues() { log.trace("Executing findAllQueues"); return queueDao.findAllQueues(); } @Override public Queue findQueueById(TenantId tenantId, QueueId queueId) { log.trace("Executing findQueueById, queueId: [{}]", queueId); return queueDao.findById(tenantId, queueId.getId()); } @Override public Queue findQueueByTenantIdAndName(TenantId tenantId, String queueName) { log.trace("Executing findQueueByTenantIdAndName, tenantId: [{}] queueName: [{}]", tenantId, queueName); return queueDao.findQueueByTenantIdAndName(getSystemOrIsolatedTenantId(tenantId), queueName); } @Override public Queue findQueueByTenantIdAndNameInternal(TenantId tenantId, String queueName) { log.trace("Executing findQueueByTenantIdAndNameInternal, tenantId: [{}] queueName: [{}]", tenantId, queueName); return queueDao.findQueueByTenantIdAndName(tenantId, queueName); } @Override public void deleteQueuesByTenantId(TenantId tenantId) { validateId(tenantId, __ -> "Incorrect tenant id for delete queues request."); tenantQueuesRemover.removeEntities(tenantId, tenantId); } @Override public void deleteByTenantId(TenantId tenantId) { deleteQueuesByTenantId(tenantId); } @Override public Optional<HasId<?>> findEntity(TenantId tenantId, EntityId entityId) { return Optional.ofNullable(findQueueById(tenantId, new QueueId(entityId.getId()))); }
@Override public FluentFuture<Optional<HasId<?>>> findEntityAsync(TenantId tenantId, EntityId entityId) { return FluentFuture.from(queueDao.findByIdAsync(tenantId, entityId.getId())) .transform(Optional::ofNullable, directExecutor()); } @Override public EntityType getEntityType() { return EntityType.QUEUE; } private final PaginatedRemover<TenantId, Queue> tenantQueuesRemover = new PaginatedRemover<>() { @Override protected PageData<Queue> findEntities(TenantId tenantId, TenantId id, PageLink pageLink) { return queueDao.findQueuesByTenantId(id, pageLink); } @Override protected void removeEntity(TenantId tenantId, Queue entity) { deleteQueue(tenantId, entity.getId()); } }; private TenantId getSystemOrIsolatedTenantId(TenantId tenantId) { if (!tenantId.equals(TenantId.SYS_TENANT_ID)) { TenantProfile tenantProfile = tenantProfileCache.get(tenantId); if (tenantProfile.isIsolatedTbRuleEngine()) { return tenantId; } } return TenantId.SYS_TENANT_ID; } }
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\queue\BaseQueueService.java
1
请在Spring Boot框架中完成以下Java代码
public class ApplicationConfiguration { public ApplicationConfiguration( @NonNull final ExternalReferenceTypes externalReferenceTypes, @NonNull final ExternalSystemRepository externalSystemRepository) { externalReferenceTypes.registerType(ExternalServiceReferenceType.ISSUE_ID); externalReferenceTypes.registerType(ExternalServiceReferenceType.TIME_BOOKING_ID); externalReferenceTypes.registerType(ExternalServiceReferenceType.MILESTONE_ID); } @Bean public IUserDAO userDAO() { return Services.get(IUserDAO.class); } @Bean public ITrxManager trxManager() { return Services.get(ITrxManager.class); } @Bean public IQueryBL queryBL() { return Services.get(IQueryBL.class); } @Bean public ImportQueue<ImportTimeBookingInfo> timeBookingImportQueue() { return new ImportQueue<>(TIME_BOOKING_QUEUE_CAPACITY, IMPORT_TIME_BOOKINGS_LOG_MESSAGE_PREFIX); } @Bean
public ImportQueue<ImportIssueInfo> importIssuesQueue() { return new ImportQueue<>(ISSUE_QUEUE_CAPACITY, IMPORT_LOG_MESSAGE_PREFIX); } @Bean public ObjectMapper objectMapper() { return JsonObjectMapperHolder.sharedJsonObjectMapper(); } @Bean public IMsgBL msgBL() { return Services.get(IMsgBL.class); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.serviceprovider\src\main\java\de\metas\serviceprovider\configuration\ApplicationConfiguration.java
2
请完成以下Java代码
public int getAD_Process_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_AD_Process_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Process Statistics. @param AD_Process_Stats_ID Process Statistics */ @Override public void setAD_Process_Stats_ID (int AD_Process_Stats_ID) { if (AD_Process_Stats_ID < 1) set_ValueNoCheck (COLUMNNAME_AD_Process_Stats_ID, null); else set_ValueNoCheck (COLUMNNAME_AD_Process_Stats_ID, Integer.valueOf(AD_Process_Stats_ID)); } /** Get Process Statistics. @return Process Statistics */ @Override public int getAD_Process_Stats_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_AD_Process_Stats_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Statistic Count. @param Statistic_Count Internal statistics how often the entity was used */ @Override public void setStatistic_Count (int Statistic_Count) { set_Value (COLUMNNAME_Statistic_Count, Integer.valueOf(Statistic_Count)); } /** Get Statistic Count. @return Internal statistics how often the entity was used */ @Override
public int getStatistic_Count () { Integer ii = (Integer)get_Value(COLUMNNAME_Statistic_Count); if (ii == null) return 0; return ii.intValue(); } /** Set Statistic Milliseconds. @param Statistic_Millis Internal statistics how many milliseconds a process took */ @Override public void setStatistic_Millis (int Statistic_Millis) { set_Value (COLUMNNAME_Statistic_Millis, Integer.valueOf(Statistic_Millis)); } /** Get Statistic Milliseconds. @return Internal statistics how many milliseconds a process took */ @Override public int getStatistic_Millis () { Integer ii = (Integer)get_Value(COLUMNNAME_Statistic_Millis); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Process_Stats.java
1
请完成以下Java代码
public Builder claim(String name, Object value) { Assert.hasText(name, "name cannot be empty"); Assert.notNull(value, "value cannot be null"); this.claims.put(name, value); return this; } /** * A {@code Consumer} to be provided access to the claims allowing the ability to * add, replace, or remove. * @param claimsConsumer a {@code Consumer} of the claims */ public Builder claims(Consumer<Map<String, Object>> claimsConsumer) { claimsConsumer.accept(this.claims); return this; } /** * Builds a new {@link JwtClaimsSet}. * @return a {@link JwtClaimsSet} */
public JwtClaimsSet build() { Assert.notEmpty(this.claims, "claims cannot be empty"); // The value of the 'iss' claim is a String or URL (StringOrURI). // Attempt to convert to URL. Object issuer = this.claims.get(JwtClaimNames.ISS); if (issuer != null) { URL convertedValue = ClaimConversionService.getSharedInstance().convert(issuer, URL.class); if (convertedValue != null) { this.claims.put(JwtClaimNames.ISS, convertedValue); } } return new JwtClaimsSet(this.claims); } } }
repos\spring-security-main\oauth2\oauth2-jose\src\main\java\org\springframework\security\oauth2\jwt\JwtClaimsSet.java
1
请完成以下Java代码
public long executeCount(CommandContext commandContext) { checkQueryOk(); ensureVariablesInitialized(); return commandContext .getHistoricCaseInstanceManager() .findHistoricCaseInstanceCountByQueryCriteria(this); } public List<HistoricCaseInstance> executeList(CommandContext commandContext, Page page) { checkQueryOk(); ensureVariablesInitialized(); return commandContext .getHistoricCaseInstanceManager() .findHistoricCaseInstancesByQueryCriteria(this, page); } @Override protected boolean hasExcludingConditions() { return super.hasExcludingConditions() || CompareUtil.areNotInAscendingOrder(createdAfter, createdBefore) || CompareUtil.areNotInAscendingOrder(closedAfter, closedBefore) || CompareUtil.elementIsNotContainedInList(caseInstanceId, caseInstanceIds) || CompareUtil.elementIsContainedInList(caseDefinitionKey, caseKeyNotIn); } public String getBusinessKey() { return businessKey; } public String getBusinessKeyLike() { return businessKeyLike; } public String getCaseDefinitionId() { return caseDefinitionId; } public String getCaseDefinitionKey() { return caseDefinitionKey; } public String getCaseDefinitionIdLike() { return caseDefinitionKey + ":%:%"; } public String getCaseDefinitionName() { return caseDefinitionName; } public String getCaseDefinitionNameLike() { return caseDefinitionNameLike; } public String getCaseInstanceId() { return caseInstanceId; } public Set<String> getCaseInstanceIds() { return caseInstanceIds; } public String getStartedBy() { return createdBy; } public String getSuperCaseInstanceId() { return superCaseInstanceId; } public void setSuperCaseInstanceId(String superCaseInstanceId) { this.superCaseInstanceId = superCaseInstanceId;
} public List<String> getCaseKeyNotIn() { return caseKeyNotIn; } public Date getCreatedAfter() { return createdAfter; } public Date getCreatedBefore() { return createdBefore; } public Date getClosedAfter() { return closedAfter; } public Date getClosedBefore() { return closedBefore; } public String getSubCaseInstanceId() { return subCaseInstanceId; } public String getSuperProcessInstanceId() { return superProcessInstanceId; } public String getSubProcessInstanceId() { return subProcessInstanceId; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\HistoricCaseInstanceQueryImpl.java
1
请完成以下Java代码
public static BpmnModel getBpmnModel(String processDefinitionId) { if (CommandContextUtil.getProcessEngineConfiguration() == null) { return Flowable5Util.getFlowable5CompatibilityHandler().getProcessDefinitionBpmnModel(processDefinitionId); } else { DeploymentManager deploymentManager = CommandContextUtil.getProcessEngineConfiguration().getDeploymentManager(); // This will check the cache in the findDeployedProcessDefinitionById and resolveProcessDefinition method ProcessDefinition processDefinitionEntity = deploymentManager.findDeployedProcessDefinitionById(processDefinitionId); return deploymentManager.resolveProcessDefinition(processDefinitionEntity).getBpmnModel(); } } public static BpmnModel getBpmnModelFromCache(String processDefinitionId) { ProcessDefinitionCacheEntry cacheEntry = CommandContextUtil.getProcessEngineConfiguration().getProcessDefinitionCache().get(processDefinitionId); if (cacheEntry != null) { return cacheEntry.getBpmnModel(); } return null; }
public static boolean isProcessDefinitionSuspended(String processDefinitionId) { ProcessDefinitionEntity processDefinition = getProcessDefinitionFromDatabase(processDefinitionId); return processDefinition.isSuspended(); } public static ProcessDefinitionEntity getProcessDefinitionFromDatabase(String processDefinitionId) { ProcessDefinitionEntityManager processDefinitionEntityManager = CommandContextUtil.getProcessEngineConfiguration().getProcessDefinitionEntityManager(); ProcessDefinitionEntity processDefinition = processDefinitionEntityManager.findById(processDefinitionId); if (processDefinition == null) { throw new FlowableObjectNotFoundException("No process definition found with id " + processDefinitionId); } return processDefinition; } }
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\util\ProcessDefinitionUtil.java
1
请在Spring Boot框架中完成以下Java代码
public IBarAuditableDao barHibernateAuditableDao() { return new BarAuditableDao(); } @Bean public IFooDao fooHibernateDao() { return new FooDao(); } @Bean public IFooAuditableDao fooHibernateAuditableDao() { return new FooAuditableDao(); } private final Properties hibernateProperties() {
final Properties hibernateProperties = new Properties(); hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); hibernateProperties.setProperty("hibernate.show_sql", "true"); // hibernateProperties.setProperty("hibernate.format_sql", "true"); hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true"); // Envers properties hibernateProperties.setProperty("org.hibernate.envers.audit_table_suffix", env.getProperty("envers.audit_table_suffix")); return hibernateProperties; } }
repos\tutorials-master\persistence-modules\spring-data-jpa-query\src\main\java\com\baeldung\hibernate\audit\PersistenceConfig.java
2
请完成以下Java代码
public static class GroupCreatorBuilder { public Group createGroup(@NonNull final Collection<OrderLineId> lineIdsToGroup) { return build().createGroup(lineIdsToGroup, null, null); } public Group createGroup( @NonNull final OrderId orderId, @Nullable final ConditionsId conditionsId) { return build().createGroup(null, orderId, conditionsId); } public void recreateGroup(@NonNull final Group group) {build().recreateGroup(group);} } public Group createGroup( @Nullable final Collection<OrderLineId> lineIdsToGroup, @Nullable final OrderId orderId, @Nullable final ConditionsId contractConditionsId) { final Group group = groupsRepo.retrieveOrCreateGroup( RetrieveOrCreateGroupRequest.builder() .orderId(orderId) .orderLineIds(lineIdsToGroup != null ? ImmutableSet.copyOf(lineIdsToGroup) : ImmutableSet.of())
.newGroupTemplate(groupTemplate) .newContractConditionsId(contractConditionsId) .qtyMultiplier(qty) .build()); recreateGroup(group); return group; } public void recreateGroup(@NonNull final Group group) { group.removeAllGeneratedLines(); groupTemplate.getCompensationLines() .stream() .filter(compensationLineTemplate -> compensationLineTemplate.isMatching(group)) .map(templateLine -> compensationLineCreateRequestFactory.createGroupCompensationLineCreateRequest(templateLine, group)) .forEach(group::addNewCompensationLine); group.updateAllCompensationLines(); groupsRepo.saveGroup(group); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\order\compensationGroup\GroupCreator.java
1
请完成以下Java代码
public boolean isAuthorizationCheckEnabled() { return isAuthorizationCheckEnabled; } public boolean getIsAuthorizationCheckEnabled() { return isAuthorizationCheckEnabled; } public void setAuthorizationCheckEnabled(boolean isAuthorizationCheckPerformed) { this.isAuthorizationCheckEnabled = isAuthorizationCheckPerformed; } public boolean shouldPerformAuthorizatioCheck() { return shouldPerformAuthorizatioCheck; } /** is used by myBatis */ public boolean getShouldPerformAuthorizatioCheck() { return isAuthorizationCheckEnabled && !isPermissionChecksEmpty(); } public void setShouldPerformAuthorizatioCheck(boolean shouldPerformAuthorizatioCheck) { this.shouldPerformAuthorizatioCheck = shouldPerformAuthorizatioCheck; } protected boolean isPermissionChecksEmpty() { return permissionChecks.getAtomicChecks().isEmpty() && permissionChecks.getCompositeChecks().isEmpty(); } public String getAuthUserId() { return authUserId; } public void setAuthUserId(String authUserId) { this.authUserId = authUserId; } public List<String> getAuthGroupIds() { return authGroupIds; } public void setAuthGroupIds(List<String> authGroupIds) { this.authGroupIds = authGroupIds; } public int getAuthDefaultPerm() { return authDefaultPerm; } public void setAuthDefaultPerm(int authDefaultPerm) { this.authDefaultPerm = authDefaultPerm; } // authorization check parameters public CompositePermissionCheck getPermissionChecks() { return permissionChecks; } public void setAtomicPermissionChecks(List<PermissionCheck> permissionChecks) { this.permissionChecks.setAtomicChecks(permissionChecks); }
public void addAtomicPermissionCheck(PermissionCheck permissionCheck) { permissionChecks.addAtomicCheck(permissionCheck); } public void setPermissionChecks(CompositePermissionCheck permissionChecks) { this.permissionChecks = permissionChecks; } public boolean isRevokeAuthorizationCheckEnabled() { return isRevokeAuthorizationCheckEnabled; } public void setRevokeAuthorizationCheckEnabled(boolean isRevokeAuthorizationCheckEnabled) { this.isRevokeAuthorizationCheckEnabled = isRevokeAuthorizationCheckEnabled; } public void setHistoricInstancePermissionsEnabled(boolean historicInstancePermissionsEnabled) { this.historicInstancePermissionsEnabled = historicInstancePermissionsEnabled; } /** * Used in SQL mapping */ public boolean isHistoricInstancePermissionsEnabled() { return historicInstancePermissionsEnabled; } public boolean isUseLeftJoin() { return useLeftJoin; } public void setUseLeftJoin(boolean useLeftJoin) { this.useLeftJoin = useLeftJoin; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\db\AuthorizationCheck.java
1
请完成以下Java代码
public Set<String> getColumnNames() { return pojoWrapper.getColumnNames(); } @Override public int getColumnIndex(final String propertyName) { // TODO Auto-generated method stub throw new UnsupportedOperationException("POJOWrapper has no supported for column indexes"); } @Override public boolean isVirtualColumn(final String columnName) { return pojoWrapper.isCalculated(columnName); } @Override public Object getValue(final String propertyName, final int idx, final Class<?> returnType) { return getValue(propertyName, returnType); } @Override public Object getValue(final String propertyName, final Class<?> returnType) { return pojoWrapper.getValue(propertyName, returnType); } @Override public boolean setValue(final String propertyName, final Object value) { pojoWrapper.setValue(propertyName, value); return true; } @Override public boolean setValueNoCheck(String columnName, Object value) { pojoWrapper.setValue(columnName, value); return true; } @Override public Object getReferencedObject(final String propertyName, final Method interfaceMethod) throws Exception { return pojoWrapper.getReferencedObject(propertyName, interfaceMethod); } @Override public void setValueFromPO(final String idPropertyName, final Class<?> parameterType, final Object value) { final String propertyName; if (idPropertyName.endsWith("_ID")) { propertyName = idPropertyName.substring(0, idPropertyName.length() - 3); } else {
throw new AdempiereException("Invalid idPropertyName: " + idPropertyName); } pojoWrapper.setReferencedObject(propertyName, value); } @Override public boolean invokeEquals(final Object[] methodArgs) { return pojoWrapper.invokeEquals(methodArgs); } @Override public Object invokeParent(final Method method, final Object[] methodArgs) throws Exception { throw new IllegalStateException("Invoking parent method is not supported"); } @Override public boolean isKeyColumnName(final String columnName) { return pojoWrapper.isKeyColumnName(columnName); } @Override public boolean isCalculated(final String columnName) { return pojoWrapper.isCalculated(columnName); } @Override public boolean hasColumnName(String columnName) { return pojoWrapper.hasColumnName(columnName); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\wrapper\POJOModelInternalAccessor.java
1
请完成以下Java代码
public class EventListener { private static int eventsHandled; private static final Logger LOG = LoggerFactory.getLogger(EventListener.class); @Subscribe public void stringEvent(String event) { LOG.info("do event [" + event + "]"); eventsHandled++; } @Subscribe public void someCustomEvent(CustomEvent customEvent) { LOG.info("do event [" + customEvent.getAction() + "]"); eventsHandled++; }
@Subscribe public void handleDeadEvent(DeadEvent deadEvent) { LOG.info("unhandled event [" + deadEvent.getEvent() + "]"); eventsHandled++; } int getEventsHandled() { return eventsHandled; } void resetEventsHandled() { eventsHandled = 0; } }
repos\tutorials-master\guava-modules\guava-utilities\src\main\java\com\baeldung\guava\eventbus\EventListener.java
1
请完成以下Java代码
public void setIncludeEventSubscriptionsWithoutTenantId(Boolean includeEventSubscriptionsWithoutTenantId) { this.includeEventSubscriptionsWithoutTenantId = includeEventSubscriptionsWithoutTenantId; } @Override protected boolean isValidSortByValue(String value) { return VALID_SORT_BY_VALUES.contains(value); } @Override protected EventSubscriptionQuery createNewQuery(ProcessEngine engine) { return engine.getRuntimeService().createEventSubscriptionQuery(); } @Override protected void applyFilters(EventSubscriptionQuery query) { if (eventSubscriptionId != null) { query.eventSubscriptionId(eventSubscriptionId); } if (eventName != null) { query.eventName(eventName); } if (eventType != null) { query.eventType(eventType); } if (executionId != null) { query.executionId(executionId); } if (processInstanceId != null) { query.processInstanceId(processInstanceId); } if (activityId != null) {
query.activityId(activityId); } if (tenantIdIn != null && !tenantIdIn.isEmpty()) { query.tenantIdIn(tenantIdIn.toArray(new String[tenantIdIn.size()])); } if (TRUE.equals(withoutTenantId)) { query.withoutTenantId(); } if (TRUE.equals(includeEventSubscriptionsWithoutTenantId)) { query.includeEventSubscriptionsWithoutTenantId(); } } @Override protected void applySortBy(EventSubscriptionQuery query, String sortBy, Map<String, Object> parameters, ProcessEngine engine) { if (sortBy.equals(SORT_BY_CREATED)) { query.orderByCreated(); } else if (sortBy.equals(SORT_BY_TENANT_ID)) { query.orderByTenantId(); } } }
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\runtime\EventSubscriptionQueryDto.java
1
请在Spring Boot框架中完成以下Java代码
public String getName() { return this.name; } /** * {@inheritDoc} */ public MessageInstance sendFor( MessageInstance message, Operation operation, ConcurrentMap<QName, URL> overridenEndpointAddresses ) throws Exception { Object[] arguments = this.getArguments(message); Object[] results = this.safeSend(arguments, overridenEndpointAddresses); return this.createResponseMessage(results, operation); } private Object[] getArguments(MessageInstance message) { return message.getStructureInstance().toArray(); } private Object[] safeSend(Object[] arguments, ConcurrentMap<QName, URL> overridenEndpointAddresses) throws Exception { Object[] results = null; results = this.service.getClient().send(this.name, arguments, overridenEndpointAddresses); if (results == null) { results = new Object[] {}; } return results;
} private MessageInstance createResponseMessage(Object[] results, Operation operation) { MessageInstance message = null; MessageDefinition outMessage = operation.getOutMessage(); if (outMessage != null) { message = outMessage.createInstance(); message.getStructureInstance().loadFrom(results); } return message; } public WSService getService() { return this.service; } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\webservice\WSOperation.java
2
请完成以下Java代码
public boolean compileFile(Path sourceFile) { if (!Files.exists(sourceFile)) { throw new IllegalArgumentException("Source file does not exist: " + sourceFile); } try { Iterable<? extends JavaFileObject> compilationUnits = standardFileManager.getJavaFileObjectsFromFiles(Collections.singletonList(sourceFile.toFile())); return compile(compilationUnits); } catch (Exception e) { logger.error("Compilation failed: ", e); return false; } } public boolean compileFromString(String className, String sourceCode) { JavaFileObject sourceObject = new InMemoryJavaFile(className, sourceCode); return compile(Collections.singletonList(sourceObject)); } private boolean compile(Iterable<? extends JavaFileObject> compilationUnits) { DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>(); JavaCompiler.CompilationTask task = compiler.getTask( null, standardFileManager, diagnostics, null, null, compilationUnits
); boolean success = task.call(); for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics.getDiagnostics()) { logger.debug(diagnostic.getMessage(null)); } return success; } public void runClass(String className, String... args) throws Exception { try (URLClassLoader classLoader = new URLClassLoader(new URL[]{outputDirectory.toUri().toURL()})) { Class<?> loadedClass = classLoader.loadClass(className); loadedClass.getMethod("main", String[].class).invoke(null, (Object) args); } } public Path getOutputDirectory() { return outputDirectory; } }
repos\tutorials-master\core-java-modules\core-java-compiler\src\main\java\com\baeldung\compilerapi\JavaCompilerUtils.java
1
请在Spring Boot框架中完成以下Java代码
public class MyShiroRealm extends AuthorizingRealm { @Autowired private UserService userService; @Autowired private RoleService roleService; @Autowired private PermService permService; //告诉shiro如何根据获取到的用户信息中的密码和盐值来校验密码 // 抽取到配置类中设置 // { // //设置用于匹配密码的CredentialsMatcher // HashedCredentialsMatcher hashMatcher = new HashedCredentialsMatcher(); // hashMatcher.setHashAlgorithmName(Sha256Hash.ALGORITHM_NAME); // hashMatcher.setStoredCredentialsHexEncoded(false); // hashMatcher.setHashIterations(1024); // this.setCredentialsMatcher(hashMatcher); // } //定义如何获取用户的角色和权限的逻辑,给shiro做权限判断 @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { if (principals == null) { throw new AuthorizationException("PrincipalCollection method argument cannot be null."); } User user = (User) getAvailablePrincipal(principals); SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); System.out.println("获取角色信息:" + user.getRoles()); System.out.println("获取权限信息:" + user.getPerms()); info.setRoles(user.getRoles()); info.setStringPermissions(user.getPerms()); return info; } //定义如何获取用户信息的业务逻辑,给shiro做登录 /** * 可在此逻辑下增加保存用户信息到session或缓存中 * @param token the authentication token containing the user's principal and credentials. * @return * @throws AuthenticationException */ @Override protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { UsernamePasswordToken usernamePasswordToken = (UsernamePasswordToken) token; String username = usernamePasswordToken.getUsername(); if (StringUtils.isEmpty(username)) { throw new AccountException("Null usernames are not allowed by this realm."); } User userByName = userService.findUserByName(username);
if (Objects.isNull(userByName)) { throw new UnknownAccountException("No account found for admin [" + username + "]"); } //查询用户的角色和权限存到SimpleAuthenticationInfo中,这样在其它地方 //SecurityUtils.getSubject().getPrincipal()就能拿出用户的所有信息,包括角色和权限 Set<String> roles = roleService.getRolesByUserId(userByName.getUid()); Set<String> perms = permService.getPermsByUserId(userByName.getUid()); userByName.getRoles().addAll(roles); userByName.getPerms().addAll(perms); SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(userByName, userByName.getPwd(), getName()); if (userByName.getSalt() != null) { info.setCredentialsSalt(ByteSource.Util.bytes(userByName.getSalt())); } return info; } public static void main(String[] args) { String hashAlgorithmName = "MD5"; String credentials = "123456"; Object salt = "wxKYXuTPST5SG0jMQzVPsg=="; int hashIterations = 100; SimpleHash simpleHash = new SimpleHash(hashAlgorithmName, credentials, salt, hashIterations); System.out.println(simpleHash); } }
repos\spring-boot-quick-master\quick-spring-shiro\src\main\java\com\shiro\shiro\realm\MyShiroRealm.java
2
请完成以下Java代码
public int getUnitsInt() { String du = getDimensionUnits(); if (du == null || DIMENSIONUNITS_MM.equals(du)) return Size2DSyntax.MM; else if (DIMENSIONUNITS_Inch.equals(du)) return Size2DSyntax.INCH; else throw new AdempiereException("@NotSupported@ @DimensionUnit@ : "+du); } // getUnits /** * Get CPaper * @return CPaper */ public CPaper getCPaper() { //Modify Lines By AA Goodwill : Custom Paper Support CPaper retValue; if (getCode().toLowerCase().startsWith("custom")) { retValue = new CPaper (getSizeX().doubleValue(), getSizeY().doubleValue(), getUnitsInt(), isLandscape(), getMarginLeft(), getMarginTop(), getMarginRight(), getMarginBottom()); } else { retValue = new CPaper (getMediaSize(), isLandscape(), getMarginLeft(), getMarginTop(), getMarginRight(), getMarginBottom()); } //End Of AA Goodwill return retValue; } // getCPaper @Override protected boolean beforeSave(boolean newRecord) { // Check all settings are correct by reload all data m_mediaSize = null; getMediaSize(); getCPaper(); return true; } /** * Media Size Name */ class CMediaSizeName extends MediaSizeName { /** * */ private static final long serialVersionUID = 8561532175435930293L; /** * CMediaSizeName * @param code */ public CMediaSizeName(int code) { super (code); } // CMediaSizeName /** * Get String Table * @return string
*/ public String[] getStringTable () { return super.getStringTable (); } /** * Get Enum Value Table * @return Media Sizes */ public EnumSyntax[] getEnumValueTable () { return super.getEnumValueTable (); } } // CMediaSizeName /************************************************************************** * Test * @param args args */ public static void main(String[] args) { org.compiere.Adempiere.startupEnvironment(true); // create ("Standard Landscape", true); // create ("Standard Portrait", false); // Read All Papers int[] IDs = PO.getAllIDs ("AD_PrintPaper", null, null); for (int i = 0; i < IDs.length; i++) { System.out.println("--"); MPrintPaper pp = new MPrintPaper(Env.getCtx(), IDs[i], null); pp.dump(); } } } // MPrintPaper
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\print\MPrintPaper.java
1
请完成以下Java代码
public java.lang.String getPP_Order_Receipt_DocStatus() { return get_ValueAsString(COLUMNNAME_PP_Order_Receipt_DocStatus); } @Override public void setPP_Order_Receipt_DocType_ID (final int PP_Order_Receipt_DocType_ID) { if (PP_Order_Receipt_DocType_ID < 1) set_ValueNoCheck (COLUMNNAME_PP_Order_Receipt_DocType_ID, null); else set_ValueNoCheck (COLUMNNAME_PP_Order_Receipt_DocType_ID, PP_Order_Receipt_DocType_ID); } @Override public int getPP_Order_Receipt_DocType_ID() { return get_ValueAsInt(COLUMNNAME_PP_Order_Receipt_DocType_ID); } @Override public org.eevolution.model.I_PP_Order getPP_Order_Receipt() { return get_ValueAsPO(COLUMNNAME_PP_Order_Receipt_ID, org.eevolution.model.I_PP_Order.class); } @Override public void setPP_Order_Receipt(final org.eevolution.model.I_PP_Order PP_Order_Receipt) { set_ValueFromPO(COLUMNNAME_PP_Order_Receipt_ID, org.eevolution.model.I_PP_Order.class, PP_Order_Receipt); } @Override public void setPP_Order_Receipt_ID (final int PP_Order_Receipt_ID) { if (PP_Order_Receipt_ID < 1) set_ValueNoCheck (COLUMNNAME_PP_Order_Receipt_ID, null); else set_ValueNoCheck (COLUMNNAME_PP_Order_Receipt_ID, PP_Order_Receipt_ID); } @Override public int getPP_Order_Receipt_ID() { return get_ValueAsInt(COLUMNNAME_PP_Order_Receipt_ID); } @Override public void setQty (final @Nullable BigDecimal Qty) { set_ValueNoCheck (COLUMNNAME_Qty, Qty); }
@Override public BigDecimal getQty() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setQualityInspectionCycle (final @Nullable java.lang.String QualityInspectionCycle) { set_ValueNoCheck (COLUMNNAME_QualityInspectionCycle, QualityInspectionCycle); } @Override public java.lang.String getQualityInspectionCycle() { return get_ValueAsString(COLUMNNAME_QualityInspectionCycle); } @Override public void setRV_M_Material_Tracking_HU_Details_ID (final int RV_M_Material_Tracking_HU_Details_ID) { if (RV_M_Material_Tracking_HU_Details_ID < 1) set_ValueNoCheck (COLUMNNAME_RV_M_Material_Tracking_HU_Details_ID, null); else set_ValueNoCheck (COLUMNNAME_RV_M_Material_Tracking_HU_Details_ID, RV_M_Material_Tracking_HU_Details_ID); } @Override public int getRV_M_Material_Tracking_HU_Details_ID() { return get_ValueAsInt(COLUMNNAME_RV_M_Material_Tracking_HU_Details_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java-gen\de\metas\handlingunits\model\X_RV_M_Material_Tracking_HU_Details.java
1
请在Spring Boot框架中完成以下Java代码
public void setHoursAndMinutes (final java.lang.String HoursAndMinutes) { set_Value (COLUMNNAME_HoursAndMinutes, HoursAndMinutes); } @Override public java.lang.String getHoursAndMinutes() { return get_ValueAsString(COLUMNNAME_HoursAndMinutes); } @Override public de.metas.serviceprovider.model.I_S_Issue getS_Issue() { return get_ValueAsPO(COLUMNNAME_S_Issue_ID, de.metas.serviceprovider.model.I_S_Issue.class); } @Override public void setS_Issue(final de.metas.serviceprovider.model.I_S_Issue S_Issue) { set_ValueFromPO(COLUMNNAME_S_Issue_ID, de.metas.serviceprovider.model.I_S_Issue.class, S_Issue); } @Override public void setS_Issue_ID (final int S_Issue_ID) { if (S_Issue_ID < 1) set_Value (COLUMNNAME_S_Issue_ID, null); else set_Value (COLUMNNAME_S_Issue_ID, S_Issue_ID); } @Override public int getS_Issue_ID() {
return get_ValueAsInt(COLUMNNAME_S_Issue_ID); } @Override public void setS_TimeBooking_ID (final int S_TimeBooking_ID) { if (S_TimeBooking_ID < 1) set_ValueNoCheck (COLUMNNAME_S_TimeBooking_ID, null); else set_ValueNoCheck (COLUMNNAME_S_TimeBooking_ID, S_TimeBooking_ID); } @Override public int getS_TimeBooking_ID() { return get_ValueAsInt(COLUMNNAME_S_TimeBooking_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.serviceprovider\src\main\java-gen\de\metas\serviceprovider\model\X_S_TimeBooking.java
2
请在Spring Boot框架中完成以下Java代码
public class AuthorizationCode { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "code") private String code; @Column(name = "client_id") private String clientId; @Column(name = "user_id") private String userId; @Column(name = "approved_scopes") private String approvedScopes; @Column(name = "redirect_uri") private String redirectUri; @Column(name = "expiration_date") private LocalDateTime expirationDate; public String getUserId() { return userId; } public void setUserId(String username) { this.userId = username; } public String getClientId() { return clientId; } public void setClientId(String clientId) { this.clientId = clientId; }
public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getApprovedScopes() { return approvedScopes; } public void setApprovedScopes(String approvedScopes) { this.approvedScopes = approvedScopes; } public String getRedirectUri() { return redirectUri; } public void setRedirectUri(String redirectUri) { this.redirectUri = redirectUri; } public LocalDateTime getExpirationDate() { return expirationDate; } public void setExpirationDate(LocalDateTime expirationDate) { this.expirationDate = expirationDate; } }
repos\tutorials-master\security-modules\oauth2-framework-impl\oauth2-authorization-server\src\main\java\com\baeldung\oauth2\authorization\server\model\AuthorizationCode.java
2
请在Spring Boot框架中完成以下Java代码
public class PushProductProcessor implements Processor { @Override public void process(final Exchange exchange) { final JsonBOM jsonBOM = exchange.getIn().getBody(JsonBOM.class); final PushBOMsRouteContext context = PushBOMsRouteContext.builder() .jsonBOM(jsonBOM) .build(); exchange.setProperty(GRSSignumConstants.ROUTE_PROPERTY_PUSH_BOMs_CONTEXT, context); final ProductUpsertCamelRequest productUpsertCamelRequest = getProductUpsertCamelRequest(jsonBOM); exchange.getIn().setBody(productUpsertCamelRequest, ProductUpsertCamelRequest.class); } @NonNull private ProductUpsertCamelRequest getProductUpsertCamelRequest(@NonNull final JsonBOM jsonBOM){ final TokenCredentials credentials = (TokenCredentials)SecurityContextHolder.getContext().getAuthentication().getCredentials(); final JsonRequestProduct requestProduct = new JsonRequestProduct(); requestProduct.setCode(jsonBOM.getProductValue()); requestProduct.setActive(jsonBOM.isActive()); requestProduct.setType(JsonRequestProduct.Type.ITEM); requestProduct.setName(JsonBOMUtil.getName(jsonBOM)); requestProduct.setUomCode(GRSSignumConstants.DEFAULT_UOM_CODE); requestProduct.setGtin(jsonBOM.getGtin()); requestProduct.setBpartnerProductItems(ImmutableList.of(getBPartnerProductUpsertRequest(jsonBOM)));
final JsonRequestProductUpsertItem productUpsertItem = JsonRequestProductUpsertItem.builder() .productIdentifier(ExternalIdentifierFormat.asExternalIdentifier(jsonBOM.getProductId())) .requestProduct(requestProduct) .build(); final JsonRequestProductUpsert productUpsert = JsonRequestProductUpsert.builder() .requestItem(productUpsertItem) .syncAdvise(SyncAdvise.CREATE_OR_MERGE) .build(); return ProductUpsertCamelRequest.builder() .orgCode(credentials.getOrgCode()) .jsonRequestProductUpsert(productUpsert) .build(); } @NonNull private JsonRequestBPartnerProductUpsert getBPartnerProductUpsertRequest(@NonNull final JsonBOM jsonBOM) { if(Check.isBlank(jsonBOM.getBPartnerMetasfreshId())) { throw new RuntimeException("Missing mandatory METASFRESHID! JsonBOM.ARTNRID=" + jsonBOM.getProductId()); } final JsonRequestBPartnerProductUpsert requestBPartnerProductUpsert = new JsonRequestBPartnerProductUpsert(); requestBPartnerProductUpsert.setBpartnerIdentifier(jsonBOM.getBPartnerMetasfreshId()); requestBPartnerProductUpsert.setActive(true); return requestBPartnerProductUpsert; } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-grssignum\src\main\java\de\metas\camel\externalsystems\grssignum\from_grs\bom\processor\PushProductProcessor.java
2
请完成以下Java代码
public static boolean run(String[] args) { Option cmd = new Option(); List<String> unkownArgs = null; try { unkownArgs = Args.parse(cmd, args, false); } catch (IllegalArgumentException e) { Args.usage(cmd); return false; } if (cmd.help) { Args.usage(cmd); return true; } int nbest = cmd.nbest; int vlevel = cmd.verbose; double costFactor = cmd.cost_factor; String model = cmd.model; String outputFile = cmd.output; TaggerImpl tagger = new TaggerImpl(TaggerImpl.Mode.TEST); try { InputStream stream = IOUtil.newInputStream(model); if (!tagger.open(stream, nbest, vlevel, costFactor)) { System.err.println("open error"); return false; } String[] restArgs = unkownArgs.toArray(new String[0]); if (restArgs.length == 0) { return false; } OutputStreamWriter osw = null; if (outputFile != null) { osw = new OutputStreamWriter(IOUtil.newOutputStream(outputFile)); } for (String inputFile : restArgs) { InputStream fis = IOUtil.newInputStream(inputFile); InputStreamReader isr = new InputStreamReader(fis, "UTF-8"); BufferedReader br = new BufferedReader(isr);
while (true) { TaggerImpl.ReadStatus status = tagger.read(br); if (TaggerImpl.ReadStatus.ERROR == status) { System.err.println("read error"); return false; } else if (TaggerImpl.ReadStatus.EOF == status && tagger.empty()) { break; } if (!tagger.parse()) { System.err.println("parse error"); return false; } if (osw == null) { System.out.print(tagger.toString()); } else { osw.write(tagger.toString()); } } if (osw != null) { osw.flush(); } br.close(); } if (osw != null) { osw.close(); } } catch (Exception e) { e.printStackTrace(); return false; } return true; } public static void main(String[] args) { crf_test.run(args); } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\model\crf\crfpp\crf_test.java
1
请完成以下Java代码
public final class AstNested extends AstRightValue { private final AstNode child; public AstNested(AstNode child) { this.child = child; } @Override public Object eval(Bindings bindings, ELContext context) { return child.eval(bindings, context); } @Override public String toString() { return "(...)";
} @Override public void appendStructure(StringBuilder b, Bindings bindings) { b.append("("); child.appendStructure(b, bindings); b.append(")"); } public int getCardinality() { return 1; } public AstNode getChild(int i) { return i == 0 ? child : null; } }
repos\Activiti-develop\activiti-core-common\activiti-juel-jakarta\src\main\java\org\activiti\core\el\juel\tree\impl\ast\AstNested.java
1
请完成以下Spring Boot application配置
server: port: 8080 servlet: context-path: /demo spring: application: # Spring Boot Admin展示的客户端项目名,不设置,会使用自动生成的随机id name: spring-boot-demo-admin-client boot: admin: client: # Spring Boot Admin 服务端地址 url: "http://localhost:8000/" instance: metadata: # 客户端端点信息的安全认证信息 user.name: ${spring.security.user.name} user.password: ${spring.security.user.password} security: user: name: xkcoding password: 123456 manageme
nt: endpoint: health: # 端点健康情况,默认值"never",设置为"always"可以显示硬盘使用情况和线程情况 show-details: always endpoints: web: exposure: # 设置端点暴露的哪些内容,默认["health","info"],设置"*"代表暴露所有可访问的端点 include: "*"
repos\spring-boot-demo-master\demo-admin\admin-client\src\main\resources\application.yml
2
请在Spring Boot框架中完成以下Java代码
public class DeliveryOrderId implements RepoIdAware { int repoId; @JsonCreator public static DeliveryOrderId ofRepoId(final int repoId) { return new DeliveryOrderId(repoId); } public static DeliveryOrderId ofRepoIdOrNull(final int repoId) { return repoId > 0 ? ofRepoId(repoId) : null; } private DeliveryOrderId(final int repoId) { this.repoId = Check.assumeGreaterThanZero(repoId, "repoId"); } public static int toRepoId(@Nullable final DeliveryOrderId deliveryOrderId)
{ return toRepoIdOr(deliveryOrderId, -1); } public static int toRepoIdOr(@Nullable final DeliveryOrderId deliveryOrderId, final int defaultValue) { return deliveryOrderId != null ? deliveryOrderId.getRepoId() : defaultValue; } public String toString() { return String.valueOf(repoId); } @Override @JsonValue public int getRepoId() { return repoId; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.spi\src\main\java\de\metas\shipper\gateway\spi\DeliveryOrderId.java
2
请在Spring Boot框架中完成以下Java代码
public Date getTerminatedBefore() { return terminatedBefore; } public void setTerminatedBefore(Date terminatedBefore) { this.terminatedBefore = terminatedBefore; } public Date getTerminatedAfter() { return terminatedAfter; } public void setTerminatedAfter(Date terminatedAfter) { this.terminatedAfter = terminatedAfter; } public Date getOccurredBefore() { return occurredBefore; } public void setOccurredBefore(Date occurredBefore) { this.occurredBefore = occurredBefore; } public Date getOccurredAfter() { return occurredAfter; } public void setOccurredAfter(Date occurredAfter) { this.occurredAfter = occurredAfter; } public Date getExitBefore() { return exitBefore; } public void setExitBefore(Date exitBefore) { this.exitBefore = exitBefore; } public Date getExitAfter() { return exitAfter; } public void setExitAfter(Date exitAfter) { this.exitAfter = exitAfter; } public Date getEndedBefore() { return endedBefore; } public void setEndedBefore(Date endedBefore) { this.endedBefore = endedBefore; } public Date getEndedAfter() { return endedAfter; } public void setEndedAfter(Date endedAfter) { this.endedAfter = endedAfter;
} public String getStartUserId() { return startUserId; } public void setStartUserId(String startUserId) { this.startUserId = startUserId; } public String getReferenceId() { return referenceId; } public void setReferenceId(String referenceId) { this.referenceId = referenceId; } public String getReferenceType() { return referenceType; } public void setReferenceType(String referenceType) { this.referenceType = referenceType; } public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } public Boolean getWithoutTenantId() { return withoutTenantId; } public void setWithoutTenantId(Boolean withoutTenantId) { this.withoutTenantId = withoutTenantId; } public Boolean getIncludeLocalVariables() { return includeLocalVariables; } public void setIncludeLocalVariables(Boolean includeLocalVariables) { this.includeLocalVariables = includeLocalVariables; } public Set<String> getCaseInstanceIds() { return caseInstanceIds; } public void setCaseInstanceIds(Set<String> caseInstanceIds) { this.caseInstanceIds = caseInstanceIds; } }
repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\history\planitem\HistoricPlanItemInstanceQueryRequest.java
2
请完成以下Java代码
default DocumentEntityDescriptor getDocumentEntityDescriptor(final DocumentPath documentPath) { final DocumentEntityDescriptor rootEntityDescriptor = getDocumentEntityDescriptor(documentPath.getWindowId()); if (documentPath.isRootDocument()) { return rootEntityDescriptor; } else { return rootEntityDescriptor.getIncludedEntityByDetailId(documentPath.getDetailId()); } } default TableRecordReference getTableRecordReference(@NonNull final DocumentPath documentPath) { return getTableRecordReferenceIfPossible(documentPath) .orElseThrow(() -> new AdempiereException("Cannot determine table/record from " + documentPath)); } default Optional<TableRecordReference> getTableRecordReferenceIfPossible(@NonNull final DocumentPath documentPath) { if (documentPath.getWindowIdOrNull() == null || !documentPath.getWindowId().isInt()) { return Optional.empty(); } final DocumentEntityDescriptor rootEntityDescriptor = getDocumentEntityDescriptor(documentPath.getWindowId()); if (documentPath.isRootDocument()) { final DocumentId rootDocumentId = documentPath.getDocumentId(); if (!rootDocumentId.isInt()) { return Optional.empty(); }
final String tableName = rootEntityDescriptor.getTableName(); final int recordId = rootDocumentId.toInt(); return Optional.of(TableRecordReference.of(tableName, recordId)); } else { final DocumentId includedRowId = documentPath.getSingleRowId(); if (!includedRowId.isInt()) { return Optional.empty(); } final DocumentEntityDescriptor includedEntityDescriptor = rootEntityDescriptor.getIncludedEntityByDetailId(documentPath.getDetailId()); final String tableName = includedEntityDescriptor.getTableName(); final int recordId = includedRowId.toInt(); return Optional.of(TableRecordReference.of(tableName, recordId)); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\descriptor\factory\DocumentDescriptorFactory.java
1
请完成以下Java代码
public void processRow(ResultSet rs) throws SQLException { // 遍历返回的结果 do { String username = rs.getString("username"); if ("yudaoyuanma".equals(username)) { Integer id = rs.getInt("id"); template.update("UPDATE users SET username = ? WHERE id = ?", "yutou", id); logger.info("[migrate][更新 user({}) 的用户名({} => {})", id, username, "yutou"); } } while (rs.next()); } }); }
@Override public Integer getChecksum() { return 11; // 默认返回,是 null 。 } @Override public boolean canExecuteInTransaction() { return true; // 默认返回,也是 true } @Override public MigrationVersion getVersion() { return super.getVersion(); // 默认按照约定的规则,从类名中解析获得。可以自定义 } }
repos\SpringBoot-Labs-master\lab-20\lab-20-database-version-control-flyway\src\main\java\cn\iocoder\springboot\lab20\databaseversioncontrol\migration\V1_1__FixUsername.java
1
请完成以下Spring Boot application配置
spring: jpa: properties: hibernate: integrator_provider: com.baeldung.changevalue.hibernate.HibernateEventListenerIntegratorProvider query: in_clause_parameter_padding: true logging: level: org: hibernate: SQL: DEBUG orm:
jdbc: bind: TRACE type: descriptor: sql: BasicBinder: TRACE
repos\tutorials-master\persistence-modules\hibernate-jpa-2\src\main\resources\application.yaml
2
请完成以下Java代码
public JSONObject buildBoolQuery(JSONArray must, JSONArray mustNot, JSONArray should) { JSONObject bool = new JSONObject(); if (must != null) { bool.put("must", must); } if (mustNot != null) { bool.put("must_not", mustNot); } if (should != null) { bool.put("should", should); } JSONObject json = new JSONObject(); json.put("bool", bool); return json; } /** * @param field 要查询的字段 * @param args 查询参数,参考: *哈哈* OR *哒* NOT *呵* OR *啊* * @return */ public JSONObject buildQueryString(String field, String... args) { if (field == null) { return null; } StringBuilder sb = new StringBuilder(field).append(":("); if (args != null) { for (String arg : args) { sb.append(arg).append(" "); } } sb.append(")"); return this.buildQueryString(sb.toString()); } /** * @return { "query_string": { "query": query } } */ public JSONObject buildQueryString(String query) { JSONObject queryString = new JSONObject();
queryString.put("query", query); JSONObject json = new JSONObject(); json.put("query_string", queryString); return json; } /** * @param field 查询字段 * @param min 最小值 * @param max 最大值 * @param containMin 范围内是否包含最小值 * @param containMax 范围内是否包含最大值 * @return { "range" : { field : { 『 "gt『e』?containMin" : min 』?min!=null , 『 "lt『e』?containMax" : max 』}} } */ public JSONObject buildRangeQuery(String field, Object min, Object max, boolean containMin, boolean containMax) { JSONObject inner = new JSONObject(); if (min != null) { if (containMin) { inner.put("gte", min); } else { inner.put("gt", min); } } if (max != null) { if (containMax) { inner.put("lte", max); } else { inner.put("lt", max); } } JSONObject range = new JSONObject(); range.put(field, inner); JSONObject json = new JSONObject(); json.put("range", range); return json; } }
repos\JeecgBoot-main\jeecg-boot\jeecg-boot-base-core\src\main\java\org\jeecg\common\es\JeecgElasticsearchTemplate.java
1
请完成以下Java代码
public static boolean hasRole(String roleName) { return getSubject() != null && roleName != null && roleName.length() > 0 && getSubject().hasRole(roleName); } /** * 与hasRole标签逻辑相反,当用户不属于该角色时验证通过。 * * @param roleName 角色名 * @return 不属于该角色:true,否则false */ public static boolean lacksRole(String roleName) { return !hasRole(roleName); } /** * 验证当前用户是否属于以下任意一个角色。 * * @param roleNames 角色列表 * @return 属于:true,否则false */ public static boolean hasAnyRoles(String roleNames) { boolean hasAnyRole = false; Subject subject = getSubject(); if (subject != null && roleNames != null && roleNames.length() > 0) { for (String role : roleNames.split(NAMES_DELIMETER)) { if (subject.hasRole(role.trim())) { hasAnyRole = true; break; } } } return hasAnyRole; } /** * 验证当前用户是否拥有指定权限,使用时与lacksPermission 搭配使用 * * @param permission 权限名 * @return 拥有权限:true,否则false */ public static boolean hasPermission(String permission) { return getSubject() != null && permission != null && permission.length() > 0 && getSubject().isPermitted(permission); } /** * 与hasPermission标签逻辑相反,当前用户没有制定权限时,验证通过。 * * @param permission 权限名 * @return 拥有权限:true,否则false */ public static boolean lacksPermission(String permission) { return !hasPermission(permission); } /**
* 已认证通过的用户,不包含已记住的用户,这是与user标签的区别所在。与notAuthenticated搭配使用 * * @return 通过身份验证:true,否则false */ public static boolean isAuthenticated() { return getSubject() != null && getSubject().isAuthenticated(); } /** * 未认证通过用户,与authenticated标签相对应。与guest标签的区别是,该标签包含已记住用户。。 * * @return 没有通过身份验证:true,否则false */ public static boolean notAuthenticated() { return !isAuthenticated(); } /** * 认证通过或已记住的用户。与guset搭配使用。 * * @return 用户:true,否则 false */ public static boolean isUser() { return getSubject() != null && getSubject().getPrincipal() != null; } /** * 验证当前用户是否为“访客”,即未认证(包含未记住)的用户。用user搭配使用 * * @return 访客:true,否则false */ public static boolean isGuest() { return !isUser(); } /** * 输出当前用户信息,通常为登录帐号信息。 * * @return 当前用户信息 */ public static String principal() { if (getSubject() != null) { Object principal = getSubject().getPrincipal(); return principal.toString(); } return ""; } }
repos\SpringBootBucket-master\springboot-jwt\src\main\java\com\xncoding\jwt\shiro\ShiroKit.java
1
请在Spring Boot框架中完成以下Java代码
public class FlowableLdapAutoConfiguration { protected final FlowableLdapProperties properties; protected final LDAPQueryBuilder ldapQueryBuilder; protected final LDAPGroupCache.LDAPGroupCacheListener ldapGroupCacheListener; public FlowableLdapAutoConfiguration( FlowableLdapProperties properties, ObjectProvider<LDAPQueryBuilder> ldapQueryBuilder, ObjectProvider<LDAPGroupCache.LDAPGroupCacheListener> ldapGroupCacheListener ) { this.properties = properties; this.ldapQueryBuilder = ldapQueryBuilder.getIfAvailable(); this.ldapGroupCacheListener = ldapGroupCacheListener.getIfAvailable(); } @Bean @ConditionalOnMissingBean public LDAPConfiguration ldapConfiguration() { LDAPConfiguration ldapConfiguration = new LDAPConfiguration(); properties.customize(ldapConfiguration); if (ldapQueryBuilder != null) { ldapConfiguration.setLdapQueryBuilder(ldapQueryBuilder); } if (ldapGroupCacheListener != null) { ldapConfiguration.setGroupCacheListener(ldapGroupCacheListener); } return ldapConfiguration; }
@Bean public EngineConfigurationConfigurer<SpringIdmEngineConfiguration> ldapIdmEngineConfigurer(LDAPConfiguration ldapConfiguration) { return idmEngineConfiguration -> idmEngineConfiguration .setIdmIdentityService(new LDAPIdentityServiceImpl(ldapConfiguration, createCache(idmEngineConfiguration, ldapConfiguration), idmEngineConfiguration)); } // We need a custom AuthenticationProvider for the LDAP Support // since the default (DaoAuthenticationProvider) from Spring Security // uses a Password encoder to perform the matching and we need to use // the IdmIdentityService for LDAP @Bean @ConditionalOnMissingBean(AuthenticationProvider.class) public FlowableAuthenticationProvider flowableAuthenticationProvider(IdmIdentityService idmIdentitySerivce, UserDetailsService userDetailsService) { return new FlowableAuthenticationProvider(idmIdentitySerivce, userDetailsService); } protected LDAPGroupCache createCache(SpringIdmEngineConfiguration engineConfiguration, LDAPConfiguration ldapConfiguration) { LDAPGroupCache ldapGroupCache = null; if (ldapConfiguration.getGroupCacheSize() > 0) { // We need to use a supplier for the clock as the clock would be created later ldapGroupCache = new LDAPGroupCache(ldapConfiguration.getGroupCacheSize(), ldapConfiguration.getGroupCacheExpirationTime(), engineConfiguration::getClock); if (ldapConfiguration.getGroupCacheListener() != null) { ldapGroupCache.setLdapCacheListener(ldapConfiguration.getGroupCacheListener()); } } return ldapGroupCache; } }
repos\flowable-engine-main\modules\flowable-spring-boot\flowable-spring-boot-starters\flowable-spring-boot-autoconfigure\src\main\java\org\flowable\spring\boot\ldap\FlowableLdapAutoConfiguration.java
2
请完成以下Java代码
public class PropertyMapKey<K,V> { protected final String name; protected boolean allowOverwrite = true; public PropertyMapKey(String name) { this(name, true); } public PropertyMapKey(String name, boolean allowOverwrite) { this.name = name; this.allowOverwrite = allowOverwrite; } public boolean allowsOverwrite() { return allowOverwrite; } public String getName() { return name; } @Override public String toString() { return "PropertyMapKey [name=" + name + "]"; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((name == null) ? 0 : name.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PropertyMapKey<?,?> other = (PropertyMapKey<?,?>) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; return true; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\core\model\PropertyMapKey.java
1
请完成以下Java代码
public byte[] getPasswordBytes() { return passwordBytes; } public void setPasswordBytes(byte[] passwordBytes) { this.passwordBytes = passwordBytes; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getName() { return key; } public String getUsername() { return value; } public String getParentId() { return parentId; } public void setParentId(String parentId) { this.parentId = parentId; } public Map<String, String> getDetails() {
return details; } public void setDetails(Map<String, String> details) { this.details = details; } @Override public String toString() { return this.getClass().getSimpleName() + "[id=" + id + ", revision=" + revision + ", type=" + type + ", userId=" + userId + ", key=" + key + ", value=" + value + ", password=" + password + ", parentId=" + parentId + ", details=" + details + "]"; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\IdentityInfoEntity.java
1
请完成以下Java代码
public int getM_Product_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Quantity. @param Qty Quantity */ public void setQty (BigDecimal Qty) { set_Value (COLUMNNAME_Qty, Qty); } /** Get Quantity. @return Quantity */ public BigDecimal getQty () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty); if (bd == null) return Env.ZERO; return bd;
} /** Set Calculated Quantity. @param QtyCalculated Calculated Quantity */ public void setQtyCalculated (BigDecimal QtyCalculated) { set_Value (COLUMNNAME_QtyCalculated, QtyCalculated); } /** Get Calculated Quantity. @return Calculated Quantity */ public BigDecimal getQtyCalculated () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyCalculated); if (bd == null) return Env.ZERO; return bd; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_DemandLine.java
1
请完成以下Java代码
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; } @Override public void destroy() throws Exception { System.out.println("接口-执行InitBeanAndDestroyBeanTest:destroy方法"); } /** * Bean所有属性设置完(初始化完)之后调用 * * @throws Exception Exception */ @Override public void afterPropertiesSet() throws Exception { System.out.println("接口-执行InitBeanAndDestroyBeanTest:afterPropertiesSet方法"); } @PostConstruct public void postConstructstroy() { System.out.println("注解-执行InitBeanAndDestroyBeanTest:preDestroy方法"); } @PreDestroy public void preDestroy() {
System.out.println("注解--执行InitBeanAndDestroyBeanTest:preDestroy方法"); } /** * 真正的Bean初始化方法 */ public void initMethod() { System.out.println("XML配置-执行InitBeanAndDestroyBeanTest:init-method方法"); } /** * 真正的Bean销毁方法 */ public void destroyMethod() { System.out.println("XML配置-执行InitBeanAndDestroyBeanTest:destroy-method方法"); } }
repos\spring-boot-student-master\spring-boot-student-spring\src\main\java\com\xiaolyuh\init\destory\InitBeanAndDestroyBean.java
1
请完成以下Java代码
public static String printAnIsoscelesTriangle(int N) { StringBuilder result = new StringBuilder(); for (int r = 1; r <= N; r++) { for (int sp = 1; sp <= N - r; sp++) { result.append(" "); } for (int c = 1; c <= (r * 2) - 1; c++) { result.append("*"); } result.append(System.lineSeparator()); } return result.toString(); } public static String printAnIsoscelesTriangleUsingStringUtils(int N) { StringBuilder result = new StringBuilder(); for (int r = 1; r <= N; r++) { result.append(StringUtils.repeat(' ', N - r)); result.append(StringUtils.repeat('*', 2 * r - 1)); result.append(System.lineSeparator()); }
return result.toString(); } public static String printAnIsoscelesTriangleUsingSubstring(int N) { StringBuilder result = new StringBuilder(); String helperString = StringUtils.repeat(' ', N - 1) + StringUtils.repeat('*', N * 2 - 1); for (int r = 0; r < N; r++) { result.append(helperString.substring(r, N + 2 * r)); result.append(System.lineSeparator()); } return result.toString(); } public static void main(String[] args) { System.out.println(printARightTriangle(5)); System.out.println(printAnIsoscelesTriangle(5)); System.out.println(printAnIsoscelesTriangleUsingStringUtils(5)); System.out.println(printAnIsoscelesTriangleUsingSubstring(5)); } }
repos\tutorials-master\algorithms-modules\algorithms-miscellaneous-3\src\main\java\com\baeldung\algorithms\printtriangles\PrintTriangleExamples.java
1
请在Spring Boot框架中完成以下Java代码
SpringOpaqueTokenIntrospector opaqueTokenIntrospector(OAuth2ResourceServerProperties properties) { OAuth2ResourceServerProperties.Opaquetoken opaquetoken = properties.getOpaquetoken(); String introspectionUri = opaquetoken.getIntrospectionUri(); Assert.state(introspectionUri != null, "'introspectionUri' must not be null"); String clientId = opaquetoken.getClientId(); Assert.state(clientId != null, "'clientId' must not be null"); String clientSecret = opaquetoken.getClientSecret(); Assert.state(clientSecret != null, "'clientSecret' must not be null"); return SpringOpaqueTokenIntrospector.withIntrospectionUri(introspectionUri) .clientId(clientId) .clientSecret(clientSecret) .build(); } }
@Configuration(proxyBeanMethods = false) @ConditionalOnDefaultWebSecurity static class OAuth2SecurityFilterChainConfiguration { @Bean @ConditionalOnBean(OpaqueTokenIntrospector.class) SecurityFilterChain opaqueTokenSecurityFilterChain(HttpSecurity http) { http.authorizeHttpRequests((requests) -> requests.anyRequest().authenticated()); http.oauth2ResourceServer((resourceServer) -> resourceServer.opaqueToken(withDefaults())); return http.build(); } } }
repos\spring-boot-4.0.1\module\spring-boot-security-oauth2-resource-server\src\main\java\org\springframework\boot\security\oauth2\server\resource\autoconfigure\servlet\OAuth2ResourceServerOpaqueTokenConfiguration.java
2
请完成以下Java代码
public BatchStatisticsQuery active() { this.suspensionState = SuspensionState.ACTIVE; return this; } public BatchStatisticsQuery suspended() { this.suspensionState = SuspensionState.SUSPENDED; return this; } @Override public BatchStatisticsQuery createdBy(final String userId) { this.userId = userId; return this; } @Override public BatchStatisticsQuery startedBefore(final Date date) { this.startedBefore = date; return this; } @Override public BatchStatisticsQuery startedAfter(final Date date) { this.startedAfter = date; return this; } @Override public BatchStatisticsQuery withFailures() { this.hasFailure = true; return this; } @Override public BatchStatisticsQuery withoutFailures() { this.hasFailure = false; return this; } public SuspensionState getSuspensionState() { return suspensionState; } public BatchStatisticsQuery orderById() { return orderBy(BatchQueryProperty.ID); } @Override public BatchStatisticsQuery orderByTenantId() {
return orderBy(BatchQueryProperty.TENANT_ID); } @Override public BatchStatisticsQuery orderByStartTime() { return orderBy(BatchQueryProperty.START_TIME); } public long executeCount(CommandContext commandContext) { checkQueryOk(); return commandContext .getStatisticsManager() .getStatisticsCountGroupedByBatch(this); } public List<BatchStatistics> executeList(CommandContext commandContext, Page page) { checkQueryOk(); return commandContext .getStatisticsManager() .getStatisticsGroupedByBatch(this, page); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\batch\BatchStatisticsQueryImpl.java
1
请完成以下Java代码
public void setRoleUserLevel(final TableAccessLevel roleUserLevel) { setProperty(Env.CTXNAME_AD_Role_UserLevel, roleUserLevel.getUserLevelString()); // Format 'SCO' } public void setAllowLoginDateOverride(final boolean allowLoginDateOverride) { setProperty(Env.CTXNAME_IsAllowLoginDateOverride, allowLoginDateOverride); } public boolean isAllowLoginDateOverride() { return getPropertyAsBoolean(Env.CTXNAME_IsAllowLoginDateOverride); } public RoleId getRoleId() { return RoleId.ofRepoId(getMandatoryPropertyAsInt(Env.CTXNAME_AD_Role_ID)); } public void setClient(final ClientId clientId, final String clientName) { setProperty(Env.CTXNAME_AD_Client_ID, ClientId.toRepoId(clientId)); setProperty(Env.CTXNAME_AD_Client_Name, clientName); Ini.setProperty(Ini.P_CLIENT, clientName); } public ClientId getClientId() { return ClientId.ofRepoId(getMandatoryPropertyAsInt(Env.CTXNAME_AD_Client_ID)); } public LocalDate getLoginDate() { return getPropertyAsLocalDate(Env.CTXNAME_Date); } public void setLoginDate(final LocalDate date) { setProperty(Env.CTXNAME_Date, date); } public void setOrg(final OrgId orgId, final String orgName) { setProperty(Env.CTXNAME_AD_Org_ID, OrgId.toRepoId(orgId)); setProperty(Env.CTXNAME_AD_Org_Name, orgName); Ini.setProperty(Ini.P_ORG, orgName);
} public void setUserOrgs(final String userOrgs) { setProperty(Env.CTXNAME_User_Org, userOrgs); } public OrgId getOrgId() { return OrgId.ofRepoId(getMandatoryPropertyAsInt(Env.CTXNAME_AD_Org_ID)); } public void setWarehouse(final WarehouseId warehouseId, final String warehouseName) { setProperty(Env.CTXNAME_M_Warehouse_ID, WarehouseId.toRepoId(warehouseId)); Ini.setProperty(Ini.P_WAREHOUSE, warehouseName); } @Nullable public WarehouseId getWarehouseId() { return WarehouseId.ofRepoIdOrNull(getPropertyAsInt(Env.CTXNAME_M_Warehouse_ID)); } public void setPrinterName(final String printerName) { setProperty(Env.CTXNAME_Printer, printerName == null ? "" : printerName); Ini.setProperty(Ini.P_PRINTER, printerName); } public void setAcctSchema(final AcctSchema acctSchema) { setProperty("$C_AcctSchema_ID", acctSchema.getId().getRepoId()); setProperty("$C_Currency_ID", acctSchema.getCurrencyId().getRepoId()); setProperty("$HasAlias", acctSchema.getValidCombinationOptions().isUseAccountAlias()); } @Nullable public AcctSchemaId getAcctSchemaId() { return AcctSchemaId.ofRepoIdOrNull(getPropertyAsInt("$C_AcctSchema_ID")); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\util\LoginContext.java
1
请完成以下Java代码
public void setQtyAvailable (final @Nullable BigDecimal QtyAvailable) { set_ValueNoCheck (COLUMNNAME_QtyAvailable, QtyAvailable); } @Override public BigDecimal getQtyAvailable() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyAvailable); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setQtyBatch (final @Nullable BigDecimal QtyBatch) { set_ValueNoCheck (COLUMNNAME_QtyBatch, QtyBatch); } @Override public BigDecimal getQtyBatch() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyBatch); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setQtyBatchSize (final @Nullable BigDecimal QtyBatchSize) { set_ValueNoCheck (COLUMNNAME_QtyBatchSize, QtyBatchSize); } @Override public BigDecimal getQtyBatchSize() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyBatchSize); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setQtyBOM (final @Nullable BigDecimal QtyBOM) { set_ValueNoCheck (COLUMNNAME_QtyBOM, QtyBOM); } @Override public BigDecimal getQtyBOM() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyBOM); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setQtyOnHand (final @Nullable BigDecimal QtyOnHand) { set_ValueNoCheck (COLUMNNAME_QtyOnHand, QtyOnHand); }
@Override public BigDecimal getQtyOnHand() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyOnHand); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setQtyRequiered (final @Nullable BigDecimal QtyRequiered) { set_ValueNoCheck (COLUMNNAME_QtyRequiered, QtyRequiered); } @Override public BigDecimal getQtyRequiered() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyRequiered); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setQtyReserved (final @Nullable BigDecimal QtyReserved) { set_ValueNoCheck (COLUMNNAME_QtyReserved, QtyReserved); } @Override public BigDecimal getQtyReserved() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyReserved); return bd != null ? bd : BigDecimal.ZERO; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_RV_PP_Order_BOMLine.java
1