instruction
string
input
string
output
string
source_file
string
priority
int64
请完成以下Java代码
public List<Player> loadAllPlayersThrowingChecked(String playersFile) throws TimeoutException { boolean tooLong = true; while (!tooLong) { // ... potentially long operation } throw new TimeoutException("This operation took too long"); } public List<Player> loadAllPlayersThrowingUnchecked(String playersFile) throws TimeoutException { if(!isFilenameValid(playersFile)) { throw new IllegalArgumentException("Filename isn't valid!"); } return null; // ... } public List<Player> loadAllPlayersWrapping(String playersFile) throws IOException { try { throw new IOException(); } catch (IOException io) { throw io; } } public List<Player> loadAllPlayersRethrowing(String playersFile) throws PlayerLoadException { try { throw new IOException(); } catch (IOException io) { throw new PlayerLoadException(io); } } public List<Player> loadAllPlayersThrowable(String playersFile) { try { throw new NullPointerException(); } catch ( Throwable t ) { throw t; } } class FewerExceptions extends Exceptions { @Override public List<Player> loadAllPlayers(String playersFile) { //can't add "throws MyCheckedException return null; // overridden } } public void throwAsGotoAntiPattern() throws MyException { try { // bunch of code throw new MyException(); // second bunch of code } catch ( MyException e ) { // third bunch of code } } public int getPlayerScoreSwallowingExceptionAntiPattern(String playerFile) { try {
// ... } catch (Exception e) {} // <== catch and swallow return 0; } public int getPlayerScoreSwallowingExceptionAntiPatternAlternative(String playerFile) { try { // ... } catch (Exception e) { e.printStackTrace(); } return 0; } public int getPlayerScoreSwallowingExceptionAntiPatternAlternative2(String playerFile) throws PlayerScoreException { try { throw new IOException(); } catch (IOException e) { throw new PlayerScoreException(e); } } public int getPlayerScoreReturnInFinallyAntiPattern(String playerFile) { int score = 0; try { throw new IOException(); } finally { return score; // <== the IOException is dropped } } private boolean isFilenameValid(String name) { return false; } }
repos\tutorials-master\core-java-modules\core-java-exceptions\src\main\java\com\baeldung\exceptions\exceptionhandling\Exceptions.java
1
请在Spring Boot框架中完成以下Java代码
public void process(final Exchange exchange) throws Exception { final ImportProductsRouteContext context = ProcessorHelper.getPropertyOrThrowError(exchange, ROUTE_PROPERTY_IMPORT_PRODUCTS_CONTEXT, ImportProductsRouteContext.class); final JsonProduct product = exchange.getIn().getBody(JsonProduct.class); context.setJsonProduct(product); final ShopwareClient shopwareClient = context.getShopwareClient(); if (product.getParentId() != null) { processLogger.logMessage("Getting variant parent", context.getPInstanceId()); //TODO - maybe add getSingleProduct to shopware client. final MultiQueryRequest getProductsRequest = buildQueryParentProductRequest(product.getParentId()); final Optional<JsonProducts> jsonProductsOptional = shopwareClient.getProducts(getProductsRequest); if (jsonProductsOptional.isEmpty()) {
exchange.getIn().setBody(null); return; } final JsonProduct parentProduct = jsonProductsOptional.get().getProductList().get(0); context.setParentJsonProduct(parentProduct); } else { exchange.getIn().setBody(null); return; } } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-shopware6\src\main\java\de\metas\camel\externalsystems\shopware6\product\processor\GetProductVariantParentProcessor.java
2
请完成以下Java代码
public final UserSpecificationsBuilder with(final String orPredicate, final String key, final String operation, final Object value, final String prefix, final String suffix) { SearchOperation op = SearchOperation.getSimpleOperation(operation.charAt(0)); if (op != null) { if (op == SearchOperation.EQUALITY) { // the operation may be complex operation final boolean startWithAsterisk = prefix != null && prefix.contains(SearchOperation.ZERO_OR_MORE_REGEX); final boolean endWithAsterisk = suffix != null && suffix.contains(SearchOperation.ZERO_OR_MORE_REGEX); if (startWithAsterisk && endWithAsterisk) { op = SearchOperation.CONTAINS; } else if (startWithAsterisk) { op = SearchOperation.ENDS_WITH; } else if (endWithAsterisk) { op = SearchOperation.STARTS_WITH; } } params.add(new SpecSearchCriteria(orPredicate, key, op, value)); } return this; } public Specification<User> build() { if (params.size() == 0) return null; Specification<User> result = new UserSpecification(params.get(0)); for (int i = 1; i < params.size(); i++) { result = params.get(i).isOrPredicate() ? Specification.where(result).or(new UserSpecification(params.get(i)))
: Specification.where(result).and(new UserSpecification(params.get(i))); } return result; } public final UserSpecificationsBuilder with(UserSpecification spec) { params.add(spec.getCriteria()); return this; } public final UserSpecificationsBuilder with(SpecSearchCriteria criteria) { params.add(criteria); return this; } }
repos\tutorials-master\spring-web-modules\spring-rest-query-language\src\main\java\com\baeldung\persistence\dao\UserSpecificationsBuilder.java
1
请在Spring Boot框架中完成以下Java代码
BeanDefinition getLogoutRequestFilter() { return this.logoutRequestFilter; } BeanDefinition getLogoutResponseFilter() { return this.logoutResponseFilter; } BeanDefinition getLogoutFilter() { return this.logoutFilter; } public static class Saml2RequestMatcher implements RequestMatcher { private SecurityContextHolderStrategy securityContextHolderStrategy = SecurityContextHolder .getContextHolderStrategy(); @Override public boolean matches(HttpServletRequest request) { Authentication authentication = this.securityContextHolderStrategy.getContext().getAuthentication(); if (authentication == null) {
return false; } if (authentication.getPrincipal() instanceof Saml2AuthenticatedPrincipal) { return true; } if (authentication.getCredentials() instanceof Saml2ResponseAssertionAccessor) { return true; } return authentication instanceof Saml2Authentication; } public void setSecurityContextHolderStrategy(SecurityContextHolderStrategy securityContextHolderStrategy) { this.securityContextHolderStrategy = securityContextHolderStrategy; } } }
repos\spring-security-main\config\src\main\java\org\springframework\security\config\http\Saml2LogoutBeanDefinitionParser.java
2
请完成以下Java代码
public class OIView_AddToJournal extends OIViewBasedProcess { private final SAPGLJournalService sapglJournalService = SpringContextHolder.instance.getBean(SAPGLJournalService.class); private final MoneyService moneyService = SpringContextHolder.instance.getBean(MoneyService.class); @Override protected ProcessPreconditionsResolution checkPreconditionsApplicable() { if (!getView().hasSelectedRows()) { return ProcessPreconditionsResolution.rejectWithInternalReason("No rows marked as selected"); } return ProcessPreconditionsResolution.accept(); } @Override protected String doIt() { final OIView view = getView(); final List<SAPGLJournalLineCreateRequest> createRequests = view.streamByIds(DocumentIdsSelection.ALL) .filter(OIRow::isSelected) .map(this::toSAPGLJournalLineCreateRequest) .collect(Collectors.toList()); sapglJournalService.createLines(createRequests, view.getSapglJournalId()); return MSG_OK; } @Override
protected void postProcess(final boolean success) { if (success) { final OIView view = getView(); view.clearUserInputAndResetFilter(); } } private SAPGLJournalLineCreateRequest toSAPGLJournalLineCreateRequest(final OIRow row) { final Money openAmount = row.getOpenAmountEffective() .toMoney(moneyService::getCurrencyIdByCurrencyCode); return SAPGLJournalLineCreateRequest.builder() .postingSign(row.getPostingSign().reverse()) .account(row.getAccount()) .amount(openAmount.toBigDecimal()) .expectedCurrencyId(openAmount.getCurrencyId()) .bpartnerId(row.getBpartnerId()) .dimension(row.getDimension()) .openItemTrxInfo(FAOpenItemTrxInfo.clearing(row.getOpenItemKey())) .isFieldsReadOnlyInUI(true) .build(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.webui\src\main\java\de\metas\acct\gljournal_sap\select_open_items\OIView_AddToJournal.java
1
请在Spring Boot框架中完成以下Java代码
public static class ApacheShiroProperties { private String iniResourcePath; public String getIniResourcePath() { return this.iniResourcePath; } public void setIniResourcePath(String iniResourcePath) { this.iniResourcePath = iniResourcePath; } } public static class SecurityLogProperties { private static final String DEFAULT_SECURITY_LOG_LEVEL = "config"; private String file; private String level = DEFAULT_SECURITY_LOG_LEVEL; public String getFile() { return this.file; } public void setFile(String file) { this.file = file; } public String getLevel() { return this.level; } public void setLevel(String level) {
this.level = level; } } public static class SecurityManagerProperties { private String className; public String getClassName() { return this.className; } public void setClassName(String className) { this.className = className; } } public static class SecurityPostProcessorProperties { private String className; public String getClassName() { return this.className; } public void setClassName(String className) { this.className = className; } } }
repos\spring-boot-data-geode-main\spring-geode-project\spring-geode-autoconfigure\src\main\java\org\springframework\geode\boot\autoconfigure\configuration\support\SecurityProperties.java
2
请完成以下Java代码
public int getAD_Val_Rule_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_AD_Val_Rule_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Classname. @param Classname Java Classname */ public void setClassname (String Classname) { set_Value (COLUMNNAME_Classname, Classname); } /** Get Classname. @return Java Classname */ public String getClassname () { return (String)get_Value(COLUMNNAME_Classname); } /** Set Validierungscode. @param Code Validation Code */ public void setCode (String Code) { set_Value (COLUMNNAME_Code, Code); } /** Get Validierungscode. @return Validation Code */ public String getCode () { return (String)get_Value(COLUMNNAME_Code); } /** Set Beschreibung. @param Description Optional short description of the record */ public void setDescription (String Description) { set_Value (COLUMNNAME_Description, Description); } /** Get Beschreibung. @return Optional short description of the record */ public String getDescription () { return (String)get_Value(COLUMNNAME_Description); } /** EntityType AD_Reference_ID=389 */ public static final int ENTITYTYPE_AD_Reference_ID=389; /** Set Entitaets-Art. @param EntityType Dictionary Entity Type; Determines ownership and synchronization */ public void setEntityType (String EntityType) { set_Value (COLUMNNAME_EntityType, EntityType); }
/** Get Entitaets-Art. @return Dictionary Entity Type; Determines ownership and synchronization */ public String getEntityType () { return (String)get_Value(COLUMNNAME_EntityType); } /** 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()); } /** Type AD_Reference_ID=101 */ public static final int TYPE_AD_Reference_ID=101; /** SQL = S */ public static final String TYPE_SQL = "S"; /** Java = J */ public static final String TYPE_Java = "J"; /** Java-Script = E */ public static final String TYPE_Java_Script = "E"; /** Composite = C */ public static final String TYPE_Composite = "C"; /** Set Art. @param Type Type of Validation (SQL, Java Script, Java Language) */ public void setType (String Type) { set_Value (COLUMNNAME_Type, Type); } /** Get Art. @return Type of Validation (SQL, Java Script, Java Language) */ public String getType () { return (String)get_Value(COLUMNNAME_Type); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Val_Rule.java
1
请完成以下Java代码
public String getColor() { return color; } public String getGrade() { return grade; } public Long getId() { return id; } public ItemType getItemType() { return itemType; } public String getName() { return name; } public BigDecimal getPrice() { return price; } public Store getStore() { return store; } public void setColor(String color) { this.color = color; } public void setGrade(String grade) { this.grade = grade;
} public void setId(Long id) { this.id = id; } public void setItemType(ItemType itemType) { this.itemType = itemType; } public void setName(String name) { this.name = name; } public void setPrice(BigDecimal price) { this.price = price; } public void setStore(Store store) { this.store = store; } }
repos\tutorials-master\persistence-modules\spring-data-jpa-repo-2\src\main\java\com\baeldung\boot\domain\Item.java
1
请在Spring Boot框架中完成以下Java代码
public @Nullable String getUsername() { return this.username; } public void setUsername(@Nullable String username) { this.username = username; } public @Nullable String getPassword() { return this.password; } public void setPassword(@Nullable String password) { this.password = password; } public Duration getPushRate() { return this.pushRate; } public void setPushRate(Duration pushRate) { this.pushRate = pushRate; } public @Nullable String getJob() { return this.job; } public void setJob(@Nullable String job) { this.job = job; } public Map<String, String> getGroupingKey() { return this.groupingKey; } public void setGroupingKey(Map<String, String> groupingKey) { this.groupingKey = groupingKey; } public ShutdownOperation getShutdownOperation() { return this.shutdownOperation; } public void setShutdownOperation(ShutdownOperation shutdownOperation) { this.shutdownOperation = shutdownOperation; } public Scheme getScheme() { return this.scheme; }
public void setScheme(Scheme scheme) { this.scheme = scheme; } public @Nullable String getToken() { return this.token; } public void setToken(@Nullable String token) { this.token = token; } public Format getFormat() { return this.format; } public void setFormat(Format format) { this.format = format; } public enum Format { /** * Push metrics in text format. */ TEXT, /** * Push metrics in protobuf format. */ PROTOBUF } public enum Scheme { /** * Use HTTP to push metrics. */ HTTP, /** * Use HTTPS to push metrics. */ HTTPS } } }
repos\spring-boot-4.0.1\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\export\prometheus\PrometheusProperties.java
2
请完成以下Java代码
public void addQtyDelivered(@NonNull final CallOrderSummaryId callOrderSummaryId, @NonNull final Quantity deltaQtyDelivered) { final CallOrderSummary callOrderSummary = summaryRepo.getById(callOrderSummaryId); final CallOrderSummaryData summaryData = callOrderSummary.getSummaryData(); final Quantity currentQtyDelivered = Quantitys.of(summaryData.getQtyDelivered(), summaryData.getUomId()); final Quantity sum = conversionBL.computeSum( UOMConversionContext.of(callOrderSummary.getSummaryData().getProductId()), ImmutableList.of(currentQtyDelivered, deltaQtyDelivered), currentQtyDelivered.getUomId()); final BigDecimal newQtyDelivered = sum.toBigDecimal(); summaryRepo.update(callOrderSummary.withSummaryData(summaryData.withQtyDelivered(newQtyDelivered))); } public void addQtyInvoiced(@NonNull final CallOrderSummaryId callOrderSummaryId, @NonNull final Quantity deltaQtyInvoiced)
{ final CallOrderSummary callOrderSummary = summaryRepo.getById(callOrderSummaryId); final CallOrderSummaryData summaryData = callOrderSummary.getSummaryData(); final Quantity currentQtyInvoiced = Quantitys.of(summaryData.getQtyInvoiced(), summaryData.getUomId()); final Quantity sum = conversionBL.computeSum( UOMConversionContext.of(callOrderSummary.getSummaryData().getProductId()), ImmutableList.of(currentQtyInvoiced, deltaQtyInvoiced), currentQtyInvoiced.getUomId()); final BigDecimal newQtyInvoiced = sum.toBigDecimal(); summaryRepo.update(callOrderSummary.withSummaryData(summaryData.withQtyInvoiced(newQtyInvoiced))); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\callorder\summary\CallOrderSummaryService.java
1
请完成以下Spring Boot application配置
spring: datasource: # url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE url: jdbc:mysql://localhost:3308/testdb username: root password: 123456 driver-class-name: com.mysql.jdbc.Driver tomcat: max-wait: 20000 max-active: 50 max-idle: 20 min-idle: 15 jpa: hibernate: ddl-auto: create-drop # ddl-auto: update # properties: # hibernate: # dialect: org.hibernate.dialect.MySQLInnoDBDialect # format_sql: true # id: # new_generator_mappings: false show-sql: true security: jwt: token: secret-key: secret-key
expire-length: 36000 UserController: signin: Authenticates user and returns its JWT token. signup: Creates user and returns its JWT token delete: Deletes specific user by username search: Returns specific user by username me: Returns current user's data
repos\spring-boot-quick-master\quick-jwt\src\main\resources\application.yml
2
请完成以下Java代码
public C_AggregationItem_Builder setIncluded_Aggregation(final I_C_Aggregation includedAggregation) { this.includedAggregation = includedAggregation; return this; } private I_C_Aggregation getIncluded_Aggregation() { return includedAggregation; } public C_AggregationItem_Builder setIncludeLogic(final String includeLogic) { this.includeLogic = includeLogic; return this; } private String getIncludeLogic()
{ return includeLogic; } public C_AggregationItem_Builder setC_Aggregation_Attribute(I_C_Aggregation_Attribute attribute) { this.attribute = attribute; return this; } private I_C_Aggregation_Attribute getC_Aggregation_Attribute() { return this.attribute; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.aggregation\src\main\java\de\metas\aggregation\model\C_AggregationItem_Builder.java
1
请完成以下Java代码
public class X_MobileUI_UserProfile_MFG extends org.compiere.model.PO implements I_MobileUI_UserProfile_MFG, org.compiere.model.I_Persistent { private static final long serialVersionUID = -734644038L; /** Standard Constructor */ public X_MobileUI_UserProfile_MFG (final Properties ctx, final int MobileUI_UserProfile_MFG_ID, @Nullable final String trxName) { super (ctx, MobileUI_UserProfile_MFG_ID, trxName); } /** Load Constructor */ public X_MobileUI_UserProfile_MFG (final Properties ctx, final ResultSet rs, @Nullable final String trxName) { super (ctx, rs, trxName); } /** Load Meta Data */ @Override protected org.compiere.model.POInfo initPO(final Properties ctx) { return org.compiere.model.POInfo.getPOInfo(Table_Name); } @Override public void setAD_User_ID (final int AD_User_ID) { if (AD_User_ID < 0) set_ValueNoCheck (COLUMNNAME_AD_User_ID, null); else set_ValueNoCheck (COLUMNNAME_AD_User_ID, AD_User_ID); } @Override 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 JsonObject writeConfiguration(ModificationBatchConfiguration configuration) { JsonObject json = JsonUtil.createObject(); JsonUtil.addListField(json, INSTRUCTIONS, ModificationCmdJsonConverter.INSTANCE, configuration.getInstructions()); JsonUtil.addListField(json, PROCESS_INSTANCE_IDS, configuration.getIds()); JsonUtil.addListField(json, PROCESS_INSTANCE_ID_MAPPINGS, DeploymentMappingJsonConverter.INSTANCE, configuration.getIdMappings()); JsonUtil.addField(json, PROCESS_DEFINITION_ID, configuration.getProcessDefinitionId()); JsonUtil.addField(json, SKIP_LISTENERS, configuration.isSkipCustomListeners()); JsonUtil.addField(json, SKIP_IO_MAPPINGS, configuration.isSkipIoMappings()); return json; } @Override public ModificationBatchConfiguration readConfiguration(JsonObject json) { List<String> processInstanceIds = readProcessInstanceIds(json); DeploymentMappings mappings = readIdMappings(json); String processDefinitionId = JsonUtil.getString(json, PROCESS_DEFINITION_ID); List<AbstractProcessInstanceModificationCommand> instructions = JsonUtil.asList(JsonUtil.getArray(json, INSTRUCTIONS), ModificationCmdJsonConverter.INSTANCE); boolean skipCustomListeners = JsonUtil.getBoolean(json, SKIP_LISTENERS); boolean skipIoMappings = JsonUtil.getBoolean(json, SKIP_IO_MAPPINGS);
return new ModificationBatchConfiguration( processInstanceIds, mappings, processDefinitionId, instructions, skipCustomListeners, skipIoMappings); } protected List<String> readProcessInstanceIds(JsonObject jsonObject) { return JsonUtil.asStringList(JsonUtil.getArray(jsonObject, PROCESS_INSTANCE_IDS)); } protected DeploymentMappings readIdMappings(JsonObject json) { return JsonUtil.asList(JsonUtil.getArray(json, PROCESS_INSTANCE_ID_MAPPINGS), DeploymentMappingJsonConverter.INSTANCE, DeploymentMappings::new); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\json\ModificationBatchConfigurationJsonConverter.java
1
请完成以下Java代码
public static final class Builder { private String id; private int xmlRowNumber; private int xmlColumnNumber; private Map<String, List<ExtensionElement>> extensionElements = emptyMap(); private Map<String, List<ExtensionAttribute>> attributes = emptyMap(); private String name; private String itemRef; private Builder() {} private Builder(Message message) { this.id = message.id; this.xmlRowNumber = message.xmlRowNumber; this.xmlColumnNumber = message.xmlColumnNumber; this.extensionElements = message.extensionElements; this.attributes = message.attributes; this.name = message.name; this.itemRef = message.itemRef; } public Builder id(String id) { this.id = id; return this; } public Builder xmlRowNumber(int xmlRowNumber) { this.xmlRowNumber = xmlRowNumber; return this; } public Builder xmlColumnNumber(int xmlColumnNumber) { this.xmlColumnNumber = xmlColumnNumber; return this;
} public Builder extensionElements(Map<String, List<ExtensionElement>> extensionElements) { this.extensionElements = extensionElements; return this; } public Builder attributes(Map<String, List<ExtensionAttribute>> attributes) { this.attributes = attributes; return this; } public Builder name(String name) { this.name = name; return this; } public Builder itemRef(String itemRef) { this.itemRef = itemRef; return this; } public Message build() { return new Message(this); } } }
repos\Activiti-develop\activiti-core\activiti-bpmn-model\src\main\java\org\activiti\bpmn\model\Message.java
1
请在Spring Boot框架中完成以下Java代码
public class LabelParticipant { String stationNo; String name1; String name2; String name3; String street; String streetNo; String city; String zipCode; String country; String phone; String notice; @Builder private LabelParticipant( String stationNo, String name1, String name2, String name3, String street, String streetNo, String city,
String zipCode, String country, String phone, String notice) { this.stationNo = Check.assumeNotEmpty(stationNo, "Parameter stationNo may not be null"); this.name1 = Check.assumeNotEmpty(name1, "Parameter name1 may not be null"); this.name2 = name2; this.name3 = name3; this.street = Check.assumeNotEmpty(street, "Parameter street may not be null"); this.streetNo = Check.assumeNotEmpty(streetNo, "Parameter streetNo may not be null"); this.city = Check.assumeNotEmpty(city, "Parameter city may not be null"); this.zipCode = Check.assumeNotEmpty(zipCode, "Parameter street may not be null"); this.country = Check.assumeNotEmpty(country, "Parameter country may not be null"); this.phone = phone; this.notice = notice; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.derkurier\src\main\java\de\metas\shipper\gateway\derkurier\restapi\models\LabelParticipant.java
2
请完成以下Java代码
protected Insets getSelectedTabPadInsets() { return NORTH_INSETS; } @Override protected Insets getTabInsets(int tabIndex, Insets tabInsets) { return new Insets(tabInsets.top - 1, tabInsets.left - 4, tabInsets.bottom, tabInsets.right - 4); } @Override protected void paintFocusIndicator( Graphics g, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected) { if (!tabPane.hasFocus() || !isSelected) return; Rectangle tabRect = rects[tabIndex]; int top = tabRect.y + 1; int left = tabRect.x + 4; int height = tabRect.height - 3; int width = tabRect.width - 9; g.setColor(focus); g.drawRect(left, top, width, height); } @Override protected void paintTabBackground(Graphics g, int tabIndex, int x, int y, int w, int h, boolean isSelected) { int sel = (isSelected) ? 0 : 1; g.setColor(selectColor); g.fillRect(x, y + sel, w, h / 2); g.fillRect(x - 1, y + sel + h / 2, w + 2, h - h / 2); } @Override protected void paintTabBorder(Graphics g, int tabIndex, int x, int y, int w, int h, boolean isSelected) { g.translate(x - 4, y); int top = 0; int right = w + 6; // Paint Border g.setColor(selectHighlight); // Paint left g.drawLine(1, h - 1, 4, top + 4); g.fillRect(5, top + 2, 1, 2); g.fillRect(6, top + 1, 1, 1); // Paint top g.fillRect(7, top, right - 12, 1); // Paint right g.setColor(darkShadow); g.drawLine(right, h - 1, right - 3, top + 4); g.fillRect(right - 4, top + 2, 1, 2); g.fillRect(right - 5, top + 1, 1, 1); g.translate(-x + 4, -y); } @Override protected void paintContentBorderTopEdge(
Graphics g, int x, int y, int w, int h, boolean drawBroken, Rectangle selRect, boolean isContentBorderPainted) { int right = x + w - 1; int top = y; g.setColor(selectHighlight); if (drawBroken && selRect.x >= x && selRect.x <= x + w) { // Break line to show visual connection to selected tab g.fillRect(x, top, selRect.x - 2 - x, 1); if (selRect.x + selRect.width < x + w - 2) { g.fillRect(selRect.x + selRect.width + 2, top, right - 2 - selRect.x - selRect.width, 1); } else { g.fillRect(x + w - 2, top, 1, 1); } } else { g.fillRect(x, top, w - 1, 1); } } @Override protected int getTabsOverlay() { return 6; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\plaf\AdempiereTabbedPaneUI.java
1
请在Spring Boot框架中完成以下Java代码
public class NettySocketConfig { @Resource private MyProperties myProperties; @Resource private ApiService apiService; private static final Logger logger = LoggerFactory.getLogger(NettySocketConfig.class); @Bean public SocketIOServer socketIOServer() { /* * 创建Socket,并设置监听端口 */ com.corundumstudio.socketio.Configuration config = new com.corundumstudio.socketio.Configuration(); // 设置主机名,默认是0.0.0.0 // config.setHostname("localhost");
// 设置监听端口 config.setPort(myProperties.getSocketPort()); // 协议升级超时时间(毫秒),默认10000。HTTP握手升级为ws协议超时时间 config.setUpgradeTimeout(10000); // Ping消息间隔(毫秒),默认25000。客户端向服务器发送一条心跳消息间隔 config.setPingInterval(myProperties.getPingInterval()); // Ping消息超时时间(毫秒),默认60000,这个时间间隔内没有接收到心跳消息就会发送超时事件 config.setPingTimeout(myProperties.getPingTimeout()); return new SocketIOServer(config); } @Bean public SpringAnnotationScanner springAnnotationScanner(SocketIOServer socketServer) { return new SpringAnnotationScanner(socketServer); } }
repos\SpringBootBucket-master\springboot-echarts\src\main\java\com\xncoding\echarts\config\NettySocketConfig.java
2
请完成以下Java代码
public ProcessDefinitionEntity findProcessDefinitionByDeploymentAndKey( String deploymentId, String processDefinitionKey ) { return processDefinitionDataManager.findProcessDefinitionByDeploymentAndKey(deploymentId, processDefinitionKey); } @Override public ProcessDefinitionEntity findProcessDefinitionByDeploymentAndKeyAndTenantId( String deploymentId, String processDefinitionKey, String tenantId ) { return processDefinitionDataManager.findProcessDefinitionByDeploymentAndKeyAndTenantId( deploymentId, processDefinitionKey, tenantId ); } @Override public ProcessDefinition findProcessDefinitionByKeyAndVersionAndTenantId( String processDefinitionKey, Integer processDefinitionVersion, String tenantId ) { if (tenantId == null || ProcessEngineConfiguration.NO_TENANT_ID.equals(tenantId)) { return processDefinitionDataManager.findProcessDefinitionByKeyAndVersion( processDefinitionKey, processDefinitionVersion ); } else { return processDefinitionDataManager.findProcessDefinitionByKeyAndVersionAndTenantId( processDefinitionKey, processDefinitionVersion, tenantId ); } } @Override public List<ProcessDefinition> findProcessDefinitionsByNativeQuery( Map<String, Object> parameterMap,
int firstResult, int maxResults ) { return processDefinitionDataManager.findProcessDefinitionsByNativeQuery(parameterMap, firstResult, maxResults); } @Override public long findProcessDefinitionCountByNativeQuery(Map<String, Object> parameterMap) { return processDefinitionDataManager.findProcessDefinitionCountByNativeQuery(parameterMap); } @Override public void updateProcessDefinitionTenantIdForDeployment(String deploymentId, String newTenantId) { processDefinitionDataManager.updateProcessDefinitionTenantIdForDeployment(deploymentId, newTenantId); } public ProcessDefinitionDataManager getProcessDefinitionDataManager() { return processDefinitionDataManager; } public void setProcessDefinitionDataManager(ProcessDefinitionDataManager processDefinitionDataManager) { this.processDefinitionDataManager = processDefinitionDataManager; } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\persistence\entity\ProcessDefinitionEntityManagerImpl.java
1
请完成以下Java代码
public void setS_Resource_ID (final int S_Resource_ID) { if (S_Resource_ID < 1) set_Value (COLUMNNAME_S_Resource_ID, null); else set_Value (COLUMNNAME_S_Resource_ID, S_Resource_ID); } @Override public int getS_Resource_ID() { return get_ValueAsInt(COLUMNNAME_S_Resource_ID); } @Override public void setScannedQRCode (final @Nullable java.lang.String ScannedQRCode) { set_Value (COLUMNNAME_ScannedQRCode, ScannedQRCode); } @Override public java.lang.String getScannedQRCode() { return get_ValueAsString(COLUMNNAME_ScannedQRCode); } @Override public void setSetupTime (final int SetupTime) { set_Value (COLUMNNAME_SetupTime, SetupTime); } @Override public int getSetupTime() { return get_ValueAsInt(COLUMNNAME_SetupTime); } @Override public void setSetupTimeReal (final int SetupTimeReal) { set_Value (COLUMNNAME_SetupTimeReal, SetupTimeReal); } @Override public int getSetupTimeReal() { return get_ValueAsInt(COLUMNNAME_SetupTimeReal); }
@Override public void setSetupTimeRequiered (final int SetupTimeRequiered) { set_Value (COLUMNNAME_SetupTimeRequiered, SetupTimeRequiered); } @Override public int getSetupTimeRequiered() { return get_ValueAsInt(COLUMNNAME_SetupTimeRequiered); } @Override public void setValue (final java.lang.String Value) { set_Value (COLUMNNAME_Value, Value); } @Override public java.lang.String getValue() { return get_ValueAsString(COLUMNNAME_Value); } @Override public void setWaitingTime (final int WaitingTime) { set_Value (COLUMNNAME_WaitingTime, WaitingTime); } @Override public int getWaitingTime() { return get_ValueAsInt(COLUMNNAME_WaitingTime); } @Override public void setYield (final int Yield) { set_Value (COLUMNNAME_Yield, Yield); } @Override public int getYield() { return get_ValueAsInt(COLUMNNAME_Yield); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_PP_Order_Node.java
1
请完成以下Java代码
public class Main extends AbstractModuleInterceptor { @Override protected void onAfterInit() { // // Setup Time Format (see 06148) Language.setDefaultTimeStyle(DateFormat.SHORT); // // Apply misc workarounds for GOLIVE apply_Fresh_GOLIVE_Workarounds(); // task 09833 // Register the Printing Info ctx provider for C_Order_MFGWarehouse_Report Services.get(INotificationBL.class).addCtxProvider(C_Order_MFGWarehouse_Report_RecordTextProvider.instance); // // register ProductPOCopyRecordSupport, which needs to know about many different tables CopyRecordFactory.enableForTableName(I_M_Product.Table_Name); } @Override protected void registerInterceptors(final IModelValidationEngine engine) { // // add model validators engine.addModelValidator(new C_Order()); engine.addModelValidator(new C_Invoice_Candidate()); engine.addModelValidator(new de.metas.fresh.freshQtyOnHand.model.validator.Fresh_QtyOnHand()); engine.addModelValidator(new de.metas.fresh.freshQtyOnHand.model.validator.Fresh_QtyOnHand_Line());
//engine.addModelValidator(de.metas.fresh.material.interceptor.PMM_PurchaseCandidate.INSTANCE); // added via spring now // these two are now spring components // engine.addModelValidator(de.metas.fresh.ordercheckup.model.validator.C_Order.instance); // task 09028 // engine.addModelValidator(de.metas.fresh.ordercheckup.model.validator.C_Order_MFGWarehouse_ReportLine.instance); // task 09028 } private void apply_Fresh_GOLIVE_Workarounds() { // QtyOnHand manual bookings table (08287) { CopyRecordFactory.enableForTableName(I_Fresh_QtyOnHand.Table_Name); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.fresh\de.metas.fresh.base\src\main\java\de\metas\fresh\model\validator\Main.java
1
请在Spring Boot框架中完成以下Java代码
public class DecisionService extends Invocable { protected List<DmnElementReference> outputDecisions = new ArrayList<>(); protected List<DmnElementReference> encapsulatedDecisions = new ArrayList<>(); protected List<DmnElementReference> inputDecisions = new ArrayList<>(); protected List<DmnElementReference> inputData = new ArrayList<>(); @JsonIgnore protected DmnDefinition dmnDefinition; public List<DmnElementReference> getOutputDecisions() { return outputDecisions; } public void setOutputDecisions(List<DmnElementReference> outputDecisions) { this.outputDecisions = outputDecisions; } public void addOutputDecision(DmnElementReference outputDecision) { this.outputDecisions.add(outputDecision); } public List<DmnElementReference> getEncapsulatedDecisions() { return encapsulatedDecisions; } public void setEncapsulatedDecisions(List<DmnElementReference> encapsulatedDecisions) { this.encapsulatedDecisions = encapsulatedDecisions; } public void addEncapsulatedDecision(DmnElementReference encapsulatedDecision) { this.encapsulatedDecisions.add(encapsulatedDecision); } public List<DmnElementReference> getInputDecisions() { return inputDecisions; } public void setInputDecisions(List<DmnElementReference> inputDecisions) { this.inputDecisions = inputDecisions; } public void addInputDecision(DmnElementReference inputDecision) { this.inputDecisions.add(inputDecision); }
public List<DmnElementReference> getInputData() { return inputData; } public void setInputData(List<DmnElementReference> inputData) { this.inputData = inputData; } public void addInputData(DmnElementReference inputData) { this.inputData.add(inputData); } @JsonIgnore public DmnDefinition getDmnDefinition() { return dmnDefinition; } public void setDmnDefinition(DmnDefinition dmnDefinition) { this.dmnDefinition = dmnDefinition; } }
repos\flowable-engine-main\modules\flowable-dmn-model\src\main\java\org\flowable\dmn\model\DecisionService.java
2
请完成以下Java代码
protected Class<OtaPackageInfoEntity> getEntityClass() { return OtaPackageInfoEntity.class; } @Override protected JpaRepository<OtaPackageInfoEntity, UUID> getRepository() { return otaPackageInfoRepository; } @Override public OtaPackageInfo findById(TenantId tenantId, UUID id) { return DaoUtil.getData(otaPackageInfoRepository.findOtaPackageInfoById(id)); } @Transactional @Override public OtaPackageInfo save(TenantId tenantId, OtaPackageInfo otaPackageInfo) { OtaPackageInfo savedOtaPackage = super.save(tenantId, otaPackageInfo); if (otaPackageInfo.getId() == null) { return savedOtaPackage; } else { return findById(tenantId, savedOtaPackage.getId().getId()); } } @Override public PageData<OtaPackageInfo> findOtaPackageInfoByTenantId(TenantId tenantId, PageLink pageLink) { return DaoUtil.toPageData(otaPackageInfoRepository .findAllByTenantId(
tenantId.getId(), pageLink.getTextSearch(), DaoUtil.toPageable(pageLink))); } @Override public PageData<OtaPackageInfo> findOtaPackageInfoByTenantIdAndDeviceProfileIdAndTypeAndHasData(TenantId tenantId, DeviceProfileId deviceProfileId, OtaPackageType otaPackageType, PageLink pageLink) { return DaoUtil.toPageData(otaPackageInfoRepository .findAllByTenantIdAndTypeAndDeviceProfileIdAndHasData( tenantId.getId(), deviceProfileId.getId(), otaPackageType, pageLink.getTextSearch(), DaoUtil.toPageable(pageLink))); } @Override public boolean isOtaPackageUsed(OtaPackageId otaPackageId, OtaPackageType otaPackageType, DeviceProfileId deviceProfileId) { return otaPackageInfoRepository.isOtaPackageUsed(otaPackageId.getId(), deviceProfileId.getId(), otaPackageType.name()); } }
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\sql\ota\JpaOtaPackageInfoDao.java
1
请在Spring Boot框架中完成以下Java代码
class OnJndiCondition extends SpringBootCondition { @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { AnnotationAttributes attributes = AnnotationAttributes .fromMap(metadata.getAnnotationAttributes(ConditionalOnJndi.class.getName())); Assert.state(attributes != null, "'attributes' must not be null"); String[] locations = attributes.getStringArray("value"); try { return getMatchOutcome(locations); } catch (NoClassDefFoundError ex) { return ConditionOutcome .noMatch(ConditionMessage.forCondition(ConditionalOnJndi.class).because("JNDI class not found")); } } private ConditionOutcome getMatchOutcome(String[] locations) { if (!isJndiAvailable()) { return ConditionOutcome .noMatch(ConditionMessage.forCondition(ConditionalOnJndi.class).notAvailable("JNDI environment")); } if (locations.length == 0) { return ConditionOutcome .match(ConditionMessage.forCondition(ConditionalOnJndi.class).available("JNDI environment")); } JndiLocator locator = getJndiLocator(locations); String location = locator.lookupFirstLocation(); String details = "(" + StringUtils.arrayToCommaDelimitedString(locations) + ")"; if (location != null) { return ConditionOutcome.match(ConditionMessage.forCondition(ConditionalOnJndi.class, details) .foundExactly("\"" + location + "\"")); } return ConditionOutcome.noMatch(ConditionMessage.forCondition(ConditionalOnJndi.class, details) .didNotFind("any matching JNDI location") .atAll()); } protected boolean isJndiAvailable() { return JndiLocatorDelegate.isDefaultJndiEnvironmentAvailable(); }
protected JndiLocator getJndiLocator(String[] locations) { return new JndiLocator(locations); } protected static class JndiLocator extends JndiLocatorSupport { private final String[] locations; public JndiLocator(String[] locations) { this.locations = locations; } public @Nullable String lookupFirstLocation() { for (String location : this.locations) { try { lookup(location); return location; } catch (NamingException ex) { // Swallow and continue } } return null; } } }
repos\spring-boot-4.0.1\core\spring-boot-autoconfigure\src\main\java\org\springframework\boot\autoconfigure\condition\OnJndiCondition.java
2
请完成以下Java代码
protected void setTimings(long shutdown, long sleep, long timeout) { this.shutdownTime = shutdown; this.sleepTime = sleep; this.timeout = timeout; } @Override public void run() { try { Thread.sleep(this.shutdownTime); long start = System.currentTimeMillis(); while (!isUp()) { long runTime = System.currentTimeMillis() - start; if (runTime > this.timeout) { return; } Thread.sleep(this.sleepTime); } logger.info("Remote server has changed, triggering LiveReload"); this.liveReloadServer.triggerReload(); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } }
private boolean isUp() { try { ClientHttpRequest request = createRequest(); try (ClientHttpResponse response = request.execute()) { return response.getStatusCode() == HttpStatus.OK; } } catch (Exception ex) { return false; } } private ClientHttpRequest createRequest() throws IOException { return this.requestFactory.createRequest(this.uri, HttpMethod.GET); } }
repos\spring-boot-4.0.1\module\spring-boot-devtools\src\main\java\org\springframework\boot\devtools\remote\client\DelayedLiveReloadTrigger.java
1
请完成以下Java代码
public void setM_HU_PI_Item(final de.metas.handlingunits.model.I_M_HU_PI_Item M_HU_PI_Item) { set_ValueFromPO(COLUMNNAME_M_HU_PI_Item_ID, de.metas.handlingunits.model.I_M_HU_PI_Item.class, M_HU_PI_Item); } @Override public void setM_HU_PI_Item_ID (final int M_HU_PI_Item_ID) { if (M_HU_PI_Item_ID < 1) set_Value (COLUMNNAME_M_HU_PI_Item_ID, null); else set_Value (COLUMNNAME_M_HU_PI_Item_ID, M_HU_PI_Item_ID); } @Override public int getM_HU_PI_Item_ID() { return get_ValueAsInt(COLUMNNAME_M_HU_PI_Item_ID); } @Override public void setM_HU_PI_Item_Product_ID (final int M_HU_PI_Item_Product_ID) { if (M_HU_PI_Item_Product_ID < 1) set_ValueNoCheck (COLUMNNAME_M_HU_PI_Item_Product_ID, null); else set_ValueNoCheck (COLUMNNAME_M_HU_PI_Item_Product_ID, M_HU_PI_Item_Product_ID); } @Override public int getM_HU_PI_Item_Product_ID() { return get_ValueAsInt(COLUMNNAME_M_HU_PI_Item_Product_ID); } @Override public void setM_Product_ID (final int M_Product_ID) { if (M_Product_ID < 1) set_ValueNoCheck (COLUMNNAME_M_Product_ID, null); else set_ValueNoCheck (COLUMNNAME_M_Product_ID, M_Product_ID); } @Override public int getM_Product_ID() { return get_ValueAsInt(COLUMNNAME_M_Product_ID); } @Override public void setName (final @Nullable java.lang.String Name) { set_ValueNoCheck (COLUMNNAME_Name, Name); } @Override public java.lang.String getName() { return get_ValueAsString(COLUMNNAME_Name); } @Override public void setQty (final BigDecimal Qty) { set_Value (COLUMNNAME_Qty, Qty); } @Override public BigDecimal getQty() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty); return bd != null ? bd : BigDecimal.ZERO; } @Override
public void setUPC (final @Nullable java.lang.String UPC) { set_Value (COLUMNNAME_UPC, UPC); } @Override public java.lang.String getUPC() { return get_ValueAsString(COLUMNNAME_UPC); } @Override public void setValidFrom (final java.sql.Timestamp ValidFrom) { set_Value (COLUMNNAME_ValidFrom, ValidFrom); } @Override public java.sql.Timestamp getValidFrom() { return get_ValueAsTimestamp(COLUMNNAME_ValidFrom); } @Override public void setValidTo (final @Nullable java.sql.Timestamp ValidTo) { set_Value (COLUMNNAME_ValidTo, ValidTo); } @Override public java.sql.Timestamp getValidTo() { return get_ValueAsTimestamp(COLUMNNAME_ValidTo); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java-gen\de\metas\handlingunits\model\X_M_HU_PI_Item_Product.java
1
请完成以下Java代码
public boolean isDiscountSchema() { return !result.isDisallowDiscount() && result.isUsesDiscountSchema(); } // isDiscountSchema /** * Is the Price Calculated (i.e. found)? * * @return calculated */ public boolean isCalculated() { return result.isCalculated(); } // isCalculated /** * Convenience method to get priceStd with the discount already subtracted. Note that the result matches the former behavior of {@link #getPriceStd()}. */ public BigDecimal mkPriceStdMinusDiscount() { calculatePrice(false); return result.getDiscount().subtractFromBase(result.getPriceStd(), result.getPrecision().toInt()); } @Override public String toString() { return "MProductPricing [" + pricingCtx + ", " + result + "]"; }
public void setConvertPriceToContextUOM(boolean convertPriceToContextUOM) { pricingCtx.setConvertPriceToContextUOM(convertPriceToContextUOM); } public void setReferencedObject(Object referencedObject) { pricingCtx.setReferencedObject(referencedObject); } // metas: end public int getC_TaxCategory_ID() { return TaxCategoryId.toRepoId(result.getTaxCategoryId()); } public boolean isManualPrice() { return pricingCtx.getManualPriceEnabled().isTrue(); } public void setManualPrice(boolean manualPrice) { pricingCtx.setManualPriceEnabled(manualPrice); } public void throwProductNotOnPriceListException() { throw new ProductNotOnPriceListException(pricingCtx); } } // MProductPrice
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MProductPricing.java
1
请完成以下Java代码
public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } public Integer getType() { return type; } public void setType(Integer type) { this.type = type; } public Date getCreateTime() { return createTime; }
public void setCreateTime(Date createTime) { this.createTime = createTime; } @Override public String toString() { return this.getClass().getSimpleName() + "[id=" + id + ", name=" + name + ", deploymentId=" + deploymentId + ", generated=" + generated + ", tenantId=" + tenantId + ", type=" + type + ", createTime=" + createTime + "]"; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\ResourceEntity.java
1
请完成以下Java代码
private void loadColumns() { ArrayList<MReportColumn> list = new ArrayList<MReportColumn>(); String sql = "SELECT * FROM PA_ReportColumn WHERE PA_ReportColumnSet_ID=? AND IsActive='Y' ORDER BY SeqNo"; PreparedStatement pstmt = null; try { pstmt = DB.prepareStatement(sql, get_TrxName()); pstmt.setInt(1, getPA_ReportColumnSet_ID()); ResultSet rs = pstmt.executeQuery(); while (rs.next()) list.add(new MReportColumn (getCtx(), rs, null)); rs.close(); pstmt.close(); pstmt = null; } catch (Exception e) { log.error(sql, e); } finally { try { if (pstmt != null) pstmt.close (); } catch (Exception e) {} pstmt = null; } // m_columns = new MReportColumn[list.size()]; list.toArray(m_columns); log.trace("ID=" + getPA_ReportColumnSet_ID() + " - Size=" + list.size()); } // loadColumns /** * Get Columns * @return columns */
public MReportColumn[] getColumns() { return m_columns; } // getColumns /** * List Info */ public void list() { System.out.println(toString()); if (m_columns == null) return; for (int i = 0; i < m_columns.length; i++) System.out.println("- " + m_columns[i].toString()); } // list /*************************************************************************/ /** * String Representation * @return info */ public String toString () { StringBuffer sb = new StringBuffer ("MReportColumnSet[") .append(get_ID()).append(" - ").append(getName()) .append ("]"); return sb.toString (); } } // MReportColumnSet
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\report\MReportColumnSet.java
1
请完成以下Java代码
public void fileToDatabase(String fileName) throws IOException { logger.info("Reading file lines into a List<String> ..."); // fetch 200000+ lines List<String> allLines = Files.readAllLines(Path.of(fileName)); // run on a snapshot of NUMBER_OF_LINES_TO_INSERT lines List<String> lines = allLines.subList(0, NUMBER_OF_LINES_TO_INSERT); logger.info(() -> "Read a total of " + allLines.size() + " lines, inserting " + NUMBER_OF_LINES_TO_INSERT + " lines"); logger.info("Start inserting ...");
StopWatch watch = new StopWatch(); watch.start(); forkjoin(lines); watch.stop(); logger.log(Level.INFO, "Stop inserting. \n Total time: {0} ms ({1} s)", new Object[]{watch.getTotalTimeMillis(), watch.getTotalTimeSeconds()}); } private void forkjoin(List<String> lines) { ForkingComponent forkingComponent = applicationContext.getBean(ForkingComponent.class, lines); forkJoinPool.invoke(forkingComponent); } }
repos\Hibernate-SpringBoot-master\HibernateSpringBootBatchJsonFileForkJoin\src\main\java\com\citylots\forkjoin\ForkJoinService.java
1
请完成以下Java代码
public class MyDtoWithEnumCustom { private String stringValue; private int intValue; private boolean booleanValue; private Distance type; public MyDtoWithEnumCustom() { super(); } public MyDtoWithEnumCustom(final String stringValue, final int intValue, final boolean booleanValue, final Distance type) { super(); this.stringValue = stringValue; this.intValue = intValue; this.booleanValue = booleanValue; this.type = type; } // API public String getStringValue() { return stringValue; } public void setStringValue(final String stringValue) { this.stringValue = stringValue; } public int getIntValue() { return intValue; } public void setIntValue(final int intValue) {
this.intValue = intValue; } public boolean isBooleanValue() { return booleanValue; } public void setBooleanValue(final boolean booleanValue) { this.booleanValue = booleanValue; } public Distance getType() { return type; } public void setType(final Distance type) { this.type = type; } }
repos\tutorials-master\jackson-modules\jackson-conversions\src\main\java\com\baeldung\jackson\enums\withEnum\MyDtoWithEnumCustom.java
1
请完成以下Java代码
public I_M_ForecastLine getForecastLineById(final int forecastLineRecordId) { return InterfaceWrapperHelper.load(forecastLineRecordId, I_M_ForecastLine.class); } @Override @NonNull public ForecastId createForecast(@NonNull final ForecastRequest request) { final I_M_Forecast forecastRecord = InterfaceWrapperHelper.newInstance(I_M_Forecast.class); forecastRecord.setM_Warehouse_ID(request.getWarehouseId().getRepoId()); forecastRecord.setDatePromised(TimeUtil.asTimestamp(request.getDatePromised())); forecastRecord.setName(StringUtils.trimBlankToNull(request.getName())); forecastRecord.setC_BPartner_ID(BPartnerId.toRepoId(request.getBpartnerId())); forecastRecord.setM_PriceList_ID(PriceListId.getRepoId(request.getPriceListId())); forecastRecord.setExternalId(StringUtils.trimBlankToNull(request.getExternalId())); saveRecord(forecastRecord); request.getForecastLineRequests() .forEach(lineRequest -> addForecastLine(forecastRecord, lineRequest)); return ForecastId.ofRepoId(forecastRecord.getM_Forecast_ID()); } @Override public void addForecastLine( @NonNull final ForecastId forecastId, @NonNull final ForecastLineRequest request) { final I_M_Forecast forecastRecord = getById(forecastId); addForecastLine(forecastRecord, request); }
private static void addForecastLine(final I_M_Forecast forecastRecord, final @NotNull ForecastLineRequest request) { final I_M_ForecastLine forecastLineRecord = InterfaceWrapperHelper.newInstance(I_M_ForecastLine.class); forecastLineRecord.setM_Forecast_ID(forecastRecord.getM_Forecast_ID()); forecastLineRecord.setM_Warehouse_ID(forecastRecord.getM_Warehouse_ID()); forecastLineRecord.setQty(request.getQuantity().toBigDecimal()); forecastLineRecord.setC_UOM_ID(request.getQuantity().getUomId().getRepoId()); forecastLineRecord.setM_Product_ID(request.getProductId().getRepoId()); forecastLineRecord.setC_Activity_ID(ActivityId.toRepoId(request.getActivityId())); forecastLineRecord.setC_Campaign_ID(CampaignId.toRepoId(request.getCampaignId())); forecastLineRecord.setC_Project_ID(ProjectId.toRepoId(request.getProjectId())); forecastLineRecord.setQtyCalculated(Quantity.toBigDecimal(request.getQuantityCalculated())); saveRecord(forecastLineRecord); } @Override public I_M_Forecast getById(@NonNull final ForecastId forecastId) { final I_M_Forecast forecast = InterfaceWrapperHelper.load(forecastId, I_M_Forecast.class); if (forecast == null) { throw new AdempiereException("@NotFound@: " + forecastId); } return forecast; } @Override public void save(@NonNull final I_M_Forecast forecastRecord) { saveRecord(forecastRecord); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\mforecast\impl\ForecastDAO.java
1
请在Spring Boot框架中完成以下Java代码
protected Map<String, Object> decode(String token) { try { //check if our public key and thus SignatureVerifier have expired long ttl = oAuth2Properties.getSignatureVerification().getTtl(); if (ttl > 0 && System.currentTimeMillis() - lastKeyFetchTimestamp > ttl) { throw new InvalidTokenException("public key expired"); } return super.decode(token); } catch (InvalidTokenException ex) { if (tryCreateSignatureVerifier()) { return super.decode(token); } throw ex; } } /** * Fetch a new public key from the AuthorizationServer. * * @return true, if we could fetch it; false, if we could not. */ private boolean tryCreateSignatureVerifier() { long t = System.currentTimeMillis(); if (t - lastKeyFetchTimestamp < oAuth2Properties.getSignatureVerification().getPublicKeyRefreshRateLimit()) { return false; } try { SignatureVerifier verifier = signatureVerifierClient.getSignatureVerifier(); if (verifier != null) { setVerifier(verifier); lastKeyFetchTimestamp = t; log.debug("Public key retrieved from OAuth2 server to create SignatureVerifier"); return true; } } catch (Throwable ex) { log.error("could not get public key from OAuth2 server to create SignatureVerifier", ex); } return false; } /** * Extract JWT claims and set it to OAuth2Authentication decoded details. * Here is how to get details: * * <pre> * <code>
* SecurityContext securityContext = SecurityContextHolder.getContext(); * Authentication authentication = securityContext.getAuthentication(); * if (authentication != null) { * Object details = authentication.getDetails(); * if(details instanceof OAuth2AuthenticationDetails) { * Object decodedDetails = ((OAuth2AuthenticationDetails) details).getDecodedDetails(); * if(decodedDetails != null &amp;&amp; decodedDetails instanceof Map) { * String detailFoo = ((Map) decodedDetails).get("foo"); * } * } * } * </code> * </pre> * @param claims OAuth2JWTToken claims * @return OAuth2Authentication */ @Override public OAuth2Authentication extractAuthentication(Map<String, ?> claims) { OAuth2Authentication authentication = super.extractAuthentication(claims); authentication.setDetails(claims); return authentication; } }
repos\tutorials-master\jhipster-modules\jhipster-uaa\gateway\src\main\java\com\baeldung\jhipster\gateway\config\oauth2\OAuth2JwtAccessTokenConverter.java
2
请完成以下Java代码
public static void bruteForce(int[] arr, int k) { checkInvalidInput(arr, k); k %= arr.length; int temp; int previous; for (int i = 0; i < k; i++) { previous = arr[arr.length - 1]; for (int j = 0; j < arr.length; j++) { temp = arr[j]; arr[j] = previous; previous = temp; } } } /** * * @param arr array to apply rotation to * @param k number of rotations */ public static void withExtraArray(int[] arr, int k) { checkInvalidInput(arr, k); int[] extraArray = new int[arr.length]; for (int i = 0; i < arr.length; i++) { extraArray[(i + k) % arr.length] = arr[i]; } System.arraycopy(extraArray, 0, arr, 0, arr.length); } /** * * @param arr array to apply rotation to * @param k number of rotations */ public static void cyclicReplacement(int[] arr, int k) { checkInvalidInput(arr, k); k = k % arr.length; int count = 0; for (int start = 0; count < arr.length; start++) { int current = start; int prev = arr[start]; do { int next = (current + k) % arr.length; int temp = arr[next];
arr[next] = prev; prev = temp; current = next; count++; } while (start != current); } } /** * * @param arr array to apply rotation to * @param k number of rotations */ public static void reverse(int[] arr, int k) { checkInvalidInput(arr, k); k %= arr.length; reverse(arr, 0, arr.length - 1); reverse(arr, 0, k - 1); reverse(arr, k, arr.length - 1); } private static void reverse(int[] nums, int start, int end) { while (start < end) { int temp = nums[start]; nums[start] = nums[end]; nums[end] = temp; start++; end--; } } private static void checkInvalidInput(int[] arr, int rotation) { if (rotation < 1 || arr == null) throw new IllegalArgumentException("Rotation must be greater than zero or array must be not null"); } }
repos\tutorials-master\algorithms-modules\algorithms-miscellaneous-7\src\main\java\com\baeldung\algorithms\rotatearray\RotateArray.java
1
请完成以下Java代码
public static LocatorGlobalQRCodeResolverKey ofString(@NonNull String value) { final LocatorGlobalQRCodeResolverKey key = ofNullableString(value); if (key == null) { throw new AdempiereException("Invalid key: " + value); } return key; } @NonNull public static LocatorGlobalQRCodeResolverKey ofClass(@NonNull Class<?> clazz) { return ofString(clazz.getSimpleName()); } @JsonCreator @Nullable public static LocatorGlobalQRCodeResolverKey ofNullableString(@Nullable String value)
{ final String valueNorm = StringUtils.trimBlankToNull(value); if (valueNorm == null) { return null; } return interner.computeIfAbsent(valueNorm, LocatorGlobalQRCodeResolverKey::new); } @Override @Deprecated public String toString() {return toJson();} @JsonValue public String toJson() {return value;} }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\warehouse\qrcode\resolver\LocatorGlobalQRCodeResolverKey.java
1
请完成以下Java代码
public void error(Marker marker, String format, Object arg1, Object arg2) { logger.error(marker, mdcValue(format), arg1, arg2); } @Override public void error(Marker marker, String format, Object... arguments) { logger.error(marker, mdcValue(format), arguments); } @Override public void error(Marker marker, String msg, Throwable t) { logger.error(marker, mdcValue(msg), t); } /** * 输出MDC容器中的值 * * @param msg * @return */ private String mdcValue(String msg) { try { StringBuilder sb = new StringBuilder(); sb.append(" ["); try { sb.append(MDC.get(MdcConstant.SESSION_KEY) + ", ");
} catch (IllegalArgumentException e) { sb.append(" , "); } try { sb.append(MDC.get(MdcConstant.REQUEST_KEY)); } catch (IllegalArgumentException e) { sb.append(" "); } sb.append("] "); sb.append(msg); return sb.toString(); } catch (Exception e) { return msg; } } }
repos\spring-boot-student-master\spring-boot-student-log\src\main\java\com\xiaolyuh\core\TrackLogger.java
1
请完成以下Java代码
public void setProcessed (final boolean Processed) { set_ValueNoCheck (COLUMNNAME_Processed, Processed); } @Override public boolean isProcessed() { return get_ValueAsBoolean(COLUMNNAME_Processed); } @Override public void setProcessing (final boolean Processing) { set_Value (COLUMNNAME_Processing, Processing); } @Override public boolean isProcessing() { return get_ValueAsBoolean(COLUMNNAME_Processing); } @Override public void setQty (final 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 setQtyInUOM (final @Nullable BigDecimal QtyInUOM) { set_Value (COLUMNNAME_QtyInUOM, QtyInUOM);
} @Override public BigDecimal getQtyInUOM() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyInUOM); return bd != null ? bd : BigDecimal.ZERO; } /** * Type AD_Reference_ID=541716 * Reference name: M_MatchInv_Type */ public static final int TYPE_AD_Reference_ID=541716; /** Material = M */ public static final String TYPE_Material = "M"; /** Cost = C */ public static final String TYPE_Cost = "C"; @Override public void setType (final java.lang.String Type) { set_ValueNoCheck (COLUMNNAME_Type, Type); } @Override public java.lang.String getType() { return get_ValueAsString(COLUMNNAME_Type); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_MatchInv.java
1
请在Spring Boot框架中完成以下Java代码
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class DeviceInformationLine {\n"); sb.append(" articleDescription: ").append(toIndentedString(articleDescription)).append("\n"); sb.append(" articleNumber: ").append(toIndentedString(articleNumber)).append("\n"); sb.append(" batchNumber: ").append(toIndentedString(batchNumber)).append("\n"); sb.append(" technicalServiceCompletionDate: ").append(toIndentedString(technicalServiceCompletionDate)).append("\n"); sb.append(" dueDate: ").append(toIndentedString(dueDate)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" additionalName: ").append(toIndentedString(additionalName)).append("\n"); sb.append(" inspectionType: ").append(toIndentedString(inspectionType)).append("\n"); sb.append(" inspectionCompleted: ").append(toIndentedString(inspectionCompleted)).append("\n"); sb.append(" serialNumber: ").append(toIndentedString(serialNumber)).append("\n"); sb.append(" serviceOriginType: ").append(toIndentedString(serviceOriginType)).append("\n"); sb.append(" serviceDescription: ").append(toIndentedString(serviceDescription)).append("\n"); sb.append(" serviceLocation: ").append(toIndentedString(serviceLocation)).append("\n"); sb.append(" serviceCompleted: ").append(toIndentedString(serviceCompleted)).append("\n"); sb.append(" deviceAppraisalLines: ").append(toIndentedString(deviceAppraisalLines)).append("\n"); sb.append(" active: ").append(toIndentedString(active)).append("\n"); sb.append(" archived: ").append(toIndentedString(archived)).append("\n"); sb.append("}");
return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\alberta\alberta-article-api\src\main\java\io\swagger\client\model\DeviceInformationLine.java
2
请完成以下Java代码
public void setStorageAttributesKey (final @Nullable java.lang.String StorageAttributesKey) { set_Value (COLUMNNAME_StorageAttributesKey, StorageAttributesKey); } @Override public java.lang.String getStorageAttributesKey() { return get_ValueAsString(COLUMNNAME_StorageAttributesKey); } @Override public void setTransfertTime (final @Nullable BigDecimal TransfertTime) { set_Value (COLUMNNAME_TransfertTime, TransfertTime); } @Override public BigDecimal getTransfertTime() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_TransfertTime); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setWorkingTime (final @Nullable BigDecimal WorkingTime) { set_Value (COLUMNNAME_WorkingTime, WorkingTime); } @Override public BigDecimal getWorkingTime() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_WorkingTime); return bd != null ? bd : BigDecimal.ZERO; }
@Override public void setYield (final int Yield) { set_Value (COLUMNNAME_Yield, Yield); } @Override public int getYield() { return get_ValueAsInt(COLUMNNAME_Yield); } @Override public void setC_Manufacturing_Aggregation_ID (final int C_Manufacturing_Aggregation_ID) { if (C_Manufacturing_Aggregation_ID < 1) set_Value (COLUMNNAME_C_Manufacturing_Aggregation_ID, null); else set_Value (COLUMNNAME_C_Manufacturing_Aggregation_ID, C_Manufacturing_Aggregation_ID); } @Override public int getC_Manufacturing_Aggregation_ID() { return get_ValueAsInt(COLUMNNAME_C_Manufacturing_Aggregation_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_PP_Product_Planning.java
1
请在Spring Boot框架中完成以下Java代码
private Method getIdMethod(Class<?> clazz) { Method idMethod = null; // Get all public declared methods on the class. According to spec, @Id should only be // applied to fields and property get methods Method[] methods = clazz.getMethods(); Id idAnnotation = null; for (Method method : methods) { idAnnotation = method.getAnnotation(Id.class); if (idAnnotation != null && !method.isBridge()) { idMethod = method; break; } } return idMethod; } private Field getIdField(Class<?> clazz) { Field idField = null; Field[] fields = clazz.getDeclaredFields(); Id idAnnotation = null; for (Field field : fields) { idAnnotation = field.getAnnotation(Id.class); if (idAnnotation != null) { idField = field;
break; } } if (idField == null) { // Check superClass for fields with @Id, since getDeclaredFields // does not return superclass-fields. Class<?> superClass = clazz.getSuperclass(); if (superClass != null && !superClass.equals(Object.class)) { // Recursively go up class hierarchy idField = getIdField(superClass); } } return idField; } private boolean isEntityAnnotationPresent(Class<?> clazz) { return (clazz.getAnnotation(Entity.class) != null); } }
repos\flowable-engine-main\modules\flowable-variable-service\src\main\java\org\flowable\variable\service\impl\types\JPAEntityScanner.java
2
请在Spring Boot框架中完成以下Java代码
KafkaStreamsConfiguration defaultKafkaStreamsConfig(Environment environment, KafkaConnectionDetails connectionDetails) { Map<String, Object> properties = this.properties.buildStreamsProperties(); applyKafkaConnectionDetailsForStreams(properties, connectionDetails); if (this.properties.getStreams().getApplicationId() == null) { String applicationName = environment.getProperty("spring.application.name"); if (applicationName == null) { throw new InvalidConfigurationPropertyValueException("spring.kafka.streams.application-id", null, "This property is mandatory and fallback 'spring.application.name' is not set either."); } properties.put(StreamsConfig.APPLICATION_ID_CONFIG, applicationName); } return new KafkaStreamsConfiguration(properties); } @Bean StreamsBuilderFactoryBeanConfigurer kafkaPropertiesStreamsBuilderFactoryBeanConfigurer() { return new KafkaPropertiesStreamsBuilderFactoryBeanConfigurer(this.properties); } private void applyKafkaConnectionDetailsForStreams(Map<String, Object> properties, KafkaConnectionDetails connectionDetails) { KafkaConnectionDetails.Configuration streams = connectionDetails.getStreams(); properties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, streams.getBootstrapServers()); KafkaAutoConfiguration.applySecurityProtocol(properties, streams.getSecurityProtocol()); KafkaAutoConfiguration.applySslBundle(properties, streams.getSslBundle());
} static class KafkaPropertiesStreamsBuilderFactoryBeanConfigurer implements StreamsBuilderFactoryBeanConfigurer { private final KafkaProperties properties; KafkaPropertiesStreamsBuilderFactoryBeanConfigurer(KafkaProperties properties) { this.properties = properties; } @Override public void configure(StreamsBuilderFactoryBean factoryBean) { factoryBean.setAutoStartup(this.properties.getStreams().isAutoStartup()); KafkaProperties.Cleanup cleanup = this.properties.getStreams().getCleanup(); CleanupConfig cleanupConfig = new CleanupConfig(cleanup.isOnStartup(), cleanup.isOnShutdown()); factoryBean.setCleanupConfig(cleanupConfig); } @Override public int getOrder() { return Ordered.HIGHEST_PRECEDENCE; } } }
repos\spring-boot-4.0.1\module\spring-boot-kafka\src\main\java\org\springframework\boot\kafka\autoconfigure\KafkaStreamsAnnotationDrivenConfiguration.java
2
请完成以下Java代码
public void setC_Tax(final I_C_Tax tax) { final int taxId = tax != null ? tax.getC_Tax_ID() : -1; if (isAccountSignDR()) { glJournalLine.setDR_Tax_ID(taxId); } else { glJournalLine.setCR_Tax_ID(taxId); } } @Override public I_C_ValidCombination getTax_Acct() { return isAccountSignDR() ? glJournalLine.getDR_Tax_Acct() : glJournalLine.getCR_Tax_Acct(); } @Override public void setTax_Acct(final I_C_ValidCombination taxAcct) { if (isAccountSignDR()) { glJournalLine.setDR_Tax_Acct(taxAcct); } else { glJournalLine.setCR_Tax_Acct(taxAcct); } } @Override public BigDecimal getTaxAmt() { return isAccountSignDR() ? glJournalLine.getDR_TaxAmt() : glJournalLine.getCR_TaxAmt(); } @Override public void setTaxAmt(final BigDecimal taxAmt) { if (isAccountSignDR()) { glJournalLine.setDR_TaxAmt(taxAmt); } else { glJournalLine.setCR_TaxAmt(taxAmt); } } @Override public BigDecimal getTaxBaseAmt() { return isAccountSignDR() ? glJournalLine.getDR_TaxBaseAmt() : glJournalLine.getCR_TaxBaseAmt(); } @Override public void setTaxBaseAmt(final BigDecimal taxBaseAmt) { if (isAccountSignDR()) { glJournalLine.setDR_TaxBaseAmt(taxBaseAmt); } else { glJournalLine.setCR_TaxBaseAmt(taxBaseAmt);
} } @Override public BigDecimal getTaxTotalAmt() { return isAccountSignDR() ? glJournalLine.getDR_TaxTotalAmt() : glJournalLine.getCR_TaxTotalAmt(); } @Override public void setTaxTotalAmt(final BigDecimal totalAmt) { if (isAccountSignDR()) { glJournalLine.setDR_TaxTotalAmt(totalAmt); } else { glJournalLine.setCR_TaxTotalAmt(totalAmt); } // // Update AmtSourceDr/Cr // NOTE: we are updating both sides because they shall be the SAME glJournalLine.setAmtSourceDr(totalAmt); glJournalLine.setAmtSourceCr(totalAmt); } @Override public I_C_ValidCombination getTaxBase_Acct() { return isAccountSignDR() ? glJournalLine.getAccount_DR() : glJournalLine.getAccount_CR(); } @Override public I_C_ValidCombination getTaxTotal_Acct() { return isAccountSignDR() ? glJournalLine.getAccount_CR() : glJournalLine.getAccount_DR(); } @Override public CurrencyPrecision getPrecision() { final CurrencyId currencyId = CurrencyId.ofRepoIdOrNull(glJournalLine.getC_Currency_ID()); return currencyId != null ? Services.get(ICurrencyDAO.class).getStdPrecision(currencyId) : CurrencyPrecision.TWO; } @Override public AcctSchemaId getAcctSchemaId() { return AcctSchemaId.ofRepoId(glJournalLine.getGL_Journal().getC_AcctSchema_ID()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\gljournal\impl\GLJournalLineTaxAccountable.java
1
请完成以下Java代码
public void completed(ActivityExecution execution) throws Exception { // only control flow. no sub process instance data available leave(execution); } public void setProcessDefinitonKey(String processDefinitonKey) { this.processDefinitonKey = processDefinitonKey; } public String getProcessDefinitonKey() { return processDefinitonKey; } public void setInheritVariables(boolean inheritVariables) { this.inheritVariables = inheritVariables; } public void setSameDeployment(boolean sameDeployment) { this.sameDeployment = sameDeployment; }
public String getBusinessKey() { return businessKey; } public void setBusinessKey(String businessKey) { this.businessKey = businessKey; } public boolean isInheritBusinessKey() { return inheritBusinessKey; } public void setInheritBusinessKey(boolean inheritBusinessKey) { this.inheritBusinessKey = inheritBusinessKey; } }
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\bpmn\behavior\CallActivityBehavior.java
1
请在Spring Boot框架中完成以下Java代码
public String getLevel() { return this.level; } public void setLevel(String level) { this.level = level; } } public static class SecurityManagerProperties { private String className; public String getClassName() { return this.className; }
public void setClassName(String className) { this.className = className; } } public static class SecurityPostProcessorProperties { private String className; public String getClassName() { return this.className; } public void setClassName(String className) { this.className = className; } } }
repos\spring-boot-data-geode-main\spring-geode-project\spring-geode-autoconfigure\src\main\java\org\springframework\geode\boot\autoconfigure\configuration\support\SecurityProperties.java
2
请完成以下Java代码
public void onRollback(final ITrx trx) { removeTimeoutTimer(trx); final String stacktraceOnTimerStart = mkStacktrace(); trxName2Stacktrace.put(trx.getTrxName(), stacktraceOnTimerStart); startTimeoutTimer(trx, stacktraceOnTimerStart); } @Override public void onSetSavepoint(final ITrx trx, final ITrxSavepoint savepoint) { final ITrxConstraints constraints = getConstraints(); if (Services.get(ITrxConstraintsBL.class).isDisabled(constraints)) { return; // nothing to do } if (constraints.isActive()) { if (constraints.getMaxSavepoints() < getSavepointsForTrxName(trx.getTrxName()).size()) { throw new TrxConstraintException("Transaction '" + trx + "' has too many unreleased savepoints: " + getSavepointsForTrxName(trx.getTrxName())); } } } @Override public void onReleaseSavepoint(final ITrx trx, final ITrxSavepoint savepoint) { getSavepointsForTrxName(trx.getTrxName()).remove(savepoint); } private static ITrxConstraints getConstraints() { return Services.get(ITrxConstraintsBL.class).getConstraints(); } private Collection<String> getTrxNamesForCurrentThread() { return getTrxNamesForThreadId(Thread.currentThread().getId()); } private Collection<String> getTrxNamesForThreadId(final long threadId) { synchronized (threadId2TrxName) { Collection<String> trxNames = threadId2TrxName.get(threadId); if (trxNames == null) { trxNames = new HashSet<String>(); threadId2TrxName.put(threadId, trxNames); } return trxNames; } }
private Collection<ITrxSavepoint> getSavepointsForTrxName(final String trxName) { synchronized (trxName2SavePoint) { Collection<ITrxSavepoint> savepoints = trxName2SavePoint.get(trxName); if (savepoints == null) { savepoints = new HashSet<ITrxSavepoint>(); trxName2SavePoint.put(trxName, savepoints); } return savepoints; } } private String mkStacktraceInfo(final Thread thread, final String beginStacktrace) { final StringBuilder msgSB = new StringBuilder(); msgSB.append(">>> Stacktrace at trx creation, commit or rollback:\n"); msgSB.append(beginStacktrace); msgSB.append(">>> Current stacktrace of the creating thread:\n"); if (thread.isAlive()) { msgSB.append(mkStacktrace(thread)); } else { msgSB.append("\t(Thread already finished)\n"); } final String msg = msgSB.toString(); return msg; } @Override public String getCreationStackTrace(final String trxName) { return trxName2Stacktrace.get(trxName); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\util\trxConstraints\api\impl\OpenTrxBL.java
1
请在Spring Boot框架中完成以下Java代码
public class JpaDashboardDao extends JpaAbstractDao<DashboardEntity, Dashboard> implements DashboardDao { @Autowired DashboardRepository dashboardRepository; @Override protected Class<DashboardEntity> getEntityClass() { return DashboardEntity.class; } @Override protected JpaRepository<DashboardEntity, UUID> getRepository() { return dashboardRepository; } @Override public Long countByTenantId(TenantId tenantId) { return dashboardRepository.countByTenantId(tenantId.getId()); } @Override public Dashboard findByTenantIdAndExternalId(UUID tenantId, UUID externalId) { return DaoUtil.getData(dashboardRepository.findByTenantIdAndExternalId(tenantId, externalId)); } @Override public PageData<Dashboard> findByTenantId(UUID tenantId, PageLink pageLink) { return DaoUtil.toPageData(dashboardRepository.findByTenantId(tenantId, DaoUtil.toPageable(pageLink))); } @Override public DashboardId getExternalIdByInternal(DashboardId internalId) { return Optional.ofNullable(dashboardRepository.getExternalIdById(internalId.getId())) .map(DashboardId::new).orElse(null); } @Override public List<Dashboard> findByTenantIdAndTitle(UUID tenantId, String title) {
return DaoUtil.convertDataList(dashboardRepository.findByTenantIdAndTitle(tenantId, title)); } @Override public PageData<DashboardId> findIdsByTenantId(TenantId tenantId, PageLink pageLink) { return DaoUtil.pageToPageData(dashboardRepository.findIdsByTenantId(tenantId.getId(), DaoUtil.toPageable(pageLink)).map(DashboardId::new)); } @Override public PageData<DashboardId> findAllIds(PageLink pageLink) { return DaoUtil.pageToPageData(dashboardRepository.findAllIds(DaoUtil.toPageable(pageLink)).map(DashboardId::new)); } @Override public PageData<Dashboard> findAllByTenantId(TenantId tenantId, PageLink pageLink) { return findByTenantId(tenantId.getId(), pageLink); } @Override public List<DashboardFields> findNextBatch(UUID id, int batchSize) { return dashboardRepository.findNextBatch(id, Limit.of(batchSize)); } @Override public EntityType getEntityType() { return EntityType.DASHBOARD; } }
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\sql\dashboard\JpaDashboardDao.java
2
请完成以下Java代码
public final class AdempiereServerGroup extends ThreadGroup { /** * Get Adempiere Server Group * @return Server Group */ public static synchronized AdempiereServerGroup get() { if (s_group == null || s_group.isDestroyed()) { s_group = new AdempiereServerGroup(); } return s_group; } // get /** Group */ private static AdempiereServerGroup s_group = null; /** * AdempiereServerGroup */ private AdempiereServerGroup () { super ("AdempiereServers"); setDaemon(true); setMaxPriority(Thread.MAX_PRIORITY); log.info(getName() + " - Parent=" + getParent()); } // AdempiereServerGroup /** Logger */ private final Logger log = LogManager.getLogger(getClass()); /** * Uncaught Exception * @param t thread * @param e exception */ @Override public void uncaughtException (Thread t, Throwable e) { log.info("uncaughtException = " + e.toString()); super.uncaughtException (t, e);
} // uncaughtException /** * String Representation * @return name */ @Override public String toString () { return getName(); } // toString /** * Dump Info */ public void dump() { if (!log.isDebugEnabled()) { return; } log.debug(getName() + (isDestroyed() ? " (destroyed)" : "")); log.debug("- Parent=" + getParent()); Thread[] list = new Thread[activeCount()]; log.debug("- Count=" + enumerate(list, true)); for (int i = 0; i < list.length; i++) { log.debug("-- " + list[i]); } } // dump } // AdempiereServerGroup
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\serverRoot\de.metas.adempiere.adempiere.serverRoot.base\src\main\java-legacy\org\compiere\server\AdempiereServerGroup.java
1
请完成以下Java代码
public BigDecimal getApprovalAmt() { return BigDecimal.ZERO; } @Override public int getC_Currency_ID() { return 0; } @Override public String getProcessMsg() { return null; } @Override public String getSummary() { return getDocumentNo() + "/" + getDatePromised(); } @Override public LocalDate getDocumentDate() { return TimeUtil.asLocalDate(getDateOrdered()); } @Override public File createPDF() { final DocumentReportService documentReportService = SpringContextHolder.instance.getBean(DocumentReportService.class); final ReportResultData report = documentReportService.createStandardDocumentReportData(getCtx(), StandardDocumentReportType.MANUFACTURING_ORDER, getPP_Order_ID()); return report.writeToTemporaryFile(get_TableName() + get_ID()); } @Override public String getDocumentInfo() { final IDocTypeBL docTypeBL = Services.get(IDocTypeBL.class); final DocTypeId docTypeId = DocTypeId.ofRepoId(getC_DocType_ID()); final ITranslatableString docTypeName = docTypeBL.getNameById(docTypeId); return docTypeName.translate(Env.getADLanguageOrBaseLanguage()) + " " + getDocumentNo(); } private PPOrderRouting getOrderRouting() { final PPOrderId orderId = PPOrderId.ofRepoId(getPP_Order_ID()); return Services.get(IPPOrderRoutingRepository.class).getByOrderId(orderId); } @Override public String toString()
{ return "MPPOrder[ID=" + get_ID() + "-DocumentNo=" + getDocumentNo() + ",IsSOTrx=" + isSOTrx() + ",C_DocType_ID=" + getC_DocType_ID() + "]"; } /** * Auto report the first Activity and Sub contracting if are Milestone Activity */ private void autoReportActivities() { final IPPCostCollectorBL ppCostCollectorBL = Services.get(IPPCostCollectorBL.class); final PPOrderRouting orderRouting = getOrderRouting(); for (final PPOrderRoutingActivity activity : orderRouting.getActivities()) { if (activity.isMilestone() && (activity.isSubcontracting() || orderRouting.isFirstActivity(activity))) { ppCostCollectorBL.createActivityControl(ActivityControlCreateRequest.builder() .order(this) .orderActivity(activity) .qtyMoved(activity.getQtyToDeliver()) .durationSetup(Duration.ZERO) .duration(Duration.ZERO) .build()); } } } private void createVariances() { final IPPCostCollectorBL ppCostCollectorBL = Services.get(IPPCostCollectorBL.class); // for (final I_PP_Order_BOMLine bomLine : getLines()) { ppCostCollectorBL.createMaterialUsageVariance(this, bomLine); } // final PPOrderRouting orderRouting = getOrderRouting(); for (final PPOrderRoutingActivity activity : orderRouting.getActivities()) { ppCostCollectorBL.createResourceUsageVariance(this, activity); } } } // MPPOrder
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\model\MPPOrder.java
1
请完成以下Java代码
public class InjectedPlanItemInstanceBuilderImpl implements InjectedPlanItemInstanceBuilder { protected final CommandExecutor commandExecutor; protected String stagePlanItemInstanceId; protected String caseInstanceId; protected String caseDefinitionId; protected String elementId; protected String name; public InjectedPlanItemInstanceBuilderImpl(CommandExecutor commandExecutor) { this.commandExecutor = commandExecutor; } @Override public InjectedPlanItemInstanceBuilder name(String name) { this.name = name; return this; } @Override public InjectedPlanItemInstanceBuilder caseDefinitionId(String caseDefinitionId) { this.caseDefinitionId = caseDefinitionId; return this; } @Override public InjectedPlanItemInstanceBuilder elementId(String elementId) { this.elementId = elementId; return this; } @Override public PlanItemInstance createInStage(String stagePlanItemInstanceId) { validateData(); this.stagePlanItemInstanceId = stagePlanItemInstanceId; return commandExecutor.execute(new CreateInjectedPlanItemInstanceCmd(this)); }
@Override public PlanItemInstance createInCase(String caseInstanceId) { validateData(); this.caseInstanceId = caseInstanceId; return commandExecutor.execute(new CreateInjectedPlanItemInstanceCmd(this)); } protected void validateData() { if (caseDefinitionId == null) { throw new FlowableIllegalArgumentException("The case definition id must be provided for the plan item instance"); } if (elementId == null) { throw new FlowableIllegalArgumentException("The element id must be provided for the plan item instance"); } } public boolean injectInStage() { return stagePlanItemInstanceId != null; } public boolean injectInCase() { return caseInstanceId != null; } public String getStagePlanItemInstanceId() { return stagePlanItemInstanceId; } public String getCaseInstanceId() { return caseInstanceId; } public String getName() { return name; } public String getCaseDefinitionId() { return caseDefinitionId; } public String getElementId() { return elementId; } }
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\runtime\InjectedPlanItemInstanceBuilderImpl.java
1
请完成以下Java代码
private List<PPOrderLine> toPPOrderLinesList(@NonNull final I_PP_Order ppOrderRecord) { final List<PPOrderLine> lines = new ArrayList<>(); for (final I_PP_Order_BOMLine ppOrderLineRecord : ppOrderBOMsRepo.retrieveOrderBOMLines(ppOrderRecord)) { final PPOrderLine ppOrderLinePojo = toPPOrderLine(ppOrderLineRecord, ppOrderRecord); lines.add(ppOrderLinePojo); } return lines; } private PPOrderLine toPPOrderLine( @NonNull final I_PP_Order_BOMLine ppOrderLineRecord, @NonNull final I_PP_Order ppOrderRecord) { final BOMComponentType componentType = BOMComponentType.ofCode(ppOrderLineRecord.getComponentType()); final boolean receipt = componentType.isReceipt(); final Instant issueOrReceiveDate = asInstant(receipt ? ppOrderRecord.getDatePromised() : ppOrderRecord.getDateStartSchedule()); final ProductId lineProductId = ProductId.ofRepoId(ppOrderLineRecord.getM_Product_ID()); final OrderBOMLineQuantities bomLineQuantities = ppOrderBOMBL.getQuantities(ppOrderLineRecord); final Quantity qtyRequiredInStockingUOM = uomConversionBL.convertToProductUOM(bomLineQuantities.getQtyRequired(), lineProductId); final Quantity qtyDeliveredInStockingUOM = uomConversionBL.convertToProductUOM(bomLineQuantities.getQtyIssuedOrReceived(), lineProductId); final WarehouseId warehouseId = WarehouseId.ofRepoId(ppOrderRecord.getM_Warehouse_ID()); final ReplenishInfo replenishInfo = replenishInfoRepository.getBy(ReplenishInfo.Identifier.of( warehouseId, // both from-warehouse and product are mandatory DB-columns LocatorId.ofRepoIdOrNull(warehouseId, ppOrderLineRecord.getM_Locator_ID()), ProductId.ofRepoId(ppOrderLineRecord.getM_Product_ID())));
return PPOrderLine.builder() .ppOrderLineData(PPOrderLineData.builder() .productDescriptor(productDescriptorFactory.createProductDescriptor(ppOrderLineRecord)) .description(ppOrderLineRecord.getDescription()) .productBomLineId(ppOrderLineRecord.getPP_Product_BOMLine_ID()) .qtyRequired(qtyRequiredInStockingUOM.toBigDecimal()) .qtyDelivered(qtyDeliveredInStockingUOM.toBigDecimal()) .issueOrReceiveDate(issueOrReceiveDate) .receipt(receipt) .minMaxDescriptor(replenishInfo.toMinMaxDescriptor()) .build()) .ppOrderLineId(ppOrderLineRecord.getPP_Order_BOMLine_ID()) .build(); } @VisibleForTesting public static MaterialDispoGroupId getMaterialDispoGroupIdOrNull(@NonNull final I_PP_Order ppOrderRecord) { return ATTR_PPORDER_REQUESTED_EVENT_GROUP_ID.getValue(ppOrderRecord); } public static void setMaterialDispoGroupId( @NonNull final I_PP_Order ppOrderRecord, @Nullable final MaterialDispoGroupId materialDispoGroupId) { ATTR_PPORDER_REQUESTED_EVENT_GROUP_ID.setValue(ppOrderRecord, materialDispoGroupId); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.material\planning\src\main\java\de\metas\material\planning\pporder\PPOrderPojoConverter.java
1
请完成以下Java代码
public class DunningContext extends AbstractDunningContext { private final IDunningConfig dunningConfig; private final Properties ctx; private final Date dunningDate; private final I_C_DunningLevel dunningLevel; private final String trxName; private final ITrxRunConfig trxRunnerConfig; public DunningContext(final Properties ctx, final IDunningConfig config, final I_C_DunningLevel dunningLevel, final Date dunningDate, final ITrxRunConfig trxRunnerConfig, final String trxName) { super(); Check.assume(ctx != null, "ctx is not null"); Check.assume(config != null, "config is not null"); this.dunningConfig = config; this.ctx = ctx; this.dunningLevel = dunningLevel; this.dunningDate = dunningDate == null ? null : TimeUtil.trunc(dunningDate, TimeUtil.TRUNC_DAY); this.trxName = trxName; this.trxRunnerConfig = trxRunnerConfig; } public DunningContext(final IDunningContext context, final String trxName) { super(context); this.dunningConfig = context.getDunningConfig(); this.ctx = context.getCtx(); this.dunningLevel = context.getC_DunningLevel(); this.dunningDate = context.getDunningDate(); this.trxName = trxName; this.trxRunnerConfig = context.getTrxRunnerConfig(); } @Override public String toString() { return "DunningContext [" + "dunningLevel=" + dunningLevel + ", dunningDate=" + dunningDate + ", trxName=" + trxName + ", config=" + dunningConfig + ", ctx=" + ctx + "]"; } @Override public Properties getCtx() { return ctx; } @Override public String getTrxName() {
return trxName; } @Override public ITrxRunConfig getTrxRunnerConfig() { return trxRunnerConfig; } @Override public I_C_DunningLevel getC_DunningLevel() { return dunningLevel; } @Override public IDunningConfig getDunningConfig() { return dunningConfig; } @Override public Date getDunningDate() { if (dunningDate == null) { return dunningDate; } return (Date)dunningDate.clone(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.dunning\src\main\java\de\metas\dunning\api\impl\DunningContext.java
1
请在Spring Boot框架中完成以下Java代码
private void init() { FirebaseOptions options; try { options = FirebaseOptions.builder() .setCredentials(GoogleCredentials.fromStream(IOUtils.toInputStream(credentials, StandardCharsets.UTF_8))) .build(); } catch (IOException e) { throw new RuntimeException("Failed to process service account credentials: " + e.getMessage(), e); } try { app = FirebaseApp.initializeApp(options, key); } catch (IllegalStateException alreadyExists) { // should never normally happen app = FirebaseApp.getInstance(key); } try { messaging = FirebaseMessaging.getInstance(app); } catch (IllegalStateException alreadyExists) { // should never normally happen messaging = FirebaseMessaging.getInstance(app); } log.debug("[{}] Initialized new FirebaseContext", key); } public void check(String credentials) { if (!this.credentials.equals(credentials)) { destroy(); this.credentials = credentials; init(); } else if (app == null || messaging == null) {
throw new IllegalStateException("Firebase app couldn't be initialized"); } } public void destroy() { if (app != null) { app.delete(); app = null; } messaging = null; log.debug("[{}] Destroyed FirebaseContext", key); } } }
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\notification\provider\DefaultFirebaseService.java
2
请完成以下Java代码
public void setIs_AD_User_InCharge_UI_Setting (final boolean Is_AD_User_InCharge_UI_Setting) { set_Value (COLUMNNAME_Is_AD_User_InCharge_UI_Setting, Is_AD_User_InCharge_UI_Setting); } @Override public boolean is_AD_User_InCharge_UI_Setting() { return get_ValueAsBoolean(COLUMNNAME_Is_AD_User_InCharge_UI_Setting); } @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 setTableName (final java.lang.String TableName) { set_Value (COLUMNNAME_TableName, TableName); } @Override public java.lang.String getTableName() { return get_ValueAsString(COLUMNNAME_TableName); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\de\metas\invoicecandidate\model\X_C_ILCandHandler.java
1
请完成以下Java代码
public final class NullTrxPlaceholder implements ITrx { public static final transient NullTrxPlaceholder instance = new NullTrxPlaceholder(); public static ITrx boxNotNull(@Nullable final ITrx trx) { return trx != null ? trx : instance; } @Nullable public static ITrx unboxToNull(@Nullable final ITrx trx) { return trx != instance ? trx : null; } private NullTrxPlaceholder() { } @Override public String getTrxName() { throw new UnsupportedOperationException(); } @Override public boolean start() { throw new UnsupportedOperationException(); } @Override public boolean close() { throw new UnsupportedOperationException(); } @Override public boolean isActive() { throw new UnsupportedOperationException(); } @Override public boolean isCommittedOK() { throw new UnsupportedOperationException(); } @Override public boolean isAutoCommit() { throw new UnsupportedOperationException(); } @Override public Date getStartTime() { throw new UnsupportedOperationException(); } @Override public boolean commit(final boolean throwException) throws SQLException { throw new UnsupportedOperationException(); } @Override public boolean rollback() { throw new UnsupportedOperationException(); } @Override public boolean rollback(final boolean throwException) throws SQLException { throw new UnsupportedOperationException(); } @Override public boolean rollback(final ITrxSavepoint savepoint) throws DBException { throw new UnsupportedOperationException(); } @Override public ITrxSavepoint createTrxSavepoint(final String name) throws DBException { throw new UnsupportedOperationException(); } @Override public void releaseSavepoint(final ITrxSavepoint savepoint) { throw new UnsupportedOperationException();
} @Override public ITrxListenerManager getTrxListenerManager() { throw new UnsupportedOperationException(); } @Override public ITrxManager getTrxManager() { throw new UnsupportedOperationException(); } @Override public <T> T setProperty(final String name, final Object value) { throw new UnsupportedOperationException(); } @Override public <T> T getProperty(final String name) { throw new UnsupportedOperationException(); } @Override public <T> T getProperty(final String name, final Supplier<T> valueInitializer) { throw new UnsupportedOperationException(); } @Override public <T> T getProperty(final String name, final Function<ITrx, T> valueInitializer) { throw new UnsupportedOperationException(); } @Override public <T> T setAndGetProperty(final String name, final Function<T, T> valueRemappingFunction) { throw new UnsupportedOperationException(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\trx\api\NullTrxPlaceholder.java
1
请在Spring Boot框架中完成以下Java代码
class M_ShipmentSchedule_QtyPicked { private final HUTraceEventsService huTraceEventsService; private final ITrxManager trxManager = Services.get(ITrxManager.class); public M_ShipmentSchedule_QtyPicked(@NonNull final HUTraceEventsService huTraceEventsService) { this.huTraceEventsService = huTraceEventsService; } @ModelChange(timings = { ModelValidator.TYPE_AFTER_CHANGE, ModelValidator.TYPE_AFTER_NEW }) public void addTraceEventForNewAndChange(@NonNull final I_M_ShipmentSchedule_QtyPicked shipmentScheduleQtyPicked) { deferredProcessor().schedule(shipmentScheduleQtyPicked); } private DeferredProcessor deferredProcessor() { return trxManager.getThreadInheritedTrx(OnTrxMissingPolicy.Fail) // at this point we always run in trx .getPropertyAndProcessAfterCommit( DeferredProcessor.class.getName(), () -> new DeferredProcessor(huTraceEventsService), DeferredProcessor::processNow); } @ModelChange(timings = ModelValidator.TYPE_BEFORE_DELETE) public void addTraceEventForDelete(@NonNull final I_M_ShipmentSchedule_QtyPicked shipmentScheduleQtyPicked) { huTraceEventsService.createAndAddFor(shipmentScheduleQtyPicked); } private static class DeferredProcessor { private final HUTraceEventsService huTraceEventsService; private final AtomicBoolean processed = new AtomicBoolean(false); private final LinkedHashMap<Integer, I_M_ShipmentSchedule_QtyPicked> records = new LinkedHashMap<>();
public DeferredProcessor(@NonNull final HUTraceEventsService huTraceEventsService) { this.huTraceEventsService = huTraceEventsService; } public void schedule(@NonNull final I_M_ShipmentSchedule_QtyPicked record) { if (processed.get()) { throw new AdempiereException("already processed: " + this); } this.records.put(record.getM_ShipmentSchedule_QtyPicked_ID(), record); } public void processNow() { final boolean alreadyProcessed = processed.getAndSet(true); if (alreadyProcessed) { throw new AdempiereException("already processed: " + this); } records.values().forEach(huTraceEventsService::createAndAddFor); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\trace\interceptor\M_ShipmentSchedule_QtyPicked.java
2
请在Spring Boot框架中完成以下Java代码
public @Nullable String getUserInfoAuthenticationMethod() { return this.userInfoAuthenticationMethod; } public void setUserInfoAuthenticationMethod(@Nullable String userInfoAuthenticationMethod) { this.userInfoAuthenticationMethod = userInfoAuthenticationMethod; } public @Nullable String getUserNameAttribute() { return this.userNameAttribute; } public void setUserNameAttribute(@Nullable String userNameAttribute) { this.userNameAttribute = userNameAttribute; } public @Nullable String getJwkSetUri() { return this.jwkSetUri; }
public void setJwkSetUri(@Nullable String jwkSetUri) { this.jwkSetUri = jwkSetUri; } public @Nullable String getIssuerUri() { return this.issuerUri; } public void setIssuerUri(@Nullable String issuerUri) { this.issuerUri = issuerUri; } } }
repos\spring-boot-4.0.1\module\spring-boot-security-oauth2-client\src\main\java\org\springframework\boot\security\oauth2\client\autoconfigure\OAuth2ClientProperties.java
2
请完成以下Java代码
protected boolean doProcess(TbActorMsg msg) { switch (msg.getMsgType()) { case TRANSPORT_TO_DEVICE_ACTOR_MSG: processor.process((TransportToDeviceActorMsgWrapper) msg); break; case DEVICE_ATTRIBUTES_UPDATE_TO_DEVICE_ACTOR_MSG: processor.processAttributesUpdate((DeviceAttributesEventNotificationMsg) msg); break; case DEVICE_DELETE_TO_DEVICE_ACTOR_MSG: ctx.stop(ctx.getSelf()); break; case DEVICE_CREDENTIALS_UPDATE_TO_DEVICE_ACTOR_MSG: processor.processCredentialsUpdate(msg); break; case DEVICE_NAME_OR_TYPE_UPDATE_TO_DEVICE_ACTOR_MSG: processor.processNameOrTypeUpdate((DeviceNameOrTypeUpdateMsg) msg); break; case DEVICE_RPC_REQUEST_TO_DEVICE_ACTOR_MSG: processor.processRpcRequest(ctx, (ToDeviceRpcRequestActorMsg) msg); break; case DEVICE_RPC_RESPONSE_TO_DEVICE_ACTOR_MSG: processor.processRpcResponsesFromEdge((FromDeviceRpcResponseActorMsg) msg); break; case DEVICE_ACTOR_SERVER_SIDE_RPC_TIMEOUT_MSG:
processor.processServerSideRpcTimeout((DeviceActorServerSideRpcTimeoutMsg) msg); break; case SESSION_TIMEOUT_MSG: processor.checkSessionsTimeout(); break; case DEVICE_EDGE_UPDATE_TO_DEVICE_ACTOR_MSG: processor.processEdgeUpdate((DeviceEdgeUpdateMsg) msg); break; case REMOVE_RPC_TO_DEVICE_ACTOR_MSG: processor.processRemoveRpc((RemoveRpcActorMsg) msg); break; default: return false; } return true; } }
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\actors\device\DeviceActor.java
1
请完成以下Java代码
protected String getDefaultMessage() { return DEFAULT_MESSAGE; } @Nullable public URI getWebhookUrl() { return webhookUrl; } public void setWebhookUrl(@Nullable URI webhookUrl) { this.webhookUrl = webhookUrl; } public boolean isTts() { return tts; } public void setTts(boolean tts) { this.tts = tts; } @Nullable public String getUsername() {
return username; } public void setUsername(@Nullable String username) { this.username = username; } @Nullable public String getAvatarUrl() { return avatarUrl; } public void setAvatarUrl(@Nullable String avatarUrl) { this.avatarUrl = avatarUrl; } public void setRestTemplate(RestTemplate restTemplate) { this.restTemplate = restTemplate; } }
repos\spring-boot-admin-master\spring-boot-admin-server\src\main\java\de\codecentric\boot\admin\server\notify\DiscordNotifier.java
1
请完成以下Java代码
public IHUPIItemProductDisplayNameBuilder setQtyTUPlanned(final BigDecimal qtyTUPlanned) { _qtyTUPlanned = qtyTUPlanned; return this; } @Override public IHUPIItemProductDisplayNameBuilder setQtyTUPlanned(final int qtyTUPlanned) { setQtyTUPlanned(BigDecimal.valueOf(qtyTUPlanned)); return this; } @Override public IHUPIItemProductDisplayNameBuilder setQtyTUMoved(final BigDecimal qtyTUMoved) { _qtyTUMoved = qtyTUMoved; return this; } @Override public IHUPIItemProductDisplayNameBuilder setQtyTUMoved(final int qtyTUMoved) { setQtyTUMoved(BigDecimal.valueOf(qtyTUMoved)); return this; } @Override public HUPIItemProductDisplayNameBuilder setQtyCapacity(final BigDecimal qtyCapacity) { _qtyCapacity = qtyCapacity; return this; }
@Override public IHUPIItemProductDisplayNameBuilder setShowAnyProductIndicator(boolean showAnyProductIndicator) { this._showAnyProductIndicator = showAnyProductIndicator; return this; } private boolean isShowAnyProductIndicator() { return _showAnyProductIndicator; } private boolean isAnyProductAllowed() { return getM_HU_PI_Item_Product().isAllowAnyProduct(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\impl\HUPIItemProductDisplayNameBuilder.java
1
请完成以下Java代码
public class DPoPAuthenticationToken extends AbstractAuthenticationToken { @Serial private static final long serialVersionUID = 5481690438914686216L; private final String accessToken; private final String dPoPProof; private final String method; private final String resourceUri; /** * Constructs a {@code DPoPAuthenticationToken} using the provided parameters. * @param accessToken the DPoP-bound access token * @param dPoPProof the DPoP Proof {@link Jwt} * @param method the value of the HTTP method of the request * @param resourceUri the value of the HTTP resource URI of the request, without query * and fragment parts */ public DPoPAuthenticationToken(String accessToken, String dPoPProof, String method, String resourceUri) { super(Collections.emptyList()); Assert.hasText(accessToken, "accessToken cannot be empty"); Assert.hasText(dPoPProof, "dPoPProof cannot be empty"); Assert.hasText(method, "method cannot be empty"); Assert.hasText(resourceUri, "resourceUri cannot be empty"); this.accessToken = accessToken; this.dPoPProof = dPoPProof; this.method = method; this.resourceUri = resourceUri; } @Override public Object getPrincipal() { return getAccessToken(); } @Override public Object getCredentials() { return getAccessToken(); } /** * Returns the DPoP-bound access token. * @return the DPoP-bound access token */ public String getAccessToken() { return this.accessToken; } /**
* Returns the DPoP Proof {@link Jwt}. * @return the DPoP Proof {@link Jwt} */ public String getDPoPProof() { return this.dPoPProof; } /** * Returns the value of the HTTP method of the request. * @return the value of the HTTP method of the request */ public String getMethod() { return this.method; } /** * Returns the value of the HTTP resource URI of the request, without query and * fragment parts. * @return the value of the HTTP resource URI of the request */ public String getResourceUri() { return this.resourceUri; } }
repos\spring-security-main\oauth2\oauth2-resource-server\src\main\java\org\springframework\security\oauth2\server\resource\authentication\DPoPAuthenticationToken.java
1
请完成以下Java代码
public ManualGrpcSecurityMetadataSource remove(final ServiceDescriptor service) { requireNonNull(service, "service"); for (final MethodDescriptor<?, ?> method : service.getMethods()) { this.accessMap.remove(method); } return this; } /** * Set the given access predicate for the given method. This will replace previously set predicates. * * @param method The method to protect with a custom check. * @param predicate The predicate used to check the {@link Authentication}. * @return This instance for chaining. * @see #setDefault(AccessPredicate) */ public ManualGrpcSecurityMetadataSource set(final MethodDescriptor<?, ?> method, final AccessPredicate predicate) { requireNonNull(method, "method"); this.accessMap.put(method, wrap(predicate)); return this; } /** * Removes all access predicates for the given method. After that, the default will be used for that method. * * @param method The method to protect with only the default. * @return This instance for chaining. * @see #setDefault(AccessPredicate) */ public ManualGrpcSecurityMetadataSource remove(final MethodDescriptor<?, ?> method) { requireNonNull(method, "method"); this.accessMap.remove(method); return this; } /** * Sets the default that will be used if no specific configuration has been made. * * @param predicate The default predicate used to check the {@link Authentication}. * @return This instance for chaining. */ public ManualGrpcSecurityMetadataSource setDefault(final AccessPredicate predicate) {
this.defaultAttributes = wrap(predicate); return this; } /** * Wraps the given predicate in a configuration attribute and an immutable collection. * * @param predicate The predicate to wrap. * @return The newly created list with the given predicate. */ private Collection<ConfigAttribute> wrap(final AccessPredicate predicate) { requireNonNull(predicate, "predicate"); if (predicate == AccessPredicates.PERMIT_ALL) { return of(); // Empty collection => public invocation } return of(new AccessPredicateConfigAttribute(predicate)); } }
repos\grpc-spring-master\grpc-server-spring-boot-starter\src\main\java\net\devh\boot\grpc\server\security\check\ManualGrpcSecurityMetadataSource.java
1
请完成以下Java代码
public String toString() { return ( "TaskImpl{" + "id='" + id + '\'' + ", owner='" + owner + '\'' + ", assignee='" + assignee + '\'' + ", name='" + name + '\'' + ", description='" + description + '\'' + ", createdDate=" + createdDate + ", claimedDate=" + claimedDate + ", dueDate=" + dueDate + ", priority=" + priority + ", processDefinitionId='" + processDefinitionId + '\'' + ", processInstanceId='" + processInstanceId +
'\'' + ", taskProcessRootProcessInstanceId='" + taskProcessRootProcessInstanceId + '\'' + ", parentTaskId='" + parentTaskId + '\'' + ", formKey='" + formKey + '\'' + ", status=" + status + ", processDefinitionVersion=" + processDefinitionVersion + ", businessKey=" + businessKey + ", taskDefinitionKey=" + taskDefinitionKey + ", completedBy=" + completedBy + '}' ); } }
repos\Activiti-develop\activiti-core\activiti-api-impl\activiti-api-task-model-impl\src\main\java\org\activiti\api\task\model\impl\TaskImpl.java
1
请完成以下Java代码
public boolean isDirty() { return m_modified; } @Override public void rollbackChanges() { m_text.setText (m_oldText); m_initialText = m_oldText; m_initialTextObj = m_oldTextObj; m_modified = false; } // metas: begin private Object m_oldTextObj; private Object m_initialTextObj; @Override public boolean isAutoCommit() { return true; } public void setDecimalFormat(final DecimalFormat format) { this.m_format = format; m_text.setDocument(new MDocNumber(m_displayType, m_format, m_text, m_title)); } public DecimalFormat getDecimalFormat() { return m_format; } // metas: end // metas @Override public void addMouseListener(MouseListener l) { m_text.addMouseListener(l); } /** * This implementation always returns true. */ // task 05005 @Override public boolean isRealChange(final PropertyChangeEvent e) { return true; }
@Override public final ICopyPasteSupportEditor getCopyPasteSupport() { return m_text == null ? NullCopyPasteSupportEditor.instance : m_text.getCopyPasteSupport(); } @Override protected final boolean processKeyBinding(final KeyStroke ks, final KeyEvent e, final int condition, final boolean pressed) { // Forward all key events on this component to the text field. // We have to do this for the case when we are embedding this editor in a JTable and the JTable is forwarding the key strokes to editing component. // Effect of NOT doing this: when in JTable, user presses a key (e.g. a digit) to start editing but the first key he pressed gets lost here. if (m_text != null && condition == WHEN_FOCUSED) { // Usually the text component does not have focus yet but it was requested, so, considering that: // * we are requesting the focus just to make sure // * we select all text (once) => as an effect, on first key pressed the editor content (which is selected) will be deleted and replaced with the new typing // * make sure that in the focus event which will come, the text is not selected again, else, if user is typing fast, the editor content will be only what he typed last. if(!m_text.hasFocus()) { skipNextSelectAllOnFocusGained = true; m_text.requestFocus(); if (m_text.getDocument().getLength() > 0) { m_text.selectAll(); } } if (m_text.processKeyBinding(ks, e, condition, pressed)) { return true; } } // // Fallback to super return super.processKeyBinding(ks, e, condition, pressed); } } // VNumber
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\grid\ed\VNumber.java
1
请完成以下Java代码
public float getLayoutAlignmentY(Container target) { return 0f; } // getLayoutAlignmentY /** * Invalidates the layout, indicating that if the layout manager * has cached information it should be discarded. * @param target target */ public void invalidateLayout(Container target) { } // invalidateLayout /*************************************************************************/ /** * Check target components and add components, which don't have no constraints * @param target target */ private void checkComponents (Container target) { int size = target.getComponentCount(); for (int i = 0; i < size; i++) { Component comp = target.getComponent(i); if (!m_data.containsValue(comp)) m_data.put(null, comp); } } // checkComponents /** * Get Number of Rows * @return no pf rows */ public int getRowCount() { return m_data.getMaxRow()+1; } // getRowCount /** * Get Number of Columns * @return no of cols */ public int getColCount() { return m_data.getMaxCol()+1; } // getColCount /** * Set Horizontal Space (top, between rows, button) * @param spaceH horizontal space (top, between rows, button) */
public void setSpaceH (int spaceH) { m_spaceH = spaceH; } // setSpaceH /** * Get Horizontal Space (top, between rows, button) * @return spaceH horizontal space (top, between rows, button) */ public int getSpaceH() { return m_spaceH; } // getSpaceH /** * Set Vertical Space (left, between columns, right) * @param spaceV vertical space (left, between columns, right) */ public void setSpaceV(int spaceV) { m_spaceV = spaceV; } // setSpaceV /** * Get Vertical Space (left, between columns, right) * @return spaceV vertical space (left, between columns, right) */ public int getSpaceV() { return m_spaceV; } // getSpaceV } // ALayout
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\apps\ALayout.java
1
请完成以下Java代码
public class CompensationEventHandler implements EventHandler { @Override public String getEventHandlerType() { return EventType.COMPENSATE.name(); } @Override public void handleEvent(EventSubscriptionEntity eventSubscription, Object payload, Object localPayload, Object payloadToTriggeredScope, String businessKey, CommandContext commandContext) { eventSubscription.delete(); String configuration = eventSubscription.getConfiguration(); ensureNotNull("Compensating execution not set for compensate event subscription with id " + eventSubscription.getId(), "configuration", configuration); ExecutionEntity compensatingExecution = commandContext.getExecutionManager().findExecutionById(configuration); ActivityImpl compensationHandler = eventSubscription.getActivity(); // activate execution compensatingExecution.setActive(true); if (compensatingExecution.getActivity().getActivityBehavior() instanceof CompositeActivityBehavior) { compensatingExecution.getParent().setActivityInstanceId(compensatingExecution.getActivityInstanceId()); } if (compensationHandler.isScope() && !compensationHandler.isCompensationHandler()) { // descend into scope: List<EventSubscriptionEntity> eventsForThisScope = compensatingExecution.getCompensateEventSubscriptions(); CompensationUtil.throwCompensationEvent(eventsForThisScope, compensatingExecution, false); } else { try { if (compensationHandler.isSubProcessScope() && compensationHandler.isTriggeredByEvent()) {
compensatingExecution.executeActivity(compensationHandler); } else { // since we already have a scope execution, we don't need to create another one // for a simple scoped compensation handler compensatingExecution.setActivity(compensationHandler); compensatingExecution.performOperation(PvmAtomicOperation.ACTIVITY_START); } } catch (Exception e) { throw new ProcessEngineException("Error while handling compensation event " + eventSubscription, e); } } } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\event\CompensationEventHandler.java
1
请完成以下Java代码
public String[] getWhereClauses(final List<Object> params) { final I_AD_InfoColumn infoColumn = getAD_InfoColumn(); if (infoColumn.isTree()) { return null; } final Object value = getParameterValue(0, false); // // Set Context Value { final String column = infoColumn.getName(); final IInfoSimple parent = getParent(); if (value == null) { final int displayType = infoColumn.getAD_Reference_ID(); if (DisplayType.Date == displayType) { parent.setCtxAttribute(column, de.metas.common.util.time.SystemTime.asDayTimestamp()); } else if (DisplayType.Time == displayType) { parent.setCtxAttribute(column, de.metas.common.util.time.SystemTime.asTimestamp()); } else if (DisplayType.DateTime == displayType) { parent.setCtxAttribute(column, SystemTime.asDate()); } } else { parent.setCtxAttribute(column, value); } }
// // create the actual where clause // task: 08329: as of now, the date is a real column of the underlying view/table { final StringBuilder where = new StringBuilder(); where.append(infoColumn.getSelectClause()); where.append("=?"); params.add(value); return new String[] { where.toString() }; } } @Override public String getText() { if (editor == null) { return null; } final Object value = editor.getValue(); if (value == null) { return null; } return value.toString(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\de\metas\adempiere\gui\search\InfoQueryCriteriaDateModifier.java
1
请完成以下Java代码
public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getDate() { return date; } public void setDate(String date) {
this.date = date; } public Date getSubmissionDate() { return submissionDate; } public void setSubmissionDate(Date submissionDate) { this.submissionDate = submissionDate; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } }
repos\tutorials-master\spring-web-modules\spring-boot-rest\src\main\java\com\baeldung\springpagination\model\Post.java
1
请完成以下Java代码
public void removeItem(final FavoriteItem item) { if (item == null) { return; } // Database sync final MTreeNode node = item.getNode(); favoritesDAO.remove(getLoggedUserId(), node.getNode_ID()); // UI final FavoritesGroup group = item.getGroup(); group.removeItem(item); if (group.isEmpty()) { removeGroup(group); } updateUI(); } private void clearGroups() { for (final FavoritesGroup group : topNodeId2group.values()) { group.removeAllItems(); } topNodeId2group.clear(); panel.removeAll(); } public boolean isEmpty() { return topNodeId2group.isEmpty(); } private final void updateUI() { final JComponent comp = getComponent(); panel.invalidate(); panel.repaint(); final boolean visible = !isEmpty(); final boolean visibleOld = comp.isVisible(); if (visible == visibleOld) { return; } comp.setVisible(visible);
// // If this group just became visible if (visible) { updateParentSplitPaneDividerLocation(); } } private final void updateParentSplitPaneDividerLocation() { final JComponent comp = getComponent(); if (!comp.isVisible()) { return; // nothing to update } // Find parent split pane if any JSplitPane parentSplitPane = null; for (Component c = comp.getParent(); c != null; c = c.getParent()) { if (c instanceof JSplitPane) { parentSplitPane = (JSplitPane)c; break; } } // Update it's divider location. // NOTE: if we would not do this, user would have to manually drag it when the first component is added. if (parentSplitPane != null) { if (parentSplitPane.getDividerLocation() <= 0) { parentSplitPane.setDividerLocation(Ini.getDividerLocation()); } } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\grid\tree\FavoritesGroupContainer.java
1
请完成以下Java代码
public OrderLineBuilder qty(@NonNull final Quantity qty) { assertNotBuilt(); this.qty = qty; return this; } public OrderLineBuilder addQty(@NonNull final Quantity qtyToAdd) { assertNotBuilt(); return qty(Quantity.addNullables(this.qty, qtyToAdd)); } public OrderLineBuilder qty(@NonNull final BigDecimal qty) { if (productId == null) { throw new AdempiereException("Setting BigDecimal Qty not allowed if the product was not already set"); } final I_C_UOM uom = productBL.getStockUOM(productId); return qty(Quantity.of(qty, uom)); } @Nullable private UomId getUomId() { return qty != null ? qty.getUomId() : null; } public OrderLineBuilder priceUomId(@Nullable final UomId priceUomId) { assertNotBuilt(); this.priceUomId = priceUomId; return this; } public OrderLineBuilder externalId(@Nullable final ExternalId externalId) { assertNotBuilt(); this.externalId = externalId; return this; } public OrderLineBuilder manualPrice(@Nullable final BigDecimal manualPrice) { assertNotBuilt(); this.manualPrice = manualPrice; return this; } public OrderLineBuilder manualPrice(@Nullable final Money manualPrice) { return manualPrice(manualPrice != null ? manualPrice.toBigDecimal() : null); } public OrderLineBuilder manualDiscount(final BigDecimal manualDiscount) { assertNotBuilt(); this.manualDiscount = manualDiscount; return this; } public OrderLineBuilder setDimension(final Dimension dimension)
{ assertNotBuilt(); this.dimension = dimension; return this; } public boolean isProductAndUomMatching(@Nullable final ProductId productId, @Nullable final UomId uomId) { return ProductId.equals(getProductId(), productId) && UomId.equals(getUomId(), uomId); } public OrderLineBuilder description(@Nullable final String description) { this.description = description; return this; } public OrderLineBuilder hideWhenPrinting(final boolean hideWhenPrinting) { this.hideWhenPrinting = hideWhenPrinting; return this; } public OrderLineBuilder details(@NonNull final Collection<OrderLineDetailCreateRequest> details) { assertNotBuilt(); detailCreateRequests.addAll(details); return this; } public OrderLineBuilder detail(@NonNull final OrderLineDetailCreateRequest detail) { assertNotBuilt(); detailCreateRequests.add(detail); return this; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\order\OrderLineBuilder.java
1
请在Spring Boot框架中完成以下Java代码
public final class DelegatingSecurityContextRepository implements SecurityContextRepository { private final List<SecurityContextRepository> delegates; public DelegatingSecurityContextRepository(SecurityContextRepository... delegates) { this(Arrays.asList(delegates)); } public DelegatingSecurityContextRepository(List<SecurityContextRepository> delegates) { Assert.notEmpty(delegates, "delegates cannot be empty"); this.delegates = delegates; } /** * @deprecated * @see SecurityContextRepository#loadContext */ @Override @Deprecated public SecurityContext loadContext(HttpRequestResponseHolder requestResponseHolder) { SecurityContext result = SecurityContextHolder.createEmptyContext(); for (SecurityContextRepository delegate : this.delegates) { SecurityContext delegateResult = delegate.loadContext(requestResponseHolder); if (result == null || delegate.containsContext(requestResponseHolder.getRequest())) { result = delegateResult; } } return result; } @Override public DeferredSecurityContext loadDeferredContext(HttpServletRequest request) { DeferredSecurityContext deferredSecurityContext = null; for (SecurityContextRepository delegate : this.delegates) { if (deferredSecurityContext == null) { deferredSecurityContext = delegate.loadDeferredContext(request); } else { DeferredSecurityContext next = delegate.loadDeferredContext(request); deferredSecurityContext = new DelegatingDeferredSecurityContext(deferredSecurityContext, next); } } if (deferredSecurityContext == null) { throw new IllegalStateException("No deferredSecurityContext found"); } return deferredSecurityContext; } @Override public void saveContext(SecurityContext context, HttpServletRequest request, HttpServletResponse response) { for (SecurityContextRepository delegate : this.delegates) { delegate.saveContext(context, request, response); } } @Override public boolean containsContext(HttpServletRequest request) { for (SecurityContextRepository delegate : this.delegates) {
if (delegate.containsContext(request)) { return true; } } return false; } static final class DelegatingDeferredSecurityContext implements DeferredSecurityContext { private final DeferredSecurityContext previous; private final DeferredSecurityContext next; DelegatingDeferredSecurityContext(DeferredSecurityContext previous, DeferredSecurityContext next) { this.previous = previous; this.next = next; } @Override public SecurityContext get() { SecurityContext securityContext = this.previous.get(); if (!this.previous.isGenerated()) { return securityContext; } return this.next.get(); } @Override public boolean isGenerated() { return this.previous.isGenerated() && this.next.isGenerated(); } } }
repos\spring-security-main\web\src\main\java\org\springframework\security\web\context\DelegatingSecurityContextRepository.java
2
请在Spring Boot框架中完成以下Java代码
public class TodoController { @Autowired private ITodoService todoService; @InitBinder public void initBinder(WebDataBinder binder) { // Date - dd/MM/yyyy SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false)); } //@RequestMapping(value = "/list-todos", method = RequestMethod.GET) @GetMapping(value = "/list-todos") public String showTodos(ModelMap model) { String name = getLoggedInUserName(model); model.put("todos", todoService.getTodosByUser(name)); // model.put("todos", service.retrieveTodos(name)); return "list-todos"; } private String getLoggedInUserName(ModelMap model) { Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); if (principal instanceof UserDetails) { return ((UserDetails) principal).getUsername(); } return principal.toString(); } @RequestMapping(value = "/add-todo", method = RequestMethod.GET) public String showAddTodoPage(ModelMap model) { model.addAttribute("todo", new Todo()); return "todo"; } @RequestMapping(value = "/delete-todo", method = RequestMethod.GET) public String deleteTodo(@RequestParam long id) { todoService.deleteTodo(id); // service.deleteTodo(id); return "redirect:/list-todos"; } @RequestMapping(value = "/update-todo", method = RequestMethod.GET) public String showUpdateTodoPage(@RequestParam long id, ModelMap model) { Todo todo = todoService.getTodoById(id).get(); model.put("todo", todo); return "todo"; }
@RequestMapping(value = "/update-todo", method = RequestMethod.POST) public String updateTodo(ModelMap model, @Valid Todo todo, BindingResult result) { if (result.hasErrors()) { return "todo"; } todo.setUserName(getLoggedInUserName(model)); todoService.updateTodo(todo); return "redirect:/list-todos"; } @RequestMapping(value = "/add-todo", method = RequestMethod.POST) public String addTodo(ModelMap model, @Valid Todo todo, BindingResult result) { if (result.hasErrors()) { return "todo"; } todo.setUserName(getLoggedInUserName(model)); todoService.saveTodo(todo); return "redirect:/list-todos"; } }
repos\SpringBoot-Projects-FullStack-master\Part-8 Spring Boot Real Projects\0.ProjectToDoinDB\src\main\java\spring\hibernate\controller\TodoController.java
2
请完成以下Java代码
public class WEBUI_PP_Order_IssueReceipt_Launcher extends JavaProcess implements IProcessPrecondition { @Override public ProcessPreconditionsResolution checkPreconditionsApplicable(final IProcessPreconditionsContext context) { if (Objects.equals(PPOrderConstants.AD_WINDOW_ID_IssueReceipt.toAdWindowIdOrNull(), context.getAdWindowId())) { // we did already launch the IssueReceipt window return ProcessPreconditionsResolution.rejectWithInternalReason("Already within the window " + PPOrderConstants.AD_WINDOW_ID_IssueReceipt); } if (!context.isSingleSelection()) { return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection(); } final I_PP_Order ppOrder = context.getSelectedModel(I_PP_Order.class);
if (!X_PP_Order.DOCSTATUS_Completed.equals(ppOrder.getDocStatus())) { return ProcessPreconditionsResolution.reject("not completed"); } return ProcessPreconditionsResolution.accept(); } @Override protected String doIt() throws Exception { final TableRecordReference ppOrderRef = TableRecordReference.of(I_PP_Order.Table_Name, getRecord_ID()); getResult().setRecordToOpen(ppOrderRef, PPOrderConstants.AD_WINDOW_ID_IssueReceipt.toInt(), OpenTarget.GridView, ProcessExecutionResult.RecordsToOpen.TargetTab.SAME_TAB_OVERLAY); return MSG_OK; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\pporder\process\WEBUI_PP_Order_IssueReceipt_Launcher.java
1
请完成以下Java代码
public boolean isNew() { return huAttribute.getM_HU_Attribute_ID() <= 0; } @Override protected void setInternalValueDate(Date value) { huAttribute.setValueDate(TimeUtil.asTimestamp(value)); this.valueDate = value; } @Override protected Date getInternalValueDate() {
return valueDate; } @Override protected void setInternalValueDateInitial(Date value) { huAttribute.setValueDateInitial(TimeUtil.asTimestamp(value)); } @Override protected Date getInternalValueDateInitial() { return huAttribute.getValueDateInitial(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\attribute\storage\impl\HUAttributeValue.java
1
请完成以下Java代码
public ProcessPreconditionsResolution checkPreconditionsApplicable(final @NonNull IProcessPreconditionsContext context) { if (context.isNoSelection()) { return ProcessPreconditionsResolution.rejectBecauseNoSelection(); } else if (context.isMoreThanOneSelected()) { return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection(); } else { final String externalSystemType = externalSystemConfigRepo.getParentTypeById(ExternalSystemParentConfigId.ofRepoId(context.getSingleSelectedRecordId())); final ExternalSystemType type = ExternalSystemType.ofValue(externalSystemType); final ExternalSystemConfigQuery query = ExternalSystemConfigQuery.builder() .parentConfigId(ExternalSystemParentConfigId.ofRepoId(context.getSingleSelectedRecordId())) .build(); final Optional<ExternalSystemParentConfig> config = externalSystemConfigRepo.getByQuery(type, query); if (!config.isPresent()) { return ProcessPreconditionsResolution.reject(msgBL.getTranslatableMsgText(MSG_ERR_NO_EXTERNAL_SELECTION, type.getValue())); } } return ProcessPreconditionsResolution.accept(); } @Override
protected String doIt() throws Exception { final SchedulerEventBusService schedulerEventBusService = SpringContextHolder.instance.getBean(SchedulerEventBusService.class); final String externalSystemType = externalSystemConfigRepo.getParentTypeById(ExternalSystemParentConfigId.ofRepoId(getRecord_ID())); final ExternalSystemType type = ExternalSystemType.ofValue(externalSystemType); final AdProcessId targetProcessId = adProcessDAO.retrieveProcessIdByClassIfUnique(ExternalSystemProcesses.getExternalSystemProcessClassName(type)); Check.assumeNotNull(targetProcessId, "There should always be an AD_Process record for classname:" + ExternalSystemProcesses.getExternalSystemProcessClassName(type)); schedulerEventBusService.postRequest(ManageSchedulerRequest.builder() .schedulerSearchKey(SchedulerSearchKey.of(targetProcessId)) .clientId(Env.getClientId()) .schedulerAction(SchedulerAction.DISABLE) .supervisorAction(ManageSchedulerRequest.SupervisorAction.DISABLE) .build()); return MSG_OK; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java\de\metas\externalsystem\process\DisableSchedulerForExternalSystem.java
1
请在Spring Boot框架中完成以下Java代码
private void bindDataSourceToRegistry(String beanName, DataSource dataSource, Collection<DataSourcePoolMetadataProvider> metadataProviders, MeterRegistry registry) { String dataSourceName = getDataSourceName(beanName); new DataSourcePoolMetrics(dataSource, metadataProviders, dataSourceName, Collections.emptyList()) .bindTo(registry); } /** * Get the name of a DataSource based on its {@code beanName}. * @param beanName the name of the data source bean * @return a name for the given data source */ private String getDataSourceName(String beanName) { if (beanName.length() > DATASOURCE_SUFFIX.length() && StringUtils.endsWithIgnoreCase(beanName, DATASOURCE_SUFFIX)) { return beanName.substring(0, beanName.length() - DATASOURCE_SUFFIX.length()); } return beanName; } } } @Configuration(proxyBeanMethods = false) @ConditionalOnClass(HikariDataSource.class) static class HikariDataSourceMetricsConfiguration { @Bean HikariDataSourceMeterBinder hikariDataSourceMeterBinder(ObjectProvider<DataSource> dataSources) { return new HikariDataSourceMeterBinder(dataSources); } static class HikariDataSourceMeterBinder implements MeterBinder { private static final Log logger = LogFactory.getLog(HikariDataSourceMeterBinder.class); private final ObjectProvider<DataSource> dataSources; HikariDataSourceMeterBinder(ObjectProvider<DataSource> dataSources) { this.dataSources = dataSources; } @Override public void bindTo(MeterRegistry registry) { this.dataSources.stream(ObjectProvider.UNFILTERED, false).forEach((dataSource) -> { HikariDataSource hikariDataSource = DataSourceUnwrapper.unwrap(dataSource, HikariConfigMXBean.class, HikariDataSource.class); if (hikariDataSource != null) {
bindMetricsRegistryToHikariDataSource(hikariDataSource, registry); } }); } private void bindMetricsRegistryToHikariDataSource(HikariDataSource hikari, MeterRegistry registry) { if (hikari.getMetricRegistry() == null && hikari.getMetricsTrackerFactory() == null) { try { hikari.setMetricsTrackerFactory(new MicrometerMetricsTrackerFactory(registry)); } catch (Exception ex) { logger.warn(LogMessage.format("Failed to bind Hikari metrics: %s", ex.getMessage())); } } } } } }
repos\spring-boot-4.0.1\module\spring-boot-jdbc\src\main\java\org\springframework\boot\jdbc\autoconfigure\metrics\DataSourcePoolMetricsAutoConfiguration.java
2
请完成以下Java代码
public class BatchTbRuleEngineSubmitStrategy extends AbstractTbRuleEngineSubmitStrategy { private final int batchSize; private final AtomicInteger packIdx = new AtomicInteger(0); private final Map<UUID, TbProtoQueueMsg<TransportProtos.ToRuleEngineMsg>> pendingPack = new LinkedHashMap<>(); private volatile BiConsumer<UUID, TbProtoQueueMsg<TransportProtos.ToRuleEngineMsg>> msgConsumer; public BatchTbRuleEngineSubmitStrategy(String queueName, int batchSize) { super(queueName); this.batchSize = batchSize; } @Override public void submitAttempt(BiConsumer<UUID, TbProtoQueueMsg<TransportProtos.ToRuleEngineMsg>> msgConsumer) { this.msgConsumer = msgConsumer; submitNext(); } @Override public void update(ConcurrentMap<UUID, TbProtoQueueMsg<TransportProtos.ToRuleEngineMsg>> reprocessMap) { super.update(reprocessMap); packIdx.set(0); } @Override protected void doOnSuccess(UUID id) { boolean endOfPendingPack; synchronized (pendingPack) { TbProtoQueueMsg<TransportProtos.ToRuleEngineMsg> msg = pendingPack.remove(id); endOfPendingPack = msg != null && pendingPack.isEmpty(); } if (endOfPendingPack) { packIdx.incrementAndGet(); submitNext(); } } private void submitNext() {
int listSize = orderedMsgList.size(); int startIdx = Math.min(packIdx.get() * batchSize, listSize); int endIdx = Math.min(startIdx + batchSize, listSize); Map<UUID, TbProtoQueueMsg<TransportProtos.ToRuleEngineMsg>> tmpPack; synchronized (pendingPack) { pendingPack.clear(); for (int i = startIdx; i < endIdx; i++) { IdMsgPair<TransportProtos.ToRuleEngineMsg> pair = orderedMsgList.get(i); pendingPack.put(pair.uuid, pair.msg); } tmpPack = new LinkedHashMap<>(pendingPack); } int submitSize = pendingPack.size(); if (log.isDebugEnabled() && submitSize > 0) { log.debug("[{}] submitting [{}] messages to rule engine", queueName, submitSize); } tmpPack.forEach(msgConsumer); } }
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\queue\processing\BatchTbRuleEngineSubmitStrategy.java
1
请完成以下Java代码
public class Response { private boolean status; private String details; public Response() { this.status = true; //default to true } public Response(boolean status) { this.status = status; } public Response(boolean status, String details) { this.status = status; this.details = details; } public boolean isStatus() { return status; } public void setStatus(boolean status) { this.status = status; } public String getDetails() {
return details; } public void setDetails(String details) { this.details = details; } @Override public String toString() { return "Response{" + "status=" + status + ", details='" + details + '\'' + '}'; } }
repos\springboot-demo-master\stripe\src\main\java\com\et\stripe\common\Response.java
1
请完成以下Java代码
public class AD_Process_Copy extends JavaProcess { private final transient IADProcessDAO processesRepo = Services.get(IADProcessDAO.class); private AdProcessId p_sourceProcessId; private AdProcessId p_targetProcessId; @Override protected void prepare() { for (final ProcessInfoParameter parameter : getParameters()) { final String para = parameter.getParameterName(); if ("AD_Process_ID".equals(para)) { p_sourceProcessId = parameter.getParameterAsRepoId(AdProcessId::ofRepoId); } else if ("AD_Process_To_ID".equals(para)) { p_targetProcessId = parameter.getParameterAsRepoId(AdProcessId::ofRepoId); }
} if (p_targetProcessId == null && I_AD_Process.Table_Name.equals(getTableName())) { p_targetProcessId = AdProcessId.ofRepoId(getRecord_ID()); } } @Override protected String doIt() { if (p_sourceProcessId == null || p_targetProcessId == null) { throw new AdempiereException("@CopyProcessRequired@"); } processesRepo.copyProcess(p_targetProcessId, p_sourceProcessId); return MSG_OK; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\process\processtools\AD_Process_Copy.java
1
请完成以下Java代码
public String getName () { return (String)get_Value(COLUMNNAME_Name); } /** Get Record ID/ColumnName @return ID/ColumnName pair */ public KeyNamePair getKeyNamePair() { return new KeyNamePair(get_ID(), getName()); } /** Set Process Now. @param Processing Process Now */ public void setProcessing (boolean Processing) { set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing)); } /** Get Process Now. @return Process Now */ public boolean isProcessing () { Object oo = get_Value(COLUMNNAME_Processing); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; }
/** Set Training. @param S_Training_ID Repeated Training */ public void setS_Training_ID (int S_Training_ID) { if (S_Training_ID < 1) set_ValueNoCheck (COLUMNNAME_S_Training_ID, null); else set_ValueNoCheck (COLUMNNAME_S_Training_ID, Integer.valueOf(S_Training_ID)); } /** Get Training. @return Repeated Training */ public int getS_Training_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_S_Training_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_S_Training.java
1
请完成以下Java代码
public AmountRangeBoundary1 getFrAmt() { return frAmt; } /** * Sets the value of the frAmt property. * * @param value * allowed object is * {@link AmountRangeBoundary1 } * */ public void setFrAmt(AmountRangeBoundary1 value) { this.frAmt = value; } /** * Gets the value of the toAmt property. * * @return * possible object is * {@link AmountRangeBoundary1 } * */ public AmountRangeBoundary1 getToAmt() {
return toAmt; } /** * Sets the value of the toAmt property. * * @param value * allowed object is * {@link AmountRangeBoundary1 } * */ public void setToAmt(AmountRangeBoundary1 value) { this.toAmt = value; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_02\FromToAmountRange.java
1
请完成以下Java代码
public void setIsSyncHUsOnMaterialReceipt (final boolean IsSyncHUsOnMaterialReceipt) { set_Value (COLUMNNAME_IsSyncHUsOnMaterialReceipt, IsSyncHUsOnMaterialReceipt); } @Override public boolean isSyncHUsOnMaterialReceipt() { return get_ValueAsBoolean(COLUMNNAME_IsSyncHUsOnMaterialReceipt); } @Override public void setIsSyncHUsOnProductionReceipt (final boolean IsSyncHUsOnProductionReceipt) { set_Value (COLUMNNAME_IsSyncHUsOnProductionReceipt, IsSyncHUsOnProductionReceipt); } @Override public boolean isSyncHUsOnProductionReceipt() { return get_ValueAsBoolean(COLUMNNAME_IsSyncHUsOnProductionReceipt); }
/** * TenantId AD_Reference_ID=276 * Reference name: AD_Org (all) */ public static final int TENANTID_AD_Reference_ID=276; @Override public void setTenantId (final java.lang.String TenantId) { set_Value (COLUMNNAME_TenantId, TenantId); } @Override public java.lang.String getTenantId() { return get_ValueAsString(COLUMNNAME_TenantId); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java-gen\de\metas\externalsystem\model\X_ExternalSystem_Config_GRSSignum.java
1
请完成以下Java代码
public void setInvoiceRecipient (java.lang.String InvoiceRecipient) { set_Value (COLUMNNAME_InvoiceRecipient, InvoiceRecipient); } /** Get Rechnungsempfänger. @return Rechnungsempfänger */ @Override public java.lang.String getInvoiceRecipient () { return (java.lang.String)get_Value(COLUMNNAME_InvoiceRecipient); } /** Set Erledigt. @param IsDone Erledigt */ @Override public void setIsDone (boolean IsDone) { set_Value (COLUMNNAME_IsDone, Boolean.valueOf(IsDone)); } /** Get Erledigt. @return Erledigt */ @Override public boolean isDone () { Object oo = get_Value(COLUMNNAME_IsDone); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Telefon. @param Phone Beschreibt eine Telefon Nummer */ @Override public void setPhone (java.lang.String Phone) { set_Value (COLUMNNAME_Phone, Phone); } /** Get Telefon. @return Beschreibt eine Telefon Nummer */ @Override public java.lang.String getPhone ()
{ return (java.lang.String)get_Value(COLUMNNAME_Phone); } /** Set Grund. @param Reason Grund */ @Override public void setReason (java.lang.String Reason) { set_Value (COLUMNNAME_Reason, Reason); } /** Get Grund. @return Grund */ @Override public java.lang.String getReason () { return (java.lang.String)get_Value(COLUMNNAME_Reason); } /** Set Sachbearbeiter. @param ResponsiblePerson Sachbearbeiter */ @Override public void setResponsiblePerson (java.lang.String ResponsiblePerson) { set_Value (COLUMNNAME_ResponsiblePerson, ResponsiblePerson); } /** Get Sachbearbeiter. @return Sachbearbeiter */ @Override public java.lang.String getResponsiblePerson () { return (java.lang.String)get_Value(COLUMNNAME_ResponsiblePerson); } /** Set Status. @param Status Status */ @Override public void setStatus (java.lang.String Status) { set_Value (COLUMNNAME_Status, Status); } /** Get Status. @return Status */ @Override public java.lang.String getStatus () { return (java.lang.String)get_Value(COLUMNNAME_Status); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Invoice_Rejection_Detail.java
1
请完成以下Java代码
public ImmutableSet<String> getFieldNames() { ImmutableSet<String> fieldNames = this.fieldNames; if (fieldNames == null) { fieldNames = this.fieldNames = ImmutableSet.<String> builder() .addAll(ViewColumnHelper.extractFieldNames(rowType)) .addAll(getViewEditorRenderModeByFieldName().keySet()) .addAll(getWidgetTypesByFieldName().keySet()) .build(); } return fieldNames; } public ViewRowFieldNameAndJsonValues get(@NonNull final RowType row) { ViewRowFieldNameAndJsonValues values = this.values;
if (values == null) { values = this.values = ViewColumnHelper.extractJsonMap(row); } return values; } public void clearValues() { this.values = null; } public ViewRowFieldNameAndJsonValuesHolder<RowType> copy() { return new ViewRowFieldNameAndJsonValuesHolder<>(this); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\view\ViewRowFieldNameAndJsonValuesHolder.java
1
请完成以下Java代码
private HuId getSelectedHUId() { return getSingleSelectedRow().getHuId(); } private boolean checkSourceHuPreconditionIncludingEmptyHUs() { final HuId huId = getSelectedHUId(); final Collection<HuId> sourceHUs = sourceHUsRepository.retrieveMatchingSourceHUIds(huId); return !sourceHUs.isEmpty(); } private List<ProductId> getProductIds() { return getHUProductStorages() .stream() .filter(productStorage -> !productStorage.isEmpty()) .map(IProductStorage::getProductId) .distinct() .collect(ImmutableList.toImmutableList()); } private Quantity getHUStorageQty(@NonNull final ProductId productId) { return getHUProductStorages() .stream() .filter(productStorage -> ProductId.equals(productStorage.getProductId(), productId)) .map(IHUProductStorage::getQty) .findFirst()
.orElseThrow(() -> new AdempiereException("No Qty found for " + productId)); } private ImmutableList<IHUProductStorage> getHUProductStorages() { ImmutableList<IHUProductStorage> huProductStorage = _huProductStorages; if (huProductStorage == null) { final HuId huId = getSelectedHUId(); final I_M_HU hu = handlingUnitsBL.getById(huId); final IHUStorageFactory storageFactory = handlingUnitsBL.getStorageFactory(); huProductStorage = _huProductStorages = ImmutableList.copyOf(storageFactory .getStorage(hu) .getProductStorages()); } return huProductStorage; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\picking\pickingslot\process\WEBUI_Picking_ReturnQtyToSourceHU.java
1
请完成以下Java代码
public void onTaxTotalAmt(final ITaxAccountable taxAccountable) { final Tax tax = getTaxOrNull(taxAccountable); if (tax == null) { return; } if (tax.isReverseCharge()) { throw new AdempiereException("Reverse Charge Tax is not supported"); } // // Calculate TaxAmt final BigDecimal taxTotalAmt = taxAccountable.getTaxTotalAmt(); final boolean taxIncluded = true; final CurrencyPrecision precision = taxAccountable.getPrecision(); final BigDecimal taxAmt = tax.calculateTax(taxTotalAmt, taxIncluded, precision.toInt()).getTaxAmount(); final BigDecimal taxBaseAmt = taxTotalAmt.subtract(taxAmt); taxAccountable.setTaxAmt(taxAmt); taxAccountable.setTaxBaseAmt(taxBaseAmt); } /** * Called when C_Tax_ID is changed. * <p> * Sets Tax_Acct, TaxAmt. */ public void onC_Tax_ID(final ITaxAccountable taxAccountable) { final TaxAcctType taxAcctType; if (taxAccountable.isAccountSignDR()) { taxAcctType = TaxAcctType.TaxCredit; // taxAcctType = TaxAcctType.TaxExpense; // used for booking services tax } else if (taxAccountable.isAccountSignCR()) { taxAcctType = TaxAcctType.TaxDue; } else { return; } // // Set DR/CR Tax Account
final TaxId taxId = TaxId.ofRepoIdOrNull(taxAccountable.getC_Tax_ID()); if (taxId != null) { final AcctSchemaId acctSchemaId = taxAccountable.getAcctSchemaId(); final MAccount taxAccount = taxAccountsRepository.getAccounts(taxId, acctSchemaId) .getAccount(taxAcctType) .map(Account::getAccountId) .map(accountDAO::getById) .orElseThrow(() -> new AdempiereException("@NotFound@ " + taxAcctType + " (" + taxId + ", " + acctSchemaId + ")")); taxAccountable.setTax_Acct(taxAccount); } else { taxAccountable.setTax_Acct(null); } // // Set TaxAmt based on TaxBaseAmt and C_Tax_ID onTaxBaseAmt(taxAccountable); } private I_C_Tax getTaxOrNull(final I_C_ValidCombination accountVC) { if (accountVC == null) { return null; } final I_C_ElementValue account = accountVC.getAccount(); if (account == null) { return null; } if (!account.isAutoTaxAccount()) { return null; } final TaxId taxId = TaxId.ofRepoIdOrNull(account.getC_Tax_ID()); if (taxId == null) { return null; } return InterfaceWrapperHelper.load(taxId, I_C_Tax.class); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\callout\TaxAccountableCallout.java
1
请完成以下Java代码
public List<DocumentLayoutElementDescriptor> getElements() { return elements; } public static final class Builder { private final List<DocumentLayoutElementDescriptor.Builder> elementBuilders = new ArrayList<>(); private Builder() { super(); } public AddressLayout build() { return new AddressLayout(this); } private List<DocumentLayoutElementDescriptor> buildElements() { return elementBuilders
.stream() .map(elementBuilder -> elementBuilder.build()) .collect(GuavaCollectors.toImmutableList()); } @Override public String toString() { return MoreObjects.toStringHelper(this) .add("elements-count", elementBuilders.size()) .toString(); } public Builder addElement(final DocumentLayoutElementDescriptor.Builder elementBuilder) { Check.assumeNotNull(elementBuilder, "Parameter elementBuilder is not null"); elementBuilders.add(elementBuilder); return this; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\address\AddressLayout.java
1
请完成以下Java代码
protected ImportRecordResult importRecord( @NonNull final IMutable<Object> state_NOTUSED, @NonNull final I_I_Replenish importRecord, final boolean isInsertOnly_NOTUSED) { if (ReplenishImportHelper.isValidRecordForImport(importRecord)) { return importReplenish(importRecord); } else { throw new AdempiereException(MSG_NoValidRecord); } } private ImportRecordResult importReplenish(@NonNull final I_I_Replenish importRecord) { final ImportRecordResult replenishImportResult; final I_M_Replenish replenish; if (importRecord.getM_Replenish_ID() <= 0) { replenish = ReplenishImportHelper.createNewReplenish(importRecord); replenishImportResult = ImportRecordResult.Inserted; } else {
replenish = ReplenishImportHelper.uppdateReplenish(importRecord); replenishImportResult = ImportRecordResult.Updated; } InterfaceWrapperHelper.save(replenish); importRecord.setM_Replenish_ID(replenish.getM_Replenish_ID()); InterfaceWrapperHelper.save(importRecord); return replenishImportResult; } @Override protected void markImported(@NonNull final I_I_Replenish importRecord) { importRecord.setI_IsImported(X_I_Replenish.I_ISIMPORTED_Imported); importRecord.setProcessed(true); InterfaceWrapperHelper.save(importRecord); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\replenishment\impexp\ReplenishmentImportProcess.java
1
请在Spring Boot框架中完成以下Java代码
public List<SysPermissionDataRule> queryPermissionRule(SysPermissionDataRule permRule) { QueryWrapper<SysPermissionDataRule> queryWrapper = QueryGenerator.initQueryWrapper(permRule, null); return this.list(queryWrapper); } @Override public List<SysPermissionDataRule> queryPermissionDataRules(String username,String permissionId) { List<String> idsList = this.baseMapper.queryDataRuleIds(username, permissionId); // 代码逻辑说明: 数据权限失效问题处理-------------------- if(idsList==null || idsList.size()==0) { return null; } Set<String> set = new HashSet<String>(); for (String ids : idsList) { if(oConvertUtils.isEmpty(ids)) { continue; } String[] arr = ids.split(","); for (String id : arr) { if(oConvertUtils.isNotEmpty(id) && !set.contains(id)) { set.add(id); } } } if(set.size()==0) { return null; } return this.baseMapper.selectList(new QueryWrapper<SysPermissionDataRule>().in("id", set).eq("status",CommonConstant.STATUS_1)); } @Override @Transactional(rollbackFor = Exception.class) public void savePermissionDataRule(SysPermissionDataRule sysPermissionDataRule) { this.save(sysPermissionDataRule); SysPermission permission = sysPermissionMapper.selectById(sysPermissionDataRule.getPermissionId());
boolean flag = permission != null && (permission.getRuleFlag() == null || permission.getRuleFlag().equals(CommonConstant.RULE_FLAG_0)); if(flag) { permission.setRuleFlag(CommonConstant.RULE_FLAG_1); sysPermissionMapper.updateById(permission); } } @Override @Transactional(rollbackFor = Exception.class) public void deletePermissionDataRule(String dataRuleId) { SysPermissionDataRule dataRule = this.baseMapper.selectById(dataRuleId); if(dataRule!=null) { this.removeById(dataRuleId); Long count = this.baseMapper.selectCount(new LambdaQueryWrapper<SysPermissionDataRule>().eq(SysPermissionDataRule::getPermissionId, dataRule.getPermissionId())); //注:同一个事务中删除后再查询是会认为数据已被删除的 若事务回滚上述删除无效 if(count==null || count==0) { SysPermission permission = sysPermissionMapper.selectById(dataRule.getPermissionId()); if(permission!=null && permission.getRuleFlag().equals(CommonConstant.RULE_FLAG_1)) { permission.setRuleFlag(CommonConstant.RULE_FLAG_0); sysPermissionMapper.updateById(permission); } } } } }
repos\JeecgBoot-main\jeecg-boot\jeecg-module-system\jeecg-system-biz\src\main\java\org\jeecg\modules\system\service\impl\SysPermissionDataRuleImpl.java
2
请完成以下Java代码
private static void infoOfSpawnProcess() throws IOException { String javaCmd = ProcessUtils.getJavaCmd().getAbsolutePath(); ProcessBuilder processBuilder = new ProcessBuilder(javaCmd, "-version"); Process process = processBuilder.inheritIO().start(); ProcessHandle processHandle = process.toHandle(); ProcessHandle.Info processInfo = processHandle.info(); log.info("PID: " + processHandle.pid()); log.info("Arguments: " + processInfo.arguments()); log.info("Command: " + processInfo.command()); log.info("Instant: " + processInfo.startInstant()); log.info("Total CPU duration: " + processInfo.totalCpuDuration()); log.info("User: " + processInfo.user()); } private static void infoOfLiveProcesses() { Stream<ProcessHandle> liveProcesses = ProcessHandle.allProcesses(); liveProcesses.filter(ProcessHandle::isAlive) .forEach(ph -> { log.info("PID: " + ph.pid()); log.info("Instance: " + ph.info().startInstant()); log.info("User: " + ph.info().user()); }); } private static void infoOfChildProcess() throws IOException { int childProcessCount = 5; for (int i = 0; i < childProcessCount; i++) { String javaCmd = ProcessUtils.getJavaCmd() .getAbsolutePath(); ProcessBuilder processBuilder = new ProcessBuilder(javaCmd, "-version"); processBuilder.inheritIO().start(); } Stream<ProcessHandle> children = ProcessHandle.current() .children(); children.filter(ProcessHandle::isAlive) .forEach(ph -> log.info("PID: {}, Cmd: {}", ph.pid(), ph.info() .command())); Stream<ProcessHandle> descendants = ProcessHandle.current() .descendants(); descendants.filter(ProcessHandle::isAlive) .forEach(ph -> log.info("PID: {}, Cmd: {}", ph.pid(), ph.info() .command()));
} private static void infoOfExitCallback() throws IOException, InterruptedException, ExecutionException { String javaCmd = ProcessUtils.getJavaCmd() .getAbsolutePath(); ProcessBuilder processBuilder = new ProcessBuilder(javaCmd, "-version"); Process process = processBuilder.inheritIO() .start(); ProcessHandle processHandle = process.toHandle(); log.info("PID: {} has started", processHandle.pid()); CompletableFuture<ProcessHandle> onProcessExit = processHandle.onExit(); onProcessExit.get(); log.info("Alive: " + processHandle.isAlive()); onProcessExit.thenAccept(ph -> { log.info("PID: {} has stopped", ph.pid()); }); } }
repos\tutorials-master\core-java-modules\core-java-os-2\src\main\java\com\baeldung\java9\process\ProcessAPIEnhancements.java
1
请完成以下Java代码
protected org.compiere.model.POInfo initPO(final Properties ctx) { return org.compiere.model.POInfo.getPOInfo(Table_Name); } @Override public void setDescription (final @Nullable java.lang.String Description) { set_Value (COLUMNNAME_Description, Description); } @Override public java.lang.String getDescription() { return get_ValueAsString(COLUMNNAME_Description); } @Override public void setIsDefault (final boolean IsDefault) { set_Value (COLUMNNAME_IsDefault, IsDefault); } @Override public boolean isDefault() { return get_ValueAsBoolean(COLUMNNAME_IsDefault); } @Override public void setName (final java.lang.String Name) {
set_Value (COLUMNNAME_Name, Name); } @Override public java.lang.String getName() { return get_ValueAsString(COLUMNNAME_Name); } @Override public void setWEBUI_Dashboard_ID (final int WEBUI_Dashboard_ID) { if (WEBUI_Dashboard_ID < 1) set_ValueNoCheck (COLUMNNAME_WEBUI_Dashboard_ID, null); else set_ValueNoCheck (COLUMNNAME_WEBUI_Dashboard_ID, WEBUI_Dashboard_ID); } @Override public int getWEBUI_Dashboard_ID() { return get_ValueAsInt(COLUMNNAME_WEBUI_Dashboard_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java-gen\de\metas\ui\web\base\model\X_WEBUI_Dashboard.java
1
请完成以下Java代码
public int getFileLineNo() { return fileLineNo; } public String getLineString() { return lineStr; } public boolean hasErrors() { return parseError != null || (cells != null && cells.stream().anyMatch(ImpDataCell::isCellError)); } public String getErrorMessageAsStringOrNull() { return getErrorMessageAsStringOrNull(-1); } public String getErrorMessageAsStringOrNull(final int maxLength) { final int maxLengthEffective = maxLength > 0 ? maxLength : Integer.MAX_VALUE; final StringBuilder result = new StringBuilder(); if (parseError != null) { result.append(parseError.getMessage()); } if (cells != null) { for (final ImpDataCell cell : cells) { if (!cell.isCellError()) { continue; } final String cellErrorMessage = cell.getCellErrorMessage().getMessage(); if (result.length() > 0) { result.append("; "); } result.append(cellErrorMessage); if (result.length() >= maxLengthEffective) { break; } } } return result.length() > 0 ? StringUtils.trunc(result.toString(), maxLengthEffective) : null; } public List<Object> getJdbcValues(@NonNull final List<ImpFormatColumn> columns) { final int columnsCount = columns.size();
if (parseError != null) { final ArrayList<Object> nulls = new ArrayList<>(columnsCount); for (int i = 0; i < columnsCount; i++) { nulls.add(null); } return nulls; } else { final ArrayList<Object> values = new ArrayList<>(columnsCount); final int cellsCount = cells.size(); for (int i = 0; i < columnsCount; i++) { if (i < cellsCount) { values.add(cells.get(i).getJdbcValue()); } else { values.add(null); } } return values; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\impexp\parser\ImpDataLine.java
1
请完成以下Java代码
public String getCaseDefinitionId() { return caseDefinitionId; } public void setCaseDefinitionId(String caseDefinitionId) { this.caseDefinitionId = caseDefinitionId; } public String getCaseInstanceId() { return caseInstanceId; } public void setCaseInstanceId(String caseInstanceId) { this.caseInstanceId = caseInstanceId; } public String getCaseExecutionId() { return caseExecutionId; } public void setCaseExecutionId(String caseExecutionId) { this.caseExecutionId = caseExecutionId; } public String getTaskId() { return taskId; } public void setTaskId(String taskId) { this.taskId = taskId; } public String getOperationType() { return operationType; } public void setOperationType(String operationType) { this.operationType = operationType; } public String getEntityType() { return entityType; } public void setEntityType(String entityType) { this.entityType = entityType; } public List<PropertyChange> getPropertyChanges() { return propertyChanges; } public void setPropertyChanges(List<PropertyChange> propertyChanges) { this.propertyChanges = propertyChanges; } public String getProcessDefinitionKey() { return processDefinitionKey; } public void setProcessDefinitionKey(String processDefinitionKey) { this.processDefinitionKey = processDefinitionKey; } public String getJobDefinitionId() { return jobDefinitionId; } public void setJobDefinitionId(String jobDefinitionId) { this.jobDefinitionId = jobDefinitionId; } public String getJobId() { return jobId; } public void setJobId(String jobId) { this.jobId = jobId; }
public String getBatchId() { return batchId; } public void setBatchId(String batchId) { this.batchId = batchId; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public String getRootProcessInstanceId() { return rootProcessInstanceId; } public void setRootProcessInstanceId(String rootProcessInstanceId) { this.rootProcessInstanceId = rootProcessInstanceId; } public String getExternalTaskId() { return externalTaskId; } public void setExternalTaskId(String externalTaskId) { this.externalTaskId = externalTaskId; } public String getAnnotation() { return annotation; } public void setAnnotation(String annotation) { this.annotation = annotation; } public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\oplog\UserOperationLogContextEntry.java
1
请完成以下Java代码
public static final class Builder { private I_M_ReceiptSchedule receiptSchedule; private boolean tolerateNoHUsFound = false; private Builder() { super(); } public ReceiptCorrectHUsProcessor build() { return new ReceiptCorrectHUsProcessor(this); } public Builder setM_ReceiptSchedule(final I_M_ReceiptSchedule receiptSchedule) { this.receiptSchedule = receiptSchedule; return this; }
private I_M_ReceiptSchedule getM_ReceiptSchedule() { Check.assumeNotNull(receiptSchedule, "Parameter receiptSchedule is not null"); return receiptSchedule; } public Builder tolerateNoHUsFound() { tolerateNoHUsFound = true; return this; } private boolean isFailOnNoHUsFound() { return !tolerateNoHUsFound; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\inout\ReceiptCorrectHUsProcessor.java
1
请完成以下Java代码
public String amt (final Properties ctx, final int WindowNo, final GridTab mTab, final GridField mField, final Object value) { if (isCalloutActive() || value == null) { return ""; } final int StdPrecision = 2; // temporary // get values BigDecimal QtyEntered = (BigDecimal)mTab.getValue("QtyEntered"); BigDecimal PriceEntered = (BigDecimal)mTab.getValue("PriceEntered"); log.debug("QtyEntered=" + QtyEntered + ", PriceEntered=" + PriceEntered); if (QtyEntered == null) { QtyEntered = Env.ZERO; } if (PriceEntered == null) { PriceEntered = Env.ZERO; } // Line Net Amt BigDecimal LineNetAmt = QtyEntered.multiply(PriceEntered); if (LineNetAmt.scale() > StdPrecision) { LineNetAmt = LineNetAmt.setScale(StdPrecision, BigDecimal.ROUND_HALF_UP); } // Calculate Tax Amount final boolean IsSOTrx = "Y".equals(Env.getContext(Env.getCtx(), WindowNo, "IsSOTrx")); final boolean IsTaxIncluded = "Y".equals(Env.getContext(Env.getCtx(), WindowNo, "IsTaxIncluded"));
BigDecimal TaxAmt = null; if (mField.getColumnName().equals("TaxAmt")) { TaxAmt = (BigDecimal)mTab.getValue("TaxAmt"); } else { final Integer taxID = (Integer)mTab.getValue("C_Tax_ID"); if (taxID != null) { final int C_Tax_ID = taxID.intValue(); final MTax tax = new MTax (ctx, C_Tax_ID, null); TaxAmt = Services.get(ITaxBL.class).calculateTaxAmt(tax, LineNetAmt, IsTaxIncluded, StdPrecision); mTab.setValue("TaxAmt", TaxAmt); } } // if (IsTaxIncluded) { mTab.setValue("LineTotalAmt", LineNetAmt); mTab.setValue("LineNetAmt", LineNetAmt.subtract(TaxAmt)); } else { mTab.setValue("LineNetAmt", LineNetAmt); mTab.setValue("LineTotalAmt", LineNetAmt.add(TaxAmt)); } return ""; } // amt } // CalloutInvoiceBatch
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\CalloutInvoiceBatch.java
1
请完成以下Java代码
public HashMap<String, Object> getProcessVariables() { return (HashMap<String, Object>) processVariables; } public void setProcessVariables(Map<String, Object> processVariables) { if (this.processVariables == null) { this.processVariables = new HashMap<>(); } for (Map.Entry<String, Object> processVariable : processVariables.entrySet()) { this.processVariables.put(processVariable.getKey(), processVariable.getValue()); } } public boolean isWithoutTenantId() { return withoutTenantId; } public void setWithoutTenantId(boolean withoutTenantId) { this.withoutTenantId = withoutTenantId; } public List<String> getTenantIdIn() { return tenantIdIn; } public TopicSubscription setTenantIdIn(List<String> tenantIds) { this.tenantIdIn = tenantIds; return this; } public boolean isIncludeExtensionProperties() { return includeExtensionProperties; } public void setIncludeExtensionProperties(boolean includeExtensionProperties) { this.includeExtensionProperties = includeExtensionProperties; } public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((topicName == null) ? 0 : topicName.hashCode());
return result; } public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } TopicSubscriptionImpl other = (TopicSubscriptionImpl) obj; if (topicName == null) { if (other.topicName != null) return false; } else if (!topicName.equals(other.topicName)) { return false; } return true; } }
repos\camunda-bpm-platform-master\clients\java\client\src\main\java\org\camunda\bpm\client\topic\impl\TopicSubscriptionImpl.java
1
请完成以下Java代码
public class TcpConnectionEndPoint implements ITcpConnectionEndPoint { private static final Logger logger = LogManager.getLogger(TcpConnectionEndPoint.class); private String hostName; private int port; /** * see {@link #setReadTimeoutMillis(int)}. */ private int readTimeoutMillis = 500; /** * Opens a socked, sends the command, reads the response and closes the socked again afterwards. * Note: discards everything besides the last line. */ @Override @Nullable public String sendCmd(@NonNull final String cmd) { try (final Socket clientSocket = new Socket(hostName, port); final OutputStream out = clientSocket.getOutputStream();) { clientSocket.setSoTimeout(readTimeoutMillis); logger.debug("Writing cmd to the socket: {}", cmd); out.write(cmd.getBytes(ICmd.DEFAULT_CMD_CHARSET)); out.flush(); return readSocketResponse(clientSocket.getInputStream()); } catch (final UnknownHostException e) { throw new EndPointException("Caught UnknownHostException: " + e.getLocalizedMessage(), e); } catch (final IOException e) { throw new EndPointException("Caught IOException: " + e.getLocalizedMessage(), e); } } @Nullable String readSocketResponse(@NonNull final InputStream in) throws IOException { final StringBuilder sb = new StringBuilder(); int i; try { while ((i = in.read()) != -1) { sb.append((char)i); } } catch (final SocketTimeoutException e) { // if the device doesn't send "EOF", then there is nothing we can do here // ..because at this place here we don't know how the response is terminated. // so we just wait for the respective timeout } return sb.toString(); } public TcpConnectionEndPoint setHost(final String hostName) {
this.hostName = hostName; return this; } public TcpConnectionEndPoint setPort(final int port) { this.port = port; return this; } /** * Timeout for this endpoint for each read, before considering the result to be <code>null</code>. The default is 500ms. */ public TcpConnectionEndPoint setReadTimeoutMillis(final int readTimeoutMillis) { this.readTimeoutMillis = readTimeoutMillis; return this; } @Override public String toString() { return MoreObjects.toStringHelper(this) .add("hostName", hostName) .add("port", port) .toString(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.device.scales\src\main\java\de\metas\device\scales\endpoint\TcpConnectionEndPoint.java
1
请完成以下Java代码
public boolean isCustomObjectDeserializationEnabled() { return isCustomObjectDeserializationEnabled; } public String getRootDecisionInstanceId() { return rootDecisionInstanceId; } public HistoricDecisionInstanceQuery rootDecisionInstanceId(String rootDecisionInstanceId) { ensureNotNull(NotValidException.class, "rootDecisionInstanceId", rootDecisionInstanceId); this.rootDecisionInstanceId = rootDecisionInstanceId; return this; } public boolean isRootDecisionInstancesOnly() { return rootDecisionInstancesOnly; } public HistoricDecisionInstanceQuery rootDecisionInstancesOnly() { this.rootDecisionInstancesOnly = true; return this; } @Override public HistoricDecisionInstanceQuery decisionRequirementsDefinitionId(String decisionRequirementsDefinitionId) { ensureNotNull(NotValidException.class, "decisionRequirementsDefinitionId", decisionRequirementsDefinitionId); this.decisionRequirementsDefinitionId = decisionRequirementsDefinitionId; return this; } @Override public HistoricDecisionInstanceQuery decisionRequirementsDefinitionKey(String decisionRequirementsDefinitionKey) { ensureNotNull(NotValidException.class, "decisionRequirementsDefinitionKey", decisionRequirementsDefinitionKey); this.decisionRequirementsDefinitionKey = decisionRequirementsDefinitionKey;
return this; } public String getDecisionRequirementsDefinitionId() { return decisionRequirementsDefinitionId; } public String getDecisionRequirementsDefinitionKey() { return decisionRequirementsDefinitionKey; } public boolean isTenantIdSet() { return isTenantIdSet; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\HistoricDecisionInstanceQueryImpl.java
1
请完成以下Java代码
protected JobEntityManager getJobEntityManager() { return getProcessEngineConfiguration().getJobEntityManager(); } protected TimerJobEntityManager getTimerJobEntityManager() { return getProcessEngineConfiguration().getTimerJobEntityManager(); } protected SuspendedJobEntityManager getSuspendedJobEntityManager() { return getProcessEngineConfiguration().getSuspendedJobEntityManager(); } protected DeadLetterJobEntityManager getDeadLetterJobEntityManager() { return getProcessEngineConfiguration().getDeadLetterJobEntityManager(); } protected HistoricProcessInstanceEntityManager getHistoricProcessInstanceEntityManager() { return getProcessEngineConfiguration().getHistoricProcessInstanceEntityManager(); } protected HistoricDetailEntityManager getHistoricDetailEntityManager() { return getProcessEngineConfiguration().getHistoricDetailEntityManager(); } protected HistoricActivityInstanceEntityManager getHistoricActivityInstanceEntityManager() { return getProcessEngineConfiguration().getHistoricActivityInstanceEntityManager(); }
protected HistoricVariableInstanceEntityManager getHistoricVariableInstanceEntityManager() { return getProcessEngineConfiguration().getHistoricVariableInstanceEntityManager(); } protected HistoricTaskInstanceEntityManager getHistoricTaskInstanceEntityManager() { return getProcessEngineConfiguration().getHistoricTaskInstanceEntityManager(); } protected HistoricIdentityLinkEntityManager getHistoricIdentityLinkEntityManager() { return getProcessEngineConfiguration().getHistoricIdentityLinkEntityManager(); } protected AttachmentEntityManager getAttachmentEntityManager() { return getProcessEngineConfiguration().getAttachmentEntityManager(); } protected CommentEntityManager getCommentEntityManager() { return getProcessEngineConfiguration().getCommentEntityManager(); } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\persistence\AbstractManager.java
1
请完成以下Java代码
public void setDescription (final @Nullable java.lang.String Description) { set_Value (COLUMNNAME_Description, Description); } @Override public java.lang.String getDescription() { return get_ValueAsString(COLUMNNAME_Description); } @Override public void setIsAdditionalCustomQuery (final boolean IsAdditionalCustomQuery) { set_Value (COLUMNNAME_IsAdditionalCustomQuery, IsAdditionalCustomQuery); } @Override public boolean isAdditionalCustomQuery() { return get_ValueAsBoolean(COLUMNNAME_IsAdditionalCustomQuery); } @Override public void setLeichMehl_PluFile_ConfigGroup_ID (final int LeichMehl_PluFile_ConfigGroup_ID) { if (LeichMehl_PluFile_ConfigGroup_ID < 1) set_ValueNoCheck (COLUMNNAME_LeichMehl_PluFile_ConfigGroup_ID, null); else set_ValueNoCheck (COLUMNNAME_LeichMehl_PluFile_ConfigGroup_ID, LeichMehl_PluFile_ConfigGroup_ID); }
@Override public int getLeichMehl_PluFile_ConfigGroup_ID() { return get_ValueAsInt(COLUMNNAME_LeichMehl_PluFile_ConfigGroup_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); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java-gen\de\metas\externalsystem\model\X_LeichMehl_PluFile_ConfigGroup.java
1
请完成以下Spring Boot application配置
logging: level: org.springframework.cloud.gateway: TRACE reactor.netty.http.client: DEBUG server: ssl: key-store: classpath:sample.jks key-store-password: secret key-password: password http2: enabled: true spring: cloud: gateway.server.webflux: # http
server: # wiretap: true httpclient: wiretap: true ssl: use-insecure-trust-manager: true
repos\spring-cloud-gateway-main\spring-cloud-gateway-integration-tests\http2\src\main\resources\application.yml
2